[debhelper-devel] [debhelper] 07/08: dh_*: Migrate most tools to new shell-less autoscript
Niels Thykier
nthykier at moszumanska.debian.org
Sun Jul 16 12:43:50 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch shell-out-less
in repository debhelper.
commit ae83a948c45c336f8e083f0c5d55586724077776
Author: Niels Thykier <niels at thykier.net>
Date: Sat Jul 15 16:26:48 2017 +0000
dh_*: Migrate most tools to new shell-less autoscript
Signed-off-by: Niels Thykier <niels at thykier.net>
---
dh_icons | 4 ++--
dh_installcatalogs | 2 +-
dh_installemacsen | 6 +++---
dh_installmenu | 4 ++--
dh_installmodules | 4 ++--
dh_installwm | 6 +++---
dh_installxfonts | 4 ++--
dh_systemd_enable | 6 +++---
dh_systemd_start | 2 +-
dh_ucf | 9 +++++++--
10 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/dh_icons b/dh_icons
index b7e8453..73240ec 100755
--- a/dh_icons
+++ b/dh_icons
@@ -66,8 +66,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
closedir($dirfd);
if (@dirlist and ! $dh{NOSCRIPTS}) {
my $list=join(" ", sort @dirlist);
- autoscript($package,"postinst","postinst-icons","s%#DIRLIST#%$list%g");
- autoscript($package,"postrm","postrm-icons","s%#DIRLIST#%$list%g");
+ autoscript($package, 'postinst', 'postinst-icons', { 'DIRLIST' => $list });
+ autoscript($package, 'postrm', 'postrm-icons', { 'DIRLIST' => $list });
}
}
}
diff --git a/dh_installcatalogs b/dh_installcatalogs
index f15a687..d7ac9a6 100755
--- a/dh_installcatalogs
+++ b/dh_installcatalogs
@@ -113,7 +113,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! $dh{NOSCRIPTS}) {
autotrigger($package, "activate-await", "update-sgmlcatalog");
autoscript($package, "postrm", "postrm-sgmlcatalog",
- "s%#CENTRALCAT#%$centralcat%g;");
+ { 'CENTRALCAT' => $centralcat });
}
}
else {
diff --git a/dh_installemacsen b/dh_installemacsen
index fcae6df..2e19c1f 100755
--- a/dh_installemacsen
+++ b/dh_installemacsen
@@ -125,11 +125,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if ($emacsen_install ne '' || $emacsen_remove ne '') {
if (! $dh{NOSCRIPTS}) {
autoscript($package,"preinst","preinst-emacsen",
- "s/#PACKAGE#/$package/g");
+ { 'PACKAGE' => $package });
autoscript($package,"postinst","postinst-emacsen",
- "s/#PACKAGE#/$package/g");
+ { 'PACKAGE' => $package });
autoscript($package,"prerm","prerm-emacsen",
- "s/#PACKAGE#/$package/g");
+ { 'PACKAGE' => $package });
}
}
}
diff --git a/dh_installmenu b/dh_installmenu
index 3bad129..475b58f 100755
--- a/dh_installmenu
+++ b/dh_installmenu
@@ -79,8 +79,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
install_file($menu_method,"$tmp/etc/menu-methods/$package");
if (! $dh{NOSCRIPTS}) {
- autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/g");
- autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/g");
+ autoscript($package, 'postinst', 'postinst-menu-method', { 'PACKAGE' => $package });
+ autoscript($package, 'postrm', 'postrm-menu-method', { 'PACKAGE' => $package });
}
}
}
diff --git a/dh_installmodules b/dh_installmodules
index 40d4233..46ef024 100755
--- a/dh_installmodules
+++ b/dh_installmodules
@@ -100,8 +100,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! $dh{NOSCRIPTS}) {
foreach my $kvers (find_kernel_modules("$tmp/lib/modules")) {
- autoscript($package,"postinst","postinst-modules","s/#KVERS#/$kvers/g");
- autoscript($package,"postrm","postrm-modules","s/#KVERS#/$kvers/g");
+ autoscript($package, 'postinst', 'postinst-modules', { 'KVERS' => $kvers });
+ autoscript($package, 'postrm', 'postrm-modules', { 'KVERS' => $kvers });
}
}
}
diff --git a/dh_installwm b/dh_installwm
index 4290b75..1be2500 100755
--- a/dh_installwm
+++ b/dh_installwm
@@ -96,14 +96,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! $dh{NOSCRIPTS}) {
WM: foreach my $wm (@wm) {
- autoscript($package,"prerm","prerm-wm","s:#WM#:$wm:g");
+ autoscript($package,"prerm","prerm-wm", { 'WM' => $wm });
my $wmman;
if (! compat(5)) {
foreach my $ext (".1", ".1x") {
$wmman="/usr/share/man/man1/".basename($wm).$ext;
if (-e "$tmp$wmman" || -e "$tmp$wmman.gz") {
- autoscript($package,"postinst","postinst-wm","s:#WM#:$wm:g;s:#WMMAN#:$wmman.gz:g;s/#PRIORITY#/$dh{PRIORITY}/g",);
+ autoscript($package,"postinst","postinst-wm", { 'WM' => $wm, 'WMMAN' => "${wmman}.gz" , 'PRIORITY' => $dh{PRIORITY} });
next WM;
}
}
@@ -114,7 +114,7 @@ WM: foreach my $wm (@wm) {
warning("no manpage found (creating an x-window-manager alternative requires a slave symlink for the manpage)");
}
# Reaching this code means a broken package will be produced.
- autoscript($package,"postinst","postinst-wm-noman","s:#WM#:$wm:g;s/#PRIORITY#/$dh{PRIORITY}/g",);
+ autoscript($package,"postinst","postinst-wm-noman", { 'WM' => $wm, 'PRIORITY' => $dh{PRIORITY} });
}
}
}
diff --git a/dh_installxfonts b/dh_installxfonts
index cc05aa5..444dc19 100755
--- a/dh_installxfonts
+++ b/dh_installxfonts
@@ -81,9 +81,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
}
autoscript($package, "postinst", "postinst-xfonts",
- "s:#CMDS#:".join(";", @cmds, @cmds_postinst).":g");
+ { 'CMDS' => join(";", @cmds, @cmds_postinst) });
autoscript($package, "postrm", "postrm-xfonts",
- "s:#CMDS#:".join(";", @cmds, @cmds_postrm).":g");
+ { 'CMDS' => join(";", @cmds, @cmds_postrm) });
addsubstvar($package, "misc:Depends", "xfonts-utils");
}
diff --git a/dh_systemd_enable b/dh_systemd_enable
index 9a256b0..c06f3c0 100755
--- a/dh_systemd_enable
+++ b/dh_systemd_enable
@@ -255,12 +255,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
for my $unit (sort @units) {
my $base = basename($unit);
if ($dh{NO_ENABLE}) {
- autoscript($package, "postinst", "postinst-systemd-dont-enable", "s/#UNITFILE#/$base/");
+ autoscript($package, 'postinst', 'postinst-systemd-dont-enable', { 'UNITFILE' => $base });
} else {
- autoscript($package, "postinst", "postinst-systemd-enable", "s/#UNITFILE#/$base/");
+ autoscript($package, 'postinst', 'postinst-systemd-enable', { 'UNITFILE' => $base });
}
}
- autoscript($package, "postrm", "postrm-systemd", "s/#UNITFILES#/$unitargs/");
+ autoscript($package, 'postrm', 'postrm-systemd', {'UNITFILES' => $unitargs });
# init-system-helpers ships deb-systemd-helper which we use in our
# autoscripts
diff --git a/dh_systemd_start b/dh_systemd_start
index 740a311..5c0297c 100755
--- a/dh_systemd_start
+++ b/dh_systemd_start
@@ -223,7 +223,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $sd_autoscript = sub {
my ($script, $filename) = @_;
my $unitargs = join(" ", sort map { basename($_) } @units);
- autoscript($package, $script, $filename, "s/#UNITFILES#/$unitargs/");
+ autoscript($package, $script, $filename, { 'UNITFILES' => $unitargs });
};
if ($dh{RESTART_AFTER_UPGRADE}) {
diff --git a/dh_ucf b/dh_ucf
index 4f940dc..6d71204 100755
--- a/dh_ucf
+++ b/dh_ucf
@@ -78,8 +78,13 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
foreach my $set (@ucf) {
my $src = $set->[0];
my $dest = $set->[1];
- autoscript($package,"postinst","postinst-ucf","s:#UCFSRC#:$src:g;s:#UCFDEST#:$dest:g;s/#PACKAGE#/$package/g",);
- autoscript($package,"postrm","postrm-ucf","s:#UCFDEST#:$dest:g;s/#PACKAGE#/$package/g");
+ if (compat(10)) {
+ autoscript($package,"postinst","postinst-ucf","s:#UCFSRC#:$src:g;s:#UCFDEST#:$dest:g;s/#PACKAGE#/$package/g",);
+ autoscript($package,"postrm","postrm-ucf","s:#UCFDEST#:$dest:g;s/#PACKAGE#/$package/g");
+ } else {
+ autoscript($package, 'postinst', 'postinst-ucf', { 'UCFSRC' => $src, 'UCFDEST' => $dest, 'PACKAGE' => $package });
+ autoscript($package, 'postrm', 'postrm-ucf', { 'UCFDEST' => $dest, 'PACKAGE' => '$package' });
+ }
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list