Re: [arch-projects] [dbscripts] [PATCH 1/1] test: db-update: @test "update same any package to same repository fails": change PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 11:04 PM, Luke Shumaker wrote:
> From: Luke Shumaker 
> 
> This has the test change PKGEXT the second time it tries to release the
> package.  Currently, this causes the tests to fail.  That's a good thing;
> it's checking for the regression where db-functions:check_pkgrepos isn't
> treating PKGEXT as a glob.
> 
> Without this, that regression didn't cause test failure because the checks
> right after it were tripping anyway.
> 
> https://lists.archlinux.org/pipermail/arch-projects/2018-February/004742.html

This looks reasonable, thanks. BTW no need to send a cover letter for
one patch. :)

> ---
>  test/cases/db-update.bats | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats
> index 1da7eef..6604841 100644
> --- a/test/cases/db-update.bats
> +++ b/test/cases/db-update.bats
> @@ -92,7 +92,16 @@ load ../lib/common
>   db-update
>   checkPackage extra pkg-any-a
>  
> - releasePackage extra pkg-any-a
> + # don't let __buildPackage use the cached build; we want to
> + # force a new build with a different PKGEXT.
> + if [[ -n ${BUILDDIR} ]]; then
> + mv -T "${BUILDDIR}/$(__getCheckSum 
> "${TMP}/svn-packages-copy/pkg-any-a/trunk/PKGBUILD")"{,.bak}
> + fi
> + PKGEXT=.pkg.tar.gz releasePackage extra pkg-any-a
> + if [[ -n ${BUILDDIR} ]]; then
> + rm -rf "${BUILDDIR}/$(__getCheckSum 
> "${TMP}/svn-packages-copy/pkg-any-a/trunk/PKGBUILD")"
> + mv -T "${BUILDDIR}/$(__getCheckSum 
> "${TMP}/svn-packages-copy/pkg-any-a/trunk/PKGBUILD")"{.bak,}
> + fi
>   run db-update
>   [ "$status" -ne 0 ]
>  }

I'm guessing you restore the old version because the new version will
throw off other tests using the cached version with the wrong $PKGEXT?
It might make more sense to change __buildPackage() to use is_globfile
${cache}*${PKGEXT} rather than [[ -d ${cache} ]]

This should prevent needing to move anything, leading to cleaner code on
both sides.

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


[arch-projects] [dbscripts] [PATCH 0/1] Update tests to check for glob regression

2018-02-15 Thread Luke Shumaker
From: Luke Shumaker 

This updates the tests to check for the regression we've been
discussing.

This doesn't include a fix.  I haven't looked too closely, or actually
tested them, but Eli's fix LGTM so far.

Luke Shumaker (1):
  test: db-update: @test "update same any package to same repository
fails": change PKGEXT

 test/cases/db-update.bats | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
2.16.1


[arch-projects] [dbscripts] [PATCH] test: fix misuse of $PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
As per the previous commits, this never worked and nobody noticed
because the use of globbing was undocumented.

Fortunately, we can fix that now, by using the new is_globfile() proxy
function.

Signed-off-by: Eli Schwartz 
---
 test/cases/ftpdir-cleanup.bats | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/cases/ftpdir-cleanup.bats b/test/cases/ftpdir-cleanup.bats
index 6280ce0..63eed03 100644
--- a/test/cases/ftpdir-cleanup.bats
+++ b/test/cases/ftpdir-cleanup.bats
@@ -13,8 +13,8 @@ __checkRepoRemovedPackage() {
local pkgname
 
for pkgname in $(__getPackageNamesFromPackageBase ${pkgbase}); do
-   [[ ! -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-*${PKGEXT} ]]
-   [[ ! -f 
${FTP_BASE}/${repo}/os/${repoarch}/${pkgname}-*${PKGEXT} ]]
+   ! is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}"-*${PKGEXT}
+   ! is_globfile 
"${FTP_BASE}/${repo}/os/${repoarch}/${pkgname}"-*${PKGEXT}
done
 }
 
-- 
2.16.1


[arch-projects] [dbscripts] [PATCH 2/3] ftpdir-cleanup, sourceballs: replace external find command with bash globbing

2018-02-15 Thread Eli Schwartz via arch-projects
This fully removes the use of find from the codebase, leads to a
micro-optimization in a couple cases,  and ensures that $PKGEXT is
consistently treated as a shell globbing character (which is important
because it is used as one).

Of the eight instances in these files:

- One was unnecessary as `cat` can natively consume all files passed to
  it and no directory traversal was in use.

- Two were unnecessary as they were hardcoded to read a single file

- Another four were only being used to strip leading directory paths,
  and can be replaced by globstar and ${filepath##*/}

- The final two were checking the modification time of the files, and
  can be replaced with touch(1) and [[ -nt ]]. Although this introduces
  an additional temporary file, this is not such a big deal.

Signed-off-by: Eli Schwartz 
---
 cron-jobs/ftpdir-cleanup | 24 ++--
 cron-jobs/sourceballs| 21 -
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 2f3d5aa..2d33047 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -38,7 +38,11 @@ for repo in ${PKGREPOS[@]}; do
continue
fi
# get a list of actual available package files
-   find "${FTP_BASE}/${repo}/os/${arch}" -xtype f -name 
"*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}"
+   for f in "${FTP_BASE}"/${repo}/os/${arch}/*${PKGEXT}; do
+   if [[ -f $f ]]; then
+   printf '%s\n' "${f##*/}"
+   fi
+   done | sort > "${WORKDIR}/repo-${repo}-${arch}"
# get a list of package files defined in the repo db
bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" | 
awk '/^%FILENAME%/{getline;print}' | sort > "${WORKDIR}/db-${repo}-${arch}"
 
@@ -61,10 +65,12 @@ for repo in ${PKGREPOS[@]}; do
done
 done
 
-# get a list of all available packages in the pacakge pool
-find "$FTP_BASE/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > 
"${WORKDIR}/pool"
+# get a list of all available packages in the package pool
+for f in "$FTP_BASE/${PKGPOOL}"/*${PKGEXT}; do
+   printf '%s\n' "${f##*/}"
+done | sort > "${WORKDIR}/pool"
 # create a list of packages in our db
-find "${WORKDIR}" -maxdepth 1 -type f -name 'db-*' -exec cat {} \; | sort -u > 
"${WORKDIR}/db"
+cat "${WORKDIR}"/db-* 2>/dev/null | sort -u > "${WORKDIR}/db"
 
 old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db"))
 if [ ${#old_pkgs[@]} -ge 1 ]; then
@@ -75,8 +81,14 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
 fi
 
-old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime 
+${CLEANUP_KEEP} -printf '%f\n'))
-if [ ${#old_pkgs[@]} -ge 1 ]; then
+unset old_pkgs
+touch -d "${CLEANUP_KEEP} days ago"  "${WORKDIR}/cleanup_timestamp"
+for f in "${CLEANUP_DESTDIR}"/**/*${PKGEXT}; do
+   if [[ ${WORKDIR}/cleanup_timestamp -nt $f ]]; then
+   old_pkgs+=("${f##*/}")
+   fi
+done
+if (( ${#old_pkgs[@]} > 1 )); then
msg "Removing old packages from the cleanup directory..."
for old_pkg in ${old_pkgs[@]}; do
msg2 "${old_pkg}"
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 9ab4e98..5844817 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -46,7 +46,11 @@ for repo in ${PKGREPOS[@]}; do
 done
 
 # Create a list of all available source package file names
-find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | 
sort -u > "${WORKDIR}/available-src-pkgs"
+for f in "${FTP_BASE}"/${SRCPOOL}/*${SRCEXT}; do
+   if [[ -f $f ]]; then
+   printf '%s\n' "${f##*/}"
+   fi
+done | sort -u > "${WORKDIR}/available-src-pkgs"
 
 # Check for all packages if we need to build a source package
 for repo in ${PKGREPOS[@]}; do
@@ -117,8 +121,8 @@ for repo in ${PKGREPOS[@]}; do
 done
 
 # Cleanup old source packages
-find "${WORKDIR}" -maxdepth 1 -type f -name 'expected-src-pkgs' -exec cat {} 
\; | sort -u > "${WORKDIR}/expected-src-pkgs.sort"
-find "${WORKDIR}" -maxdepth 1 -type f -name 'available-src-pkgs' -exec cat {} 
\; | sort -u > "${WORKDIR}/available-src-pkgs.sort"
+sort -u "${WORKDIR}/expected-src-pkgs" > "${WORKDIR}/expected-src-pkgs.sort"
+sort -u "${WORKDIR}/available-src-pkgs" > "${WORKDIR}/available-src-pkgs.sort"
 old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" 
"${WORKDIR}/expected-src-pkgs.sort"))
 
 if [ ${#old_pkgs[@]} -ge 1 ]; then
@@ -133,8 +137,15 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
 fi
 
-old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime 
+${SOURCE_CLEANUP_KEEP} -printf '%f\n'))
-if [ ${#old_pkgs[@]} -ge 1 ]; then
+unset old_pkgs
+touch -d "${SOURCE_CLEANUP_KEEP} days ago"  "${WORKDIR}/cleanup_timestamp"
+for f in "${SOURCE_CLEANUP_DESTDIR}"/*${SRCEXT}; do
+   if [[ 

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

2018-02-15 Thread Eli Schwartz via arch-projects
This can be anything makepkg.conf accepts, therefore it needs to be able
to match all that. 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 proxy function is_globfile()

Signed-off-by: Eli Schwartz 
---
 config   |  3 ++-
 db-functions | 11 ---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/config b/config
index d2c1942..7a90fc6 100644
--- a/config
+++ b/config
@@ -25,7 +25,8 @@ TMPDIR="/var/tmp"
 ARCHES=(x86_64)
 DBEXT=".db.tar.gz"
 FILESEXT=".files.tar.gz"
-PKGEXT=".pkg.tar.?z"
+# bash glob listing allowed extensions. Note that db-functions turns on 
extglob.
+PKGEXT=".pkg.tar.@(gz|bz2|xz|lzo|lrz|Z)"
 SRCEXT=".src.tar.gz"
 
 # Allowed licenses: get sourceballs only for licenses in this array
diff --git a/db-functions b/db-functions
index f0f8980..7cf8444 100644
--- a/db-functions
+++ b/db-functions
@@ -3,7 +3,7 @@
 . /usr/share/makepkg/util.sh
 
 # global shell options for enhanced bash scripting
-shopt -s globstar nullglob
+shopt -s extglob globstar nullglob
 
 
 # Some PKGBUILDs need CARCH to be set
@@ -20,6 +20,11 @@ restore_umask () {
umask $UMASK >/dev/null
 }
 
+# Check if a file exists, even if the file uses wildcards
+is_globfile() {
+   [[ -f $1 ]]
+}
+
 # just like mv -f, but we touch the file and then copy the content so
 # default ACLs in the target dir will be applied
 mv_acl() {
@@ -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}${PKGEXT} 
]] && return 1
-   [[ -f 
${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
return 1
+   is_globfile 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 1
+   is_globfile 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig && return 
1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
 
-- 
2.16.1


[arch-projects] [dbscripts] [PATCH 0/3] Fix ambiguous uses of

2018-02-15 Thread Eli Schwartz via arch-projects
This was sort of cobbled together and not really tested, so I'm not 100%
sure it will work, but it looks okay, so I am posting this to get more
eyes on it. I think I've actually gotten this to work properly, which is
yay, and support multiple extensions, which is meh but we may need this
as Luke said, if we ever decide to switch over. Which means it is
probably "more proper" to do so...

As a bonus, we get to micro-optimize a few external calls away which
saves us a handful of forked processes and should be just as fast not
counting a fraction of a second gained for all those forks?

Eli Schwartz (3):
  db-update: replace external find command with bash globbing
  ftpdir-cleanup,sourceballs: replace external find command with bash
globbing
  Globally set $PKGEXT to a bash extended glob representing valid
choices.

 config   |  3 ++-
 cron-jobs/ftpdir-cleanup | 24 ++--
 cron-jobs/sourceballs| 21 -
 db-functions | 13 +++--
 db-update|  9 ++---
 5 files changed, 53 insertions(+), 17 deletions(-)

-- 
2.16.1


[arch-projects] [dbscripts] [PATCH] Do not support wildcards in PKGEXT, and standardize on xz compression.

2018-02-15 Thread Eli Schwartz via arch-projects
This results in unpredictable behavior when used across, variously, bash
[[, POSIX sh [, and find -name

Its usage depended on matching only one result, which is bad practice.

Moreover, it never worked in the first place as

- The majority of alternative compression extensions available in
  makepkg do not use *exactly* two chars.
- It accepted lots of extensions that aren't valid at all, like for
  example .pkg.tar.z (which is what I think of using nonstandard
  compression schemes).

Since devtools pushes xz, and every single package currently in the
repos uses xz, and AFAIK we haven't actually used any others, it makes
sense to just assume xz as the only supported PKGEXT.

Signed-off-by: Eli Schwartz 
---
 config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config b/config
index d2c1942..d292c9f 100644
--- a/config
+++ b/config
@@ -25,7 +25,7 @@ TMPDIR="/var/tmp"
 ARCHES=(x86_64)
 DBEXT=".db.tar.gz"
 FILESEXT=".files.tar.gz"
-PKGEXT=".pkg.tar.?z"
+PKGEXT=".pkg.tar.xz"
 SRCEXT=".src.tar.gz"
 
 # Allowed licenses: get sourceballs only for licenses in this array
-- 
2.16.1


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 05:17 PM, Luke Shumaker wrote:
> Huh?  My version isn't broken.  Unless you mean that the glob is more
> restrictive than the one used by makepkg?

As you saw my other message, this should be answered already, but
consider this additional perspective on globs:

The glob is  both *less* restrictive and more restrictive, it accepts
any valid unicode character.

To be more exact, it's almost completely orthogonal to the one in makepkg.

makepkg only accepts .tar.gz, .tar.bz2, .tar.xz, .tar.lzo, .tar.lrz, and
.tar.Z and most of those fail to match against a two-char compression type.

dbscripts accepts .pkg.tar.z which incidentally is what I think of
cherry-picking xz and gz as supported methods.

AFAIK there should not be any non-xz packages in the official repos, I
can verify that there are currently none, and I'm not sure why we should
support it anyway (but if we do, we should do it properly).

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-59-g36b71d3

2018-02-15 Thread Luke Shumaker
On Thu, 15 Feb 2018 15:09:57 -0500,
Eli Schwartz wrote:
> 
> On 02/15/2018 02:04 PM, Luke Shumaker wrote:
> >> -  [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
> >> ] && return 1
> >> -  [ -f 
> >> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
> >> return 1
> >> +  [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
> >> ]] && return 1
> >> +  [[ -f 
> >> ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
> >> return 1
> > 
> > You don't want to do that here.  In dbscripts, PKGEXT is a glob
> > pattern--it needs to be "unquoted"; and `[[ ... ]]`'s magic-quoting
> > breaks that.  The closing-quote coming before ${PKGEXT} was quite
> > intentional.
> 
> Seems like an easy thing to fix, we always use .pkg.tar.xz and using a
> glob there seems quite ugly.
> (What happens if it magically matches two files? The POSIX [ construct
> explodes and burns your house down.)

Disregard the bit about my version not being broken in my last
message---my spam filter had eaten this message.  You are correct;
both versions are broken.

-- 
Happy hacking,
~ Luke Shumaker


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Luke Shumaker
On Thu, 15 Feb 2018 16:57:26 -0500,
Eli Schwartz wrote:
> 
> On 02/15/2018 04:43 PM, Luke Shumaker wrote:
> > That's not a bad idea.  But then someone reading the code might wonder
> > "why does such a trivial function exist?".  I think it would be silly,
> > and ultimately hurt readability to go through and replace all
> > 
> > "[[ -f ... ]]" instances with "file_exists", and if we don't do that,
> > then there's a weird magic question of "when should I use [[ -f ]] and
> > when should I used file_exists?"
> 
> Why would it hurt readability?
> 
> Why won't people be able to read the comments I wrote documenting the
> function in my working tree?

Every Bash programmer knows what [[ -f ]] does.  Sure
 - "file_exists" is self-explanatory, and
 - a comment there might better explain why it exists instead of using [[ -f ]]
But then it's another silly little thing that they have to keep in
mind everywhere in the codebase.

What about just adding a comment:

# We can't use [[ ]] for these 2 checks because glob expansion
# needs to be performed on $PKGEXT.

It avoids someone tripping over it in the future, and avoids adding
another unnecessary abstraction to the codebase.

> > Ultimately, this way doesn't hide anything, and has everything the
> > next person needs to know right there.  Sure, they'll have to be
> > careful not to trip.  The next patch I sent changes it to PKGEXT_glob,
> > to make it stand out a little more.  I'm also working on a `make
> > lint`/shellcheck patchset that will add `# shellcheck disable=SC2086`
> > directives to each line to avoid shellcheck complaining about
> > PKGEXT_glob being unquoted, drawing even more attention to it, to
> > avoid tripping.
> 
> I want to make dbscripts more readable, not less. Just reverting every
> new thing when *both* are broken, is not something I want to do.

Huh?  My version isn't broken.  Unless you mean that the glob is more
restrictive than the one used by makepkg?

-- 
Happy hacking,
~ Luke Shumaker


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 04:43 PM, Luke Shumaker wrote:
> That's not a bad idea.  But then someone reading the code might wonder
> "why does such a trivial function exist?".  I think it would be silly,
> and ultimately hurt readability to go through and replace all
> 
> "[[ -f ... ]]" instances with "file_exists", and if we don't do that,
> then there's a weird magic question of "when should I use [[ -f ]] and
> when should I used file_exists?"

Why would it hurt readability?

Why won't people be able to read the comments I wrote documenting the
function in my working tree?

> Ultimately, this way doesn't hide anything, and has everything the
> next person needs to know right there.  Sure, they'll have to be
> careful not to trip.  The next patch I sent changes it to PKGEXT_glob,
> to make it stand out a little more.  I'm also working on a `make
> lint`/shellcheck patchset that will add `# shellcheck disable=SC2086`
> directives to each line to avoid shellcheck complaining about
> PKGEXT_glob being unquoted, drawing even more attention to it, to
> avoid tripping.

I want to make dbscripts more readable, not less. Just reverting every
new thing when *both* are broken, is not something I want to do.

I'd like to just remove this time bomb properly.


-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Luke Shumaker
On Thu, 15 Feb 2018 15:11:13 -0500,
Dave Reisner wrote:
> 
> On Thu, Feb 15, 2018 at 02:49:45PM -0500, Luke Shumaker wrote:
> > -   [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
> > ]] && return 1
> > -   [[ -f 
> > ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
> > return 1
> > +   [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
> > ] && return 1
> > +   [ -f 
> > "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
> > return 1
> 
> Rather than making this stand out like a sore thumb for the next person
> to trip over, why don't we just define a "file_exists" function?
> 
>   file_exists() {
> [[ -f $1 ]]
>   }
> 
> Now you're free to do this:
> 
>   file_exists 
> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 1
> 
> Expansion is taken care of by the shell before you pass to exists, and
> the check does what you'd expect.

That's not a bad idea.  But then someone reading the code might wonder
"why does such a trivial function exist?".  I think it would be silly,
and ultimately hurt readability to go through and replace all

"[[ -f ... ]]" instances with "file_exists", and if we don't do that,
then there's a weird magic question of "when should I use [[ -f ]] and
when should I used file_exists?"

Ultimately, this way doesn't hide anything, and has everything the
next person needs to know right there.  Sure, they'll have to be
careful not to trip.  The next patch I sent changes it to PKGEXT_glob,
to make it stand out a little more.  I'm also working on a `make
lint`/shellcheck patchset that will add `# shellcheck disable=SC2086`
directives to each line to avoid shellcheck complaining about
PKGEXT_glob being unquoted, drawing even more attention to it, to
avoid tripping.

-- 
Happy hacking,
~ Luke Shumaker


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 03:48 PM, Dave Reisner wrote:
> Nope, changing the kind of glob doesn't work here. There's simply no
> glob expansion of any kind inside [[ -f  ]] (or any other stat-like
> check).

I was thinking maybe something like the way makepkg compares filenames
to various extended globs, but actually that doesn't help since [[ = ]]
will only expand the right side...

But if we do globbing at all, I want to reliably enforce actual limits
on what .pkg.tar.?z is meant to convey.

...

find(1) doesn't support the FNM_EXTGLOB flag from fnmatch(3) and we use
PKGEXT as a pattern a couple times for that. We could replace `find
-name` altogether, using globstar.

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Dave Reisner
On Thu, Feb 15, 2018 at 03:14:19PM -0500, Eli Schwartz via arch-projects wrote:
> On 02/15/2018 03:11 PM, Dave Reisner wrote:
> > Rather than making this stand out like a sore thumb for the next person
> > to trip over, why don't we just define a "file_exists" function?
> > 
> >   file_exists() {
> > [[ -f $1 ]]
> >   }
> > 
> > Now you're free to do this:
> > 
> >   file_exists 
> > "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 
> > 1
> > 
> > Expansion is taken care of by the shell before you pass to exists, and
> > the check does what you'd expect.
> 
> That was my first inclination, my second was to stop allowing people to
> upload *.kz compressed packages for giggles.
> 
> If we absolutely need to glob anything there, we should use bash
> extended globs to match @(g|z) and whatever else we actually want. This
> would work in [[ ]]
> 

Nope, changing the kind of glob doesn't work here. There's simply no
glob expansion of any kind inside [[ -f  ]] (or any other stat-like
check).


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 03:11 PM, Dave Reisner wrote:
> Rather than making this stand out like a sore thumb for the next person
> to trip over, why don't we just define a "file_exists" function?
> 
>   file_exists() {
> [[ -f $1 ]]
>   }
> 
> Now you're free to do this:
> 
>   file_exists 
> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 1
> 
> Expansion is taken care of by the shell before you pass to exists, and
> the check does what you'd expect.

That was my first inclination, my second was to stop allowing people to
upload *.kz compressed packages for giggles.

If we absolutely need to glob anything there, we should use bash
extended globs to match @(g|z) and whatever else we actually want. This
would work in [[ ]]


-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Dave Reisner
On Thu, Feb 15, 2018 at 02:49:45PM -0500, Luke Shumaker wrote:
> From: Luke Shumaker 
> 
> This partially reverts commit b61a7148eaf546a31597b74d9dd8948e4a39dea1.
> 
> In dbscripts, PKGEXT is a glob pattern--it needs to be "unquoted"; and
> The magic-quoting done by `[[ ... ]]` breaks that.  The closing-quote
> coming before ${PKGEXT} was quite intentional.
> ---
>  db-functions | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/db-functions b/db-functions
> index e8949d7..93a5af3 100644
> --- a/db-functions
> +++ b/db-functions
> @@ -374,8 +374,8 @@ check_pkgrepos() {
>   local pkgver="$(getpkgver ${pkgfile})" || return 1
>   local pkgarch="$(getpkgarch ${pkgfile})" || return 1
>  
> - [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
> ]] && return 1
> - [[ -f 
> ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
> return 1
> + [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
> ] && return 1
> + [ -f 
> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
> return 1

Rather than making this stand out like a sore thumb for the next person
to trip over, why don't we just define a "file_exists" function?

  file_exists() {
[[ -f $1 ]]
  }

Now you're free to do this:

  file_exists "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
&& return 1

Expansion is taken care of by the shell before you pass to exists, and
the check does what you'd expect.

>   [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1
>   [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
>  
> -- 
> 2.16.1


Re: [arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-59-g36b71d3

2018-02-15 Thread Eli Schwartz via arch-projects
On 02/15/2018 02:04 PM, Luke Shumaker wrote:
>> -[ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
>> ] && return 1
>> -[ -f 
>> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
>> return 1
>> +[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
>> ]] && return 1
>> +[[ -f 
>> ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
>> return 1
> 
> You don't want to do that here.  In dbscripts, PKGEXT is a glob
> pattern--it needs to be "unquoted"; and `[[ ... ]]`'s magic-quoting
> breaks that.  The closing-quote coming before ${PKGEXT} was quite
> intentional.

Seems like an easy thing to fix, we always use .pkg.tar.xz and using a
glob there seems quite ugly.
(What happens if it magically matches two files? The POSIX [ construct
explodes and burns your house down.)

But what you're saying is that check_pkgrepos should never fail even if
the package already exists, since it doesn't exist with a literal ? char
-- this should be caught by test/cases/db-update.bats in
@test "update same any package to different repositories fails"

And that test does not fail... looks like it needs to test the case
where the second package is renamed...

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


[arch-projects] [dbscripts] [PATCH 0/2] Better handling of PKGEXT

2018-02-15 Thread Luke Shumaker
From: Luke Shumaker 

This fixes a mistake introduced in b61a714 around quoting PKGEXT, then
renames PKGEXT to PKGEXT_glob to avoid that type of confusion in the
future.

Luke Shumaker (2):
  Don't quote $PKGEXT
  config: Rename PKGEXT to PKGEXT_glob

 config | 4 +++-
 cron-jobs/ftpdir-cleanup   | 6 +++---
 db-functions   | 4 ++--
 db-move| 4 ++--
 db-update  | 8 
 test/cases/db-repo-add.bats| 6 +++---
 test/cases/db-update.bats  | 2 +-
 test/cases/ftpdir-cleanup.bats | 4 ++--
 test/lib/common.bash   | 6 --
 9 files changed, 24 insertions(+), 20 deletions(-)

-- 
Happy hacking,
~ Luke Shumaker


[arch-projects] [dbscripts] [PATCH 2/2] config: Rename PKGEXT to PKGEXT_glob

2018-02-15 Thread Luke Shumaker
From: Luke Shumaker 

Unlike the other *EXT variables, which are prescriptive, PKGEXT is
descriptive, and is a blob.  This is confusing because of the other
variables, and because it is used prescriptively in makepkg.conf.

Simply, the configuration variable name PKGEXT is overloaded.

Now, in test/lib/common.bash, there *are* 2 places where it is used
prescriptively.  How does that work!?  The value has a glob character in
it!  Well, because of sloppy quoting, it just kind of works out.  So, in
those places, *don't* rename it to PKGEXT_glob, but introduce a local
PKGEXT variable with a prescriptive value.
---
 config | 4 +++-
 cron-jobs/ftpdir-cleanup   | 6 +++---
 db-functions   | 4 ++--
 db-move| 4 ++--
 db-update  | 8 
 test/cases/db-repo-add.bats| 6 +++---
 test/cases/db-update.bats  | 2 +-
 test/cases/ftpdir-cleanup.bats | 4 ++--
 test/lib/common.bash   | 6 --
 9 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/config b/config
index d2c1942..d41850e 100644
--- a/config
+++ b/config
@@ -23,10 +23,12 @@ LOCK_TIMEOUT=300
 STAGING="$HOME/staging"
 TMPDIR="/var/tmp"
 ARCHES=(x86_64)
+# prescriptive
 DBEXT=".db.tar.gz"
 FILESEXT=".files.tar.gz"
-PKGEXT=".pkg.tar.?z"
 SRCEXT=".src.tar.gz"
+# descriptive
+PKGEXT_glob=".pkg.tar.?z"
 
 # Allowed licenses: get sourceballs only for licenses in this array
 ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'GPL3' 'LGPL' 'LGPL1' 'LGPL2' 'LGPL2.1' 
'LGPL3')
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 2f3d5aa..4dc02a0 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -38,7 +38,7 @@ for repo in ${PKGREPOS[@]}; do
continue
fi
# get a list of actual available package files
-   find "${FTP_BASE}/${repo}/os/${arch}" -xtype f -name 
"*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}"
+   find "${FTP_BASE}/${repo}/os/${arch}" -xtype f -name 
"*${PKGEXT_glob}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}"
# get a list of package files defined in the repo db
bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" | 
awk '/^%FILENAME%/{getline;print}' | sort > "${WORKDIR}/db-${repo}-${arch}"
 
@@ -62,7 +62,7 @@ for repo in ${PKGREPOS[@]}; do
 done
 
 # get a list of all available packages in the pacakge pool
-find "$FTP_BASE/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > 
"${WORKDIR}/pool"
+find "$FTP_BASE/${PKGPOOL}" -name "*${PKGEXT_glob}" -printf '%f\n' | sort > 
"${WORKDIR}/pool"
 # create a list of packages in our db
 find "${WORKDIR}" -maxdepth 1 -type f -name 'db-*' -exec cat {} \; | sort -u > 
"${WORKDIR}/db"
 
@@ -75,7 +75,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
 fi
 
-old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime 
+${CLEANUP_KEEP} -printf '%f\n'))
+old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT_glob}" -mtime 
+${CLEANUP_KEEP} -printf '%f\n'))
 if [ ${#old_pkgs[@]} -ge 1 ]; then
msg "Removing old packages from the cleanup directory..."
for old_pkg in ${old_pkgs[@]}; do
diff --git a/db-functions b/db-functions
index 93a5af3..6f2d131 100644
--- a/db-functions
+++ b/db-functions
@@ -374,8 +374,8 @@ check_pkgrepos() {
local pkgver="$(getpkgver ${pkgfile})" || return 1
local pkgarch="$(getpkgarch ${pkgfile})" || return 1
 
-   [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
] && return 1
-   [ -f 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
return 1
+   [ -f 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT_glob} ] && 
return 1
+   [ -f 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT_glob}.sig ] && 
return 1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
 
diff --git a/db-move b/db-move
index 37a9884..e3bc16e 100755
--- a/db-move
+++ b/db-move
@@ -49,7 +49,7 @@ for pkgbase in ${args[@]:2}; do
 
for pkgname in ${pkgnames[@]}; do
for tarch in ${tarches[@]}; do
-   getpkgfile 
"${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null
+   getpkgfile 
"${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT_glob} 
>/dev/null
done
done
continue 2
@@ -95,7 +95,7 @@ for pkgbase in ${args[@]:2}; do
 
for pkgname in ${pkgnames[@]}; do
for tarch in ${tarches[@]}; do
-   pkgpath=$(getpkgfile 

[arch-projects] [dbscripts] [PATCH 1/2] Don't quote $PKGEXT

2018-02-15 Thread Luke Shumaker
From: Luke Shumaker 

This partially reverts commit b61a7148eaf546a31597b74d9dd8948e4a39dea1.

In dbscripts, PKGEXT is a glob pattern--it needs to be "unquoted"; and
The magic-quoting done by `[[ ... ]]` breaks that.  The closing-quote
coming before ${PKGEXT} was quite intentional.
---
 db-functions | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/db-functions b/db-functions
index e8949d7..93a5af3 100644
--- a/db-functions
+++ b/db-functions
@@ -374,8 +374,8 @@ check_pkgrepos() {
local pkgver="$(getpkgver ${pkgfile})" || return 1
local pkgarch="$(getpkgarch ${pkgfile})" || return 1
 
-   [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
]] && return 1
-   [[ -f 
${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
return 1
+   [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
] && return 1
+   [ -f 
"${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
return 1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1
[[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1
 
-- 
2.16.1


Re: [arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-59-g36b71d3

2018-02-15 Thread Luke Shumaker
On Thu, 15 Feb 2018 10:48:11 -0500,
Eli Schwartz via arch-projects wrote:
> commit b61a7148eaf546a31597b74d9dd8948e4a39dea1
> Author: Eli Schwartz 
> Date:   Mon Feb 12 20:50:57 2018 -0500
> 
> Use more bashisms
> 
> Fix numerous instances of POSIX `[ ... ]`, including reliance on ugly
> deprecated constructs like POSIX `-a`. Since we require bash regardless,
> it makes sense to take full advantage of it.
> 
> bash `[[ ... ]]` does not require quoting variables as the shell
> natively recognizes them as variables rather than expanded strings.
> 
> Use shell arithmetic rather than test, when checking numerical values.
> 
> diff --git a/db-functions b/db-functions
> index d66955b..c0af03c 100644
> --- a/db-functions
> +++ b/db-functions
> @@ -381,10 +380,10 @@ check_pkgrepos() {
>   local pkgver="$(getpkgver ${pkgfile})" || return 1
>   local pkgarch="$(getpkgarch ${pkgfile})" || return 1
>  
> - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} 
> ] && return 1
> - [ -f 
> "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && 
> return 1
> + [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} 
> ]] && return 1
> + [[ -f 
> ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && 
> return 1

You don't want to do that here.  In dbscripts, PKGEXT is a glob
pattern--it needs to be "unquoted"; and `[[ ... ]]`'s magic-quoting
breaks that.  The closing-quote coming before ${PKGEXT} was quite
intentional.

-- 
Happy hacking,
~ Luke Shumaker


[arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-63-g134aff7

2018-02-15 Thread Pierre Schmitz via arch-projects
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Official repo DB scripts".

The branch, master has been updated
   via  134aff74d16331231ed94f34d8417d1325d4600f (commit)
   via  c7f1d85c0e11aaf3c9acd944388f664aea40037b (commit)
   via  24671e6cb2fa343fd6f15fe54b16840aed091ad4 (commit)
   via  883005f5450ed6a278b5cef46be1245783840b29 (commit)
  from  36b71d3231aca071ad635b995342b786676ef8fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 134aff74d16331231ed94f34d8417d1325d4600f
Author: Pierre Schmitz 
Date:   Thu Feb 15 17:29:57 2018 +0100

Add usage tests

commit c7f1d85c0e11aaf3c9acd944388f664aea40037b
Author: Pierre Schmitz 
Date:   Thu Feb 15 17:07:02 2018 +0100

PR-2: Default to x86_64 for check_packages

commit 24671e6cb2fa343fd6f15fe54b16840aed091ad4
Author: Pierre Schmitz 
Date:   Thu Feb 15 17:04:29 2018 +0100

PR-2: Allow i686 for tests

commit 883005f5450ed6a278b5cef46be1245783840b29
Author: Florian Pritz 
Date:   Thu Feb 15 16:01:07 2018 +0100

Remove i686 from config

We dropped it long ago and this should be reflected here rather than
being changed on our servers only.

Signed-off-by: Florian Pritz 

---

Summary of changes:
 config   |  2 +-
 cron-jobs/check_archlinux/check_packages.py  |  8 
 cron-jobs/check_archlinux/parse_pkgbuilds.sh |  2 +-
 test/cases/common.bats   | 10 ++
 test/lib/common.bash |  1 +
 5 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 test/cases/common.bats


hooks/post-receive
-- 
Official repo DB scripts


[arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-59-g36b71d3

2018-02-15 Thread Eli Schwartz via arch-projects
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Official repo DB scripts".

The branch, master has been updated
  discards  be2971eca4cb08aa5c128d8b206f6943d58a7dd9 (commit)
   via  36b71d3231aca071ad635b995342b786676ef8fe (commit)
   via  b61a7148eaf546a31597b74d9dd8948e4a39dea1 (commit)
   via  f4f9d1a0099c1f784c4a964e2b5651b56f629b82 (commit)
   via  a7b497e8347fc964f8738d4dfc3c3ef23806fdc7 (commit)
   via  5afac1ed83479c5ff7aab134b54245ec4f5b59fe (commit)
   via  eec8e35eba84658bdd03230c83f449d2bb437b10 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (be2971eca4cb08aa5c128d8b206f6943d58a7dd9)
\
 N -- N -- N (36b71d3231aca071ad635b995342b786676ef8fe)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 36b71d3231aca071ad635b995342b786676ef8fe
Author: Eli Schwartz 
Date:   Mon Feb 12 20:53:06 2018 -0500

db-functions: deduplicate some repeated logic

reuse getpkgfile() in getpkgfiles()

commit b61a7148eaf546a31597b74d9dd8948e4a39dea1
Author: Eli Schwartz 
Date:   Mon Feb 12 20:50:57 2018 -0500

Use more bashisms

Fix numerous instances of POSIX `[ ... ]`, including reliance on ugly
deprecated constructs like POSIX `-a`. Since we require bash regardless,
it makes sense to take full advantage of it.

bash `[[ ... ]]` does not require quoting variables as the shell
natively recognizes them as variables rather than expanded strings.

Use shell arithmetic rather than test, when checking numerical values.

commit f4f9d1a0099c1f784c4a964e2b5651b56f629b82
Author: Eli Schwartz 
Date:   Mon Feb 12 20:39:30 2018 -0500

Use modern bash to append to strings/arrays.

Rather than using ugly hacks like arr[${#arr[*]}]="foo", bash 3.1 has
the += operator.

Update strings to use the same operator while we are at it.

commit a7b497e8347fc964f8738d4dfc3c3ef23806fdc7
Author: Eli Schwartz 
Date:   Mon Feb 12 19:41:29 2018 -0500

ARCHES is an array, do not attempt to call it as a string

This meant only the first array element was checked in
check_repo_permission(). Although arguably this should never cause real
issues as something else would have to be broken if multiple
architectures have different permissions, we should catch this now
anyway.

commit 5afac1ed83479c5ff7aab134b54245ec4f5b59fe
Author: Eli Schwartz 
Date:   Mon Feb 12 17:53:10 2018 -0500

Update messages to make full use of printf formatters

libmakepkg messaging functions provide automatic access to gettext
(which we do not currently make use of) in addition to cleanly
separating data from message strings.

In order for this to work properly, pass argv correctly from die() to
libmakepkg's error()

commit eec8e35eba84658bdd03230c83f449d2bb437b10
Author: Eli Schwartz 
Date:   Mon Feb 12 17:21:39 2018 -0500

Use return codes properly when checking for failed commands.

Rather than doing a test(1) on the numerical value of the return code,
use the `if !` and `||` operators during control flow.

---

Summary of changes:
 config  |   2 +-
 cron-jobs/ftpdir-cleanup|   4 +-
 cron-jobs/sourceballs   |   4 +-
 cron-jobs/update-web-db |   4 +-
 db-functions| 177 
 db-move |  28 +++
 db-remove   |  18 ++---
 db-repo-add |  12 +--
 db-repo-remove  |   8 +-
 db-update   |  47 ++--
 test/cases/db-repo-add.bats |   2 +-
 testing2x   |  16 ++--
 12 files changed, 151 insertions(+), 171 deletions(-)


hooks/post-receive
-- 
Official repo DB scripts


[arch-projects] [dbscripts] [GIT] Official repo DB scripts branch master updated. 20131102-54-gbe2971e

2018-02-15 Thread Eli Schwartz via arch-projects
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Official repo DB scripts".

The branch, master has been updated
   via  be2971eca4cb08aa5c128d8b206f6943d58a7dd9 (commit)
  from  1cad51c5af4b0aa1e1196d737edaa00938af937f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit be2971eca4cb08aa5c128d8b206f6943d58a7dd9
Author: Luke Shumaker 
Date:   Sun May 17 19:44:11 2015 -0400

Use += instead of jumping through hoops.

The += operator was introduced in Bash 3.1, and was already used in some
places in dbscripts, but not everywhere.

For normal strings, this isn't a big deal, but appending to an array
without using += is nasty.

[gabrielfrancoso...@gmail.com: Adjust for removed files]
Signed-off-by: Gabriel Souza Franco 

---

Summary of changes:
 cron-jobs/sourceballs | 6 +++---
 db-functions  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Official repo DB scripts