[pacman-dev] Alternatives system brainstorm
Allan McRae
allan at archlinux.org
Thu Oct 17 10:53:49 UTC 2019
Hi all,
Some further brainstorming on alternatives system.
Last time, I suggested something like:
alternatives=(python->python3)
But as was pointed out, there may be many other things you want to bring
along with the python binary. Some directly related:
/usr/share/man/man1/python3.1.gz -> python.1.gz
Some less directly related:
/usr/bin/idle
/usr/bin/pydoc
/usr/bin/python-config
Another example would be lua, where you want to set the main interpreter
and the header directory.
In Debian & Fedora land, these additional files are called slaves.
Note that both those distros use the "same" tool to manage these things.
In addition, each alternative is given a priority. So if (e.g.) two
python2 and python3 are installed at the same time, it would select the
one with the higher priority. Fedora also has "ghost" files (not sure
about Debian). I.e. the python3 package contains a ghost
/usr/bin/python, so searching file databases gives a match.
Now how does that inform our potential implementation? Mostly, I don't
like that they set up all the alternatives in the post install with one
long command passed to their tool. I'd prefer we had a file with a list
of needed symlinks so this could happen automatically.
So here is a starting point for discussion:
In the PKGBUILD:
alternatives=('python::python3')
that would look for a file in our build root called
"python3.alternatives" and include it in the package root. Note we
could have more than one such entry.
This file could look like:
/usr/bin/python3 -> python
/usr/bin/idle3 -> idle
/usr/include/example3/ -> example/
Could also include an optional priority statement? Or should that be
captured in the PKGBUILD?
The file would be placed at /var/lib/pacman/alternatives/python/python3.
Any comments on that as a starting point.
Cheers,
Allan
More information about the pacman-dev
mailing list