summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-11-05 16:34:53 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-11-05 16:34:53 +0100
commit6159269bfbb850b2aed25e335fc5d538a2d4de4f (patch)
treed104a55fd0de24e3bb88023b0c1610ab1891edbd
parentae3ff361863b72d9cd52d9379cda7e7dbe825b15 (diff)
db-remove: support removing multiple packages at once
-rwxr-xr-xdb-remove33
-rwxr-xr-xtest/test.d/db-remove.sh25
2 files changed, 43 insertions, 15 deletions
diff --git a/db-remove b/db-remove
index 7e2282a..a3e03e6 100755
--- a/db-remove
+++ b/db-remove
@@ -10,7 +10,7 @@ fi
repo="$1"
arch="$2"
-pkgbase="$3"
+pkgbases=(${@:3})
ftppath="$FTP_BASE/$repo/os"
svnrepo="$repo-$arch"
@@ -29,21 +29,24 @@ for tarch in ${tarches[@]}; do
repo_lock $repo $tarch || exit 1
done
-msg "Removing $pkgbase from [$repo]..."
-/usr/bin/svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null
-
-if [ -d "${WORKDIR}/svn/$pkgbase/repos/$svnrepo" ]; then
- pkgnames=($(. "${WORKDIR}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
- /usr/bin/svn rm --force -q "${WORKDIR}/svn/$pkgbase/repos/$svnrepo"
- /usr/bin/svn commit -q "${WORKDIR}/svn/$pkgbase" -m "$(basename $0): $pkgbase removed by $(id -un)"
-else
- warning "$pkgbase not found in $svnrepo"
- warning "Removing only $pkgbase from the repo"
- warning "If it was a split package you have to remove the others yourself!"
- pkgnames=($pkgbase)
-fi
+remove_pkgs=()
+for pkgbase in ${pkgbases[@]}; do
+ msg "Removing $pkgbase from [$repo]..."
+ /usr/bin/svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null
+
+ if [ -d "${WORKDIR}/svn/$pkgbase/repos/$svnrepo" ]; then
+ remove_pkgs=(${remove_pkgs[@]} $(. "${WORKDIR}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
+ /usr/bin/svn rm --force -q "${WORKDIR}/svn/$pkgbase/repos/$svnrepo"
+ /usr/bin/svn commit -q "${WORKDIR}/svn/$pkgbase" -m "$(basename $0): $pkgbase removed by $(id -un)"
+ else
+ warning "$pkgbase not found in $svnrepo"
+ warning "Removing only $pkgbase from the repo"
+ warning "If it was a split package you have to remove the others yourself!"
+ remove_pkgs[${#remove_pkgs[*]}]=$pkgbase
+ fi
+done
for tarch in ${tarches[@]}; do
- arch_repo_remove "${repo}" "${tarch}" ${pkgnames[@]}
+ arch_repo_remove "${repo}" "${tarch}" ${remove_pkgs[@]}
repo_unlock $repo $tarch
done
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index 945ca62..416e693 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -30,6 +30,31 @@ testRemovePackages() {
done
}
+testRemoveMultiplePackages() {
+ local arches=('i686' 'x86_64')
+ local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
+ local pkgbase
+ local arch
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ releasePackage extra ${pkgbase} ${arch}
+ done
+ done
+
+ ../db-update
+
+ for arch in ${arches[@]}; do
+ ../db-remove extra ${arch} ${pkgs[@]}
+ done
+
+ for pkgbase in ${pkgs[@]}; do
+ for arch in ${arches[@]}; do
+ checkRemovedPackage extra ${pkgbase} ${arch}
+ done
+ done
+}
+
testRemoveAnyPackages() {
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase