diff options
author | cturner <devnull@localhost> | 2003-03-09 17:53:35 +0000 |
---|---|---|
committer | cturner <devnull@localhost> | 2003-03-09 17:53:35 +0000 |
commit | 477a3e0e3cc64d346c72a645828eda0dd75cf832 (patch) | |
tree | 93477c22d95bcb0ec75c1513290a6fdb699daeab /perl-RPM2 | |
parent | 6da035db569794121d4311a34754fb268cf68702 (diff) | |
download | librpm-tizen-477a3e0e3cc64d346c72a645828eda0dd75cf832.tar.gz librpm-tizen-477a3e0e3cc64d346c72a645828eda0dd75cf832.tar.bz2 librpm-tizen-477a3e0e3cc64d346c72a645828eda0dd75cf832.zip |
add expand_macro
CVS patchset: 6668
CVS date: 2003/03/09 17:53:35
Diffstat (limited to 'perl-RPM2')
-rw-r--r-- | perl-RPM2/RPM2.xs | 11 | ||||
-rw-r--r-- | perl-RPM2/test.pl | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/perl-RPM2/RPM2.xs b/perl-RPM2/RPM2.xs index b05c03375..83ca883a2 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 24c6a66d9..c3c7b4b03 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"); |