Hi,

I am proposing the following individual patches:

 1) dh_systemd_start: Default to -R in compat 10
  - For consistency with dh_installinit, which changed the same default
    in compat 10.

 2) dh_systemd_*: Limit the directory scanning to /lib/systemd/system,
    which is the only path that satisfies the constraints of the scan.

 3) dh_systemd_*: Add a "DH PROMISE" so dh knows when it can safely
    optimise out the commands.
    - Arguably, this is mostly interesting if these helpers are merged
      into debhelper at some point.

 4) d/control: Use HTTPS links for the Vcs fields.

Testing: I have only tested that the init-system-helpers and passes its
own test suite.  Which, AFAICT, sums up to "no testing" because the test
suite does not cover these scripts.

Thanks,
~Niels

From 69cda52cd4deb579263bddf887c29f1d029dd80f Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Thu, 10 Mar 2016 16:34:13 +0000
Subject: [PATCH 1/4] dh_systemd_start: Default to -R in compat 10

Signed-off-by: Niels Thykier <[email protected]>
---
 script/dh_systemd_start | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/script/dh_systemd_start b/script/dh_systemd_start
index dc6ab48..1340899 100755
--- a/script/dh_systemd_start
+++ b/script/dh_systemd_start
@@ -35,14 +35,23 @@ because invoke-rc.d performs the stop/start/restart in that case.
 =item B<--restart-after-upgrade>
 
 Do not stop the unit file until after the package upgrade has been completed.
-This is different than the default behavior, which stops the unit file in the
-F<prerm> and starts it again in the F<postinst> maintscript.
+This is the default behaviour in compat 10.
+
+In early compat levels, the default was to stop the unit file in the
+F<prerm>, and starts it again in the F<postinst>.
 
 This can be useful for daemons that should not have a possibly long
 downtime during upgrade. But you should make sure that the daemon will not
 get confused by the package being upgraded while it's running before using
 this option.
 
+=item B<--no-restart-after-upgrade>
+
+Undo a previous B<--restart-after-upgrade> (or the default of compat
+10).  If no other options are given, this will cause the service to be
+stopped in the F<prerm> script and started again in the F<postinst>
+script.
+
 =item B<-r>, B<--no-restart-on-upgrade>
 
 Do not stop service on upgrade.
@@ -68,11 +77,13 @@ B<dh_systemd_start> manually.
 
 =cut
 
+$dh{RESTART_AFTER_UPGRADE} = 1 if not compat(10);
+
 init(options => {
 	"r" => \$dh{R_FLAG},
 	"no-restart-on-upgrade" => \$dh{R_FLAG},
 	"no-start" => \$dh{NO_START},
-	"R|restart-after-upgrade" => \$dh{RESTART_AFTER_UPGRADE},
+	"R|restart-after-upgrade!" => \$dh{RESTART_AFTER_UPGRADE},
 	"no-also" => \$dh{NO_ALSO},
 });
 
-- 
2.7.0

From c683af99c6d58e60c18fb781175c06fa77815957 Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Thu, 10 Mar 2016 16:42:50 +0000
Subject: [PATCH 2/4] dh_systemd_*: Do not traverse the entire package tree

There is no point in scanning the entire package tree, if we can
narrow it to specific subdirs (like we can in this case).

Signed-off-by: Niels Thykier <[email protected]>
---
 script/dh_systemd_enable | 2 +-
 script/dh_systemd_start  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/script/dh_systemd_enable b/script/dh_systemd_enable
index ab1de19..41d7a15 100755
--- a/script/dh_systemd_enable
+++ b/script/dh_systemd_enable
@@ -178,7 +178,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			push @installed_units, $name;
 		},
 		no_chdir => 1,
-	}, $tmpdir);
+	}, "${tmpdir}/lib/systemd/system");
 
 	# Handle either only the unit files which were passed as arguments or
 	# all unit files that are installed in this package.
diff --git a/script/dh_systemd_start b/script/dh_systemd_start
index 1340899..25cc933 100755
--- a/script/dh_systemd_start
+++ b/script/dh_systemd_start
@@ -135,7 +135,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 				push @installed_units, $name;
 			}
 		},
-	}, $tmpdir);
+	}, "${tmpdir}/lib/systemd/system");
 	chdir($oldcwd);
 
 	# Handle either only the unit files which were passed as arguments or
-- 
2.7.0

From f80bb619e9c20f56afd9d5566c01441ca2186af3 Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Thu, 10 Mar 2016 16:46:15 +0000
Subject: [PATCH 3/4] dh_systemd_*: Add DH promise to avoid being called for no
 reason

The commands have a well-defined set of constrains that define if they
will do anything.  Add a promise so dh knows if and when it may
optimise them out of the sequence.

Signed-off-by: Niels Thykier <[email protected]>
---
 script/dh_systemd_enable | 2 ++
 script/dh_systemd_start  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/script/dh_systemd_enable b/script/dh_systemd_enable
index 41d7a15..39955c4 100755
--- a/script/dh_systemd_enable
+++ b/script/dh_systemd_enable
@@ -102,6 +102,8 @@ sub contains_install_section {
 	return 0;
 }
 
+# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) service socket tmpfile
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	my $tmpdir = tmpdir($package);
 	my @installed_units;
diff --git a/script/dh_systemd_start b/script/dh_systemd_start
index 25cc933..448128d 100755
--- a/script/dh_systemd_start
+++ b/script/dh_systemd_start
@@ -115,6 +115,9 @@ sub extract_key {
 	return @values;
 }
 
+
+# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system)
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	my $tmpdir = tmpdir($package);
 	my @installed_units;
-- 
2.7.0

From fee57f076ae48c3369bef466b5097c7cea5cb4f3 Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Thu, 10 Mar 2016 17:08:50 +0000
Subject: [PATCH 4/4] Update Vcs-* fields to use https

Signed-off-by: Niels Thykier <[email protected]>
---
 debian/control | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index eeedfd4..11c7191 100644
--- a/debian/control
+++ b/debian/control
@@ -7,8 +7,8 @@ Uploaders: Michael Biebl <[email protected]>,
 Build-Depends: debhelper (>= 9),
                perl:any,
 Standards-Version: 3.9.6
-Vcs-Git: git://anonscm.debian.org/collab-maint/init-system-helpers.git
-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/init-system-helpers.git;a=summary
+Vcs-Git: https://anonscm.debian.org/gi/collab-maint/init-system-helpers.git
+Vcs-Browser: https://anonscm.debian.org/git/collab-maint/init-system-helpers.git
 
 Package: init-system-helpers
 Architecture: all
-- 
2.7.0

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Pkg-systemd-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to