#150 New bcond main_python
Merged 4 years ago by churchyard. Opened 4 years ago by torsava.
rpms/ torsava/python3 master  into  master

file modified
+35 -9
@@ -30,12 +30,21 @@ 

  

  

  # Flat package, i.e. python36, python37, python38 for tox etc.

- # warning: changes some other defaults

+ # WARNING: This also influences the main_python bcond below.

  # in Fedora, never turn this on for the python3 package

  # and always keep it on for python37 etc.

- # WARNING: This does not change the package name and summary above

+ # WARNING: This does not change the package name and summary above.

  %bcond_with flatpackage

  

+ # Main Python, i.e. whether this is the main Python version in the distribution

+ # that owns /usr/bin/python3 and other unique paths

+ # Default: if this is a flatpackage -> it is not the main Python

+ %if %{with flatpackage}

+ %bcond_with main_python

+ %else

+ %bcond_without main_python

+ %endif

+ 

  # When bootstrapping python3, we need to build setuptools.

  # but setuptools BR python3-devel and that brings in python3-rpm-generators;

  # python3-rpm-generators needs python3-setuptools, so we cannot have it yet.
@@ -311,12 +320,14 @@ 

  # replace python36-3.6.2.

  Obsoletes: python%{pyshortver}

  

+ %if %{with main_python}

  # https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

  # https://fedoraproject.org/wiki/Changes/Python_means_Python3

  # We recommend /usr/bin/python so users get it by default

  # Versioned recommends are problematic, and we know that the package requires

  # python3 back with fixed version, so we just use the path here:

  Recommends: %{_bindir}/python

+ %endif

  

  # In Fedora 31, /usr/bin/pydoc was moved here from Python 2.

  # Ideally we'd have an explicit conflict with "/usr/bin/pydoc < 3",
@@ -358,6 +369,7 @@ 

  the "%{name}-" prefix.

  

  

+ %if %{with main_python}

  # https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

  # https://fedoraproject.org/wiki/Changes/Python_means_Python3

  %package -n python-unversioned-command
@@ -373,6 +385,8 @@ 

  %description -n python-unversioned-command

  This package contains /usr/bin/python - the "python" command that runs Python 3.

  

+ %endif # with main_python

+ 

  

  %package libs

  Summary:        Python runtime libraries
@@ -842,7 +856,7 @@ 

  install -d -m 0755 %{buildroot}%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__

  %endif

  

- %if %{without flatpackage}

+ %if %{with main_python}

  # add idle3 to menu

  install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png

  install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png
@@ -925,7 +939,7 @@ 

  # Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to

  # avoid the user having to know the precise version and ABI flags.

  # See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748

- %if %{with debug_build} && %{without flatpackage}

+ %if %{with debug_build} && %{with main_python}

  ln -s \

    %{_bindir}/python%{LDVERSION_debug} \

    %{buildroot}%{_bindir}/python3-debug
@@ -936,7 +950,7 @@ 

  # See https://bugzilla.redhat.com/show_bug.cgi?id=1111275

  mv %{buildroot}%{_bindir}/2to3-%{pybasever} %{buildroot}%{_bindir}/2to3

  

- %if %{with flatpackage}

+ %if %{without main_python}

  # Remove stuff that would conflict with python3 package

  rm %{buildroot}%{_bindir}/python3

  rm %{buildroot}%{_bindir}/pydoc3
@@ -1056,7 +1070,7 @@ 

  %files

  %doc README.rst

  

- %if %{without flatpackage}

+ %if %{with main_python}

  %{_bindir}/pydoc*

  %{_bindir}/python3

  %else
@@ -1068,11 +1082,15 @@ 

  %{_mandir}/*/*3*

  

  

+ %if %{with main_python}

  %if %{without flatpackage}

  %files -n python-unversioned-command

+ %endif

  %{_bindir}/python

  %{_mandir}/*/python.1*

+ %endif

  

+ %if %{without flatpackage}

  %files libs

  %doc README.rst

  %endif
@@ -1286,13 +1304,16 @@ 

  %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}

  

  %{_libdir}/%{py_INSTSONAME_optimized}

- %if %{without flatpackage}

+ %if %{with main_python}

  %{_libdir}/libpython3.so

  %endif

  

  

  %if %{without flatpackage}

  %files devel

+ %endif

+ 

+ %if %{with main_python}

  %{_bindir}/2to3

  %endif

  
@@ -1306,7 +1327,7 @@ 

  %{_includedir}/python%{LDVERSION_optimized}/cpython/

  %doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit

  

- %if %{without flatpackage}

+ %if %{with main_python}

  %{_bindir}/python3-config

  %{_bindir}/python-config

  %{_libdir}/pkgconfig/python3.pc
@@ -1334,7 +1355,9 @@ 

  

  %if %{without flatpackage}

  %files idle

+ %endif

  

+ %if %{with main_python}

  %{_bindir}/idle*

  %else

  %{_bindir}/idle%{pybasever}
@@ -1342,7 +1365,7 @@ 

  

  %{pylibdir}/idlelib

  

- %if %{without flatpackage}

+ %if %{with main_python}

  %{_metainfodir}/idle3.appdata.xml

  %{_datadir}/applications/idle3.desktop

  %{_datadir}/icons/hicolor/*/apps/idle3.*
@@ -1394,6 +1417,9 @@ 

  %if %{with debug_build}

  %if %{without flatpackage}

  %files debug

+ %endif

+ 

+ %if %{with main_python}

  %{_bindir}/python3-debug

  %{_bindir}/python-debug

  %endif

The bcond flatpackage assumed that if building without flatpackage,
that we want to build the main Python for the distribution. However, in
some instances we want a non-flatpackage build of Python that is not
the main Python in the distro.
Therefore I have split the main-Python setting into its own bcond.

extend the warning?

should we conditionalize the python-unversioned-command subpackage on this?

rebased onto 69f9a5e095e493daaed7106d35e7463eead06ec0

4 years ago

rebased onto b85b692c901d6d9e00ec661cb3e753fe753bc2be

4 years ago

should we conditionalize the python-unversioned-command subpackage on this?

Already done.

rebased onto 849acf13e23515c3e11273ad7f8143cc3ce13f25

4 years ago

extend the warning?

Good idea, clarified.

rebased onto fbd950a4c55bda87ac940c4737c5a18ed9e1dc4a

4 years ago

I had one condition set the wrong way and the build failed. Rebased and testing again.

could you please koji build various combinations?

could you please koji build various combinations?

Good idea, will do.

Fatpackage default (disabled), main_python default (enabled):
- https://koji.fedoraproject.org/koji/taskinfo?taskID=39082945

Flatpackage default (disabled), main_python disabled:
- https://koji.fedoraproject.org/koji/taskinfo?taskID=39083000

Flatpackage enabled, main_python default (disabled):
- https://koji.fedoraproject.org/koji/taskinfo?taskID=39082965

Flatpackage enabled, main_python enabled:
- https://koji.fedoraproject.org/koji/taskinfo?taskID=39082969

Flatpackage enabled, main_python enabled:
- https://koji.fedoraproject.org/koji/taskinfo?taskID=39082969

This one is failing, which I think is ok. Having a flatpackage being the main Python is not supported.

Let's make it supported? It can be useful for experimenting.

The fix seems trivial:

Installed (but unpackaged) file(s) found:
   /usr/bin/python
   /usr/share/man/man1/python.1.gz

Just make the files listed in %files -n python-unversioned-command part of the main package with this combination.

1 new commit added

  • fixup! Fix flatpack AND main_python enabled
4 years ago

Fixed. Building the whole matrix again.

Fatpackage default (disabled), main_python default (enabled):
https://koji.fedoraproject.org/koji/taskinfo?taskID=39088620

Flatpackage default (disabled), main_python disabled:
https://koji.fedoraproject.org/koji/taskinfo?taskID=39088648

Flatpackage enabled, main_python default (disabled):
https://koji.fedoraproject.org/koji/taskinfo?taskID=39088614

Flatpackage enabled, main_python enabled:
https://koji.fedoraproject.org/koji/taskinfo?taskID=39088596

Side note: I don't particularly like the main_python name, but I haven't said it yet because I was trying to figure out other names. I've failed.

Let's squash and merge.

Hold the merge, the CI failed.

rebased onto 7eeb8ab43a944270682872e8ffcf6a2491225c8f

4 years ago

Side note: I don't particularly like the main_python name, but I haven't said it yet because I was trying to figure out other names. I've failed.

Yeah, I didn't find anything better :)

Let's squash and merge.

Squashed. Since we have the Koji scratch builds, I'd say we can merge, what do you think?

In this case, the build should not be different, but I'd rather have the CI job finished.

Let's wait a day and if the CI is still broken, I can run rpmdiff to make sure we haven't accidentally nuked some files, etc.

Ci build failed in root.log for no discernable reason.

rebased onto a50a780

4 years ago

Pull-Request has been merged by churchyard

4 years ago