Bug#51478: dpkg-dev: packages file built from first .deb found rather than latest version of .deb
Package: dpkg-dev
Version: 1.6.1
Severity: normal
The script dpkg-scanpackages from dpkg-dev exhibits a problem if the
hierarchy scanned has multiple versions of the same package in it. If
the "binarydir" has foo.1.deb and foo.2.deb, dpkg-scanpackages just
takes the first one found by "find". Even if it is the older version.
Below is a patch to instead call 'dpkg --compare-versions' and use the
newer of the two .deb files found.
-Steve
--- dpkg-scanpackages Fri Nov 26 14:24:47 1999
+++ /usr/bin/dpkg-scanpackages Sun Nov 28 21:37:53 1999
@@ -2,11 +2,13 @@
$version="1.6"; # This line modified by Makefile
-%kmap= ('optional','suggests',
- 'recommended','recommends',
- 'class','priority',
- 'package_revision','revision');
+# map old keywords to new ones
+%kmap= ('optional' => 'suggests',
+ 'recommended' => 'recommends',
+ 'class' => 'priority',
+ 'package_revision' => 'revision');
+# list of keywords for which we are careful about case
@fieldpri= ('Package',
'Version',
'Priority',
@@ -72,10 +74,19 @@
$p= $tv{'Package'}; delete $tv{'Package'};
if (defined($p1{$p})) {
+ # compare version strings; replace if we found a newer version of
+ # the package
+ `dpkg --compare-versions $tv{'Version'} gt $pv{$p,'Version'}`;
+ if ( $? ) {
print(STDERR " ! Package $p (filename $fn) is repeat;\n".
" ignored that one and using data from $pfilename{$p} !\n")
|| die $!;
next;
+ } else {
+ print(STDERR " ! Package $p (filename $fn) is repeat;\n".
+ " replacing data from $pfilename{$p} !\n")
+ || die $!;
+ }
}
print(STDERR " ! Package $p (filename $fn) has Filename field!\n") || die $!
if defined($tv{'Filename'});
-- System Information
Debian Release: potato
Kernel Version: Linux riemann 2.2.13 #1 Thu Nov 25 01:27:04 EST 1999 i686 unknown
Versions of the packages dpkg-dev depends on:
ii cpio 2.4.2-28 GNU cpio -- a program to manage archives of
ii make 3.78.1-1.1 The GNU version of the "make" utility.
ii patch 2.5-2 Apply a diff file to an original
ii perl-5.004 5.004.05-3 Larry Wall's Practical Extracting and Report
^^^ (Provides virtual package perl5)
Reply to: