[arch-projects] [dbscripts] [PATCH v2 2/8] test: db-update: @test "update same any package to same repository fails": change PKGEXT
Dave Reisner
d at falconindy.com
Mon Feb 19 21:57:48 UTC 2018
On Sun, Feb 18, 2018 at 12:17:30PM -0500, Luke Shumaker wrote:
> From: Luke Shumaker <lukeshu at parabola.nu>
>
> 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
> ---
> test/cases/db-update.bats | 3 ++-
> test/lib/common.bash | 7 ++++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats
> index 1da7eef..36511c9 100644
> --- a/test/cases/db-update.bats
> +++ b/test/cases/db-update.bats
> @@ -92,8 +92,9 @@ load ../lib/common
> db-update
> checkPackage extra pkg-any-a
>
> - releasePackage extra pkg-any-a
> + PKGEXT=.pkg.tar.gz releasePackage extra pkg-any-a
> run db-update
> + [[ -z $BUILDDIR ]] || rm -f "${BUILDDIR}/$(__getCheckSum "${TMP}/svn-packages-copy/pkg-any-a/trunk/PKGBUILD")"/*.pkg.tar.gz{,.sig}
> [ "$status" -ne 0 ]
> }
>
> diff --git a/test/lib/common.bash b/test/lib/common.bash
> index cad4e13..d34af8a 100644
> --- a/test/lib/common.bash
> +++ b/test/lib/common.bash
> @@ -14,6 +14,11 @@ __getCheckSum() {
> echo "${result%% *}"
> }
>
> +# Check if a file exists, even if the file uses wildcards
> +__isGlobfile() {
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.
> + [[ -f $1 ]]
> +}
> +
> __buildPackage() {
> local pkgdest=${1:-.}
> local p
> @@ -24,7 +29,7 @@ __buildPackage() {
>
> if [[ -n ${BUILDDIR} ]]; then
> cache=${BUILDDIR}/$(__getCheckSum PKGBUILD)
> - if [[ -d ${cache} ]]; then
> + if __isGlobfile "${cache}"/*${PKGEXT}; then
> cp -Lv ${cache}/*${PKGEXT}{,.sig} ${pkgdest}
> return 0
> else
> --
> 2.16.1
More information about the arch-projects
mailing list