summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-20 09:22:01 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-20 09:22:01 +0000
commit4b32b62a13073b390832dd5c9d8af341bbf013ae (patch)
treedad1c5c52e6875935855f3f60c32fb280131cb0b
parent5ba817cb4cedccc2d0b289abb81e3fd01d7651ef (diff)
downloadurpmi-4b32b62a13073b390832dd5c9d8af341bbf013ae.tar
urpmi-4b32b62a13073b390832dd5c9d8af341bbf013ae.tar.gz
urpmi-4b32b62a13073b390832dd5c9d8af341bbf013ae.tar.bz2
urpmi-4b32b62a13073b390832dd5c9d8af341bbf013ae.tar.xz
urpmi-4b32b62a13073b390832dd5c9d8af341bbf013ae.zip
- urpmi.update
o fix --force-key (#45094) (backported from trunk)
-rw-r--r--NEWS2
-rw-r--r--urpm/media.pm43
2 files changed, 32 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index a671f4b1..93c712f1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- urpmi
o fix --auto-update ignoring --media and default-media (#45097)
+- urpmi.update
+ o fix --force-key (#45094)
- urpme, library
o do not display things like "conflicts@b-1-1.noarch@a-1-1.noarch@/etc/foo"
(regression introduced in 6.14.5)
diff --git a/urpm/media.pm b/urpm/media.pm
index 8a9d79ed..6f8980d7 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -1504,8 +1504,20 @@ sub _update_medium__parse_if_unmodified__remote {
1;
}
-sub _get_pubkey_and_descriptions {
- my ($urpm, $medium, $nopubkey) = @_;
+sub _get_pubkey {
+ my ($urpm, $medium, $b_wait_lock) = @_;
+
+ my $local = file_from_local_medium($medium);
+
+ #- examine if a pubkey file is available.
+ ($local ? \&_get_pubkey__local : \&_download_pubkey)->($urpm, $medium);
+
+ $medium->{'key-ids'} =_read_cachedir_pubkey($urpm, $medium, $b_wait_lock);
+ $urpm->{modified} = 1;
+}
+
+sub _get_descriptions {
+ my ($urpm, $medium) = @_;
my $local = file_from_local_medium($medium);
@@ -1513,11 +1525,13 @@ sub _get_pubkey_and_descriptions {
if ($medium->{update}) {
($local ? \&get_descriptions_local : \&get_descriptions_remote)->($urpm, $medium);
}
+}
- #- examine if a pubkey file is available.
- if (!$nopubkey && !$medium->{'key-ids'}) {
- ($local ? \&_get_pubkey__local : \&_download_pubkey)->($urpm, $medium);
- }
+# options: wait_lock, nopubkey, forcekey
+sub _may_get_pubkey {
+ my ($urpm, $medium, %options) = @_;
+
+ _get_pubkey($urpm, $medium, $options{wait_lock}) if !$options{nopubkey} && (!$medium->{'key-ids'} || $options{forcekey});
}
sub _read_cachedir_pubkey {
@@ -1549,7 +1563,7 @@ sub _read_cachedir_pubkey {
join(',', keys %key_ids);
}
-#- options: callback, force, nomd5sum, probe_with, quiet, nopubkey, wait_lock
+#- options: callback, force, nomd5sum, probe_with, quiet, forcekey, nopubkey, wait_lock
#- (from _update_medium__parse_if_unmodified__local and _update_medium__parse_if_unmodified__remote)
sub _update_medium_ {
my ($urpm, $medium, %options) = @_;
@@ -1567,6 +1581,11 @@ sub _update_medium_ {
? _update_medium__parse_if_unmodified__local($urpm, $medium, \%options)
: _update_medium__parse_if_unmodified__remote($urpm, $medium, \%options);
+ if ($options{forcekey} && $rc eq 'unmodified') {
+ _get_pubkey($urpm, $medium, $options{wait_lock}); # we must do it now, quite hackish...
+ return 1;
+ }
+
if (!$rc || $rc eq 'unmodified') {
return $rc;
}
@@ -1606,8 +1625,8 @@ sub _update_medium_ {
# generated on first _parse_media()
unlink statedir_names($urpm, $medium);
- _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey});
- $medium->{'key-ids'} ||= _read_cachedir_pubkey($urpm, $medium, $options{wait_lock});
+ _get_descriptions($urpm, $medium);
+ _may_get_pubkey($urpm, $medium, %options);
$is_updating and $urpm->{info}(N("updated medium \"%s\"", $medium->{name}));
@@ -1627,11 +1646,9 @@ sub _update_medium {
}
sub _update_media__handle_some_flags {
- my ($urpm, $forcekey, $all) = @_;
+ my ($urpm, $all) = @_;
foreach my $medium (non_ignored_media($urpm)) {
- $forcekey and delete $medium->{'key-ids'};
-
if ($medium->{static}) {
#- don't ever update static media
$medium->{modified} = 0;
@@ -1667,7 +1684,7 @@ sub update_media {
#- synthesis file, else build it from rpm files.
clean($urpm);
- _update_media__handle_some_flags($urpm, $options{forcekey}, $options{all});
+ _update_media__handle_some_flags($urpm, $options{all});
my %updates_result;
foreach my $medium (grep { $_->{modified} } non_ignored_media($urpm)) {