1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
--- MySQL-python.spec.nodsc 2012-05-31 10:48:04.851644356 +0200
+++ MySQL-python.spec 2012-06-01 16:09:40.220350592 +0200
@@ -1,5 +1,12 @@
+# Sets %%pkg_name to 'MySQL-python' if we build for scl.
+%{?scl:%scl_package MySQL-python}
+# If we don't build for scl, then pkg_name is empty.
+# This way, we can always use %%pkg_name for 'MySQL-python', be it scl build or not.
+%{!?scl:%global pkg_name mySQL-python}
+# %%{name} then references to either 'MySQL-python' (not in scl) or '%%{?scl:%scl_prefix}MySQL-python' (in scl).
+
Summary: An interface to MySQL
-Name: MySQL-python
+Name: %{?scl_prefix}MySQL-python
Version: 1.2.3
Release: 4%{?dist}
License: GPLv2+
@@ -8,9 +15,8 @@ URL: http://sourceforge.net/projects/mys
Source0: http://prdownloads.sourceforge.net/mysql-python/MySQL-python-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: python-devel python-setuptools
-BuildRequires: mysql-devel zlib-devel
+BuildRequires: %{?scl_prefix}mysql-devel zlib-devel
# is this still needed?
# Requires: mx
@@ -31,18 +37,21 @@ a) not thread-friendly, b) written for M
not actively maintained. No code from that version is used in MySQLdb.
%prep
-%setup -q -n %{name}-%{version}
+%setup -q -n %{pkg_name}-%{version}
%build
rm -f doc/*~
export libdirname=%{_lib}
+%{?scl:scl enable %scl - << \EOF}
CFLAGS="$RPM_OPT_FLAGS" python setup.py build
+%{?scl:EOF}
%install
-rm -rf $RPM_BUILD_ROOT
-
export libdirname=%{_lib}
-python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
+%{?scl:scl enable %scl - << \EOF}
+python setup.py install --root=$RPM_BUILD_ROOT%{?scl:%_scl_root} --record=INSTALLED_FILES
+%{?scl:EOF}
+sed -ie 's|^/usr/|%{_prefix}/|g' INSTALLED_FILES
%clean
rm -rf $RPM_BUILD_ROOT
@@ -51,10 +60,10 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%doc README doc/*
%dir %{_libdir}/python?.?/site-packages/MySQLdb
-%{_libdir}/python?.?/site-packages/MySQLdb/*.pyo
-%{_libdir}/python?.?/site-packages/MySQLdb/constants/*.pyo
-%{_libdir}/python?.?/site-packages/*.pyo
-%dir /usr/%{_lib}/python?.?/site-packages/MySQLdb/constants
+%{_libdir}/python?.?/site-packages/MySQLdb/*.pyc
+%{_libdir}/python?.?/site-packages/MySQLdb/constants/*.pyc
+%{_libdir}/python?.?/site-packages/*.pyc
+%dir %{_prefix}/%{_lib}/python?.?/site-packages/MySQLdb/constants
%changelog
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-4
|