Skip to content

Commit

Permalink
ciimage: fix pathological brokenness in Debian packaging of python
Browse files Browse the repository at this point in the history
In this case, PEP 668 was created to allow a thing that Debian wanted,
which is for `pip install foobar` to not break the system python. This
despite the fact that the system python is fine, unless you use sudo pip
which is discouraged for separate reasons, and it is in fact quite
natural to install additional packages to the user site-packages.

It isn't even the job of the operating system to decide whether the user
site-packages is broken, whether the operating system gets the answer
correct or not -- it is the job of the operating system to decide
whether the operating system is broken, and that can be solved by e.g.
enforcing a shebang policy for distribution-packaged software, which
distros like Fedora do, and mandating not only that python shebangs do
not contain `/usr/bin/env`, but that they *do* contain -s.

Anyway, this entire kerfuffle is mostly just a bit of pointless
interactive churn, but it bites pretty hard for our use case, which is a
container image which is fortunately tested before deployment, so
instead of failing to deploy because of theoretical conflicts with the
base system (we specifically need base system integration...) we fail to
deploy because 5 minutes into pulling apt updates at the very beginning,
pip refuses point-blank to work. I especially do not know why it is the
job of the operating system to throw errors intended for interactive
users at people baking "appliance" containers who cannot "break" the
system python anyway.

Fix this by doing what Debian and Ubuntu should both have done from the
beginning, and opting containers out of this questionable feature
entirely.

Note that CI images may still not actually complete their build/test
cycle and be updated, because e.g. LLVM 16 issues tracked by #11642 or
glib ASAN issues tracked by #11754.
  • Loading branch information
eli-schwartz committed May 28, 2023
1 parent f71ca28 commit 5c479d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ci/ciimage/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ dub_fetch() {
}

install_minimal_python_packages() {
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
python3 -m pip install "${base_python_pkgs[@]}" $*
}

install_python_packages() {
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
python3 -m pip install "${base_python_pkgs[@]}" "${python_pkgs[@]}" $*
}

0 comments on commit 5c479d7

Please sign in to comment.