diff options
-rw-r--r-- | urpm.pm | 14 | ||||
-rw-r--r-- | urpm/ldap.pm | 16 | ||||
-rw-r--r-- | urpm/util.pm | 3 | ||||
-rwxr-xr-x | urpmi | 2 |
4 files changed, 27 insertions, 8 deletions
@@ -1201,7 +1201,7 @@ this could happen if you mounted manually the directory when creating the medium #- we can assume at this point a basename is existing, but it needs #- to be checked for being valid, nothing can be deduced if no MD5SUM #- file is present. - my $basename = basename($with_hdlist_dir); + my $basename = urpm::download::basename($with_hdlist_dir); unless ($medium->{virtual}) { if ($medium->{with_hdlist}) { @@ -1460,7 +1460,7 @@ this could happen if you mounted manually the directory when creating the medium #- we can assume at this point a basename is existing, but it needs #- to be checked for being valid, nothing can be deduced if no MD5SUM #- file is present. - $basename = basename($medium->{with_hdlist}); + $basename = urpm::download::basename($medium->{with_hdlist}); unlink "$urpm->{cachedir}/partial/MD5SUM"; eval { @@ -1544,7 +1544,7 @@ this could happen if you mounted manually the directory when creating the medium : _probe_with_try_list(_guess_hdlist_suffix($dir), $options{probe_with}) ); foreach my $with_hdlist (@probe_list) { - $basename = basename($with_hdlist) or next; + $basename = urpm::download::basename($with_hdlist) or next; $options{force} and unlink "$urpm->{cachedir}/partial/$basename"; eval { $urpm->{sync}( @@ -1568,7 +1568,7 @@ this could happen if you mounted manually the directory when creating the medium } } } else { - $basename = basename($medium->{with_hdlist}); + $basename = urpm::download::basename($medium->{with_hdlist}); #- try to sync (copy if needed) local copy after restored the previous one. $options{force} and unlink "$urpm->{cachedir}/partial/$basename"; @@ -3333,7 +3333,7 @@ sub check_sources_signatures { } } - map { ($options{basename} ? basename($_) : $_) . ($options{translate} ? ": $invalid_sources{$_}" : "") } + map { ($options{basename} ? urpm::download::basename($_) : $_) . ($options{translate} ? ": $invalid_sources{$_}" : "") } sort keys %invalid_sources; } @@ -3357,7 +3357,9 @@ sub get_updates_description { foreach (map { $urpm->dump_description_file($_->{name}), '%package dummy' } @update_medias) { /^%package (.+)/ and do { - exists $cur->{importance} && !member($cur->{importance}, qw(security bugfix)) and $cur->{importance} = 'normal'; + if (exists $cur->{importance} && $cur->{importance} ne "security" && $cur->{importance} ne "bugfix") { + $cur->{importance} = 'normal'; + } $update_descr{$_} = $cur foreach @{$cur->{pkgs}}; $cur = {}; $cur->{pkgs} = [ split /\s/, $1 ]; diff --git a/urpm/ldap.pm b/urpm/ldap.pm index 79710654..510107ea 100644 --- a/urpm/ldap.pm +++ b/urpm/ldap.pm @@ -78,11 +78,25 @@ sub check_ldap_medium($) { return $medium->{name} && $medium->{clear_url}; } +sub get_vars_from_sh { + my $filename = $_[0]; + my %l; + open my $fh, $filename or return (); + local $_; + while (<$fh>) { + s/#.*//; s/^\s*//; s/\s*$// + my ($key, $val) = /^(\w+)=(.*)/ or next; + $val =~ s/^(["'])(.*)\1$/$2/; + $l{$key} = $val; + } + %l; +} + sub read_ldap_cache($%) { my ($urpm, %options) = @_; foreach (glob("$urpm->{cachedir}/ldap/*")) { ! -f $_ and next; - my %medium = getVarsFromSh($_); + my %medium = get_vars_from_sh($_); next if !check_ldap_medium(\%medium); $urpm->probe_medium(\%medium, %options) and push @{$urpm->{media}}, \%medium; } diff --git a/urpm/util.pm b/urpm/util.pm index 0423a094..008f2e89 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -7,6 +7,7 @@ our @EXPORT = qw(quotespace unquotespace remove_internal_name reduce_pathname offset_pathname md5sum untaint + difference2 ); #- quoting/unquoting a string that may be containing space chars. @@ -94,6 +95,8 @@ sub move { rename($file, $dest) or !system("/bin/mv", "-f", $file, $dest); } +sub difference2 { my %l; @l{@{$_[1]}} = (); grep { !exists $l{$_} } @{$_[0]} } + 1; __END__ @@ -22,7 +22,7 @@ use strict; use urpm; use urpm::args; use urpm::msg; -use urpm::util qw(untaint); +use urpm::util qw(untaint difference2); #- contains informations to parse installed system. my $urpm = new urpm; |