aboutsummaryrefslogtreecommitdiffstats
path: root/approve.sh
diff options
context:
space:
mode:
authorMarcelo Leitner <mrl@mandriva.com>2007-03-22 17:03:17 +0000
committerMarcelo Leitner <mrl@mandriva.com>2007-03-22 17:03:17 +0000
commit1b17b18e8e153e9fdd264b447b785c7892c37a18 (patch)
tree914bb9db8d9b518ff3b00d3de720024ad37624a2 /approve.sh
parenta871fdc2df808ae62a5e2243ca61ea14e6ce341f (diff)
downloadiurt-1b17b18e8e153e9fdd264b447b785c7892c37a18.tar
iurt-1b17b18e8e153e9fdd264b447b785c7892c37a18.tar.gz
iurt-1b17b18e8e153e9fdd264b447b785c7892c37a18.tar.bz2
iurt-1b17b18e8e153e9fdd264b447b785c7892c37a18.tar.xz
iurt-1b17b18e8e153e9fdd264b447b785c7892c37a18.zip
- Added helper script to be ran with emi in order to do manual approvals.
Diffstat (limited to 'approve.sh')
-rwxr-xr-xapprove.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/approve.sh b/approve.sh
new file mode 100755
index 0000000..ce0bf28
--- /dev/null
+++ b/approve.sh
@@ -0,0 +1,94 @@
+#!/bin/bash -e
+
+SRCBASEDIR=/home/mandrake/uploads/queue
+DESTBASEDIR=/home/mandrake/uploads/approved
+REJECTEDDIR=/home/mandrake/uploads/rejected
+DISTRO=cooker
+
+function list() {
+ echo "The following packages are currently queued:" >&2
+ find -L "$SRCBASEDIR/$DISTRO" -name "*.src.rpm" |\
+ sed "s@$SRCBASEDIR/$DISTRO/@@;s@\(.*\)/\([0-9]\+[^_]\+\)@\1 \2 @" |\
+ sort -k2 |\
+ while read media id pkg; do
+ printf "%-15s %s %15s %s\n" "$media" "$id" "$pkg"
+ done
+}
+
+function inspect() {
+ regexp="*.src.rpm"
+ if [ -n "$1" ]; then
+ regexp="*$1*.src.rpm"
+ fi
+ for i in `find -L "$SRCBASEDIR/$DISTRO" -name "$regexp" | sed "s@$SRCBASEDIR/$DISTRO/@@" | sort`; do
+ echo $i
+ rpm -qp --changelog $SRCBASEDIR/$DISTRO/$i | head | sed "s/^/\t/"
+ echo
+ done
+}
+
+function list_approved() {
+ echo "The following packages are currently approved:"
+ find -L "$DESTBASEDIR/$DISTRO" -name "*.src.rpm" |\
+ sed "s@$DESTBASEDIR/$DISTRO/@@;s@\(.*\)/\([0-9]\+[^_]\+\)@\1 \2 @" |\
+ sort -k2 |\
+ while read media id pkg; do
+ printf "%-15s %s %15s %s\n" "$media" "$id" "$pkg"
+ done
+}
+
+function move() {
+ id="$1"
+ dest="$2"
+ queuename=$(basename $dest)
+
+ echo "Searching for packages with id $id..."
+ packages=$(find -L "$SRCBASEDIR/$DISTRO" -name "${id}_*.rpm")
+
+ echo "- Found packages:"
+ for pkg in $packages; do
+ echo -e "\t$pkg" | sed "s@$SRCBASEDIR/$DISTRO/@@;s/${id}_@[0-9]\+://;s/${id}_//"
+ done
+
+ echo "- Moving packages to $queuename..."
+ for srcpath in $packages; do
+ destpath=$(echo "$srcpath" | sed "s@$SRCBASEDIR@$dest@")
+ mv "$srcpath" "$destpath"
+ done
+}
+
+#
+# Parse command line
+#
+if [ -z "$1" ]; then
+ echo "Usage: $(basename $0) --list-queued"
+ 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) --reject <id> [id...]"
+ echo " Where id = 20070315170513.oden.kenobi.7558, for example"
+ exit 1
+fi
+
+if [ "$1" == "--list-queued" ]; then
+ list
+elif [ "$1" == "--inspect" ]; then
+ shift
+ inspect $*
+elif [ "$1" == "--list-approved" ]; then
+ list_approved
+elif [ "$1" == "--approve" ]; then
+ while [ -n "$2" ]; do
+ move "$2" "$DESTBASEDIR"
+ shift
+ done
+elif [ "$1" == "--reject" ]; then
+ while [ -n "$2" ]; do
+ move "$2" "$REJECTEDDIR"
+ shift
+ done
+else
+ echo "Unknow command: $1"
+ exit 1
+fi
+