summaryrefslogtreecommitdiffstats
path: root/urpm/sys.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-02 05:43:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-02 05:43:10 +0000
commitab22c28406edf9904ccf1006cef1d59c5baabb0f (patch)
treebef2ac929a4fa1795ca54ec319393ea3be716823 /urpm/sys.pm
parent80cc38f20f2fde216705d8f7499df521666d4b27 (diff)
downloadurpmi-ab22c28406edf9904ccf1006cef1d59c5baabb0f.tar
urpmi-ab22c28406edf9904ccf1006cef1d59c5baabb0f.tar.gz
urpmi-ab22c28406edf9904ccf1006cef1d59c5baabb0f.tar.bz2
urpmi-ab22c28406edf9904ccf1006cef1d59c5baabb0f.tar.xz
urpmi-ab22c28406edf9904ccf1006cef1d59c5baabb0f.zip
Don't shell out unless necessary
Diffstat (limited to 'urpm/sys.pm')
-rw-r--r--urpm/sys.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 8c7ffb97..c8d65313 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -128,12 +128,20 @@ sub check_fs_writable () {
#- create a plain rpm from an installed rpm and a delta rpm (in the current directory)
#- returns the new rpm filename in case of success
+#- params :
+#- $deltarpm : full pathname of the deltarpm
+#- $pkg : URPM::Package object corresponding to the deltarpm (optional)
our $APPLYDELTARPM = '/usr/bin/applydeltarpm';
sub apply_delta_rpm {
- my ($deltarpm) = @_;
+ my ($deltarpm, $pkg) = @_;
-x $APPLYDELTARPM or return 0;
-e $deltarpm or return 0;
- my $rpm = qx(rpm -qp --qf '%{name}-%{version}-%{release}.%{arch}.rpm' '$deltarpm');
+ my $rpm;
+ if ($pkg) {
+ $rpm = $pkg->name . '-' . $pkg->version . '-' . $pkg->release . '.' . $pkg->arch . '.rpm';
+ } else {
+ $rpm = qx(rpm -qp --qf '%{name}-%{version}-%{release}.%{arch}.rpm' '$deltarpm');
+ }
$rpm or return 0;
unlink $rpm;
system($APPLYDELTARPM, '-vp', $deltarpm, $rpm);