scancpan: sort license in hash file
authorFrancois Perrad <fperrad@gmail.com>
Wed, 10 Oct 2018 06:46:12 +0000 (08:46 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 10 Oct 2018 07:05:53 +0000 (09:05 +0200)
now, the output is reproductible

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
utils/scancpan

index f7b707676d7a0e3aa5ff9bb94865ba3997a12a11..64599f4305a4536ca76444509dab8e27a343489f 100755 (executable)
@@ -767,10 +767,12 @@ while (my ($distname, $dist) = each %dist) {
         say {$fh} qq{# retrieved by scancpan from ${mirror}/};
         say {$fh} qq{md5    ${md5} ${filename}};
         say {$fh} qq{sha256 ${sha256} ${filename}};
-        if (scalar keys %{$license_files{$distname}}) {
+        my %license_files =  %{$license_files{$distname}};
+        if (scalar keys %license_files) {
             say {$fh} q{};
             say {$fh} qq{# computed by scancpan};
-            while (my ($license, $digest) = each %{$license_files{$distname}}) {
+            foreach my $license (sort keys %license_files) {
+                my $digest = $license_files{$license};
                 say {$fh} qq{sha256 ${digest} ${license}};
             }
         }