Bug 8432 - Can't upgrade meson to newer version in cenbuild
Summary: Can't upgrade meson to newer version in cenbuild
Status: RESOLVED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.18.0
Assignee: Alexander Zeijlon
URL:
Keywords: prosaic
Depends on:
Blocks: 8402
  Show dependency treegraph
 
Reported: 2024-10-14 16:01 CEST by Alexander Zeijlon
Modified: 2024-10-21 13:15 CEST (History)
0 users

See Also:
Acceptance Criteria:
MUST: * Python and all module packages should still build and function as before the change. * It should be possible to build newer meson projects in cenbuild. * Pyobfuscate must still work with the newer Python version. SHOULD: * Python should be upgraded to the newest version possible.


Attachments

Description Alexander Zeijlon cendio 2024-10-14 16:01:44 CEST
We are currently limited to an old version, v.0.61 of Meson in cenbuild due to our versio of Python, v 3.6.

Upgrading Python would hence let us upgrade meson such that it can be used to build more modern packages.
Comment 2 Alexander Zeijlon cendio 2024-10-16 13:53:23 CEST
Turns out that using setup.py, which is often bundled with python module packages, as a means of building and installing, has been deprecated in newer versions of setuptools. See https://packaging.python.org/en/latest/discussions/setup-py-deprecated/

As a consequence of this, newer versions of packages will likely ship without setup.py. Right now, there is only one with this situation that requires upgrade, the module "packaging".

Unfortunately, the new recommended way of building and installing is to use the pip-module and the build-module instead. We don't have pip or build in cenbuild, since they are mainly used for handling packages downloaded from the web (build itself does not download any packages but it uses pip under the surface).
Comment 4 Alexander Zeijlon cendio 2024-10-18 12:38:34 CEST
A follow-up on comment 2. While setup.py is deprecated, the comment was the result of an error on my part.

When Python is upgraded to a new minor verison, e.g. from 3.6 to 3.9. All other modules need to be rebuilt, since they put files in /usr/lib/python<version>. Hence, for Python 3.9 to find our modules. We need to rebuild all corresponding cenbuild packages with the new Python version.

The package that i thought required a new version for Python 3.9 was python3-packaging. Which did not seem to be able to build properly due to a missing function. But now in hindsight, this error was due to the fact that I did not rebuild all dependent packages beforehand.
Comment 10 Alexander Zeijlon cendio 2024-10-21 10:13:32 CEST
Now, this comes in a bit of a reverse order since I have already written about specific details of my work on this bug. But here goes (in retrospect).

As stated in the first comment, we want to upgrade Python to a more modern version (preferably the the latest version). This is motivated by:
- Being able to use modern syntax in code that is not a part of the ThinLinc product itself (where we are limited by our backward compatibility requirements).
- Being able to use more modern features and modules of Python.

These two points can be extended to e.g. being able to upgrade build requirements in cenbuild, that themselves require a newer Python version to build.

One such package is the build system Meson. We have seen some packages that are migrating to Meson from Autotools, and at some point these will only build with Meson. It is therefore important for us to be ready for this beforehand, such that we are able to build packages, the way that the project maintainers intend them to be built.
Comment 11 Alexander Zeijlon cendio 2024-10-21 10:19:53 CEST
An example of this is the newest version of cairo, v 1.18, which requires Meson 1.3.0 to build. Python 3.6 limits us to Meson 0.61.
Comment 12 Alexander Zeijlon cendio 2024-10-21 10:43:43 CEST
One thing that I had to learn the hard way, is that when upgrading to a new minor version of Python, you need to also rebuild all other packaged python modules. (See comment 4).

This led me down a path where I learnt some things that might be good to write down here for future reference.

As mentioned in comment 2, it is very likely that newer releases of Python modules will come bundled without the typical setup.py script that we make frequent use of to build and install packages during the rpmbuild procedure. This means that we currently do not have a way of packaging such modules in cenbuild, since we do not have pip or some equivalent module to do that for us.

Before realizing that I just had to rebuild all current versions of modules with the new Python version, I looked at providing another way of building and installing packages that does not use setup.py, since at that point it looked like i had to upgrade a few packages to make things build properly:

  For building I used the module "flit_core" which comes bundled with a bootstrap
  script that enables it to build and install itself.
  See https://flit.pypa.io/en/stable/bootstrap.html

  For installing I used the module "installer" which then can be built with
  flit_core, and then installed using its own source, also kind of bootstrapping
  itself. 
  See https://pypi.org/project/installer/

I also looked at providing a more cohesive build and install solution for us, such as the main module of flit_core called "flit", but as far as I could see, this did not give us any more functionality. It provides a commandline executable called flit that you can use to build and install modules, but unfortunately, flit does not seem to provide a way of setting an install prefix. This is something we really need when building cenbuild packages.

I also looked at a few other such modules, but they tend to be wanting to use either pip or something similar that uses a lot of features we do not need/want since we are e.g. not publishing modules, or want to dynamically download versions from an online repository.
Comment 13 Alexander Zeijlon cendio 2024-10-21 10:49:55 CEST
For now we have updated Python to version 3.9.20, which allows us to upgrade Meson to version 1.5.2.

Python 3.9 is as far as we can go without having to patch our module pyobfuscate.
Comment 15 Alexander Zeijlon cendio 2024-10-21 12:36:15 CEST
> MUST:
> * Python and all module packages should still build and function as before
>   the change.
Every package that install files in /usr/lib/python3.?/site-packages/ has been rebuilt such that it now installs to /usr/lib/python3.9/...
> * It should be possible to build newer meson projects in cenbuild.
Meson has subsequently been upgraded to version 1.5.2 which is 
> * Pyobfuscate must still work with the newer Python version.
Pyobfuscate still works as expected.
> SHOULD:
> * Python should be upgraded to the newest version possible.
In order to remain compatible with the current release of Pyobfuscate, we didn't upgrade Python past version 3.9.
Comment 16 Alexander Zeijlon cendio 2024-10-21 13:15:26 CEST
> * It should be possible to build newer meson projects in cenbuild.

Meson has subsequently been upgraded to version 1.5.2 which was the latest version when the work on this bug was done (1.6.0 was released 15 hours ago as of writing this...)

Note You need to log in before you can comment on or make changes to this bug.