-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 06/30/2011 11:17 AM, Raphael Hertzog wrote:
> On Thu, 30 Jun 2011, Stéphane Graber wrote:
>> if ($generate{keep}) { -         my $target =
>> "$DPKG/info/$pack.md5sums"; -            copy $sums, $target -               
>> or die
>> "$self: can't copy sums to $target ($!)\n"; +            @sumfiles =
>> glob("$DPKG/info/$pack.md5sums $DPKG/info/$pack:*.md5sums"); +
>> foreach(@sumfiles) { +                   copy $sums, $_ +                    
>> or die "$self: can't
>> copy sums to $_ ($!)\n"; +       }
> 
> This looks entirely wrong. debsums generate a md5sums when the
> package doesn't provide a md5sums files... so the glob can't return
> anything.
> 
> And it's this part that I suggested to get rid of entirely, because 
> you're not qualified to know whether it should be "$p.md5sums or 
> "$p:$arch.md5sums". Ideally you should store those in a debsums
> specific directory and use "$p:$arch" unconditionnaly.
> 
> Cheers,

Attached is yet another patch that this time tries to bypass the md5sums
generation if an arch-specific md5sums file already exists.


- -- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCgAGBQJODFeaAAoJEMY4l01keS1nsJAQAI9ybaAtcAj+OnpjIz4sOlD7
MmnpADHxzlV8YGoRskR2kaLVXuwt52/oq0yXk2ZhA+xkx4m2zO5jEHcSKRvr0CtQ
ned+HLYkS1Q77cBZmVYE0BAF19Tv39dNL6dGHpwHpheZU53CtdKWYp445opuQNcx
JM8ql8WapXjkbbYnWDyQrN60DCAxF7kgAJFCOmsxFDPrgCDTRXyQEpwN1XkHU4od
IIqqFGZkrhsrcHC6vbEKAKIvQkPcKdzbB50VDod8e4+q/A2rlg7kKNxxi95QMlDy
kJHjVERy19AMB1ZufZd3EBdeBTf51Jeq0pv6W+4DoWcxBUx/dqZ2qmcM/Oj8T5cW
d2tNQ0EYgAsKVngBbl1DiNh7y7eZx7WNoNcs1hsEisl69WoYMqmLsniuMN6nyb3R
VtK8D13CwL5vq0wLXuqnELUfc99gilSLITqoNpu3p59xL9WrIgfQ3nH2wpDLcZnD
ZsKikPS0gCX4WKQfjcWPZhSk909DPfrySO8BiUQ4ubdf8bXGN+1Ft8k6crMHihzE
wNoA6hIz+AfCg9idhEmT4i2GVRc2xzvGWCg7NsPCRYUVOXHYERSZmuymGAOzaBIu
XTbXLY3EQoguzPIAk7qA9ySLqdnREOLBub9Sotnb6BBq0C7ukxqxpfO2LEsHoOuA
OsfJHV6NFnoWVyGunDD1
=V+2T
-----END PGP SIGNATURE-----
=== modified file 'debsums'
--- debsums	2010-11-17 17:16:07 +0000
+++ debsums	2011-06-30 10:48:13 +0000
@@ -257,6 +257,7 @@
 sub is_replaced
 {
     my ($pack, $path, $sum) = @_;
+    my @sumfiles;
 
     unless ($installed{$pack}{ReplacedBy})
     {
@@ -273,14 +274,17 @@
 
     for my $p (@{$installed{$pack}{ReplacedBy} || []})
     {
-	open S, "$DPKG/info/$p.md5sums" or next;
-	while (<S>)
-	{
-	    if ($_ eq "$sum  $path\n")
-	    {
-		close S;
-		return 1;
-	    }
+	@sumfiles = glob("$DPKG/info/$p.md5sums $DPKG/info/$p:*.md5sums");
+	foreach(@sumfiles) {
+		open S, $_ or next;
+		while (<S>)
+		{
+		    if ($_ eq "$sum  $path\n")
+		    {
+			close S;
+			return 1;
+		    }
+		}
 	}
 
 	close S;
@@ -412,6 +416,7 @@
     my $sums;
     my $pack;
     my $conffiles;
+    my @sumfiles;
 
     # looks like a package name
     unless (/[^a-z\d+.-]/ or /\.deb$/)
@@ -460,31 +465,34 @@
 	}
 	else
 	{
-	    $sums = "$DPKG/info/$pack.md5sums";
-	    unless (-f $sums or $config)
-	    {
-		if ($missing)
-		{
-		    print "$pack\n";
-		    next;
-		}
-
-		unless ($generate{missing})
-		{
-		    warn "$self: no md5sums for $pack\n";
-		    next;
-		}
-
-		unless ($deb)
-		{
-		    warn "$self: no md5sums for $pack and no deb available\n"
-			unless $generate{nocheck} and $silent;
-
-		    next;
-		}
-
-		undef $sums;
-		$_ = $deb;
+	    @sumfiles = glob("$DPKG/info/$pack.md5sums $DPKG/info/$pack:*.md5sums");
+	    foreach(@sumfiles) {
+		    $sums = $_;
+		    unless (-f $sums or $config)
+		    {
+			if ($missing)
+			{
+			    print "$pack\n";
+			    next;
+			}
+
+			unless ($generate{missing})
+			{
+			    warn "$self: no md5sums for $pack\n";
+			    next;
+			}
+
+			unless ($deb)
+			{
+			    warn "$self: no md5sums for $pack and no deb available\n"
+				unless $generate{nocheck} and $silent;
+
+			    next;
+			}
+
+			undef $sums;
+			$_ = $deb;
+		    }
 	    }
 	}
 
@@ -585,7 +593,8 @@
 	    close F;
 	}
 
-	if (!-s $sums)
+	my @sumfiles = glob("$DPKG/info/$pack:*.md5sums");
+	if (!-s $sums && scalar(@sumfiles) == 0)
 	{
 	    my $unpacked = "$tmp/$pack";
 	    print "Generating missing md5sums for $deb..." unless $silent;

Attachment: debsums-glob.diff.sig
Description: Binary data

Reply via email to