diff options
-rw-r--r-- | urpm.pm | 56 |
1 files changed, 32 insertions, 24 deletions
@@ -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})); |