summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-05-21 03:53:21 +0200
committerGuillem Jover <guillem@debian.org>2012-05-23 09:09:24 +0200
commitbfc61827201aadb05bdff25e259490a02c5319e5 (patch)
tree75f153c837667aed928b946e6365546de57857b9
parentf62054b8d94cbd514bf2d8fc824c8e81389b9d96 (diff)
downloaddpkg-bfc61827201aadb05bdff25e259490a02c5319e5.tar.gz
Dpkg::Substvars: Add new member function set_as_used()
This sets a subtsvar and marks it as used, so no warnings are produced even if the variable is never used.
-rw-r--r--debian/changelog1
-rw-r--r--scripts/Dpkg/Substvars.pm15
2 files changed, 15 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 2771f2258..2bb057a92 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,7 @@ dpkg (1.16.4) UNRELEASED; urgency=low
* Do not obscure Dpkg::Source::Package ‘require’ errors with custom
error message. Thanks to Thomas Adam <thomas.adam@smoothwall.net> and
Jonathan Nieder <jrnieder@gmail.com>.
+ * Add new Dpkg::Substvars::set_as_used() member function.
[ Updated man page translations ]
* German (Helge Kreutzmann).
diff --git a/scripts/Dpkg/Substvars.pm b/scripts/Dpkg/Substvars.pm
index 229a41518..0c2ce5373 100644
--- a/scripts/Dpkg/Substvars.pm
+++ b/scripts/Dpkg/Substvars.pm
@@ -18,7 +18,7 @@ package Dpkg::Substvars;
use strict;
use warnings;
-our $VERSION = "1.00";
+our $VERSION = "1.01";
use Dpkg qw($version);
use Dpkg::Arch qw(get_host_arch);
@@ -94,6 +94,19 @@ sub set {
$self->{'vars'}{$key} = $value;
}
+=item $s->set_as_used($key, $value)
+
+Add/replace a substitution and mark it as used (no warnings will be produced
+even if unused).
+
+=cut
+
+sub set_as_used {
+ my ($self, $key, $value) = @_;
+ $self->set($key, $value);
+ $self->no_warn($key);
+}
+
=item $s->get($key)
Get the value of a given substitution.