diff options
author | Francois Pons <fpons@mandriva.com> | 2003-08-06 17:48:14 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-08-06 17:48:14 +0000 |
commit | 3e2545fd4b58874005c9f59a020f0225bb022a52 (patch) | |
tree | d37e020fb7554fdc2eb45d554ab581982c7cee93 | |
parent | c538bae4febfb96cbfceee464836a456b5f93172 (diff) | |
download | urpmi-3e2545fd4b58874005c9f59a020f0225bb022a52.tar urpmi-3e2545fd4b58874005c9f59a020f0225bb022a52.tar.gz urpmi-3e2545fd4b58874005c9f59a020f0225bb022a52.tar.bz2 urpmi-3e2545fd4b58874005c9f59a020f0225bb022a52.tar.xz urpmi-3e2545fd4b58874005c9f59a020f0225bb022a52.zip |
4.4-19mdk
-rw-r--r-- | urpm.pm | 173 | ||||
-rw-r--r-- | urpme | 7 | ||||
-rwxr-xr-x | urpmi | 2 | ||||
-rwxr-xr-x | urpmi.addmedia | 1 | ||||
-rw-r--r-- | urpmi.spec | 11 | ||||
-rwxr-xr-x | urpmi.update | 1 |
6 files changed, 134 insertions, 61 deletions
@@ -431,7 +431,7 @@ sub read_config { $no and $urpm->{options}{$k} = ! $urpm->{options}{$k} || 0; } next; - } elsif (($k, $v) = /^(limit-rate|excludepath|key_ids|split-(?:level|length))\s*:\s*(.*)$/) { + } elsif (($k, $v) = /^(limit-rate|excludepath|key[\-_]ids|split-(?:level|length))\s*:\s*(.*)$/) { unless (exists($urpm->{options}{$k})) { $v =~ /^'([^']*)'$/ and $v = $1; $v =~ /^"([^"]*)"$/ and $v = $1; $urpm->{options}{$k} = $v; @@ -440,17 +440,20 @@ sub read_config { } $_ and $urpm->{error}(N("syntax error in config file at line %s", $.)); } - next }; + exists $urpm->{options}{key_ids} && ! exists $urpm->{options}{'key-ids'} and + $urpm->{options}{'key-ids'} = delete $urpm->{options}{key_ids}; + next }; /^(.*?[^\\])\s+(?:(.*?[^\\])\s+)?{$/ and do { #- urpmi.cfg format extention my $medium = { name => unquotespace($1), clear_url => unquotespace($2) }; while (<F>) { chomp; s/#.*$//; s/^\s*//; s/\s*$//; $_ eq '}' and last; - /^(hdlist|list|with_hdlist|removable|md5sum|key_ids)\s*:\s*(.*)$/ and $medium->{$1} = $2, next; + /^(hdlist|list|with_hdlist|removable|md5sum|key[\-_]ids)\s*:\s*(.*)$/ and $medium->{$1} = $2, next; /^(update|ignore|synthesis|virtual)\s*$/ and $medium->{$1} = 1, next; /^modified\s*$/ and next; $_ and $urpm->{error}(N("syntax error in config file at line %s", $.)); } + exists $medium->{key_ids} && ! exists $medium->{'key-ids'} and $medium->{'key-ids'} = delete $medium->{key_ids}; $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium; next }; /^(.*?[^\\])\s+(.*?[^\\])\s+with\s+(.*)$/ and do { #- urpmi.cfg old format for ftp @@ -665,7 +668,7 @@ sub write_config { } foreach my $medium (@{$urpm->{media}}) { printf F "%s %s {\n", quotespace($medium->{name}), quotespace($medium->{clear_url}); - foreach (qw(hdlist with_hdlist list removable md5sum key_ids)) { + foreach (qw(hdlist with_hdlist list removable md5sum key-ids)) { $medium->{$_} and printf F " %s: %s\n", $_, $medium->{$_}; } foreach (qw(update ignore synthesis modified virtual)) { @@ -1094,9 +1097,13 @@ sub update_media { #- now we need additional methods not defined by default in URPM. require URPM::Build; + require URPM::Signature; $options{nolock} or $urpm->exlock_urpmi_db; + #- get gpg-pubkey signature. + $urpm->{keys} or $urpm->parse_pubkeys(root => $urpm->{root}); + #- examine each medium to see if one of them need to be updated. #- if this is the case and if not forced, try to use a pre-calculated #- hdlist file else build it from rpm files. @@ -1153,8 +1160,10 @@ sub update_media { #- the source hdlist is not used (use force). my ($prefix, $dir, $error, $retrieved_md5sum, @files); - #- always delete a remaining list file in cache. - unlink "$urpm->{cachedir}/partial/list"; + #- always delete a remaining list file or pubkey file in cache. + foreach (qw(list pubkey)) { + unlink "$urpm->{cachedir}/partial/$_"; + } #- check to see if the medium is using file protocol or removable medium. if (($prefix, $dir) = $medium->{url} =~ /^(removable[^:]*|file):\/(.*)/) { @@ -1245,7 +1254,7 @@ this could happen if you mounted manually the directory when creating the medium #- file are present. my ($basename) = $with_hdlist_dir =~ /\/([^\/]+)$/; - if (-s reduce_pathname("$dir/$with_hdlist_dir/../MD5SUM") > 32) { + if (!$options{nomd5sum} && -s reduce_pathname("$dir/$with_hdlist_dir/../MD5SUM") > 32) { if ($options{force}) { #- force downloading the file again, else why a force option has been defined ? delete $medium->{md5sum}; @@ -1378,13 +1387,12 @@ this could happen if you mounted manually the directory when creating the medium #- examine if a local list file is available (always probed according to with_hdlist #- and check hdlist has not be named very strangely... if ($medium->{hdlist} ne 'list') { - my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz$/ ? $1 : 'list'; - if (-s "$dir/$local_list") { - $urpm->{log}(N("copying source list of \"%s\"...", $medium->{name})); - system("cp", "--preserve=mode", "--preserve=timestamps", "-R", - "$dir/$local_list", "$urpm->{cachedir}/partial/list") ? - $urpm->{log}(N("...copying failed")) : $urpm->{log}(N("...copying done")); - } + my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list'; + my $path_list = reduce_pathname("$dir/$with_hdlist_dir/../$local_list"); + -s $path_list or $path_list = reduce_pathname("$dir/$with_hdlist_dir/../list"); + -s $path_list or $path_list = "$dir/$local_list"; + -s $path_list and system("cp", "--preserve=mode", "--preserve=timestamps", "-R", + $path_list, "$urpm->{cachedir}/partial/list"); } } else { #- try to find rpm files, use recursive method, added additional @@ -1425,6 +1433,16 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{error}(N("no rpm files found from [%s]", $dir)); } } + + #- examine if a local pubkey file is available. + if ($medium->{hdlist} ne 'pubkey' && !$medium->{'key-ids'}) { + my $local_pubkey = $medium->{with_hdlist} =~ /hdlist(.*)\.cz2?$/ ? "pubkey$1" : 'pubkey'; + my $path_pubkey = reduce_pathname("$dir/$with_hdlist_dir/../$local_pubkey"); + -s $path_pubkey or $path_pubkey = reduce_pathname("$dir/$with_hdlist_dir/../pubkey"); + -s $path_pubkey or $path_pubkey = "$dir/$local_pubkey"; + -s $path_pubkey and system("cp", "--preserve=mode", "--preserve=timestamps", "-R", + $path_pubkey, "$urpm->{cachedir}/partial/pubkey"); + } } else { my $basename; @@ -1458,11 +1476,13 @@ this could happen if you mounted manually the directory when creating the medium unlink "$urpm->{cachedir}/partial/MD5SUM"; eval { - $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", - quiet => 1, - limit_rate => $options{limit_rate}, - proxy => $urpm->{proxy} }, - reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../MD5SUM")); + if (!$options{nomd5sum}) { + $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", + quiet => 1, + limit_rate => $options{limit_rate}, + proxy => $urpm->{proxy} }, + reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../MD5SUM")); + } }; if (!$@ && -s "$urpm->{cachedir}/partial/MD5SUM" > 32) { if ($options{force} >= 2) { @@ -1627,20 +1647,47 @@ this could happen if you mounted manually the directory when creating the medium #- the file are different, update local copy. rename("$urpm->{cachedir}/partial/$basename", "$urpm->{cachedir}/partial/$medium->{hdlist}"); - #- retrieve of hdlist (or synthesis has been successfull, check if a list file is available. + #- retrieve of hdlist or synthesis has been successfull, check if a list file is available. #- and check hdlist has not be named very strangely... if ($medium->{hdlist} ne 'list') { - my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz$/ ? $1 : 'list'; - eval { - $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", - quiet => 1, - limit_rate => $options{limit_rate}, - proxy => $urpm->{proxy} }, - reduce_pathname("$medium->{url}/$local_list")); - $local_list ne 'list' and - rename("$urpm->{cachedir}/partial/$local_list", "$urpm->{cachedir}/partial/list"); - }; - $@ and unlink "$urpm->{cachedir}/partial/list"; + my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list'; + foreach (reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../$local_list"), + reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../list"), + reduce_pathname("$medium->{url}/$local_list"), + ) { + eval { + $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", + quiet => 1, + limit_rate => $options{limit_rate}, + proxy => $urpm->{proxy} }, + $_); + $local_list ne 'list' && -s "$urpm->{cachedir}/partial/$local_list" and + rename("$urpm->{cachedir}/partial/$local_list", "$urpm->{cachedir}/partial/list"); + }; + $@ and unlink "$urpm->{cachedir}/partial/list"; + -s "$urpm->{cachedir}/partial/list" and last; + } + } + + #- retrieve pubkey file. + if ($medium->{hdlist} ne 'pubkey' && !$medium->{'key-ids'}) { + my $local_pubkey = $medium->{with_hdlist} =~ /hdlist(.*)\.cz2?$/ ? "pubkey$1" : 'pubkey'; + foreach (reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../$local_pubkey"), + reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../pubkey"), + reduce_pathname("$medium->{url}/$local_pubkey"), + ) { + eval { + $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", + quiet => 1, + limit_rate => $options{limit_rate}, + proxy => $urpm->{proxy} }, + $_); + $local_pubkey ne 'pubkey' && -s "$urpm->{cachedir}/partial/$local_pubkey" and + rename("$urpm->{cachedir}/partial/$local_pubkey", "$urpm->{cachedir}/partial/pubkey"); + }; + $@ and unlink "$urpm->{cachedir}/partial/pubkey"; + -s "$urpm->{cachedir}/partial/pubkey" and last; + } } } else { $error = 1; @@ -1758,6 +1805,37 @@ this could happen if you mounted manually the directory when creating the medium } } + unless ($error) { + #- now... on pubkey + if (-s "$medium->{cachedir}/partial/pubkey") { + $urpm->{log}(N("examining pubkey file of \"%s\"...", $medium->{name})); + my (%keys, %unknown_keys); + eval { + foreach ($urpm->parse_armored_file("$medium->{cachedir}/partial/pubkey")) { + my $id; + foreach my $kv (values %{$urpm->{keys} || {}}) { + $kv->{content} = $_->{content} and $keys{$id = $kv->{id}} = undef, last; + } + unless ($id) { + #- the key has not been found, this is important to import it now, + #- update keys hash (as we do not know how to get key id from its content). + #- and parse again to found the key. + $urpm->import_armored_file("$medium->{cachedir}/partial/pubkey", root => $urpm->{root}); + $urpm->parse_pubkeys(root => $urpm->{root}); + + foreach my $kv (values %{$urpm->{keys} || {}}) { + $kv->{content} = $_->{content} and $keys{$id = $kv->{id}} = undef, last; + } + + #- now id should be defined, or there is a problem to import the keys... + $id or $urpm->{error}(N("unable to import pubkey file of \"%s\"", $medium->{name})); + } + } + }; + %keys and $medium->{'key-ids'} = join ',', keys %keys; + } + } + if ($error) { #- an error has occured for updating the medium, we have to remove tempory files. unlink "$urpm->{cachedir}/partial/$medium->{hdlist}"; @@ -2943,36 +3021,21 @@ sub find_packages_to_remove { #- check if something need to be removed. if ($options{callback_base} && %{$state->{rejected} || {}}) { - my @base = qw(basesystem); - my (@base_to_remove, %basepackages, %base); + my %basepackages; #- check if a package to be removed is a part of basesystem requires. - while (defined($_ = shift @base)) { - exists($basepackages{$_}) and next; - $db->traverse_tag(/^\// ? 'path' : 'whatprovides', [ $_ ], sub { - my ($p) = @_; - push @{$basepackages{$_} ||= []}, scalar $p->fullname; - push @base, $p->requires_nosense; - }); - } - - foreach (values %basepackages) { - my $n = @$_; - foreach (@$_) { - $base{$_} = \$n; - } - } + $db->traverse_tag('whatprovides', [ 'basesystem' ], sub { + my ($p) = @_; + $basepackages{$p->fullname} = 0; + }); foreach (grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected}}) { - my $rn = $base{$_}; - if ($rn) { - $$rn == 1 and push @base_to_remove, $_; - --$$rn; - } + exists $basepackages{$_} or next; + ++$basepackages{$_}; } - @base_to_remove and $options{callback_base}->($urpm, @base_to_remove) - || return (); + grep { $_ } values %basepackages and + $options{callback_base}->($urpm, grep { $basepackages{$_} } keys %basepackages) || return (); } } grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected}}; @@ -97,20 +97,21 @@ my @toremove = $urpm->find_packages_to_remove($state, \@l, } 0 }, ) or $urpm->{fatal}(0, N("Nothing to remove")); +my $list = join "\n", $urpm->translate_why_removed($state, sort @to_remove); if ($test && $auto) { my $msg = N("Checking to remove the following packages"); - print STDOUT "$msg:\n" . join("\n", sort { $a cmp $b } @toremove) . "\n"; + print STDOUT "$msg:\n$list\n"; } elsif (($parallel || @toremove > @l) && !$auto) { my $sum = 0; foreach (@toremove) { $sum += $state->{rejected}{$_}{size}; } my $msg = N("To satisfy dependencies, the following packages will be removed (%d MB)", toMb($sum)); - print STDOUT "$msg:\n" . join("\n", sort { $a cmp $b } @toremove) . "\n$askok" . N(" (Y/n) "); + print STDOUT "$msg:\n$list\n$askok" . N(" (Y/n) "); <STDIN> =~ /[$noexpr]/ and exit 0; } -print STDOUT "\n".N("removing %s", join(' ', @toremove))."\n"; +print STDOUT "\n".N("removing %s", join(' ', sort @toremove))."\n"; @l = $parallel ? $urpm->parallel_remove(\@toremove, test => $test, force => $force, translate_message => 1) : $urpm->install(\@toremove, {}, {}, test => $test, force => $force, translate_message => 1); @@ -595,7 +595,7 @@ foreach my $set (@{$state->{transaction} || []}) { } } - my $key_ids = $medium && $medium->{key_ids} || $urpm->{options}{key_ids}; + my $key_ids = $medium && $medium->{'key-ids'} || $urpm->{options}{'key-ids'}; #- check the key ids of the medium are matching (all) the given key id of the package. if ($key_ids) { my $valid_ids = 0; diff --git a/urpmi.addmedia b/urpmi.addmedia index 7239eb7d..6a697582 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -109,6 +109,7 @@ and [options] are from /^--probe-synthesis/ and $options{probe_with} = 'synthesis', next; /^--probe-hdlist/ and $options{probe_with} = 'hdlist', next; /^--no-probe/ and $options{probe_with} = undef, next; + /^--no-md5sum/ and $options{nomd5sum} = 1, next; /^--distrib$/ and $options{distrib} = undef, next; /^--distrib-(.*)$/ and $options{distrib} = $1, next; /^--from$/ and $options{mirrors_url} = shift @_, next; @@ -2,14 +2,14 @@ Name: urpmi Version: 4.4 -Release: 18mdk +Release: 19mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate Summary: User mode rpm install URL: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/urpmi Requires: eject webfetch perl-DateManip >= 5.40 gnupg -PreReq: perl-Locale-gettext >= 1.01-7mdk rpmtools >= 4.3-6mdk perl-URPM >= 0.92 +PreReq: perl-Locale-gettext >= 1.01-7mdk rpmtools >= 4.3-6mdk perl-URPM >= 0.93 BuildRequires: bzip2-devel gettext rpm-devel >= 4.0.3 perl-MDK-Common-devel BuildRoot: %{_tmppath}/%{name}-buildroot BuildArch: noarch @@ -202,6 +202,13 @@ $urpm->update_media(nolock => 1); %changelog +* Wed Aug 6 2003 François Pons <fpons@mandrakesoft.com> 4.4-19mdk +- fixed local package not found when using curl and without an + absolute path. +- added signature support on distant media (in pubkey file). +- fixed bug 4519. +- fixed bug 4513 (--no-md5sum added for test purpose, workaround). + * Fri Aug 1 2003 François Pons <fpons@mandrakesoft.com> 4.4-18mdk - fixed shared locks management by simple user. diff --git a/urpmi.update b/urpmi.update index 052f21c9..962a431b 100755 --- a/urpmi.update +++ b/urpmi.update @@ -53,6 +53,7 @@ sub main { $urpm->{proxy}{pwd} = $2; next; }; + /^--no-md5sum/ and $options{nomd5sum} = 1, next; /^--?noa/ and next; #- default, keeped for compability. /^-/ and die N("usage: urpmi.update [options] <name> ... where <name> is a medium name to update. |