From 036cd696331f2353eb569935de67b700561ca5a5 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 8 Jun 2012 18:51:17 +0000 Subject: (_install_src) split it out of run() --- urpm/main_loop.pm | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'urpm') diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index 68631584..6e66571b 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -124,6 +124,24 @@ sub _verify_rpm { } } +sub _install_src { + my ($urpm, $nok, $transaction_sources_install, $transaction_sources) = @_; + if (my @l = grep { /\.src\.rpm$/ } values %$transaction_sources_install, values %$transaction_sources) { + my $rpm_opt = $options{verbose} >= 0 ? 'vh' : ''; + system("rpm", "-i$rpm_opt", @l, ($urpm->{root} ? ("--root", $urpm->{root}) : @{[]})); + #- Warning : the following message is parsed in urpm::parallel_* + if ($?) { + $urpm->{print}(N("Installation failed")); + ++$nok; + } elsif ($urpm->{options}{'post-clean'}) { + if (my @tmp_srpm = grep { urpm::is_temporary_file($urpm, $_) } @l) { + $urpm->{log}(N("removing installed rpms (%s)", join(' ', @tmp_srpm))); + unlink @tmp_srpm; + } + } + } +} + # locking is left to callers sub run { my ($urpm, $state, $something_was_to_be_done, $ask_unselect, $_requested, $callbacks) = @_; @@ -221,20 +239,7 @@ sub run { #- install source package only (whatever the user is root or not, but use rpm for that). if ($install_src) { - if (my @l = grep { /\.src\.rpm$/ } values %transaction_sources_install, values %$transaction_sources) { - my $rpm_opt = $options{verbose} >= 0 ? 'vh' : ''; - system("rpm", "-i$rpm_opt", @l, ($urpm->{root} ? ("--root", $urpm->{root}) : @{[]})); - #- Warning : the following message is parsed in urpm::parallel_* - if ($?) { - $urpm->{print}(N("Installation failed")); - ++$nok; - } elsif ($urpm->{options}{'post-clean'}) { - if (my @tmp_srpm = grep { urpm::is_temporary_file($urpm, $_) } @l) { - $urpm->{log}(N("removing installed rpms (%s)", join(' ', @tmp_srpm))); - unlink @tmp_srpm; - } - } - } + _install_src($urpm, $nok, \%transaction_sources_install, $transaction_sources); next; } -- cgit v1.2.1