summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-06-08 18:51:17 +0000
committerThierry Vignaud <tv@mageia.org>2012-06-08 18:51:17 +0000
commit036cd696331f2353eb569935de67b700561ca5a5 (patch)
tree3279c1883cd9608dc1ec59f939e2d5640fc5feea
parent4c7e1ea9351e196229ed69cdbed5d0a0dc1a4bf4 (diff)
downloadurpmi-036cd696331f2353eb569935de67b700561ca5a5.tar
urpmi-036cd696331f2353eb569935de67b700561ca5a5.tar.gz
urpmi-036cd696331f2353eb569935de67b700561ca5a5.tar.bz2
urpmi-036cd696331f2353eb569935de67b700561ca5a5.tar.xz
urpmi-036cd696331f2353eb569935de67b700561ca5a5.zip
(_install_src) split it out of run()
-rw-r--r--urpm/main_loop.pm33
1 files changed, 19 insertions, 14 deletions
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;
}