Commit 9cd373ca authored by gregor herrmann's avatar gregor herrmann

Add patch to produce reproducible copyright files.

Thanks: Reiner Herrmann for the bug report and patch.
Closes: #803340
parent 2b18d389
Description: produce reproducible copyright files
This patches fixes the reproducibility issues this by sorting Files
sections by path, License sections by name, and "x or y" listings.
Origin: vendor
Bug-Debian: https://bugs.debian.org/803340
Author: Reiner Herrmann <reiner@reiner-h.de>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2015-10-29
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=108121
Bug: https://rt.cpan.org/Ticket/Display.html?id=108121
--- a/lib/Debian/Copyright.pm
+++ b/lib/Debian/Copyright.pm
@@ -161,6 +161,9 @@
sub write {
my ( $self, $file ) = @_;
+ $self->files->SortByKey;
+ $self->licenses->SortByKey;
+
my @stanzas = (
$self->header,
$self->files->Values,
--- a/lib/Debian/Copyright/Stanza/OrSeparated.pm
+++ b/lib/Debian/Copyright/Stanza/OrSeparated.pm
@@ -82,7 +82,7 @@
{
my $self = shift;
my $body = exists $self->{body} ? "\n$self->{body}" : "";
- return join( ' or ', @{ $self->{list} } ).$body;
+ return join( ' or ', sort @{ $self->{list} } ).$body;
}
=head2 equals
--- a/t/01.basic.t
+++ b/t/01.basic.t
@@ -1,4 +1,4 @@
-use Test::More tests => 36;
+use Test::More tests => 37;
use Debian::Copyright;
@@ -61,7 +61,8 @@
like($copyright->licenses->Values(0)->License, qr/\AArtistic\s+This\sprogram/xms, 'licenses(0)->Files');
is($copyright->files->Keys(2), 'test/*', 'key files(2)');
is($copyright->files->Values(2)->Files, 'test/*', 'files(2)->Files');
-is($copyright->licenses->Keys(2), 'BSD', 'key licenses(2)');
+is($copyright->licenses->Keys(1), 'BSD', 'key licenses(1)');
+is($copyright->licenses->Keys(2), 'GPL-2+', 'key licenses(2)');
my $copyright3 = Debian::Copyright->new;
isa_ok($copyright3, 'Debian::Copyright');
reproducible-copyright.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment