Re: [arch-projects] [dbscripts] [PATCH v2 5/5] Globally set $PKGEXT to a bash extended glob representing valid choices.

2018-02-19 Thread Luke Shumaker
On Mon, 19 Feb 2018 15:11:45 -0500,
Eli Schwartz via arch-projects wrote:
> +# Check if a file exists, even if the file uses wildcards
> +is_globfile() {
> + [[ -f $1 ]]
> +}
> +

Dave's comment on my version of this patchset applies equally to this
version:

> Frankly, this function name and comment sucks, because it says nothing
> about quoting. As I read the comment, I'm lead to believe that given a
> file "foobar" existing, I can call: __isGlobfile "foo*", and this will
> succeed. To the naive reader, you might even believe this claim based on
> the unquotedness of $1 within the -f test.

(I had the same function, with the same comment, as is_globfile in
db-functions and as __isGlobfile in common.bash)

-- 
Happy hacking,
~ Luke Shumaker


Re: [arch-projects] [dbscripts] [PATCH v2 5/5] Globally set $PKGEXT to a bash extended glob representing valid choices.

2018-02-19 Thread Eli Schwartz via arch-projects
On 02/19/2018 04:59 PM, Luke Shumaker wrote:
> Is there a reason you reject '.pkg.tar' (no compression, which makepkg
> accepts)?

I don't think there is any utility in supporting uncompressed packages
in dbscripts. Anyone who wants to customize this in a non-Arch Linux
deployment is free to do so...

If someone wants to use some deviant compression type because they're
positive it works better on those packaged files, I cannot think of a
compelling reason to say "no you're wrong", which is why I listed
everything else.

> (I also found it curious that you swapped lzo and lrz from the order
> the extensions are in in the makepkg source.)

makepkg is inconsistent here, I pulled that from the makepkg.conf(5)
source. :D

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-projects] [dbscripts] [PATCH v2 5/5] Globally set $PKGEXT to a bash extended glob representing valid choices.

2018-02-19 Thread Luke Shumaker
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