[24017] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23626 - trunk/debathena/third/common

daemon@ATHENA.MIT.EDU (Evan Broder)
Sat Mar 14 18:05:54 2009

X-Barracuda-Envelope-From: broder@mit.edu
Date: Sat, 14 Mar 2009 18:05:45 -0400
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200903142205.n2EM5jHa008104@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-03-14 18:05:45 -0400 (Sat, 14 Mar 2009)
New Revision: 23626

Modified:
   trunk/debathena/third/common/debathenificator.sh
Log:
When determining if packages need to be debathenified, escape the
version number so that components aren't treated as regex
metacharacters.


Modified: trunk/debathena/third/common/debathenificator.sh
===================================================================
--- trunk/debathena/third/common/debathenificator.sh	2009-03-14 17:22:14 UTC (rev 23625)
+++ trunk/debathena/third/common/debathenificator.sh	2009-03-14 22:05:45 UTC (rev 23626)
@@ -28,6 +28,10 @@
 schr() { schroot -r -c "$sid" -u root -- "$@"; }  # Run in the chroot as root
 schr apt-get -qq -y update || exit 3
 
+quote() {
+  echo "$1" | sed 's/[^[:alnum:]]/\\&/g'
+}
+
 munge_sections () {
     perl -0pe "s/^Section: /Section: $section\\//gm or die" -i debian/control
 }
@@ -142,9 +146,9 @@
 # Source: header for a package whose name matches its source.
 pkgfiles="$DEBATHENA_APT/dists/$dist/$section/binary-$arch/Packages.gz $DEBATHENA_APT/dists/${dist}-proposed/$section/binary-$arch/Packages.gz"
 if { zcat $pkgfiles | \
-    dpkg-awk -f - "Package:^$name\$" "Version:^$daversion~" -- Architecture;
+    dpkg-awk -f - "Package:^$name\$" "Version:^$(quote "$daversion")~" -- Architecture;
     zcat $pkgfiles | \
-    dpkg-awk -f - "Source:^$name\$" "Version:^$daversion~" -- Architecture; } \
+    dpkg-awk -f - "Source:^$name\$" "Version:^$(quote "$daversion")~" -- Architecture; } \
     | if [ "$a" = "-A" ]; then cat; else fgrep -vx 'Architecture: all'; fi \
     | grep -q .; then
     echo "$name $daversion already exists for $dist_arch." >&2


home help back first fref pref prev next nref lref last post