summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-05-04 14:47:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-05-04 14:47:19 +0000
commitab0cfb7370c3c3cef0cdb8d8290937274679bcad (patch)
treead5852b0b4ec132bdb2d404147a1fc395464126c
parent42695e87b3daf98dc387a80e0e61eb839046e63d (diff)
downloadurpmi-ab0cfb7370c3c3cef0cdb8d8290937274679bcad.tar
urpmi-ab0cfb7370c3c3cef0cdb8d8290937274679bcad.tar.gz
urpmi-ab0cfb7370c3c3cef0cdb8d8290937274679bcad.tar.bz2
urpmi-ab0cfb7370c3c3cef0cdb8d8290937274679bcad.tar.xz
urpmi-ab0cfb7370c3c3cef0cdb8d8290937274679bcad.zip
- in urpmi.addmedia, if a "with" argument was provided on the command-line,
don't probe for synthesis or hdlist files in other directories - check return value from system("cp"...) and log errors
-rw-r--r--urpm.pm38
-rwxr-xr-xurpmi8
2 files changed, 30 insertions, 16 deletions
diff --git a/urpm.pm b/urpm.pm
index 05c406d9..09b41d8a 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -664,7 +664,7 @@ sub add_distrib_media {
# (Olivier Thauvin): Is this a workaround ?
$urpm->{media} or $urpm->read_config;
- #- try to copy/retrive Mandrake/basehdlists file.
+ #- try to copy/retrieve Mandrake/basehdlists file.
if (my ($dir) = $url =~ m!^(?:removable[^:]*|file):/(.*)!) {
$hdlists_file = reduce_pathname("$dir/Mandrake/base/hdlists");
@@ -1151,7 +1151,10 @@ this could happen if you mounted manually the directory when creating the medium
my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list';
my $path_list = reduce_pathname("$with_hdlist_dir/../$local_list");
-e $path_list or $path_list = "$dir/list";
- -e $path_list and system("cp", "-p", "-R", $path_list, "$urpm->{cachedir}/partial/list");
+ if (-e $path_list) {
+ system("cp", "-p", "-R", $path_list, "$urpm->{cachedir}/partial/list")
+ and $urpm->{log}(N("...copying failed"));
+ }
}
} else {
#- try to find rpm files, use recursive method, added additional
@@ -1205,7 +1208,9 @@ this could happen if you mounted manually the directory when creating the medium
my $local_pubkey = $medium->{with_hdlist} =~ /hdlist(.*)\.cz2?$/ ? "pubkey$1" : 'pubkey';
my $path_pubkey = reduce_pathname("$with_hdlist_dir/../$local_pubkey");
-e $path_pubkey or $path_pubkey = "$dir/pubkey";
- -e $path_pubkey and system("cp", "-p", "-R", $path_pubkey, "$urpm->{cachedir}/partial/pubkey");
+ -e $path_pubkey
+ and system("cp", "-p", "-R", $path_pubkey, "$urpm->{cachedir}/partial/pubkey")
+ and $urpm->{log}(N("...copying failed"));
}
} else {
my $basename;
@@ -1326,11 +1331,12 @@ this could happen if you mounted manually the directory when creating the medium
$options{callback} && $options{callback}('retrieve', $medium->{name});
if ($options{probe_with}) {
my ($suffix) = $dir =~ m|RPMS([^/]*)/*$|;
-
- foreach my $with_hdlist (
- $medium->{with_hdlist},
- _probe_with_try_list($suffix, $options{probe_with})
- ) {
+ my @probe_list = (
+ $medium->{with_hdlist}
+ ? $medium->{with_hdlist}
+ : _probe_with_try_list($suffix, $options{probe_with})
+ );
+ foreach my $with_hdlist (@probe_list) {
$basename = basename($with_hdlist) or next;
$options{force} and unlink "$urpm->{cachedir}/partial/$basename";
@@ -1355,13 +1361,17 @@ this could happen if you mounted manually the directory when creating the medium
$options{force} and unlink "$urpm->{cachedir}/partial/$basename";
unless ($options{force}) {
if ($medium->{synthesis}) {
- -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" and
- system("cp", "-p", "-R",
- "$urpm->{statedir}/synthesis.$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ -e "$urpm->{statedir}/synthesis.$medium->{hdlist}"
+ and system("cp", "-p", "-R",
+ "$urpm->{statedir}/synthesis.$medium->{hdlist}",
+ "$urpm->{cachedir}/partial/$basename")
+ and $urpm->{log}(N("...copying failed"));
} else {
- -e "$urpm->{statedir}/$medium->{hdlist}" and
- system("cp", "-p", "-R",
- "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ -e "$urpm->{statedir}/$medium->{hdlist}"
+ and system("cp", "-p", "-R",
+ "$urpm->{statedir}/$medium->{hdlist}",
+ "$urpm->{cachedir}/partial/$basename")
+ and $urpm->{log}(N("...copying failed"));
}
}
eval {
diff --git a/urpmi b/urpmi
index 32affb6f..1d0746c5 100755
--- a/urpmi
+++ b/urpmi
@@ -231,7 +231,8 @@ if ($bug) {
? N("Directory [%s] already exists, please use another directory for bug report or delete it")
: N("Unable to create directory [%s] for bug report"), $bug));
#- copy all synthesis file used, along with configuration of urpmi
- system("cp", "-af", $urpm->{skiplist}, $urpm->{instlist}, $bug);
+ system("cp", "-af", $urpm->{skiplist}, $urpm->{instlist}, $bug)
+ and die N("Copying failed");
#- allow log file.
$log = "$bug/urpmi.log";
}
@@ -348,7 +349,10 @@ if ($bug) {
$urpm->write_config;
#- handle local packages, copy them directly in bug environment.
foreach (keys %requested) {
- $urpm->{source}{$_} and system "cp", "-af", $urpm->{source}{$_}, $bug;
+ if ($urpm->{source}{$_}) {
+ system "cp", "-af", $urpm->{source}{$_}, $bug
+ and die N("Copying failed");
+ }
}
}