From 14d3765687545804842f48cb7d0268065da40b69 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 17 Aug 2019 12:41:50 +0000 Subject: dh_installdeb: Allow "+" in token names Signed-off-by: Niels Thykier --- debian/changelog | 7 +++++++ dh_installdeb | 2 +- lib/Debian/Debhelper/Dh_Lib.pm | 4 +++- 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 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); -- cgit v1.2.3