Package: devscripts
Version: 2.10.35
Severity: wishlist

Hi,

I would like to see the appended patches be applied to getbuildlog.
Thanks.

Bye, Jörg.

-- System Information:
Debian Release: unstable/experimental
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.27-rc3
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to de_DE.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages devscripts depends on:
ii  dpkg-dev                      1.14.20    Debian package development tools
ii  libc6                         2.7-13     GNU C Library: Shared libraries
ii  perl                          5.10.0-12  Larry Wall's Practical Extraction 

Versions of packages devscripts recommends:
pn  at                 <none>                (no description available)
ii  bsd-mailx [mailx]  8.1.2-0.20071201cvs-3 A simple mail user agent
ii  curl               7.18.2-7              Get a file from an HTTP, HTTPS or 
ii  cvs                1:1.12.13-11          Concurrent Versions System
ii  dctrl-tools        2.13.0                Command-line tools to process Debi
ii  debian-keyring     2008.07.22            GnuPG (and obsolete PGP) keys of D
ii  debian-maintainers 1.42                  GPG keys of Debian maintainers
ii  dillo [www-browser 0.8.6-3               Small and fast web browser
ii  dput               0.9.2.32              Debian package upload tool
ii  elinks [www-browse 0.11.4-2              advanced text-mode WWW browser
pn  equivs             <none>                (no description available)
ii  fakeroot           1.9.6                 Gives a fake root environment
ii  git-core           1:1.5.6.3-1           fast, scalable, distributed revisi
ii  gnupg              1.4.9-3               GNU privacy guard - a free PGP rep
ii  iceweasel [www-bro 3.0.1-1               lightweight web browser based on M
pn  libauthen-sasl-per <none>                (no description available)
ii  libcrypt-ssleay-pe 0.57-1+b1             Support for https protocol in LWP
pn  libparse-debcontro <none>                (no description available)
pn  libsoap-lite-perl  <none>                (no description available)
pn  libterm-size-perl  <none>                (no description available)
ii  libtimedate-perl   1.1600-9              Time and date functions for Perl
ii  liburi-perl        1.35.dfsg.1-1         Manipulates and accesses URI strin
ii  libwww-perl        5.813-1               WWW client/server library for Perl
pn  libyaml-syck-perl  <none>                (no description available)
ii  links2 [www-browse 2.1pre37-1.1          Web browser running in both graphi
ii  lintian            1.24.3                Debian package checker
ii  lsb-release        3.2-19                Linux Standard Base version report
ii  lynx-cur [www-brow 2.8.7dev9-1.2         Text-mode WWW Browser with NLS sup
ii  mailx              1:20071201-3          Transitional package for mailx ren
ii  man-db             2.5.2-2               on-line manual pager
ii  netsurf [www-brows 1.2-1                 Small portable web browser with CS
ii  openssh-client [ss 1:5.1p1-2             secure shell client, an rlogin/rsh
ii  patch              2.5.9-5               Apply a diff file to an original
ii  patchutils         0.2.31-4              Utilities to work with patches
ii  strace             4.5.17+cvs080723-2    A system call tracer
ii  subversion         1.5.1dfsg1-1          Advanced version control system
ii  unzip              5.52-12               De-archiver for .zip files
ii  w3m [www-browser]  0.5.2-2+b1            WWW browsable pager with excellent
ii  wdiff              0.5-18                Compares two files word by word
ii  wget               1.11.4-1              retrieves files from the web

Versions of packages devscripts suggests:
ii  build-essential               11.4       Informational list of build-essent
pn  cvs-buildpackage              <none>     (no description available)
pn  devscripts-el                 <none>     (no description available)
ii  gnuplot                       4.2.3-1    A command-line driven interactive 
pn  libfile-desktopentry-perl     <none>     (no description available)
pn  libnet-smtp-ssl-perl          <none>     (no description available)
ii  mutt                          1.5.18-4   text-based mailreader supporting M
pn  svn-buildpackage              <none>     (no description available)

-- no debconf information
From 665ef7f0211de7b83a38f86d746da51793496e77 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= <[EMAIL PROTECTED]>
Date: Thu, 21 Aug 2008 11:22:26 +0200
Subject: [PATCH 1/5] Improve variable assignment

The variable expansion ${X:-Y} means expand $X if $X is set and not
empty, else expand Y. This is exactly what the former expression did.
---
 getbuildlog |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/getbuildlog b/getbuildlog
index 59768e9..daa0910 100755
--- a/getbuildlog
+++ b/getbuildlog
@@ -65,8 +65,8 @@ if [ ! -x "`which wget 2>/dev/null`" ]; then
 fi
 
 PACKAGE=$1
-VERSION=`(test -z "$2" && echo "[:~+.[:alnum:]-]+") || echo "$2"`
-ARCH=`(test -z "$3" && echo "[[:alnum:]-]+") || echo "$3"`
+VERSION=${2:-[:~+.[:alnum:]-]+}
+ARCH=${3:-[[:alnum:]-]+}
 ESCAPED_PACKAGE=`echo "$PACKAGE" | sed -e 's/\+/\\\+/g'`
 
 PATTERN="fetch\.(cgi|php)\?&pkg=$ESCAPED_PACKAGE&ver=$VERSION&arch=$ARCH&\
-- 
1.5.6.3

From 99a03bc528ed4ade5631e39d02b11bd7c74ea630 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= <[EMAIL PROTECTED]>
Date: Thu, 21 Aug 2008 11:34:48 +0200
Subject: [PATCH 2/5] Replace string operations by shell expressions
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

The task to extract these fields from the string can be done with shell
utils which saves pipes, forkes, …
---
 getbuildlog |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/getbuildlog b/getbuildlog
index daa0910..7b4a781 100755
--- a/getbuildlog
+++ b/getbuildlog
@@ -85,8 +85,10 @@ getbuildlog() {
     sed -i -e "s/%2B/\+/g" -e "s/%3A/:/g" $ALL_LOGS
 
     for match in `grep -E -o "$PATTERN" $ALL_LOGS`; do
-        ver=`echo $match | cut -d'&' -f3 | cut -d'=' -f2`
-        arch=`echo $match | cut -d'&' -f4 | cut -d'=' -f2`
+        ver=${match##*ver=}
+        ver=${ver%%&*}
+        arch=${match##*arch=}
+        arch=${arch%%&*}
 	match=`echo $match | sed -e 's/\+/%2B/g'`
         wget -O "${PACKAGE}_${ver}_${arch}.log" "$BASE/$match&file=log"
     done
-- 
1.5.6.3

From ede448c20122ba776ea7b68db7cff44efc0131de Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= <[EMAIL PROTECTED]>
Date: Thu, 21 Aug 2008 14:43:01 +0200
Subject: [PATCH 3/5] Print a warning if downloading a log a second time

Some packages were built by more than one buildd. Tell the user about it.

Example:
http://buildd.debian-ports.org/fetch.php?&pkg=slrn&ver=0.9.8.1pl1-28&arch=armel
http://experimental.debian.net/fetch.php?&pkg=slrn&ver=0.9.8.1pl1-28&arch=armel
---
 getbuildlog |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/getbuildlog b/getbuildlog
index 7b4a781..fc70317 100755
--- a/getbuildlog
+++ b/getbuildlog
@@ -90,6 +90,9 @@ getbuildlog() {
         arch=${match##*arch=}
         arch=${arch%%&*}
 	match=`echo $match | sed -e 's/\+/%2B/g'`
+        if [ -e "${PACKAGE}_${ver}_${arch}.log" ]; then
+            echo "Found ${PACKAGE}_${ver}_${arch}.log a second time on $BASE"
+        fi
         wget -O "${PACKAGE}_${ver}_${arch}.log" "$BASE/$match&file=log"
     done
 
-- 
1.5.6.3

From 2138b8ce9337f85087ded3922cdcc68c7d03319f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= <[EMAIL PROTECTED]>
Date: Thu, 21 Aug 2008 14:46:27 +0200
Subject: [PATCH 4/5] Replace %7E by ~ in URLs

---
 getbuildlog |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/getbuildlog b/getbuildlog
index fc70317..d1e7508 100755
--- a/getbuildlog
+++ b/getbuildlog
@@ -82,7 +82,7 @@ getbuildlog() {
     # matches only one href. This is required because grep is greedy.
     sed -i -e "s/href=\"/\nhref=\"/g" $ALL_LOGS
     # Quick-and-dirty unescaping
-    sed -i -e "s/%2B/\+/g" -e "s/%3A/:/g" $ALL_LOGS
+    sed -i -e "s/%2B/\+/g" -e "s/%3A/:/g" -e "s/%7E/~/g" $ALL_LOGS
 
     for match in `grep -E -o "$PATTERN" $ALL_LOGS`; do
         ver=${match##*ver=}
-- 
1.5.6.3

From 95031a64e3d5b0894a91b299ba47c7b95ed3fcbd Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=B6rg=20Sommer?= <[EMAIL PROTECTED]>
Date: Thu, 21 Aug 2008 14:50:43 +0200
Subject: [PATCH 5/5] Fetch only last version if version parameter is last

It's much more handy, especially in scripts, to fetch only the last
version without having to know the version number.
---
 getbuildlog   |   17 +++++++++++++++--
 getbuildlog.1 |    4 +++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/getbuildlog b/getbuildlog
index d1e7508..a005ad8 100755
--- a/getbuildlog
+++ b/getbuildlog
@@ -28,7 +28,8 @@ Usage: $PROGNAME <package> [<version-pattern>] [<architecture-pattern>]
   Downloads build logs of <package> from Debian auto-builders.
   If <version-pattern> or <architecture-pattern> are given, only build logs
   whose versions and architectures, respectively, matches the given patterns
-  are downloaded.
+  are downloaded. If <version-pattern> is last, only download the build logs
+  of the last version.
 Options:
   -h, --help        Show this help message.
   -V, --version     Show version and copyright information.
@@ -69,6 +70,13 @@ VERSION=${2:-[:~+.[:alnum:]-]+}
 ARCH=${3:-[[:alnum:]-]+}
 ESCAPED_PACKAGE=`echo "$PACKAGE" | sed -e 's/\+/\\\+/g'`
 
+if [ "$VERSION" = last ]; then
+    GET_ONLY_LAST_VERSION=true
+    VERSION='[:~+.[:alnum:]-]+'
+else
+    GET_ONLY_LAST_VERSION=false
+fi
+
 PATTERN="fetch\.(cgi|php)\?&pkg=$ESCAPED_PACKAGE&ver=$VERSION&arch=$ARCH&\
 stamp=[[:digit:]]+"
 
@@ -84,9 +92,14 @@ getbuildlog() {
     # Quick-and-dirty unescaping
     sed -i -e "s/%2B/\+/g" -e "s/%3A/:/g" -e "s/%7E/~/g" $ALL_LOGS
 
-    for match in `grep -E -o "$PATTERN" $ALL_LOGS`; do
+    last_ver=
+    for match in `grep -E -o "$PATTERN" $ALL_LOGS | tac`; do
         ver=${match##*ver=}
         ver=${ver%%&*}
+        if $GET_ONLY_LAST_VERSION && [ "${last_ver:-$ver}" != "$ver" ]; then
+            break
+        fi
+        last_ver=$ver
         arch=${match##*arch=}
         arch=${arch%%&*}
 	match=`echo $match | sed -e 's/\+/%2B/g'`
diff --git a/getbuildlog.1 b/getbuildlog.1
index 9861332..0376600 100644
--- a/getbuildlog.1
+++ b/getbuildlog.1
@@ -11,7 +11,9 @@ auto\-builders. It downloads build logs of all versions and for all
 architectures if \fIversion\-pattern\fR and \fIarchitecture\-pattern\fR are
 not specified or empty, otherwise only build logs whose versions match
 \fIversion-pattern\fR and build logs whose architectures match
-\fIarchitecture-pattern\fR will be downloaded. The version and architecture
+\fIarchitecture-pattern\fR will be downloaded. If \fIversion\-pattern\fP is
+last, only download the build logs of the last version. The version and
+architecture
 patterns are interpreted as extended regular expressions as described in
 \fBgrep\fR(1).
 .SH OPTIONS
-- 
1.5.6.3

Attachment: signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP

Reply via email to