From 5aa096a7f107e2d59f963dea6dcb77355b015960 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Sun, 10 Sep 2000 21:40:30 +0000 Subject: [PATCH] scripts/dpkg-scanpackages.pl: modify to use most recent version of a package of multiple versions are found --- ChangeLog | 5 +++++ scripts/dpkg-scanpackages.pl | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8367055..02a10f66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Sep 10 23:31:02 CEST 2000 Wichert Akkerman + + * scripts/dpkg-scanpackages.pl: modify to use most recent version + of a package of multiple versions are found + Sat Sep 9 21:17:37 CEST 2000 Wichert Akkerman * debian/control: add dependency on binutils for dpkg-dev (needed for diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index 853c7d5d..56bb37f4 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/scripts/dpkg-scanpackages.pl @@ -35,6 +35,14 @@ $#ARGV == 1 || $#ARGV == 2 -d $binarydir or die "Binary dir $binarydir not found\n"; -e $override or die "Override file $override not found\n"; +sub vercmp { + ($a,$b)=@_; + return $vercache{$a,$b} if defined($varcache{$a,$b}); + system("dpkg --compare-versions $a le $b"); + $varcache{$a,$a}=$?; + return $?; +} + # The extra slash causes symlinks to be followed. open(F,"find $binarydir/ -follow -name '*.deb' -print |") or die "Couldn't open pipe to find: $!\n"; @@ -72,10 +80,20 @@ while () { $p= $tv{'Package'}; delete $tv{'Package'}; if (defined($p1{$p})) { - print(STDERR " ! Package $p (filename $fn) is repeat;\n". - " ignored that one and using data from $pfilename{$p} !\n") - || die $!; - next; + if (&vercmp($tv{'Version'}, $pv{$p,'Version'})) { + print(STDERR " ! Package $p (filename $fn) is repeat but newer version;\n". + " used that one and ignored data from $pfilename{$p} !\n") + || die $!; + delete $p1{$p}; + for $k (keys %k1) { + delete $pv{$p,$k}; + } + } else { + print(STDERR " ! Package $p (filename $fn) is repeat;\n". + " ignored that one and using data from $pfilename{$p} !\n") + || die $!; + next; + } } print(STDERR " ! Package $p (filename $fn) has Filename field!\n") || die $! if defined($tv{'Filename'}); -- 2.39.5