[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 03/04: c/r-sync-state: Use b64 encoded checksums



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit d1e6aa09649aba10bcc606b1355f1e1356c74aae
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jul 7 08:24:08 2017 +0000

    c/r-sync-state: Use b64 encoded checksums
    
    Reduces the size of the checksums fields (sha256) by ~30%.  These
    fields are unconditionally loaded even for reporting-html-reports that
    do not actually use them for anything.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 commands/reporting-sync-state.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/commands/reporting-sync-state.pm b/commands/reporting-sync-state.pm
index 7bd9b27..20f0c82 100644
--- a/commands/reporting-sync-state.pm
+++ b/commands/reporting-sync-state.pm
@@ -25,6 +25,7 @@ use autodie;
 use Getopt::Long();
 use File::Basename qw(basename);
 use YAML::XS ();
+use MIME::Base64 qw(encode_base64);
 
 use Lintian::Lab;
 use Lintian::Relation::Version qw(versions_comparator);
@@ -334,8 +335,9 @@ sub _parse_srcs_pg {
         strip($f);
         next unless $f && $f =~ m/\.dsc$/;
         my ($checksum, undef, $basename) = split(m/\s++/, $f);
+        my $b64_checksum = encode_base64(pack('H*', $checksum));
         # $dir should end with a slash if it is non-empty.
-        $data{$DEFAULT_CHECKSUM} = $checksum;
+        $data{$DEFAULT_CHECKSUM} = $b64_checksum;
         $data{'path'} = $extra_metadata->{'mirror-dir'}  . "/$dir" . $basename;
         last;
     }
@@ -356,7 +358,7 @@ sub _parse_srcs_pg {
 # Helper for local_mirror_manifests - it parses a paragraph from Packages file
 sub _parse_pkgs_pg {
     my ($state, $extra_metadata, $type, $paragraph) = @_;
-    my ($group_id, $member_id, %data, %group_metadata);
+    my ($group_id, $member_id, %data, %group_metadata, $b64_checksum);
     my $package = $paragraph->{'package'};
     my $version = $paragraph->{'version'};
     my $architecture = $paragraph->{'architecture'};
@@ -373,7 +375,8 @@ sub _parse_pkgs_pg {
     $member_id = "${type}:${package}/${version}/${architecture}";
     $data{'path'}
       = $extra_metadata->{'mirror-dir'} . '/' . $paragraph->{'filename'};
-    $data{$DEFAULT_CHECKSUM} = $paragraph->{$DEFAULT_CHECKSUM};
+    $b64_checksum = encode_base64(pack('H*', $paragraph->{$DEFAULT_CHECKSUM}));
+    $data{$DEFAULT_CHECKSUM} = $b64_checksum;
 
     $group_metadata{'mirror-metadata'}{'maintainer'}
       = $paragraph->{'maintainer'};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: