[pacman-dev] [PATCH] makepkg: detect incorrect unsage of >= in provides
Using >= in the provides array is stupid 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> --- scripts/makepkg.sh.in | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 66aaa5e..634ee4e 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,10 @@ if ! in_array $CARCH ${arch[@]}; then fi fi +if [ $(echo "${provides[@]" | grep ">=") ]; then + error "$(gettext "%s is not allowed to contain >= provisions.")" "provides" +fi + if [ "$install" -a ! -f "$install" ]; then error "$(gettext "Install scriptlet (%s) does not exist.")" "$install" exit 1 -- 1.6.1
On Thu, Jan 1, 2009 at 7:16 PM, Allan McRae <allan@archlinux.org> wrote:
Using >= in the provides array is stupid 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.
Only checking for >= looks strange to me, what about all the others : < , >, <=, etc.. Maybe we could simply prevent < and > in the provision, using the same bash substitution than for -.
Xavier wrote:
On Thu, Jan 1, 2009 at 7:16 PM, Allan McRae <allan@archlinux.org> wrote:
Using >= in the provides array is stupid 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.
Only checking for >= looks strange to me, what about all the others : < , >, <=, etc.. Maybe we could simply prevent < and > in the provision, using the same bash substitution than for -.
I figure providing < or <= is sane. I will add the check for >. I can't use bash substitution because this is an array (unless I loop there). Allan
On Thu, Jan 1, 2009 at 8:38 PM, Allan McRae <allan@archlinux.org> wrote:
Xavier wrote:
On Thu, Jan 1, 2009 at 7:16 PM, Allan McRae <allan@archlinux.org> wrote:
Using >= in the provides array is stupid 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.
Only checking for >= looks strange to me, what about all the others : < , >, <=, etc.. Maybe we could simply prevent < and > in the provision, using the same bash substitution than for -.
I figure providing < or <= is sane. I will add the check for >. I can't use bash substitution because this is an array (unless I loop there).
provides (array) An array of "virtual provisions" that this package provides. This allows a package to provide dependencies other than its own package name. For example, the dcron package can provide cron, which allows packages to 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. Maybe the manpage isn't clear enough. This was where we originally used provides=('cron 2.0'), but we hit a lot of issues with space parsing, so Nagy, Xavier and I decided to just cave and use the = sign instead, knowing full well that we would then see people attempt to use the versioned operators. Versioned operators are NOT allowed here. Ever. Want to maybe make the docs a bit clearer while you are at it? -Dan
participants (3)
-
Allan McRae
-
Dan McGee
-
Xavier