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

Re: Preliminary review of dpkg-genbuildinfo



Cyril Brulebois <kibi@debian.org> (2015-04-27):
> I think you may want to additional patch scripts/Dpkg/Checksums.pm and
> possibly scripts/Dpkg/Source/Package.pm; you may otherwise get a sorted
> list under Files, but not under Checksums-*?

The attached patch seems to work OK with tasksel and its kinda huge list
of binary packages. Patching Dpkg::Source::Package's get_files() is
optional as it only passes over what Dpkg::Checksums's get_files()
returns, but I guess making sure shouldn't be too much of a penalty hit.

Mraw,
KiBi.
From 7671ca97ff4678bb29510fa8d7631a288c550c14 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Mon, 27 Apr 2015 15:21:25 +0200
Subject: [PATCH] Make all get_files() subs sort the returned list.

This improves build reproducibility, notably dpkg-genchanges's output.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
---
 scripts/Dpkg/Checksums.pm      | 2 +-
 scripts/Dpkg/Dist/Files.pm     | 2 +-
 scripts/Dpkg/Source/Package.pm | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/Dpkg/Checksums.pm b/scripts/Dpkg/Checksums.pm
index 86f555f..b606d66 100644
--- a/scripts/Dpkg/Checksums.pm
+++ b/scripts/Dpkg/Checksums.pm
@@ -273,7 +273,7 @@ Return the list of files whose checksums are stored in the object.
 
 sub get_files {
     my $self = shift;
-    return @{$self->{files}};
+    return sort @{$self->{files}};
 }
 
 =item $bool = $ck->has_file($file)
diff --git a/scripts/Dpkg/Dist/Files.pm b/scripts/Dpkg/Dist/Files.pm
index c28c4eb..dc6c0ed 100644
--- a/scripts/Dpkg/Dist/Files.pm
+++ b/scripts/Dpkg/Dist/Files.pm
@@ -86,7 +86,7 @@ sub parse {
 sub get_files {
     my $self = shift;
 
-    return map { $self->{files}->{$_} } @{$self->{order}};
+    return sort { $a->{filename} cmp $b->{filename} } map { $self->{files}->{$_} } @{$self->{order}};
 }
 
 sub get_file {
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index aeb3817..f1a0f81 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -314,7 +314,7 @@ usually do not have any path information.
 
 sub get_files {
     my $self = shift;
-    return $self->{checksums}->get_files();
+    return sort $self->{checksums}->get_files();
 }
 
 =item $p->check_checksums()
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature


Reply to: