FS#58776 - makepkg fails if dependency version is the result of evaluating a function
Attached to Project:
Pacman
Opened by Antonio Rojas (arojas) - Tuesday, 29 May 2018, 13:31 GMT
Last edited by Allan McRae (Allan) - Friday, 27 July 2018, 01:00 GMT
Opened by Antonio Rojas (arojas) - Tuesday, 29 May 2018, 13:31 GMT
Last edited by Allan McRae (Allan) - Friday, 27 July 2018, 01:00 GMT
|
Details
Summary and Info:
All binary perl packages on Arch use this snippet to set the perl version in depends: if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then _perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);') _perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);') depends+=("perl>=$_perlver_min" "perl<$_perlver_max") fi This fails with makepkg 5.1 with an error ==> ERROR: pkgver in depends is not allowed to be empty. |
This task depends upon
Closed by Allan McRae (Allan)
Friday, 27 July 2018, 01:00 GMT
Reason for closing: Fixed
Additional comments about closing: The strictness of this check has been reduced. git commit 316b031b
Friday, 27 July 2018, 01:00 GMT
Reason for closing: Fixed
Additional comments about closing: The strictness of this check has been reduced. git commit 316b031b
Try running makepkg --printsrcinfo, you'll see things like
pkgver = perl>=
The new linting checks for invalid dependency specifiers quite rightly dislike this, but they don't know how to run this complicated if statement, for the same reason as
FS#55004IMHO the versioned dependency should be dropped. Perl uses versioned libdirs now, anyway.
depends+=("perl${_perlver_min:+>=$_perlver_min}" "perl${_perlver_max:+<$_perlver_max}")
depends=("linux>=$_kernver" "linux<${_kernver/.*}.$(expr ${_kernver/*.} + 1)")
Which... well, fallback values won't really work there, actually. It would need some global helper function (which will be eval'ed just fine)
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
depends+=("perl>=$(perlver)" "perl<$(perlver 1)")
fi
Should work fine, and the .SRCINFO it generates will actually contain the versioned specifier.
(It will also always claim to depend on versioned perl, which I guess is better than never.)
This assumes we don't want to just drop the versioned dependency entirely due to the existing versioned libdir and detect-old-perl-modules.hook which will loudly warn the user on *every* upgrade that modifies /usr/lib/perl5, if any perl modules are the wrong version.
We don't usually try to version our dependencies in the first place, and IIRC we did this by perl because of the infamous "your mismatched modules will crash the perl interpreter even if you don't try using those modules" thing, which is now fixed anyway due to https://www.archlinux.org/news/perl-library-path-change/
Actually, thinking about this, this is more or less the same as libdepends/libprovides, which also evaluate the versioned component (in a much more complex fashion) only in the actual packaging stage but not when generating srcinfo. Whether it *should* be versioned is another question, of course.
And thinking about that, I think if people do want versioned dependencies this is better implemented as a libmakepkg drop-in.
FS#55004