summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-15 18:43:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-15 18:43:23 +0000
commitd306a62a151da775832bf9a1b307e686100ea8b2 (patch)
treeaadfb4fae4739ffd5de00e67dbcdcaeb6d1afb64 /urpm.pm
parent90f8d250f95d8d2d5c36eb1139a98689ef6bcee6 (diff)
downloadurpmi-d306a62a151da775832bf9a1b307e686100ea8b2.tar
urpmi-d306a62a151da775832bf9a1b307e686100ea8b2.tar.gz
urpmi-d306a62a151da775832bf9a1b307e686100ea8b2.tar.bz2
urpmi-d306a62a151da775832bf9a1b307e686100ea8b2.tar.xz
urpmi-d306a62a151da775832bf9a1b307e686100ea8b2.zip
create recover_url_from_list() out of probe_medium()
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm56
1 files changed, 32 insertions, 24 deletions
diff --git a/urpm.pm b/urpm.pm
index 29208e5c..f83b335e 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -220,6 +220,36 @@ sub remove_passwords_and_write_private_netrc {
chmod 0600, $urpm->{private_netrc};
}
+#- handle deprecated way of saving passwords
+sub recover_url_from_list {
+ my ($urpm, $medium) = @_;
+
+ my %probe;
+ if (-r statedir_list($urpm, $medium)) {
+ if (my $listfile = $urpm->open_safe("<", statedir_list($urpm, $medium))) {
+ local $_;
+ while (<$listfile>) {
+ #- /./ is end of url marker in list file (typically generated by a
+ #- find . -name "*.rpm" > list
+ #- for exportable list file.
+ m|^(.*)/\./| and $probe{$1} = undef;
+ m|^(.*)/[^/]*$| and $probe{$1} = undef;
+ }
+ }
+ }
+ foreach (sort { length($a) <=> length($b) } keys %probe) {
+ if ($medium->{url}) {
+ if ($medium->{url} ne substr($_, 0, length($medium->{url}))) {
+ $medium->{ignore} or $urpm->{error}(N("inconsistent list file for \"%s\", medium ignored", $medium->{name}));
+ $medium->{ignore} = 1;
+ last;
+ }
+ } else {
+ $medium->{url} = $_;
+ }
+ }
+}
+
#- Loads /etc/urpmi/urpmi.cfg and performs basic checks.
#- Does not handle old format: <name> <url> [with <path_hdlist>]
#- options :
@@ -380,30 +410,8 @@ sub probe_medium {
#- there is a little more to do at this point as url is not known, inspect directly list file for it.
unless ($medium->{url}) {
- my %probe;
- if (-r statedir_list($urpm, $medium)) {
- if (my $listfile = $urpm->open_safe("<", statedir_list($urpm, $medium))) {
- local $_;
- while (<$listfile>) {
- #- /./ is end of url marker in list file (typically generated by a
- #- find . -name "*.rpm" > list
- #- for exportable list file.
- m|^(.*)/\./| and $probe{$1} = undef;
- m|^(.*)/[^/]*$| and $probe{$1} = undef;
- }
- }
- }
- foreach (sort { length($a) <=> length($b) } keys %probe) {
- if ($medium->{url}) {
- if ($medium->{url} ne substr($_, 0, length($medium->{url}))) {
- $medium->{ignore} or $urpm->{error}(N("inconsistent list file for \"%s\", medium ignored", $medium->{name}));
- $medium->{ignore} = 1;
- last;
- }
- } else {
- $medium->{url} = $_;
- }
- }
+ recover_url_from_list($urpm, $medium);
+
unless ($options{nocheck_access}) {
unless ($medium->{url}) {
$medium->{ignore} or $urpm->{error}(N("unable to inspect list file for \"%s\", medium ignored", $medium->{name}));