Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back port recent fixes to 1.5 branch #1130

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

gouttegd
Copy link
Contributor

@gouttegd gouttegd commented Nov 5, 2024

This PR back ports some recent fixes to the 1.5 maintenance branch (fixes to the "update constraints" system and a fix about how the default repo name is handled in odk.py).

It's unclear whether we will need a 1.5.4 release at some point or 1.6 will be ready before that, but just in case, I'd rather have these fixes in the 1.5 branch already.

To compute the set of Python constraints, we install all the Python
packages we need in a bare Ubuntu image (same version as the one used to
build the ODK itself) in which we only install Python3 and PIP.

This ensure that `pip-constraints.txt`, the list of Python packages that
are installed by the system and that PIP should not touch no matter
what, always reflect the actual list of system-managed Python packages
found in the ODK.

This has the side-effect of allowing to use the `update-constraints.sh`
script for the specific case of bootstrapping the constraints when the
base image is upgraded to a newer version of Ubuntu, something that
previously necessitated an undocumented manual operation.
When building the ODK builder image, before attempting to install the
Python packages, we obtain the list of packages that have already been
installed by the system (i.e. by APT) and compare it with the
pre-computed list in `pip-constraints.txt`.

The two lists should normally always be the same. They MAY differ if,
between the time the constraints were last updated and the current
build, Ubuntu updated some of its Python packages (e.g. if they bump
`python3-setuptools` to a more recent minor version because of a
security vulnerability). If that happens, we allow the build to continue
(it may not necessarily cause a fatal error), but we log a warning so
that, should the build fail, we will know that we likely need to refresh
the constraints to reflect the updated Ubuntu packages.
If the ODK seeding configuration file does not define the name of the
repository (`repo`) and if no name is explicitly given on the command
line, we want to set a default repository name ("noname") to prevent a
crash when generating the files.

Unfortunately, the way this was done (#1097) makes any `repo` value
defined in the configuration _ignored_, because we:

* first set `repo` to "noname" if we didn't get anything from the
  command line;
* then call `load_config` with whatever value we have for `repo` (hether
  it comes from the command line or from our default), and `load_config`
  takes whatever value we give it and **overrides** any value it may
  have found in the config file.

So here, we define a default value for `project.repo` at the moment that
field is declared (as for all other default values), and do **not** set
a default value in the main function.

This way:

* if no `repo` argument is given in the command line, we get the value
  from the configuration file, or the default value if there is `repo`
  key in the config file;
* if a `repo` argument is given in the command line, it overrides both
  any value that may be set in the configuration file, and the default
  value.
@gouttegd gouttegd self-assigned this Nov 5, 2024
@gouttegd gouttegd merged commit df773fa into BRANCH-1.5-MAINTENANCE Nov 5, 2024
1 check passed
@gouttegd gouttegd deleted the backports-fixes-to-1.5 branch November 5, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants