From: cturner Date: Sun, 9 Mar 2003 17:53:35 +0000 (+0000) Subject: add expand_macro X-Git-Tag: rpm-4.4-release~672 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=477a3e0e3cc64d346c72a645828eda0dd75cf832;p=platform%2Fupstream%2Frpm.git add expand_macro CVS patchset: 6668 CVS date: 2003/03/09 17:53:35 --- diff --git a/perl-RPM2/RPM2.xs b/perl-RPM2/RPM2.xs index b05c033..83ca883 100644 --- a/perl-RPM2/RPM2.xs +++ b/perl-RPM2/RPM2.xs @@ -49,6 +49,17 @@ delete_macro(pkg, name) CODE: delMacro(NULL, name); +void +expand_macro(pkg, str) + char * pkg + char * str + PREINIT: + char *ret; + PPCODE: + ret = rpmExpand(str, NULL); + PUSHs(sv_2mortal(newSVpv(ret, 0))); + free(ret); + int rpmvercmp(one, two) char* one diff --git a/perl-RPM2/test.pl b/perl-RPM2/test.pl index 24c6a66..c3c7b4b 100644 --- a/perl-RPM2/test.pl +++ b/perl-RPM2/test.pl @@ -11,7 +11,7 @@ use strict; use Test; use strict; -BEGIN { plan tests => 30 }; +BEGIN { plan tests => 33 }; use RPM2; ok(1); # If we made it this far, we're ok. @@ -111,3 +111,8 @@ else { ok(1); } +ok(RPM2->expand_macro("%%foo") eq "%foo"); +RPM2->add_macro("rpm2_test_macro", "testval $$"); +ok(RPM2->expand_macro("%rpm2_test_macro") eq "testval $$"); +RPM2->delete_macro("rpm2_test_macro"); +ok(RPM2->expand_macro("%rpm2_test_macro") eq "%rpm2_test_macro");