From f5c5c333a876310619f37340a8c621e5a27d73a1 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 21 Aug 2013 13:39:02 +0300 Subject: [PATCH] - add python3 sub-package, based on patch by Bohuslav Kabrda --- rpm-4.11.0.1-setuppy-fixes.patch | 61 ++++++++++++++++++++++++++++++++ rpm.spec | 46 ++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 rpm-4.11.0.1-setuppy-fixes.patch diff --git a/rpm-4.11.0.1-setuppy-fixes.patch b/rpm-4.11.0.1-setuppy-fixes.patch new file mode 100644 index 0000000..2349ab0 --- /dev/null +++ b/rpm-4.11.0.1-setuppy-fixes.patch @@ -0,0 +1,61 @@ +--- rpm-4.11.0.1/python/setup.py.in.setuppy-fixes 2012-11-07 13:55:24.000000000 +0100 ++++ rpm-4.11.0.1/python/setup.py.in 2013-04-03 14:16:48.149931703 +0200 +@@ -1,13 +1,19 @@ + #!/usr/bin/env python + + from distutils.core import setup, Extension ++import os + import subprocess + from glob import glob + + def pkgconfig(what): + out = [] + cmd = 'pkg-config %s %s' % (what, '@PACKAGE_NAME@') +- pcout = subprocess.check_output(cmd.split()).decode() ++ env = dict(os.environ, **{'PKG_CONFIG_PATH': '..'}) ++ proc = subprocess.Popen(cmd.split(), ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ env=env) ++ pcout = proc.communicate()[0].decode() + for token in pcout.split(): + out.append(token[2:]) + return out +@@ -18,7 +24,8 @@ + srcs.extend(glob('%s*.c' % n)) + return srcs + +-cflags = ['-std=c99'] ++cflags = ['-std=c99', '-I../include'] ++additional_link_args = ['-Wl,-L../rpmio/.libs', '-Wl,-L../lib/.libs', '-Wl,-L../build/.libs', '-Wl,-L../sign/.libs'] + + rpmmod = Extension('rpm._rpm', + sources = mksources([ +@@ -28,21 +35,24 @@ + ]), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs'), +- extra_compile_args = cflags ++ extra_compile_args = cflags, ++ extra_link_args = additional_link_args + ) + + rpmbuild_mod = Extension('rpm._rpmb', + sources = mksources(['rpmbmodule', 'spec']), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs') + ['rpmbuild'], +- extra_compile_args = cflags ++ extra_compile_args = cflags, ++ extra_link_args = additional_link_args + ) + + rpmsign_mod = Extension('rpm._rpms', + sources = mksources(['rpmbmodule']), + include_dirs = pkgconfig('--cflags'), + libraries = pkgconfig('--libs') + ['rpmsign'], +- extra_compile_args = cflags ++ extra_compile_args = cflags, ++ extra_link_args = additional_link_args + ) + + setup(name='@PACKAGE_NAME@-python', diff --git a/rpm.spec b/rpm.spec index 408b89a..1fd9007 100644 --- a/rpm.spec +++ b/rpm.spec @@ -21,7 +21,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}5%{?dist}.1 +Release: %{?snapver:0.%{snapver}.}6%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2 @@ -62,6 +62,8 @@ Patch305: rpm-4.10.0-dwz-debuginfo.patch Patch306: rpm-4.10.0-minidebuginfo.patch # Fix CRC32 after dwz (#971119) Patch307: rpm-4.11.1-sepdebugcrcfix.patch +# To be upstreamed in slightly different form +Patch308: rpm-4.11.0.1-setuppy-fixes.patch # Temporary Patch to provide support for updates Patch400: rpm-4.10.90-rpmlib-filesystem-check.patch @@ -104,6 +106,7 @@ BuildRequires: libsemanage-devel%{_isa} BuildRequires: ncurses-devel%{_isa} BuildRequires: bzip2-devel%{_isa} >= 0.9.0c-2 BuildRequires: python-devel%{_isa} >= 2.6 +BuildRequires: python3-devel%{_isa} >= 3.2 BuildRequires: lua-devel%{_isa} >= 5.1 BuildRequires: libcap-devel%{_isa} BuildRequires: libacl-devel%{_isa} @@ -194,7 +197,7 @@ Requires: rpm-build-libs%{_isa} = %{version}-%{release} This package contains support for digitally signing RPM packages. %package python -Summary: Python bindings for apps which will manipulate RPM packages +Summary: Python 2 bindings for apps which will manipulate RPM packages Group: Development/Libraries Requires: rpm = %{version}-%{release} @@ -203,7 +206,20 @@ The rpm-python package contains a module that permits applications written in the Python programming language to use the interface supplied by RPM Package Manager libraries. -This package should be installed if you want to develop Python +This package should be installed if you want to develop Python 2 +programs that will manipulate RPM packages and databases. + +%package python3 +Summary: Python 3 bindings for apps which will manipulate RPM packages +Group: Development/Libraries +Requires: rpm = %{version}-%{release} + +%description python3 +The rpm-python3 package contains a module that permits applications +written in the Python programming language to use the interface +supplied by RPM Package Manager libraries. + +This package should be installed if you want to develop Python 3 programs that will manipulate RPM packages and databases. %package apidocs @@ -242,6 +258,7 @@ packages on a system. %patch305 -p1 -b .dwz-debuginfo %patch306 -p1 -b .minidebuginfo %patch307 -p1 -b .sepdebugcrcfix +%patch308 -p1 -b .setuppy-fixes %patch400 -p1 -b .rpmlib-filesystem-check @@ -285,11 +302,25 @@ export CPPFLAGS CFLAGS LDFLAGS make %{?_smp_mflags} +pushd python +%{__python} setup.py build +%{__python3} setup.py build +popd + %install rm -rf $RPM_BUILD_ROOT make DESTDIR="$RPM_BUILD_ROOT" install +# We need to build with --enable-python for the self-test suite, but we +# actually package the bindings built with setup.py (#531543#c26) +rm -rf $RPM_BUILD_ROOT/%{python_sitearch} +pushd python +%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd + + # Save list of packages through cron mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/rpm @@ -451,6 +482,12 @@ exit 0 %files python %defattr(-,root,root) %{python_sitearch}/rpm +%{python_sitearch}/rpm_python-%{version}-py2.7.egg-info + +%files python3 +%defattr(-,root,root) +%{python3_sitearch}/rpm +%{python3_sitearch}/rpm_python-%{version}-py%{python3_version}.egg-info %files devel %defattr(-,root,root) @@ -470,6 +507,9 @@ exit 0 %doc COPYING doc/librpm/html/* %changelog +* Wed Aug 21 2013 Panu Matilainen - 4.11.1-6 +- add python3 sub-package, based on patch by Bohuslav Kabrda + * Sat Aug 03 2013 Petr Pisar - 4.11.1-5.1 - Perl 5.18 rebuild