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

installer/build: get-packages grabs outdated udebs



Hello,

The get-packages script uses "sort | tail -1" to get the most recent
version of a given udeb from apt.udeb/cache.

The attached patch makes it use dpkg --compare-versions instead.

-- 
Jeremie Koenig <jk@jk.fr.eu.org>
http://jk.fr.eu.org
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 63446)
+++ debian/changelog	(working copy)
@@ -69,8 +69,11 @@
   [ Otavio Salvador ]
   * Move hppa, ia64, powerpc and s390 to linux 2.6.32 (ABI 5).
 
- -- Christian Perrier <bubulle@debian.org>  Sun, 14 Feb 2010 17:06:27 +0100
+  [ Jeremie Koenig ]
+  * util/get-packages: fix selection of the most recent packages.
 
+ -- Jeremie Koenig <jk@jk.fr.eu.org>  Thu, 17 Jun 2010 17:01:14 +0200
+
 debian-installer (20100211) unstable; urgency=low
 
   [ Frans Pop ]
Index: build/util/get-packages
===================================================================
--- build/util/get-packages	(revision 63446)
+++ build/util/get-packages	(working copy)
@@ -186,7 +186,13 @@
 
 lnpkg() {
 	local pkg=$1; local dir=$2 debdir=$3
-	local L="`find $dir -name "${pkg}_*" 2>/dev/null | sort | tail -n 1`"
+	local L LV l lv
+	for l in `find $dir -name "${pkg}_*" 2>/dev/null`; do
+		lv=${l%_*}; lv=${lv##*_};
+		if dpkg --compare-versions "$lv" gt "$LV"; then
+			L=$l LV=$lv
+		fi
+	done
 	if [ -e "$L" ]; then
 		ln -f $L $debdir/$pkg.$TYPE
 	fi

Reply to: