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

Bug#782596: RFC: possible wheezy-pu: package debhelper to address #708218 for wheezy?



On 2015-04-14 17:47, Salvatore Bonaccorso wrote:
> Package: release.debian.org
> Severity: normal
> 
> Hi Stable release managers,
> 
> This is not a wheezy-pu request per se. The recent libxrender update
> through security.d.o was initially just a rebuild of libxrender
> against a fixed version of libx11. This caused #782505 ("libxrender1:
> dist-upgrade breaks on multiarch due to conflict on
> changelog.Debian.gz").
> 
> The fix for debhelper in #708218 didn't make it into wheezy so binNMUs
> in wheezy for multiarch enabled packages will have the problem.
> 
> Would it make sense to have an update of debhelper in wheezy fixing
> this issue as well?
> 
> Regards,
> Salvatore
> 
> 

>From a debhelper PoV, it looks reasonable at first glance.

It looks like we would need to backport the 4 commits listed in the
attached "...-commits.diff" file.  The combined result (excluding
changelog entries) is in the "...-dh_installchangelogs.diff" and had no
merge conflicts (only one chunk required fuzziness to be applied).

Except a missing changelog entry, is the expected debdiff for such an
upload.  Disclaimer, not tested (not even build tested).

Thanks,
~Niels


commit f1f2efc66605805d31e05e3769264c1914dc825b
Author: Joey Hess <joey@kitenet.net>
Date:   Sun Oct 20 19:19:18 2013 -0400

    dh_installchangelogs: Avoid installing binNMU changelog file in --no-act mode. Closes: #726930

diff --git a/debian/changelog b/debian/changelog
index 948e2f5..0fa1b22 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+debhelper (9.20130922) UNRELEASED; urgency=low
+
+  * dh_installchangelogs: Avoid installing binNMU changelog file
+    in --no-act mode. Closes: #726930
+
+ -- Joey Hess <joeyh@debian.org>  Sun, 20 Oct 2013 19:18:44 -0400
+
 debhelper (9.20130921) unstable; urgency=low
 
   * dh: Call dh_installxfonts after dh_link, so that it will
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 2f65f8a..edd7f9f 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -200,9 +200,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		doit("install","-d","$tmp/usr/share/doc/$package");
 	}
 
-	if (! install_binNMU_changelog($package, $changelog, $changelog_name)) {
-		doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
-			"$tmp/usr/share/doc/$package/$changelog_name");
+	if (! $dh{NO_ACT}) {
+		if (! install_binNMU_changelog($package, $changelog, $changelog_name)) {
+			doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
+				"$tmp/usr/share/doc/$package/$changelog_name");
+		}
 	}
 
 	if (-e $news) {

commit 0a9abc9fcc85d512a16e3c553f88091c78ff4354
Author: Joey Hess <joey@kitenet.net>
Date:   Sat May 18 10:53:14 2013 -0400

    ensure files come out owned by root
    
    dh_fixperms may not always be run after dh_installchangelogs

diff --git a/dh_installchangelogs b/dh_installchangelogs
index ae61f1e..58dad3c 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -114,6 +114,9 @@ sub install_binNMU_changelog {
 		close $output or error("Couldn't close $output_fn: $!");
 		utime $stat[8], $stat[9], $output_fn;
 
+		chown 0, 0, $output_fn, $output_fn_binary
+			or error "chown: $!";
+
 		umask $mask;
 
 		return 1;

commit e004f193b15b7d1f2b398f8469de74b1d45e67be
Author: Joey Hess <joey@kitenet.net>
Date:   Sat May 18 10:48:46 2013 -0400

    only run slower changelog splitting code in binNMU mode

diff --git a/dh_installchangelogs b/dh_installchangelogs
index 1e3dbeb..ae61f1e 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -78,47 +78,50 @@ Install this file as the upstream changelog.
 
 =cut
 
-# Install a changelog into a package.
-# For binNMUs the first changelog entry is written into an extra file to keep
-# the packages coinstallable.
-sub install_changelog
-{
+# For binNMUs the first changelog entry is written into an extra file to
+# keep the packages coinstallable.
+sub install_binNMU_changelog {
 	my ($package, $input_fn, $changelog_name)=@_;
 
-	my $arch=package_arch($package);
-	my $tmp=tmpdir($package);
-	my $output_fn="$tmp/usr/share/doc/$package/$changelog_name";
-	my $mask=umask 0022;
-	my @stat=stat $input_fn or error("could not stat $input_fn: $!");
-
-	open my $input, "<", $input_fn
-		or error("could not read $input_fn: $!");
-	open my $output, ">", $output_fn
-		or error("could not open $output_fn for writing: $!");
-
+	open (my $input, "<", $input_fn);
 	my $line=<$input>;
-	if ($line =~ /\A\S.*;.*\bbinary-only=yes/) {
+	if (defined $line && $line =~ /\A\S.*;.*\bbinary-only=yes/) {
+		my $mask=umask 0022;
+
+		my @stat=stat $input_fn or error("could not stat $input_fn: $!");
+		my $tmp=tmpdir($package);
+		my $output_fn="$tmp/usr/share/doc/$package/$changelog_name";
+		open my $output, ">", $output_fn
+			or error("could not open $output_fn for writing: $!");
+		my $arch=package_arch($package);
 		my $output_fn_binary="$output_fn.$arch";
 		open my $output_binary, ">", $output_fn_binary
 			or error("could not open $output_fn_binary for writing: $!");
+
 		do {
 			print {$output_binary} $line
 				or error("Could not write to $output_fn_binary: $!");
 		} while(defined($line=<$input>) && $line !~ /\A\S/);
 		close $output_binary or error("Couldn't close $output_fn_binary: $!");
 		utime $stat[8], $stat[9], $output_fn_binary;
-	}
 
-	do {
-		print {$output} $line
-			or error("Could not write to $output_fn: $!");
-	} while(defined($line=<$input>));
+		do {
+			print {$output} $line
+				or error("Could not write to $output_fn: $!");
+		} while(defined($line=<$input>));
+
+		close $input or error("Couldn't close $input_fn: $!");
+		close $output or error("Couldn't close $output_fn: $!");
+		utime $stat[8], $stat[9], $output_fn;
 
-	close $input or error("Couldn't close $input_fn: $!");
-	close $output or error("Couldn't close $output_fn: $!");
-	utime $stat[8], $stat[9], $output_fn;
+		umask $mask;
 
-	umask $mask;
+		return 1;
+	}
+	else {
+		close $input;
+		return 0;
+	}
 }
 
 init();
@@ -182,7 +185,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if (! -d "$tmp/usr/share/doc/$package") {
 		doit("install","-d","$tmp/usr/share/doc/$package");
 	}
-	install_changelog($package, $changelog, $changelog_name);
+
+	if (! install_binNMU_changelog($package, $changelog, $changelog_name)) {
+		doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
+			"$tmp/usr/share/doc/$package/$changelog_name");
+	}
+
 	if (-e $news) {
 		doit("install","-o",0,"-g",0,"-p","-m644",$news,
 			"$tmp/usr/share/doc/$package/$news_name");

commit e069a27b2a8348d39b06a2911418d73336bdf86f
Author: Joey Hess <joey@kitenet.net>
Date:   Sat May 18 10:39:11 2013 -0400

    dh_installchangelogs: Write the changelog entry used for a binNMU, as flagged by binary-only=yes to a separate file, in order to work around infelicities in dpkg's multiarch support. Closes: #708218 (Thanks, Ansgar Burchardt)

diff --git a/debian/changelog b/debian/changelog
index da281af..fdce097 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 debhelper (9.20130517) UNRELEASED; urgency=low
 
+  * dh_installchangelogs: Write the changelog entry used for a binNMU,
+    as flagged by binary-only=yes to a separate file, in order to work
+    around infelicities in dpkg's multiarch support. Closes: #708218
+    (Thanks, Ansgar Burchardt)
   * dh_installinit: Add versioned dependency on sysv-rc
     when shipping upstart jobs. Closes: #708720
 
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 4620473..1e3dbeb 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -78,6 +78,49 @@ Install this file as the upstream changelog.
 
 =cut
 
+# Install a changelog into a package.
+# For binNMUs the first changelog entry is written into an extra file to keep
+# the packages coinstallable.
+sub install_changelog
+{
+	my ($package, $input_fn, $changelog_name)=@_;
+
+	my $arch=package_arch($package);
+	my $tmp=tmpdir($package);
+	my $output_fn="$tmp/usr/share/doc/$package/$changelog_name";
+	my $mask=umask 0022;
+	my @stat=stat $input_fn or error("could not stat $input_fn: $!");
+
+	open my $input, "<", $input_fn
+		or error("could not read $input_fn: $!");
+	open my $output, ">", $output_fn
+		or error("could not open $output_fn for writing: $!");
+
+	my $line=<$input>;
+	if ($line =~ /\A\S.*;.*\bbinary-only=yes/) {
+		my $output_fn_binary="$output_fn.$arch";
+		open my $output_binary, ">", $output_fn_binary
+			or error("could not open $output_fn_binary for writing: $!");
+		do {
+			print {$output_binary} $line
+				or error("Could not write to $output_fn_binary: $!");
+		} while(defined($line=<$input>) && $line !~ /\A\S/);
+		close $output_binary or error("Couldn't close $output_fn_binary: $!");
+		utime $stat[8], $stat[9], $output_fn_binary;
+	}
+
+	do {
+		print {$output} $line
+			or error("Could not write to $output_fn: $!");
+	} while(defined($line=<$input>));
+
+	close $input or error("Couldn't close $input_fn: $!");
+	close $output or error("Couldn't close $output_fn: $!");
+	utime $stat[8], $stat[9], $output_fn;
+
+	umask $mask;
+}
+
 init();
 
 my $upstream=shift;
@@ -139,8 +182,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if (! -d "$tmp/usr/share/doc/$package") {
 		doit("install","-d","$tmp/usr/share/doc/$package");
 	}
-	doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
-		"$tmp/usr/share/doc/$package/$changelog_name");
+	install_changelog($package, $changelog, $changelog_name);
 	if (-e $news) {
 		doit("install","-o",0,"-g",0,"-p","-m644",$news,
 			"$tmp/usr/share/doc/$package/$news_name");
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 4620473..587460d 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -78,6 +78,55 @@ Install this file as the upstream changelog.
 
 =cut
 
+# For binNMUs the first changelog entry is written into an extra file to
+# keep the packages coinstallable.
+sub install_binNMU_changelog {
+	my ($package, $input_fn, $changelog_name)=@_;
+
+	open (my $input, "<", $input_fn);
+	my $line=<$input>;
+	if (defined $line && $line =~ /\A\S.*;.*\bbinary-only=yes/) {
+		my $mask=umask 0022;
+
+		my @stat=stat $input_fn or error("could not stat $input_fn: $!");
+		my $tmp=tmpdir($package);
+		my $output_fn="$tmp/usr/share/doc/$package/$changelog_name";
+		open my $output, ">", $output_fn
+			or error("could not open $output_fn for writing: $!");
+		my $arch=package_arch($package);
+		my $output_fn_binary="$output_fn.$arch";
+		open my $output_binary, ">", $output_fn_binary
+			or error("could not open $output_fn_binary for writing: $!");
+
+		do {
+			print {$output_binary} $line
+				or error("Could not write to $output_fn_binary: $!");
+		} while(defined($line=<$input>) && $line !~ /\A\S/);
+		close $output_binary or error("Couldn't close $output_fn_binary: $!");
+		utime $stat[8], $stat[9], $output_fn_binary;
+
+		do {
+			print {$output} $line
+				or error("Could not write to $output_fn: $!");
+		} while(defined($line=<$input>));
+
+		close $input or error("Couldn't close $input_fn: $!");
+		close $output or error("Couldn't close $output_fn: $!");
+		utime $stat[8], $stat[9], $output_fn;
+
+		chown 0, 0, $output_fn, $output_fn_binary
+			or error "chown: $!";
+
+		umask $mask;
+
+		return 1;
+	}
+	else {
+		close $input;
+		return 0;
+	}
+}
+
 init();
 
 my $upstream=shift;
@@ -139,8 +188,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if (! -d "$tmp/usr/share/doc/$package") {
 		doit("install","-d","$tmp/usr/share/doc/$package");
 	}
-	doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
-		"$tmp/usr/share/doc/$package/$changelog_name");
+
+	if (! $dh{NO_ACT}) {
+		if (! install_binNMU_changelog($package, $changelog, $changelog_name)) {
+			doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
+				"$tmp/usr/share/doc/$package/$changelog_name");
+		}
+	}
+
 	if (-e $news) {
 		doit("install","-o",0,"-g",0,"-p","-m644",$news,
 			"$tmp/usr/share/doc/$package/$news_name");

Reply to: