-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 06/30/2011 08:02 AM, Raphael Hertzog wrote: > On Thu, 30 Jun 2011, Anders Kaseorg wrote: >> $ time for p in $(dpkg-query -W -f='${PackageSpec} '); do \ >> dpkg-query --control-path "$p" md5sums; done >/dev/null >> >> real 2m34.050s user 2m8.480s sys 0m19.140s > > Hum, ok. > >> That accounts for basically all of the time the debsums hook is now >> using. Besides, it’s the only thing that Stéphane’s patch changed. > > Then I can only suggest to keep a cache to avoid doing it for all > installed package every time. > > Or to work with us to integrate it in dpkg proper. :) > > Cheers,
Ok, so in the mean time, I worked on a dirty workaround that "should" work in most cases for debsums and be almost as fast as the old code. I essentially replaced all the old direct lookup at .md5sums by a glob call that'll return all the existing md5sums files for the package and fail only if the checksum can't be found in any of them. It's definitely not "right" and not what debsums should be doing but in my opinion it's better than the old behavior (no multiarch support whatsoever) and better than my former implementation as it's actually usable. As I think I already mentioned, I'm really not a perl coder. The attached patch doesn't crash for me when I run "debsums -sa" and the output seems to indeed match the state of my system. I'd think debsums will need some major work to play nicely with dpkg and not hardcode most of the paths but it's not something I have time to do (or knowledge). I'll have a few people to look at the patch and if it seems sane enough, will upload it at least in Ubuntu so our current users who have debsums installed don't have to wait 5 minutes every-time they call apt. - -- 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/ iQIcBAEBCgAGBQJODEk6AAoJEMY4l01keS1nW9sQANK1lSNWGypH7HcjyFhJE7kB b3/VDjcaW3imPpFgRxzTLLdtdb4iZB8mTv39dUhQ0cawMNhMy/qeJF6E7+o7uLLE Bo/pVZ0m31+PYTgyBmrmdJNnK5Cq/XqBfY3M52XgGFb51y8/LLSanYtvb1Ptp1Cv r13sy9exgrMrbpJgMxCZZ0DmGMSPDP2B0a57MuJLoOuutdDf+MHFXDJq1QvLIlZX KeU57a6PTgJ1eTxRa+jdL913iHfYnCACVSXwWGY3+VGhCcIrslLHTcZNmSLkS7gV SzNspkWRBuEe00FKwM3380OaNNZe0M8mUAHlI7F/0r7V4+Zuxtu5HsYg018ijjwr PsiJZnykbYQPBcDt0hfaVKlA7Ey59ELqcNuKlGomgU/mSDlffN5ak9S7o6oribbK G12/Hf4jxZ01nsBs0O305VrLu+GWwTuaI1pjTPt9osaURYyQ8GZuimqKzJcHznD+ acDm06t0m53PtJ6Pev4sI8JtiAPG2Mk1JSUYq8UuKOa9rFpLCDcIW7J3P63F3mDC cTfa9VmCRFSCIxf61691MQlvvajnLN/Zf09CYkg2E+imYjYl+dQArRCFBw5A4oQB VobSKaX7WOWFs12FG164M7H//jydRAjIjNC/GCfk9VlkIPJtV1t+QBQLgaRt1izn ehrZB1ClTSmuDNiTH8Qe =17BJ -----END PGP SIGNATURE-----
=== modified file 'debsums' --- debsums 2010-11-17 17:16:07 +0000 +++ debsums 2011-06-30 09:53:19 +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; + } } } @@ -626,9 +634,11 @@ 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"; + } } }
debsums-glob.diff.sig
Description: Binary data