summaryrefslogtreecommitdiff
path: root/t/Test
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2018-01-03 10:41:20 +0000
committerNiels Thykier <niels@thykier.net>2018-01-03 10:43:19 +0000
commite6870ceafb9d51800de86a7106cdfb4ce9c9dad8 (patch)
tree0a5700fd2f80fc40dde96f5ce500ef6b68069ff7 /t/Test
parentc1e2bbd0858b29ff1c90427501480c27e885d5b6 (diff)
downloaddebhelper-e6870ceafb9d51800de86a7106cdfb4ce9c9dad8.tar.gz
Dh_Lib: Support ordering for service handling autosnippets
This is part 1 of 2 for solving Debian#814285 and Debian#885998 Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't/Test')
-rw-r--r--t/Test/DH.pm22
1 files changed, 21 insertions, 1 deletions
diff --git a/t/Test/DH.pm b/t/Test/DH.pm
index a5465c58..01fb3db9 100644
--- a/t/Test/DH.pm
+++ b/t/Test/DH.pm
@@ -37,7 +37,7 @@ our @EXPORT = qw(
each_compat_up_to_and_incl_subtest each_compat_subtest
each_compat_from_and_above_subtest run_dh_tool
uid_0_test_is_ok create_empty_file readlines
- error
+ error find_script
);
our ($TEST_DH_COMPAT, $ROOT_OK, $ROOT_CMD);
@@ -198,4 +198,24 @@ sub readlines {
return \@lines;
}
+# In *inst order (find_script will shuffle them around for *rm order)
+my @SNIPPET_FILE_TEMPLATES = (
+ 'debian/#PACKAGE#.#SCRIPT#.debhelper',
+ 'debian/.debhelper/generated/#PACKAGE#/#SCRIPT#.service',
+);
+
+sub find_script {
+ my ($package, $script) = @_;
+ my @files;
+ for my $template (@SNIPPET_FILE_TEMPLATES) {
+ my $file = ($template =~ s/#PACKAGE#/$package/r);
+ $file =~ s/#SCRIPT#/$script/;
+ push(@files, $file) if -f $file;
+ }
+ if ($script eq 'postrm' or $script eq 'prerm') {
+ @files = reverse(@files);
+ }
+ return @files;
+}
+
1;