diff options
Diffstat (limited to 'approve.sh')
-rwxr-xr-x | approve.sh | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -1,9 +1,12 @@ #!/bin/bash -e +# Do not use trailing slashes here SRCBASEDIR=/home/mandrake/uploads/queue DESTBASEDIR=/home/mandrake/uploads/approved REJECTEDDIR=/home/mandrake/uploads/rejected +LATERBASEDIR=/home/mandrake/uploads/later DISTRO=cooker +UPDATEDISTRO="2007.1" function list() { echo "The following packages are currently queued:" >&2 @@ -37,9 +40,13 @@ function list_approved() { done } +# $1 = id = package id +# $2 = dest = destination queue +# $3 = media = forced distro/media, like "2007.1/updates/release/" function move() { id="$1" dest="$2" + media="$3" queuename=$(basename $dest) echo "Searching for packages with id $id..." @@ -50,11 +57,15 @@ function move() { echo -e "\t$pkg" | sed "s@$SRCBASEDIR/$DISTRO/@@;s/${id}_@[0-9]\+://;s/${id}_//" done - echo "- Moving packages to $queuename..." + echo -n "- Moving packages to $queuename... " for srcpath in $packages; do destpath=$(echo "$srcpath" | sed "s@$SRCBASEDIR@$dest@") + if [ -n "$media" ]; then + destpath=$(echo "$destpath" | sed "s@\($dest\)/\(\([^/]\+/\)\{3\}\)@\1/$media@") + fi mv "$srcpath" "$destpath" done + echo "done." } # @@ -65,6 +76,8 @@ if [ -z "$1" ]; then echo -e "Usage: $(basename $0) --inspect [id]\n to inspect packages changelog" echo "Usage: $(basename $0) --list-approved" echo "Usage: $(basename $0) --approve <id> [id...]" + echo "Usage: $(basename $0) --updates <id> [id...]" + echo "Usage: $(basename $0) --later <id> [id...]" echo "Usage: $(basename $0) --reject <id> [id...]" echo " Where id = 20070315170513.oden.kenobi.7558, for example" exit 1 @@ -82,6 +95,16 @@ elif [ "$1" == "--approve" ]; then move "$2" "$DESTBASEDIR" shift done +elif [ "$1" == "--updates" ]; then + while [ -n "$2" ]; do + move "$2" "$DESTBASEDIR" "$UPDATEDISTRO/updates/release/" + shift + done +elif [ "$1" == "--later" ]; then + while [ -n "$2" ]; do + move "$2" "$LATERBASEDIR" + shift + done elif [ "$1" == "--reject" ]; then while [ -n "$2" ]; do move "$2" "$REJECTEDDIR" |