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] [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


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-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