From 6fbc3cbea8cb4180d0f14f7988c969b0c20cfc8a Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 2 Jun 2005 07:24:30 +0000 Subject: Add support for deltarpms --- urpm.pm | 13 ++++++++++++- urpm/sys.pm | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/urpm.pm b/urpm.pm index b112d8c2..68165464 100644 --- a/urpm.pm +++ b/urpm.pm @@ -2928,6 +2928,7 @@ sub install { } my ($update, @l) = 0; + my @produced_deltas; foreach (@$remove) { if ($trans->remove($_)) { @@ -2940,8 +2941,17 @@ sub install { foreach (keys %$mode) { my $pkg = $urpm->{depslist}[$_]; $pkg->update_header($mode->{$_}); + 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 + } else { + $urpm->{error}(N("unable to extract rpm from delta-rpm package %s", $mode->{$_})); + } + } if ($trans->add($pkg, update => $update, - $options{excludepath} ? (excludepath => [ split ',', $options{excludepath} ]) : ())) { + $options{excludepath} ? (excludepath => [ split /,/, $options{excludepath} ]) : () + )) { $urpm->{log}(N("adding package %s (id=%d, eid=%d, update=%d, file=%s)", scalar($pkg->fullname), $_, $pkg->id, $update, $mode->{$_})); } else { @@ -2993,6 +3003,7 @@ sub install { } } } + unlink @produced_deltas; #- now exit or return according to current status. if (defined $pid && !$pid) { #- child process diff --git a/urpm/sys.pm b/urpm/sys.pm index c8d65313..3c53f62b 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -130,10 +130,11 @@ sub check_fs_writable () { #- returns the new rpm filename in case of success #- params : #- $deltarpm : full pathname of the deltarpm +#- $dir : directory where to put the produced rpm (optional) #- $pkg : URPM::Package object corresponding to the deltarpm (optional) our $APPLYDELTARPM = '/usr/bin/applydeltarpm'; sub apply_delta_rpm { - my ($deltarpm, $pkg) = @_; + my ($deltarpm, $dir, $pkg) = @_; -x $APPLYDELTARPM or return 0; -e $deltarpm or return 0; my $rpm; @@ -143,6 +144,7 @@ sub apply_delta_rpm { $rpm = qx(rpm -qp --qf '%{name}-%{version}-%{release}.%{arch}.rpm' '$deltarpm'); } $rpm or return 0; + $rpm = $dir . '/' . $rpm; unlink $rpm; system($APPLYDELTARPM, '-vp', $deltarpm, $rpm); -e $rpm ? $rpm : ''; -- cgit v1.2.1