[arch-dev-public] libalpm hook and wrapper for detecting broken perl modules
(too old to reply)
Eli Schwartz via arch-general
2017-06-11 02:27:20 UTC
Raw Message
Talking to some folks in #perl pointed me towards a hopefully satisfying
solution. I plan to version the architecture specific directories and
introduce a libalpm hook that checks for old directories and warns the
user by printing a list of affected AUR/cpanplus-dist-arch packages,
respectively a list of files for modules installed directly with cpan.
The new directory layout would be
"/usr/lib/perl5/$baseversion/{core,vendor,site}_perl" with $baseversion
being "5.26" right now. Currently the layout is
"/usr/lib/perl5/{core,vendor,site}_perl". The check for old versions
would then be rather simple since it just has to look for directories
beside the current version.
During the old discussion, Justin raised the issue that if the
directories are versioned, perl modules that are not rebuilt will just
be missing. This could lead to software not detecting them any more and
disabling a feature or using a slower module to do the job.
One possibility to counter this would be to replace the perl executable
with a wrapper that performs the check and prints errors to stderr.
Optionally it could also exit with an error code rather than continuing
to run the script. I'm not sure if I want this or not, but I'm leaning
towards a yes since exiting will make the error more difficult to miss.
I kind of feel like users who do the wrong thing should not be catered
to. That being said, using a perl directory layout that causes
non-rebuilt packages to simply go missing from the perl installation
seems like an *excellent* tradeoff of harmless while providing useful
functionality. It seems to work well for python, too.

Hooks to warn people when they do the wrong thing seem ugly, but I can't
really claim to be extremely bothered if it is as lightweight as a check
for existing files/directories, I assume running whenever the perl
package is updated...
But providing wrapper scripts that hijack the perl binary every time you
try to do anything that involves perl is a *terrible idea*, and
regardless, if users don't pay attention to pacman output they deserve
everything that happens to them. Paying attention to pacman output is
non-optional in Arch, last I checked.
Eli Schwartz