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

Bug#770394: initramfs-tools: Sorting rc versions



Control: tags -1 patch

On Thu, 20 Nov 2014 23:43:59 +0000 Ben Hutchings <ben@decadent.org.uk> wrote:
> Control: severity -1 normal
>
> On Thu, 2014-11-20 at 23:47 +0100, Javier Barroso wrote:
> > Package: initramfs-tools
> > Version: 0.118
> > Severity: wishlist
> >
> > Dear Maintainer,
> >
> >
> >    * What led up to the situation?
> > Running update-initramfs -u did not choose the latest installed kernel
> > version.
> >
> > dpkg --compare-versions doesn't play well with current kernel version
> > scheme
> >
> >    * What exactly did you do (or not do) that was effective (or
> >      ineffective)?
> > Run update-initramfs -u
> >
> >    * What was the outcome of this action?
> > update-initramfs chose 3.16-rc5-amd64
> >
> >    * What outcome did you expect instead?
> > update-initramfs would chosen 3.16-3-amd64 version
> >
> > I'm attaching a possible patch. Maybe changing version scheme to -0-rc
> > would be more dpkg compatible behaviour, so this patch is not needed.
> >
> > I don't think that teaching dpkg --compare-version about this issue is a
> > better solution. (I think dpkg maintainers would complaint about)
> [...]
>
> It should really use the linux-version command from linux-base.  Thanks
> for pointing this out.
I didn't know about linux-version tool, the patch is even more simple
then. I'm attaching the new version.

Thank you very much
--- update-initramfs.orig	2014-11-21 19:30:46.984389934 +0100
+++ update-initramfs	2014-11-21 22:47:39.899996974 +0100
@@ -228,27 +228,8 @@
 
 get_sorted_versions()
 {
-	version_list=""
 
-	for gsv_x in "${STATEDIR}"/*; do
-		gsv_x="$(basename "${gsv_x}")"
-		if [ "${gsv_x}" = '*' ]; then
-			return 0
-		fi
-		worklist=""
-		for gsv_i in $version_list; do
-			if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}" 2>/dev/null; then
-				worklist="${worklist} ${gsv_x} ${gsv_i}"
-				gsv_x=""
-			else
-				worklist="${worklist} ${gsv_i}"
-			fi
-		done
-		if [ "${gsv_x}" != "" ]; then
-			worklist="${worklist} ${gsv_x}"
-		fi
-		version_list="${worklist}"
-	done
+	version_list="$(linux-version sort --reverse $(linux-version list))"
 
 	verbose "Available versions: ${version_list}"
 }

Reply to: