Using > or < in the provides array is wrong so make it cause an error. Fixes FS#12540. Also, use bash substitution rather than spawning new processes where possible in the error checking. Move split package detection to a better position. Signed-off-by: Allan McRae <allan@archlinux.org> --- doc/PKGBUILD.5.txt | 4 +++- scripts/makepkg.sh.in | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index f90d8c0..6cc1aa9 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -160,7 +160,9 @@ name. The syntax is: `$$source=('filename::url')$$` depend on 'cron' rather than 'dcron OR fcron'. Versioned provisions are also possible, in the 'name=version' format. For example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' - dependency of other packages. + dependency of other packages. Provisions involving the '>' and '<' + operators are invalid as only specifc versions of a package may be + provided. *replaces (array)*:: An array of packages that this package should replace, and can be used diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 66aaa5e..3b7490a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1574,6 +1574,10 @@ if [ "$GENINTEG" = "1" ]; then exit 0 # $E_OK fi +if [ "${#pkgname[@]}" -gt "1" ]; then + SPLITPKG=1 +fi + # check for no-no's in the build script if [ -z "$pkgname" ]; then error "$(gettext "%s is not allowed to be empty.")" "pkgname" @@ -1587,19 +1591,15 @@ if [ -z "$pkgrel" ]; then error "$(gettext "%s is not allowed to be empty.")" "pkgrel" exit 1 fi -if [ $(echo "$pkgver" | grep '-') ]; then +if [ $pkgver != ${pkgver//-/} ]; then error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver" exit 1 fi -if [ $(echo "$pkgrel" | grep '-') ]; then +if [ $pkgrel != ${pkgrel//-/} ]; then error "$(gettext "%s is not allowed to contain hyphens.")" "pkgrel" exit 1 fi -if [ "${#pkgname[@]}" -gt "1" ]; then - SPLITPKG=1 -fi - if [ "$arch" = 'any' ]; then CARCH='any' fi @@ -1613,6 +1613,14 @@ if ! in_array $CARCH ${arch[@]}; then fi fi +for provide in ${provides[@]}; do + if [ $provide != ${provide//</} -o $provide != ${provide//>/} ]; then + error "$(gettext "%s is not allowed to contain comparisons involving the > or < operators.")" "provides" + exit 1 + fi +done +unset provide + if [ "$install" -a ! -f "$install" ]; then error "$(gettext "Install scriptlet (%s) does not exist.")" "$install" exit 1 -- 1.6.1