From a1a5f7ddc059af1c65ce45be410991e9fbb3e957 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sun, 5 Apr 2015 20:28:58 +0200 Subject: [PATCH] - most of python BRs are required only for tests - added python3 bcond (but the result requires some packages not existing in PLD) --- dnf.spec | 130 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 108 insertions(+), 22 deletions(-) diff --git a/dnf.spec b/dnf.spec index c9999d8..8ea479f 100644 --- a/dnf.spec +++ b/dnf.spec @@ -1,9 +1,10 @@ # TODO -# - bash-completion subpackage # - make -DSYSTEMD_DIR actually to work: https://github.com/rpm-software-management/dnf/pull/213 # # Conditional build: %bcond_without tests # build without tests +%bcond_without python2 # CPython 2.x version +%bcond_with python3 # CPython 3.x version (dependencies not met currently) # %define gitrev a7e0aa1 %define hawkey_ver 0.5.2 @@ -17,35 +18,38 @@ Name: dnf Version: 0.6.3 Release: 0.5 Group: Base -# For a breakdown of the licensing, see PACKAGE-LICENSING -License: GPL v2+ and GPL v2 and GPL +# GPL v2+ with GPL v2 and GPL parts; for a breakdown of the licensing, see PACKAGE-LICENSING +License: GPL v2 (parts on GPL v2+ or GPL) #Source0: http://rpm-software-management.fedorapeople.org/%{name}-%{gitrev}.tar.xz Source0: http://pkgs.fedoraproject.org/repo/pkgs/dnf/%{name}-%{gitrev}.tar.xz/82ff495e445ddc56e70dc91750a421ac/dnf-%{gitrev}.tar.xz # Source0-md5: 82ff495e445ddc56e70dc91750a421ac Patch0: rpm5.patch URL: https://github.com/rpm-software-management/dnf -BuildRequires: cmake -BuildRequires: gettext +BuildRequires: cmake >= 2.4 BuildRequires: gettext-tools -BuildRequires: python -BuildRequires: python-Sphinx -#BuildRequires: python-bugzilla -BuildRequires: python-hawkey >= %{hawkey_ver} -BuildRequires: python-iniparse -BuildRequires: python-libcomps >= %{libcomps_ver} -BuildRequires: python-librepo >= %{librepo_ver} -BuildRequires: python-nose -BuildRequires: python-pygpgme -BuildRequires: python-rpm >= %{rpm_ver} BuildRequires: rpm-pythonprov BuildRequires: rpmbuild(macros) >= 1.647 BuildRequires: sed >= 4.0 BuildRequires: sphinx-pdg BuildRequires: systemd-devel +%if %{with python2} +BuildRequires: python >= 2 %if %{with tests} +#BuildRequires: python-bugzilla +BuildRequires: python-hawkey >= %{hawkey_ver} BuildRequires: python-hawkey-test >= %{hawkey_ver} +BuildRequires: python-iniparse +BuildRequires: python-libcomps >= %{libcomps_ver} +BuildRequires: python-librepo >= %{librepo_ver} +BuildRequires: python-pygpgme +BuildRequires: python-rpm >= %{rpm_ver} +BuildRequires: python-nose BuildRequires: python-pyliblzma %endif +%endif +%if %{with python3} +BuildRequires: python3 >= 1:3.3 +%endif Requires(post,preun,postun): systemd-units >= 38 Requires: deltarpm Requires: python-hawkey >= %{hawkey_ver} @@ -84,6 +88,42 @@ execution. Alternatywny interfejs linii poleceń do "dnf upgrade", nadający się do automatycznego, regularnego wywoływania. +%package -n bash-completion-dnf +Summary: Bash completion for dnf command +Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla polecenia dnf +Group: Applications/Shells +Requires: %{name} = %{version}-%{release} +Requires: bash-completion + +%description -n bash-completion-dnf +Bash completion for dnf command. + +%description -n bash-completion-dnf -l pl.UTF-8 +Bashowe uzupełnianie parametrów dla polecenia dnf. + +%package -n python3-dnf +Summary: Python 3 version of dnf package manager +Summary(pl.UTF-8): Wersja zarządcy pakietów dnf dla Pythona 3 +Group: Libraries/Python +# for common files (make -common?) +Requires: %{name} = %{version}-%{release} +Requires: deltarpm +Requires: python3-hawkey >= %{hawkey_ver} +# XXX: missing in PLD +#Requires: python3-iniparse +Requires: python3-libcomps >= %{libcomps_ver} +# XXX: missing in PLD +#Requires: python3-librepo >= %{librepo_ver} +Requires: python3-pygpgme +# XXX: missing in PLD (is it possible with rpm5?) +#Requires: python3-rpm >= %{rpm_ver} + +%description -n python3-dnf +Python 3 version of dnf package manager. + +%description -n python3-dnf -l pl.UTF-8 +Wersja zarządcy pakietów dnf dla Pythona 3. + %prep %setup -q -n %{name} %patch0 -p1 @@ -92,11 +132,14 @@ automatycznego, regularnego wywoływania. %{__sed} -i -e '/SYSTEMD_DIR/ s#/usr/lib/systemd/system#%{systemdunitdir}#' CMakeLists.txt %build -%cmake \ - -DCMAKE_CXX_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER="%{__cc}" \ +%if %{with python2} +install -d build-py2 +cd build-py2 +%cmake .. \ + -DCMAKE_CXX_COMPILER="%{__cc}" \ + -DCMAKE_CXX_COMPILER_WORKS=1 \ -DPYTHON_DESIRED=2 \ - -DSYSTEMD_DIR=%{systemdunitdir} \ - . + -DSYSTEMD_DIR=%{systemdunitdir} %{__make} %{__make} doc-man @@ -105,9 +148,29 @@ automatycznego, regularnego wywoływania. %{__make} test ARGS="-V" %endif +cd .. +%endif + +%if %{with python3} +install -d build-py3 +cd build-py3 +%cmake .. \ + -DCMAKE_CXX_COMPILER="%{__cc}" \ + -DCMAKE_CXX_COMPILER_WORKS=1 \ + -DPYTHON_DESIRED=3 \ + -DPYTHON_EXECUTABLE=%{__python3} \ + -DSYSTEMD_DIR=%{systemdunitdir} + +%{__make} +%{__make} doc-man +cd .. +%endif + %install rm -rf $RPM_BUILD_ROOT -%{__make} install \ + +%if %{with python2} +%{__make} -C build-py2 install \ DESTDIR=$RPM_BUILD_ROOT %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} @@ -118,6 +181,17 @@ rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/plugins,%{py_sitescriptdir}/dnf-plugins,%{_localstatedir}/log} touch $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}{,-rpm,-plugin}.log +%endif + +%if %{with python3} +%{__make} -C build-py3 install \ + DESTDIR=$RPM_BUILD_ROOT + +%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir} +%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir} +%else +%{__rm} $RPM_BUILD_ROOT%{_bindir}/dnf-3 +%endif %clean rm -rf $RPM_BUILD_ROOT @@ -140,9 +214,10 @@ rm -rf $RPM_BUILD_ROOT %postun automatic %systemd_reload +%if %{with python2} %files -f %{name}.lang %defattr(644,root,root,755) -%doc AUTHORS README.rst COPYING PACKAGE-LICENSING +%doc AUTHORS PACKAGE-LICENSING README.rst %attr(755,root,root) %{_bindir}/dnf %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/plugins @@ -161,7 +236,6 @@ rm -rf $RPM_BUILD_ROOT %ghost %{_localstatedir}/log/%{name}.log %ghost %{_localstatedir}/log/%{name}-rpm.log %ghost %{_localstatedir}/log/%{name}-plugin.log -/etc/bash_completion.d/dnf-completion.bash %files automatic %defattr(644,root,root,755) @@ -171,3 +245,15 @@ rm -rf $RPM_BUILD_ROOT %{systemdunitdir}/dnf-automatic.service %{systemdunitdir}/dnf-automatic.timer %{py_sitescriptdir}/dnf/automatic +%endif + +%files -n bash-completion-dnf +%defattr(644,root,root,755) +/etc/bash_completion.d/dnf-completion.bash + +%if %{with python3} +%files -n python3-dnf +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/dnf-3 +%{py3_sitescriptdir}/dnf +%endif -- 2.43.0