[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Pass suite name to the autobyhand scripts



We have it readily available, and most scripts try to get it back from
the changes file anyway.

This makes things consistent for the scripts, so they won't get confused
by aliases (due to codenames or suite mappings) depending on whatever is
in the .changes file.

Signed-off-by: Julien Cristau <jcristau@debian.org>
---
This is also available at git://anonscm.debian.org/users/jcristau/dak autobyhand-suite

 daklib/archive.py                  |  2 +-
 scripts/debian/byhand-debian-faq   |  6 +++---
 scripts/debian/byhand-di           | 11 +++--------
 scripts/debian/byhand-task         | 11 +++--------
 scripts/debian/byhand-win32-loader | 14 ++++----------
 5 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/daklib/archive.py b/daklib/archive.py
index 7dd1822..4226ce9 100644
--- a/daklib/archive.py
+++ b/daklib/archive.py
@@ -1170,7 +1170,7 @@ class ArchiveUpload(object):
                 continue
 
             script = rule['Script']
-            retcode = daklib.daksubprocess.call([script, os.path.join(self.directory, f.filename), control['Version'], arch, os.path.join(self.directory, self.changes.filename)], shell=False)
+            retcode = daklib.daksubprocess.call([script, os.path.join(self.directory, f.filename), control['Version'], arch, os.path.join(self.directory, self.changes.filename), suite.suite_name], shell=False)
             if retcode != 0:
                 print "W: error processing {0}.".format(f.filename)
                 remaining.append(f)
diff --git a/scripts/debian/byhand-debian-faq b/scripts/debian/byhand-debian-faq
index b436dc7..e87f02c 100755
--- a/scripts/debian/byhand-debian-faq
+++ b/scripts/debian/byhand-debian-faq
@@ -28,8 +28,8 @@ export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
 
 scriptname=byhand-debian-faq
 
-if [ $# -lt 4 ]; then
-    echo "usage: ${scriptname} <byhand-file> <version> <arch> <changes-file>" >&2
+if [ $# -lt 5 ]; then
+    echo "usage: ${scriptname} <byhand-file> <version> <arch> <changes-file> <suite>" >&2
     exit 1
 fi
 
@@ -38,8 +38,8 @@ byhand_file="${byhand_path##*/}"
 version="${2}"
 architecture="${3}"
 changes="${4}"
+suite="${5}"
 
-suite="$(awk '/^Distribution:/ { print $2 }' < "${changes}")"
 case "${suite}" in
     unstable|sid)
         : # okay
diff --git a/scripts/debian/byhand-di b/scripts/debian/byhand-di
index 783c2b9..c4a747c 100755
--- a/scripts/debian/byhand-di
+++ b/scripts/debian/byhand-di
@@ -4,8 +4,8 @@ set -u
 set -e
 set -o pipefail
 
-if [ $# -lt 4 ]; then
-	echo "Usage: $0 filename version arch changes_file"
+if [ $# -lt 5 ]; then
+	echo "Usage: $0 filename version arch changes_file suite"
 	exit 1
 fi
 
@@ -13,6 +13,7 @@ TARBALL="$1"	# Tarball to read, compressed with gzip
 VERSION="$2"
 ARCH="$3"
 CHANGES="$4"	# Changes file for the upload
+SUITE="$5"
 
 error() {
 	echo "$*"
@@ -26,13 +27,7 @@ if ! echo "$VERSION" | grep -Eq "^[0-9]{8}((\.|\+?[a-z]+|\+deb[0-9]+u|\+kbsd[0-9
 	error "Invalid version: '$VERSION'"
 fi
 
-# Get the target suite from the Changes file
-# NOTE: it may be better to pass this to the script as a parameter!
-SUITE="$(grep "^Distribution:" "$CHANGES" | awk '{print $2}')"
 case $SUITE in
-    "")
-	error "Error: unable to determine suite from Changes file"
-	;;
     unstable|sid|*-proposed-updates)
 	: # nothing to do
 	;;
diff --git a/scripts/debian/byhand-task b/scripts/debian/byhand-task
index 1fcccc0..41f863c 100755
--- a/scripts/debian/byhand-task
+++ b/scripts/debian/byhand-task
@@ -4,8 +4,8 @@ set -u
 set -e
 set -o pipefail
 
-if [ $# -lt 4 ]; then
-        echo "Usage: $0 filename version arch changes_file"
+if [ $# -lt 5 ]; then
+        echo "Usage: $0 filename version arch changes_file suite"
         exit 1
 fi
 
@@ -16,19 +16,14 @@ INPUT="$1"      # Tarball to read, compressed with gzip
 VERSION="$2"
 ARCH="$3"
 CHANGES="$4"    # Changes file for the upload
+SUITE="$5"
 
 error() {
         echo "$*"
         exit 1
 }
 
-# Get the target suite from the Changes file
-# NOTE: it may be better to pass this to the script as a parameter!
-SUITE="$(grep "^Distribution:" "$CHANGES" | awk '{print $2}')"
 case $SUITE in
-    "")
-        error "Error: unable to determine suite from Changes file"
-        ;;
     unstable|sid)
         : # OK for automated byband processing
         ;;
diff --git a/scripts/debian/byhand-win32-loader b/scripts/debian/byhand-win32-loader
index 3afc8d5..ea4a1f9 100755
--- a/scripts/debian/byhand-win32-loader
+++ b/scripts/debian/byhand-win32-loader
@@ -3,8 +3,8 @@
 set -u
 set -e
 
-if [ $# -lt 4 ]; then
-	echo "Usage: $0 filename version arch changes_file"
+if [ $# -lt 5 ]; then
+	echo "Usage: $0 filename version arch changes_file suite"
 	exit 1
 fi
 
@@ -16,16 +16,10 @@ WIN32_LOADER_FILE="${WIN32_LOADER_PATH##*/}"
 VERSION="$2"
 ARCH="$3"
 CHANGES="$4"	# Changes file for the upload
+SUITE="$5"
 
-# Get the target suite from the Changes file
-# NOTE: it may be better to pass this to the script as a parameter!
-SUITE="$(grep "^Distribution:" "$CHANGES" | awk '{print $2}')"
 case $SUITE in
-    "")
-	    echo "Error: unable to determine suite from Changes file"
-        exit 1
-	    ;;
-    unstable|sid)
+    unstable|sid|*-proposed-updates)
 	    : # nothing to do
 	    ;;
     *)
-- 
2.6.2


Reply to: