diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-11-16 20:11:31 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-11-16 20:11:31 +0000 |
commit | 377d39737813c83eb8dd6a346c31e18b84917590 (patch) | |
tree | b0eb891069d07f0aaf4a6cd7e4749928e186cf28 | |
parent | b7b740b82f1f504e215dd48237ded85ba74217ca (diff) | |
download | urpmi-377d39737813c83eb8dd6a346c31e18b84917590.tar urpmi-377d39737813c83eb8dd6a346c31e18b84917590.tar.gz urpmi-377d39737813c83eb8dd6a346c31e18b84917590.tar.bz2 urpmi-377d39737813c83eb8dd6a346c31e18b84917590.tar.xz urpmi-377d39737813c83eb8dd6a346c31e18b84917590.zip |
(_apply_delta_rpm) split it out of _schedule_packages()
-rw-r--r-- | urpm/install.pm | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/urpm/install.pm b/urpm/install.pm index 15f1127c..0a3ae22a 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -187,6 +187,23 @@ sub _schedule_packages_for_erasing { } } +sub _apply_delta_rpm { + my ($urpm, $path, $mode, $pkg) = @_; + my $true_rpm = urpm::sys::apply_delta_rpm($path, "$urpm->{cachedir}/rpms", $pkg); + my $true_pkg; + if ($true_rpm) { + if (my ($id) = $urpm->parse_rpm($true_rpm)) { + $true_pkg = defined $id && $urpm->{depslist}[$id]; + $mode->{$id} = $true_rpm; + } else { + $urpm->{error}("Failed to parse $true_pkg"); + } + } else { + $urpm->{error}(N("unable to extract rpm from delta-rpm package %s", $path)); + } + $true_rpm, $true_pkg; +} + sub _schedule_packages { my ($urpm, $trans, $install, $upgrade, $update, %options) = @_; my (@trans_pkgs, @produced_deltas); @@ -194,20 +211,10 @@ sub _schedule_packages { foreach (keys %$mode) { my $pkg = $urpm->{depslist}[$_]; $pkg->update_header($mode->{$_}, keep_all_tags => 1); - my $true_pkg; + my ($true_rpm, $true_pkg); if ($pkg->payload_format eq 'drpm') { #- handle deltarpms - my $true_rpm = urpm::sys::apply_delta_rpm($mode->{$_}, "$urpm->{cachedir}/rpms", $pkg); - if ($true_rpm) { - push @produced_deltas, ($mode->{$_} = $true_rpm); #- fix path - if (my ($id) = $urpm->parse_rpm($true_rpm)) { - $true_pkg = defined $id && $urpm->{depslist}[$id]; - $mode->{$id} = $true_rpm; - } else { - $urpm->{error}("Failed to parse $true_pkg"); - } - } else { - $urpm->{error}(N("unable to extract rpm from delta-rpm package %s", $mode->{$_})); - } + ($true_rpm, $true_pkg) = _apply_delta_rpm($urpm, $_, $mode, $pkg); + push @produced_deltas, ($mode->{$_} = $true_rpm); #- fix path } if ($trans->add($true_pkg || $pkg, update => $update, $options{excludepath} ? (excludepath => [ split /,/, $options{excludepath} ]) : ())) { |