@@ -16,6 +16,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() {
@@ -374,8 +379,8 @@ check_pkgrepos() {
local pkgver="$(getpkgver ${pkgfile})" || return 1
local pkgarch="$(getpkgarch ${pkgfile})" || 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
+ is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT_glob} && return 1
+ is_globfile "${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
@@ -13,8 +13,8 @@ __checkRepoRemovedPackage() {
local pkgname
for pkgname in $(__getPackageNamesFromPackageBase ${pkgbase}); do
- [[ ! -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-*${PKGEXT_glob} ]]
- [[ ! -f ${FTP_BASE}/${repo}/os/${repoarch}/${pkgname}-*${PKGEXT_glob} ]]
+ ! is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}"-*${PKGEXT_glob}
+ ! is_globfile "${FTP_BASE}/${repo}/os/${repoarch}/${pkgname}"-*${PKGEXT_glob}
done
}
From: Luke Shumaker <lukeshu@parabola.nu> Several places treated PKGEXT as a fixed string in [[ -f ]] existence checks. Fix that elegantly by introducing an is_globfile function. This fixes the failing db-update.bats "update same any package to same repository fails" test. This is based on a patch by Eli Schwartz <eschwartz@archlinux.org> --- db-functions | 9 +++++++-- test/cases/ftpdir-cleanup.bats | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-)