Bug#550584: Initial triggers patch and tracking of highest kernel
On Wed, Mar 09, 2011, Steve McIntyre wrote:
> Neither do I *for definite*, but I know that other tools that rely on
> kernel ABI have been thrown by the sort order of "trunk" vs "1", "2",
> etc. so I'm raising it early in case it matters.
My first reaction was that it was basically the problem of the people
using this name in the first place, but then I figured that if
flash-kernel just did what grub does, nobody would complain. Turns out
grub seems to have special casing for trunk!
it uses version_find_latest() below which calls version_test_gt(),
sounds like exactly what we need, and version_test_gt() starts by
transforming trunk versions to use ~.
version_test_gt ()
{
local sedexp="s/[^-]*-//;s/[._-]\(pre\|rc\|test\|git\|old\|trunk\)/~\1/g"
local a=`echo $1 | sed -e "$sedexp"`
local b=`echo $2 | sed -e "$sedexp"`
local cmp=gt
if [ "x$b" = "x" ] ; then
return 0
fi
case $a:$b in
*.old:*.old) ;;
*.old:*) a=`echo -n $a | sed -e s/\.old$//` ; cmp=gt ;;
*:*.old) b=`echo -n $b | sed -e s/\.old$//` ; cmp=ge ;;
esac
dpkg --compare-versions "$a" $cmp "$b"
return $?
}
version_find_latest ()
{
local a=""
for i in $@ ; do
if version_test_gt "$i" "$a" ; then
a="$i"
fi
done
echo "$a"
}
--
Loïc Minier
Reply to: