Source: init-system-helpers
Version: 1.23
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: toolchain randomness
X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that dh-systemd doesn't sort the list of unit files in prerm/postinst.

The attached patch fixes this.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds

diff --git a/script/dh_systemd_enable b/script/dh_systemd_enable
index 41323dc..a03acb2 100755
--- a/script/dh_systemd_enable
+++ b/script/dh_systemd_enable
@@ -218,8 +218,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
 	next if @units == 0;
 
-	my $unitargs = join(" ", map { basename($_) } @units);
-	for my $unit (@units) {
+	my $unitargs = join(" ", sort map { basename($_) } @units);
+	for my $unit (sort @units) {
 		my $base = basename($unit);
 		if ($dh{NO_ENABLE}) {
 			autoscript($package, "postinst", "postinst-systemd-dont-enable", "s/#UNITFILE#/$base/");
diff --git a/script/dh_systemd_start b/script/dh_systemd_start
index 297f9c5..9f56f4e 100755
--- a/script/dh_systemd_start
+++ b/script/dh_systemd_start
@@ -192,7 +192,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	# This wrapper function makes the following logic easier to read.
 	my $sd_autoscript = sub {
 		my ($script, $filename) = @_;
-		my $unitargs = join(" ", map { basename($_) } @units);
+		my $unitargs = join(" ", sort map { basename($_) } @units);
 		autoscript($package, $script, $filename, "s/#UNITFILES#/$unitargs/");
 	};
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to