From 22dd30328ec4229321f1f96026704ff3cf1cc621 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 1 Nov 2011 09:55:25 -0500 Subject: db-*: always handle pkgname/pkgbase/pkgfile argument last This matches what we do in db-update, and makes the most sense if we want to expand these commands to take multiple arguments at the same time. Especially in the case of db-repo-add and db-repo-remove, these wrapper commands should be no more limiting than repo-add and repo-remove which always allow multiple arguments and are more efficient that way. This patch simply reorders the arguments; a later patch will support multiple pkgname/pkgbase/pkgfile arguments on the command line. Although this does break backwards compatibility and requires some changing of muscle memory, I think it is a worthwhile change to make as the functionality of these commands becomes more powerful and the order of arguments becomes the same in all of them. Signed-off-by: Dan McGee --- db-remove | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'db-remove') diff --git a/db-remove b/db-remove index b44eb33..e7326c0 100755 --- a/db-remove +++ b/db-remove @@ -4,13 +4,13 @@ . "$(dirname $0)/config" if [ $# -ne 3 ]; then - msg "usage: $(basename $0) " + msg "usage: $(basename $0) " exit 1 fi -pkgbase="$1" -repo="$2" -arch="$3" +repo="$1" +arch="$2" +pkgbase="$3" ftppath="$FTP_BASE/$repo/os" svnrepo="$repo-$arch" -- cgit v1.2.3 From bbf00cc90ed8d1bf3bbed1f78acca71b2d624ee2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 1 Nov 2011 09:55:26 -0500 Subject: db-repo-{add, remove}: allow specifying multiple packages This allows invoking these commands for more than one package at a time which is incredibly more efficient as the database doesn't need to be locked, unpacked, modified, changed, and unlocked for every single passed package name or file if you have more than one. Signed-off-by: Dan McGee --- db-remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'db-remove') diff --git a/db-remove b/db-remove index e7326c0..7e2282a 100755 --- a/db-remove +++ b/db-remove @@ -3,8 +3,8 @@ . "$(dirname $0)/db-functions" . "$(dirname $0)/config" -if [ $# -ne 3 ]; then - msg "usage: $(basename $0) " +if [ $# -lt 3 ]; then + msg "usage: $(basename $0) ..." exit 1 fi -- cgit v1.2.3 From 6159269bfbb850b2aed25e335fc5d538a2d4de4f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 5 Nov 2011 16:34:53 +0100 Subject: db-remove: support removing multiple packages at once --- db-remove | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'db-remove') 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 -- cgit v1.2.3