[arch-projects] [dbscripts] [PATCH v2 5/5] Globally set $PKGEXT to a bash extended glob representing valid choices.
Luke Shumaker
lukeshu at lukeshu.com
Mon Feb 19 21:59:27 UTC 2018
On Mon, 19 Feb 2018 15:11:45 -0500,
Eli Schwartz via arch-projects wrote:
> Document the fact that this has *always* been some sort of glob, and
> update the two cases where this was (not!) being evaluated by bash
> [[ ... ]], to use a not-elegant-at-all proxy function is_globfile() to
> evaluate globs *before* testing if they exist.
...
> @@ -378,8 +383,8 @@ check_pkgrepos() {
> local pkgver="$(getpkgver ${pkgfile})" || return 1
> local pkgarch="$(getpkgarch ${pkgfile})" || return 1
>
> - [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXTS} ]] && return 1
> - [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXTS}.sig ]] && return 1
> + is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS} && return 1
> + is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS}.sig && return 1
> [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1
> [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
It's not a big deal, but I'd rather that be a separate commit, as it's
fixing breakage that's unrelated to switching it from a plain glob to
an extglob.
> diff --git a/config b/config
> index 5bb3b16..0d33de0 100644
> --- a/config
> +++ b/config
> @@ -25,7 +25,8 @@ TMPDIR="/var/tmp"
> ARCHES=(x86_64)
> DBEXT=".db.tar.gz"
> FILESEXT=".files.tar.gz"
> -PKGEXTS=".pkg.tar.?z"
> +# bash glob listing allowed extensions. Note that db-functions turns on extglob.
> +PKGEXTS=".pkg.tar.@(gz|bz2|xz|lzo|lrz|Z)"
> SRCEXT=".src.tar.gz"
>
Is there a reason you reject '.pkg.tar' (no compression, which makepkg
accepts)?
(I also found it curious that you swapped lzo and lrz from the order
the extensions are in in the makepkg source.)
(Also, I'd move it down a line, so that it's more obvious that the
comment doesn't apply to SRCEXT.)
--
Happy hacking,
~ Luke Shumaker
More information about the arch-projects
mailing list