summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-17 12:41:50 +0000
committerNiels Thykier <niels@thykier.net>2019-08-17 12:41:50 +0000
commit14d3765687545804842f48cb7d0268065da40b69 (patch)
treeca829f4fa6b279c924f2fb00476d0f75ab78bdee
parent177d646d200c3a851f32729965b31b2eca83ff46 (diff)
downloaddebhelper-14d3765687545804842f48cb7d0268065da40b69.tar.gz
dh_installdeb: Allow "+" in token names
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog7
-rwxr-xr-xdh_installdeb2
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm4
3 files changed, 11 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index c317e3e2..cd3e8f03 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+debhelper (12.5.1) UNRELEASED; urgency=medium
+
+ * dh_installdeb: Allow "+" to appear in token names as it is
+ a valid character for package names.
+
+ -- Niels Thykier <niels@thykier.net> Sat, 17 Aug 2019 12:40:56 +0000
+
debhelper (12.5) unstable; urgency=medium
[ Niels Thykier ]
diff --git a/dh_installdeb b/dh_installdeb
index 73b7b43f..9f5f24c6 100755
--- a/dh_installdeb
+++ b/dh_installdeb
@@ -200,7 +200,7 @@ the concrete script.
=head2 Limitations in token names
-All tokens intended to be substituted must match the regex: #[A-Za-z0-9_.]+#
+All tokens intended to be substituted must match the regex: #[A-Za-z0-9_.+]+#
Tokens that do not match that regex will be silently ignored.
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 335873f3..7a55e22f 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -185,6 +185,7 @@ our $PKGVERSION_REGEX = qr/
[0-9][0-9A-Za-z.+:~]* # Upstream version (with no hyphens)
(?: - [0-9A-Za-z.+:~]+ )* # Optional debian revision (+ upstreams versions with hyphens)
/xoa;
+our $MAINTSCRIPT_TOKEN_REGEX = qr/[A-Za-z0-9_.+]+/o;
# From Policy 5.1:
#
@@ -2075,10 +2076,11 @@ sub debhelper_script_subst {
verbose_print("[META] Replace #TOKEN#s in \"$tmp/DEBIAN/$script\"");
}
if (not $dh{NO_ACT}) {
+ my $regex = qr{#(${MAINTSCRIPT_TOKEN_REGEX})#}o;
open(my $out_fd, '>', "$tmp/DEBIAN/$script") or error("open($tmp/DEBIAN/$script) failed: $!");
open(my $in_fd, '<', $file) or error("open($file) failed: $!");
while (my $line = <$in_fd>) {
- $line =~ s{#([A-Za-z0-9_.]+)#}{$subst->($1) // "#${1}#"}ge;
+ $line =~ s{$regex}{$subst->($1) // "#${1}#"}ge;
print {$out_fd} $line;
}
close($in_fd);