#3 Conditionalize the Python 2 subpackage, don't build it on EL > 7
Merged a year ago by jmracek. Opened a year ago by churchyard.
rpms/ churchyard/createrepo_c nopy2el8  into  master

file modified
+46 -13

@@ -17,10 +17,16 @@ 

  %bcond_without drpm

  %endif

  

+ %if 0%{?rhel} > 7

+ %bcond_with python2

+ %else

+ %bcond_without python2

+ %endif

+ 

  Summary:        Creates a common metadata repository

  Name:           createrepo_c

  Version:        0.10.0

- Release:        18%{?dist}

+ Release:        19%{?dist}

  License:        GPLv2+

  URL:            https://github.com/rpm-software-management/createrepo_c

  Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

@@ -75,6 +81,7 @@ 

  This package contains the createrepo_c C library and header files.

  These development files are for easy manipulation with a repodata.

  

+ %if %{with python2}

  %package -n python2-%{name}

  Summary:        Python bindings for the createrepo_c library

  %{?python_provide:%python_provide python2-%{name}}

@@ -85,6 +92,7 @@ 

  

  %description -n python2-%{name}

  Python bindings for the createrepo_c library.

+ %endif

  

  %if %{with python3}

  %package -n python3-%{name}

@@ -101,57 +109,72 @@ 

  

  %prep

  %autosetup -p1

- mkdir build

+ %if %{with python2}

+ mkdir build-py2

+ %endif

+ 

  %if %{with python3}

  mkdir build-py3

  %endif

  

  %build

  # Build createrepo_c with Python 2

- pushd build

+ %if %{with python2}

+ pushd build-py2

    %cmake ../

    make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"

+   %if %{without python3}

+   # Build C documentation

+   make doc-c

+   %endif

  popd

+ %endif

  

  # Build createrepo_c with Pyhon 3

  %if %{with python3}

  pushd build-py3

    %cmake ../ -DPYTHON_DESIRED:str=3

    make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"

- popd

- %endif

- 

- # Build C documentation

- pushd build

+   # Build C documentation

    make doc-c

  popd

+ %endif

  

  %check

- pushd build

+ %if %{with python2}

+ pushd build-py2

+   %if %{without python3}

    # Compile C tests

    make tests

+   %endif

  

    # Run Python 2 tests

    make ARGS="-V" test

  popd

+ %endif

  

  # Run Python 3 tests

  %if %{with python3}

  pushd build-py3

+   # Compile C tests

+   make tests

+ 

+   # Run Python 3 tests

    make ARGS="-V" test

  popd

  %endif

  

  %install

- 

- pushd build

+ %if %{with python2}

+ pushd build-py2

    # Install createrepo_c with Python 2

    make install DESTDIR=%{buildroot}

  popd

+ %endif

  

- # Install createrepo_c with Python 3

  %if %{with python3}

  pushd build-py3

+   # Install createrepo_c with Python 3

    make install DESTDIR=%{buildroot}

  popd

  %endif

@@ -175,13 +198,19 @@ 

  %{_libdir}/lib%{name}.so.*

  

  %files devel

- %doc build/doc/html

+ %if %{with python3}

+ %doc build-py3/doc/html

+ %else

+ %doc build-py2/doc/html

+ %endif

  %{_libdir}/lib%{name}.so

  %{_libdir}/pkgconfig/%{name}.pc

  %{_includedir}/%{name}/

  

+ %if %{with python2}

  %files -n python2-%{name}

  %{python2_sitearch}/%{name}/

+ %endif

  

  %if %{with python3}

  %files -n python3-%{name}

@@ -189,6 +218,10 @@ 

  %endif

  

  %changelog

+ * Fri Mar 16 2018 Miro Hrončok <mhroncok@redhat.com> - 0.10.0-19

+ - Conditionalize the Python 2 subpackage

+ - Don't build the Python 2 subpackage on EL > 7

+ 

  * Wed Feb 07 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.10.0-18

  - Update Python 2 dependency declarations to new packaging standards

    (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

It is important that this gets merged into F28 as well. Would you be ok with us merging it there after this PR is resolved?

why don't we just make %bcond_without python2?

Didn't we agree on a meeting for this?

\cc @torsava

IIRC you and I were both for the measure at the meeting, but nobody else was. Miro objected that it was too magic and that's where it died.

In the end explicit is better then implicit :)

Note that the condition here could ideally be for example %if 0%{?rhel} > 7 || 0%{?fedora} > 28. However I didn't do that, because bodhi-server still requires python2-createrepo_c. Once that's fixed, this condition can change.

Is this condition correct?

The change log message says:

Don't build the Python 2 subpackage on EL > 7

Which I understand like: "If the build is happening on EL 8, 9, 10, 11, etc." python2 sub-package won't be built.

But this condition here is %if 0%{?rhel} > 7 - if we have EL bigger then 7 then %bcond_with python2 do it WITH python2.

Shouldn't the bcond with/without statements switched?

ping. Can I help somehow move this PR forward?

@dmach, @jmracek, to me the PR looks good, but your team are the maintainers of createrepo_c now, could you please take a look and merge if it's ok for you and your team?

Please can you place your PR also on https://github.com/rpm-software-management/librepo. Due to tracking of compatibility issues recently we added spec directly to upstream project. Thanks a lot.

https://github.com/rpm-software-management/librepo has no createrepo_c specfile so I assume https://github.com/rpm-software-management/createrepo_c yet I don't see it there either.

Please take in mind that maintaining specfiles upstream is your choice and asking me (nicely) to also do a pull request in upstream specfile is fine with me, however don't assume I know how and where do you store them. So either please send a direct link to the specfile I should change or merge this here and merge is in upstream yourself, because you know where all the stuff is and hence it will burn little fraction of your time than it would burn mine. I also recommend reading this:

https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Spec_Maintenance_and_Canonicity

(I'm not trying to be passive aggressive or whatnot, if it sounds like that. I'm just trying to ask nicely not to make the barrier of contributing to your package higher than necessary.)

Sorry, I overlooked component. Please ignore my previous comment. It means never do multiple task simultaneously

@jmracek, is this good to merge, then? Anything I can do to help?

I don't thing this a good idea. Or is there any common agreement on that. Please provide a reference, or directly contact me.

What do you mean by that? Obsoleting the python2 subpackage from the python3 one?

If that's the case, there is an ongoing related discussions : https://pagure.io/packaging-committee/issue/754

But it needs to be resolved one way or another.

Feel free to remove that part and add a specific obsolete tag in Fedora once the python2 version is actually gone.

I've removed the obsoletes section. Can we merge this now?

rebased onto 459fddd

a year ago

Pagure now says this was proposed 2 months ago. Please either merge it or say you won't.

Thanks a lot and sorry for delay.

Pull-Request has been merged by jmracek

a year ago