[buildd-tools-devel] Bug#620112: Generate binNMU changelogs deterministically for multiarch support
Anders Kaseorg
andersk at MIT.EDU
Wed Mar 30 08:17:20 UTC 2011
Package: sbuild
Version: 0.60.1-1
Tags: patch
According to https://wiki.ubuntu.com/MultiarchSpec#Binary%20NMUs ,
although a Multi-Arch: same package may not be binNMU’d on individual
architectures, it should be possible to schedule a binNMU on all
architectures at once, and have the resulting packages remain
co-installable. However, this does not quite work right now for a silly
reason: sbuild generates a different timestamp for the binNMU changelog
entry in each build, and the differing changelog.gz files break
co-installability.
This fixes the problem by generating the timestamp in a deterministic way:
we just copy the timestamp from the previous changelog entry. (Since the
source has not changed since that time, it seems like as good a time as
any to write into the changelog.)
Certain automated backport setups that use --append-to-version are also
affected by this issue and require this fix as well.
-- 8< --
From: Anders Kaseorg <andersk at mit.edu>
Subject: [PATCH 1/2] hack-binNMU: Use dpkg-parsechangelog
Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
lib/Sbuild/Build.pm | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 93032a9..9121c4e 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -794,13 +794,26 @@ sub build {
$self->log_subsubsection("Hack binNMU version");
$self->set('Pkg Fail Stage', "hack-binNMU");
if (open( F, "<$dscdir/debian/changelog" )) {
- my($firstline, $text);
- $firstline = "";
- $firstline = <F> while $firstline =~ /^$/;
- { local($/); undef $/; $text = <F>; }
+ my $text = do { local $/; <F> };
close( F );
- $firstline =~ /^(\S+)\s+\((\S+)\)\s+([^;]+)\s*;\s*urgency=(\S+)\s*$/;
- my ($name, $version, $dists, $urgent) = ($1, $2, $3, $4);
+
+ my $pipe = $self->get('Session')->pipe_command(
+ { COMMAND => [$Sbuild::Sysconfig::programs{'DPKG_PARSECHANGELOG'}],
+ USER => $self->get_conf('USERNAME'),
+ PRIORITY => 0,
+ DIR => $self->get('Session')->strip_chroot_path($dscdir) });
+ my $clog = do { local $/; <$pipe> };
+ close($pipe);
+ if ($?) {
+ $self->log("FAILED [dpkg-parsechangelog died]\n");
+ return 0;
+ }
+
+ my ($name) = $clog =~ /^Source:\s*(.*)$/m;
+ my ($version) = $clog =~ /^Version:\s*(.*)$/m;
+ my ($dists) = $clog =~ /^Distribution:\s*(.*)$/m;
+ my ($urgency) = $clog =~ /^Urgency:\s*(.*)$/m;
+
my $NMUversion = $self->get('Version');
chomp( my $date = `date -R` );
if (!open( F, ">$dscdir/debian/changelog" )) {
@@ -822,7 +835,7 @@ sub build {
print F "\n";
print F " -- " . $self->get_conf('MAINTAINER_NAME') . " $date\n\n";
- print F $firstline, $text;
+ print F $text;
close( F );
$self->log("*** Created changelog entry for bin-NMU version $NMUversion\n");
}
--
1.7.4.2
From: Anders Kaseorg <andersk at mit.edu>
Subject: [PATCH 2/2] hack-binNMU: Copy the date from the previous changelog
When a Multi-Arch: same package is simultaneously binNMU’d on all
architectures, a deterministic changelog.gz is necessary to avoid
breaking co-installability.
The same issue affected automated backport setups that use
--append-to-version.
Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
lib/Sbuild/Build.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 9121c4e..0a68450 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -813,9 +813,9 @@ sub build {
my ($version) = $clog =~ /^Version:\s*(.*)$/m;
my ($dists) = $clog =~ /^Distribution:\s*(.*)$/m;
my ($urgency) = $clog =~ /^Urgency:\s*(.*)$/m;
+ my ($date) = $clog =~ /^Date:\s*(.*)$/m;
my $NMUversion = $self->get('Version');
- chomp( my $date = `date -R` );
if (!open( F, ">$dscdir/debian/changelog" )) {
$self->log("Can't open debian/changelog for binNMU hack: $!\n");
return 0;
--
1.7.4.2
More information about the Buildd-tools-devel
mailing list