From 0992cc36f525898ff07032d0ee697ecb62fedc07 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 31 Jan 2013 23:24:07 +0100 Subject: db-update: Ignore forgeign staging packages --- db-update | 9 ++++++++- test/test.d/db-update.sh | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/db-update b/db-update index caddbe6..576fe2b 100755 --- a/db-update +++ b/db-update @@ -9,11 +9,18 @@ if [ $# -ge 1 ]; then fi # Find repos with packages to release -repos=($(find "${STAGING}" -mindepth 1 -type d ! -empty -printf '%f ' 2>/dev/null)) +staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u)) if [ $? -ge 1 ]; then die "Could not read ${STAGING}" fi +repos=() +for staging_repo in ${staging_repos[@]##*/}; do + if in_array ${staging_repo} ${PKGREPOS[@]}; then + repos+=(${staging_repo}) + fi +done + # TODO: this might lock too much (architectures) for repo in ${repos[@]}; do for pkgarch in ${ARCHES[@]}; do diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh index ea1e130..7a5ce4c 100755 --- a/test/test.d/db-update.sh +++ b/test/test.d/db-update.sh @@ -162,4 +162,14 @@ testAddIncompleteSplitPackage() { done } +testUnknownRepo() { + mkdir "${STAGING}/unknown/" + releasePackage extra 'pkg-simple-a' 'i686' + releasePackage unknown 'pkg-simple-b' 'i686' + ../db-update + checkPackage extra 'pkg-simple-a-1-1-i686.pkg.tar.xz' 'i686' + [ -e "${FTP_BASE}/unknown" ] && fail "db-update pushed a package into an unknown repository" + rm -rf "${STAGING}/unknown/" +} + . "${curdir}/../lib/shunit2" -- cgit v1.2.3-24-g4f1b