From 6a41ca798367d45ee927700efa2d616bd2f2fe1d Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 9 Sep 2005 12:53:48 +0000 Subject: Make URPM::add_macro expand literal \n to \\\n in macro definitions. add URPM::add_macro_noexpand to get the old (rpmlib like) behaviour --- URPM.pm | 14 +++++++++++++- URPM.xs | 2 +- 2 files changed, 14 insertions(+), 2 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. diff --git a/URPM.xs b/URPM.xs index 840a0ea..ce42e87 100644 --- a/URPM.xs +++ b/URPM.xs @@ -3627,7 +3627,7 @@ expand(name) XPUSHs(sv_2mortal(newSVpv(value, 0))); void -add_macro(macro) +add_macro_noexpand(macro) char * macro CODE: rpmDefineMacro(NULL, macro, RMIL_DEFAULT); -- cgit v1.2.1