#2660 attempting to bridge the gap with pip
Closed 4 years ago by tkopecek. Opened 4 years ago by cobrien.
cobrien/koji pkg_resources  into  master

file modified
+41 -19
@@ -99,6 +99,7 @@ 

  %endif

  BuildRequires: systemd

  BuildRequires: pkgconfig

+ BuildRequires: sed

  

  %description

  Koji is a system for building and tracking RPMS.  The base package
@@ -354,8 +355,17 @@ 

  

  %prep

  %autosetup -p1

+ # we'll be packaging these separately and don't want them registered

+ # to the wheel we will produce.

+ sed -e '/util\/koji/g' -e '/koji_cli_plugins/g' -i setup.py

  

  %build

+ %if 0%{py2_support}

+ %py2_build_wheel

+ %endif

+ %if 0%{py3_support}

+ %py3_build_wheel

+ %endif

  

  %install

  rm -rf $RPM_BUILD_ROOT
@@ -366,22 +376,43 @@ 

  %endif

  

  # python2 build

- %if 0%{py2_support} > 1

- make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install

- %else

  %if 0%{py2_support}

- for d in koji cli plugins ; do

-     pushd $d

-     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install

+ %py2_install_wheel %{name}-%{version}-py2-none-any.whl

+ mkdir -p %{buildroot}/etc/koji.conf.d

+ cp cli/koji.conf %{buildroot}/etc/koji.conf

+ %endif

+ %if 0%{py2_support} == 1

+ pushd plugins

+ make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install

+ popd

+ %endif

+ %if 0%{py2_support} > 1

+ for D in hub builder plugins util www vm ; do

+     pushd $D

+     make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install

      popd

  done

  %endif

- %endif

  

  

  # python3 build

+ %if 0%{py3_support}

+ %py3_install_wheel %{name}-%{version}-py3-none-any.whl

+ mkdir -p %{buildroot}/etc/koji.conf.d

+ cp cli/koji.conf %{buildroot}/etc/koji.conf

+ %endif

+ %if 0%{py3_support} == 1

+ pushd plugins

+ make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} install

+ popd

+ %endif

  %if 0%{py3_support} > 1

- make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install

+ for D in hub builder plugins util www vm ; do

+     pushd $D

+     make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install

+     popd

+ done

+ 

  # alter python interpreter in koji CLI

  scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-shadow

           %{_sbindir}/koji-gc %{_sbindir}/kojivmd %{_sbindir}/koji-sweep-db
@@ -389,17 +420,6 @@ 

  for fn in $scripts ; do

      sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT$fn

  done

- %else

- %if 0%{py3_support}

- # minimal

- for d in koji cli plugins ; do

-     pushd $d

-     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} install

-     popd

- done

- # alter python interpreter in koji CLI

- sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT/usr/bin/koji

- %endif

  %endif

  

  %if 0%{?fedora}
@@ -452,12 +472,14 @@ 

  %if 0%{py2_support}

  %files -n python2-%{name}

  %{python2_sitelib}/%{name}

+ %{python2_sitelib}/%{name}-%{version}.*-info

  %{python2_sitelib}/koji_cli

  %endif

  

  %if 0%{py3_support}

  %files -n python%{python3_pkgversion}-koji

  %{python3_sitelib}/%{name}

+ %{python3_sitelib}/%{name}-%{version}.*-info

  %{python3_sitelib}/koji_cli

  %endif

  

file modified
+5 -1
@@ -48,7 +48,11 @@ 

          "Operating System :: POSIX :: Linux",

          "Topic :: Utilities"

      ],

-     packages=['koji', 'koji_cli', 'koji_cli_plugins'],

+     packages=[

+         'koji',

+         'koji_cli',

+         'koji_cli_plugins',

+     ],

      package_dir={

          'koji': 'koji',

          'koji_cli': 'cli/koji_cli',

Attempt at a fix for https://pagure.io/koji/issue/912

Uses the appropriate rpm macros for installing python wheels to provide the base koji lib. Packages the resulting dist-info data as well.

Because the RPM packaging of koji is slightly different (the koji_cli_plugins and some of the special utils are listed in setup.py but are actually broken up to be distinct subpackages in the RPM) we modify the spec slightly to omit those aspects and allow them to continue to be installed via make.

Note I still need to do more testing on this -- I'm setting up containers to verify that the python2 and python3 variations not only install but function correctly when bundled this way. But I'd appreciate some initial review and feedback :)

Looks like we'll need to add some buildrequires to make sure the wheel tools are around.

https://fedoraproject.org/wiki/PythonWheels

You may need to turn off the py2 support for Fedora 32 then, because it seems they dropped python2-pip and python2-wheel at that point. Current logic in the spec presumes Fedora 33 for the py2 drop.

Dropping a subpackage from a stream is a big deal. Can we disable the wheel build in this instance instead?

I guess either that or wait for F32 to die ;)

I just went looking, and I don't actually see python2-koji in fedora32, but I could probably hack in a check to fall back to make for python2 installs under fedora32. I don't actually see a fedora32 python2-koji package, so I wonder how far back they switched to python3 only?

so I wonder how far back they switched to python3 only?

Looks like they switched in F31
F30 has it -- https://koji.fedoraproject.org/koji/buildinfo?buildID=1500116
F31 does not -- https://koji.fedoraproject.org/koji/buildinfo?buildID=1607544

I think that dropping it for F32 is ok. Problem I see is in centos 7. (centos 8 works for me)

@mikem @cobrien Jana added few changes in #2821. Main change is that building on RHEL/CentOS 7 now requires EPEL enabled (for py2 wheel/pip). Anyway, I think it is ok as installation needs it already (requests-gssapi). Can you look at it?

Pull-Request has been closed by tkopecek

4 years ago
Metadata