From 2a353c054d97436a52ac5d558558da7a7d5d45f3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 15 Nov 2006 11:49:00 +0000 Subject: add a wrapper in perl around parse_hdlist and parse_synthesis --- URPM.pm | 17 +++++++++++++++++ URPM.xs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/URPM.pm b/URPM.pm index 9169e18..012f69c 100644 --- a/URPM.pm +++ b/URPM.pm @@ -158,6 +158,23 @@ sub traverse_tag { $count; } +sub parse_hdlist_or_synthesis { + my ($parse_func, $urpm, $file, %options) = @_; + + my $previous_indice = @{$urpm->{depslist}}; + if (my ($start, $end) = $parse_func->($urpm, $file, %options)) { + ($start, $end); + } else { + #- parse_hdlist__XS may have added some pkgs to {depslist}, + #- but we don't want those pkgs since reading hdlist failed later. + #- so we need to drop them + splice(@{$urpm->{depslist}}, $previous_indice); + (); + } +} +sub parse_synthesis { parse_hdlist_or_synthesis(\&parse_synthesis__XS, @_) } +sub parse_hdlist { parse_hdlist_or_synthesis(\&parse_hdlist__XS, @_) } + sub add_macro { my ($s) = @_; #- quote for rpmlib, *sigh* diff --git a/URPM.xs b/URPM.xs index 8605c22..3542f15 100644 --- a/URPM.xs +++ b/URPM.xs @@ -2992,7 +2992,7 @@ Urpm_ranges_overlap(a, b, b_nopromote=1) RETVAL void -Urpm_parse_synthesis(urpm, filename, ...) +Urpm_parse_synthesis__XS(urpm, filename, ...) SV *urpm char *filename PPCODE: @@ -3066,7 +3066,7 @@ Urpm_parse_synthesis(urpm, filename, ...) } else croak("first argument should be a reference to a HASH"); void -Urpm_parse_hdlist(urpm, filename, ...) +Urpm_parse_hdlist__XS(urpm, filename, ...) SV *urpm char *filename PPCODE: -- cgit v1.2.1