xbps-src: explicitly disallow pattern on build deps

It is not possible to use version other than currently in template.

Specifying pattern breaks build if dependency isn't in binary repo
already. That it worked when in repo was a coincidence.

Let's detect exact version requirement with regex equivalent to
`xbps-uhelper getpkgname`.

    bash-5.1$ for x in a-{a,0,-,_}{a,0,-,_}{a,0,-,_}{a,0,-,_}{a,0,-,_}{a,0,-,_}{a,0,-,_}{a,0,-,_}; do [[ $x = *[\>\<]* || $x =~ -[^-_]*[0-9][^-_]*_[0-9_]+$ ]]; bash=$?; xbps-uhelper getpkgname $x > /dev/null 2> /dev/null; xbps=$?; if [ $bash != $xbps ]; then echo $x; fi; done
    bash-5.1$

Co-authored-by: Duncaen <duncaen@voidlinux.org>
This commit is contained in:
Piotr Wójcik 2022-08-08 20:11:02 +02:00 committed by classabbyamp
parent 021a4e96ed
commit 1b9578b20c
1 changed files with 6 additions and 0 deletions

View File

@ -477,6 +477,12 @@ setup_pkg() {
fi
fi
for x in ${hostmakedepends} ${makedepends} ${checkdepends}; do
if [[ $x = *[\<\>]* || $x =~ -[^-_]*[0-9][^-_]*_[0-9_]+$ ]]; then
msg_error "$pkgver: specifying version in build dependency '$x' is invalid, template version is used always\n"
fi
done
FILESDIR=$XBPS_SRCPKGDIR/$sourcepkg/files
PATCHESDIR=$XBPS_SRCPKGDIR/$sourcepkg/patches
DESTDIR=$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${sourcepkg}-${version}