The following commit has been merged in the master branch:
commit c1570aca027b570030667d40570ab4feff7c0bac
Author: Cyril Brulebois <[email protected]>
Date:   Sun Jul 29 19:00:52 2012 +0200

    getbuildlog: Stop clobbering when downloading multiple logs.
    
    When several build logs are available, save all of them instead of
    downloading them all but only keeping the oldest.
    
    Signed-off-by: James McCoy <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index c56432b..97fe43b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,10 @@ devscripts (2.12.2) UNRELEASED; urgency=low
   * licensecheck.1: Consistency fix.
   * French translation update.
 
+  [ Cyril Brulebois ]
+  * getbuildlog: When several build logs are available, save all of them
+    instead of downloading them all but only keeping the oldest.
+
  -- Benjamin Drung <[email protected]>  Thu, 26 Jul 2012 12:17:51 +0200
 
 devscripts (2.12.1) unstable; urgency=low
diff --git a/scripts/getbuildlog.sh b/scripts/getbuildlog.sh
index 92a50a4..b9b7a35 100755
--- a/scripts/getbuildlog.sh
+++ b/scripts/getbuildlog.sh
@@ -128,7 +128,17 @@ arch=$ARCH&ver=$LASTVERSION&stamp=[[:digit:]]+"
        arch=${match##*arch=}
        arch=${arch%%&*}
        match=`echo $match | sed -e 's/\+/%2B/g'`
-        wget -O "${PACKAGE}_${ver}_${arch}.log" "$BASE/status/$match&raw=1"
+       # Mimick wget's behaviour, using a numerical suffix if needed,
+       # to support downloading several logs for a given tuple
+       # (unfortunately, -nc and -O means only the first file gets
+       # downloaded):
+       filename="${PACKAGE}_${ver}_${arch}.log"
+       if [ -f "$filename" ]; then
+           suffix=1
+           while [ -f "$filename.$suffix" ]; do suffix=$((suffix+1)); done
+           filename="$filename.$suffix"
+       fi
+       wget -O "$filename" "$BASE/status/$match&raw=1"
     done
 
     rm -f $ALL_LOGS

-- 
Git repository for devscripts

_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to