aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-09 12:53:48 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-09 12:53:48 +0000
commit6a41ca798367d45ee927700efa2d616bd2f2fe1d (patch)
treec25e5453a5e952230a9e2931b479a90704909209 /URPM.pm
parentd0b9de36bc70bbf05c1b30901736c23306f20d0e (diff)
downloadperl-URPM-6a41ca798367d45ee927700efa2d616bd2f2fe1d.tar
perl-URPM-6a41ca798367d45ee927700efa2d616bd2f2fe1d.tar.gz
perl-URPM-6a41ca798367d45ee927700efa2d616bd2f2fe1d.tar.bz2
perl-URPM-6a41ca798367d45ee927700efa2d616bd2f2fe1d.tar.xz
perl-URPM-6a41ca798367d45ee927700efa2d616bd2f2fe1d.zip
Make URPM::add_macro expand literal \n to \\\n in macro definitions.
add URPM::add_macro_noexpand to get the old (rpmlib like) behaviour
Diffstat (limited to 'URPM.pm')
-rw-r--r--URPM.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/URPM.pm b/URPM.pm
index 3271c3c..74dc776 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -10,7 +10,7 @@ use URPM::Resolve;
use URPM::Signature;
our @ISA = qw(DynaLoader);
-our $VERSION = '1.26';
+our $VERSION = '1.27';
URPM->bootstrap($VERSION);
@@ -158,6 +158,13 @@ sub traverse_tag {
$count;
}
+sub add_macro {
+ my ($s) = @_;
+ #- quote for rpmlib, *sigh*
+ $s =~ s/\n/\\\n/g;
+ add_macro_noexpand($s);
+}
+
package URPM::Package;
our @ISA = qw(); # help perl_checker
@@ -634,11 +641,16 @@ Expands the specified macro.
=item add_macro($macro_definition)
+=item add_macro_noexpand($macro_definition)
+
Define a macro. For example,
URPM::add_macro("vendor Mandrakesoft");
my $vendor = URPM::expand("%vendor");
+The 'noexpand' version doesn't expand literal newline characters in the
+macro definition.
+
=item del_macro($name)
Delete a macro.