summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-06-13 15:13:11 +0000
committerFrancois Pons <fpons@mandriva.com>2003-06-13 15:13:11 +0000
commit497ca49641346b3e2bb8bd9ef38db614f94fac87 (patch)
treeb6c5b6f1c82463fffe95c83b1007bff335f0dc58
parent50acfe2c3b02fde7f51e8c1b37bac4d60fce324e (diff)
downloadurpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.gz
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.bz2
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.xz
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.zip
4.3-15mdk
-rw-r--r--urpm.pm53
-rwxr-xr-xurpmi38
-rw-r--r--urpmi.spec7
3 files changed, 63 insertions, 35 deletions
diff --git a/urpm.pm b/urpm.pm
index 257a0aea..3e404655 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2790,6 +2790,59 @@ sub parallel_remove {
);
}
+#- misc functions to help finding ask_unselect and ask_remove elements with their reasons translated.
+sub unselected_packages {
+ my ($urpm, $state, %options) = @_;
+
+ grep { $state->{rejected}{$_}{backtrack} } keys %{$state->{rejected} || {}};
+}
+sub translate_why_unselected {
+ my ($urpm, $state, @l) = @_;
+
+ map { my @froms = keys %{$state->{rejected}{$_}{backtrack}{closure} || {}};
+ my @unsatisfied = @{$state->{rejected}{$_}{backtrack}{unsatisfied} || []};
+ my $s = join ", ", ((map { N("due to missing %s", $_) } @froms),
+ (map { N("due to unsatisfied %s", $_) } @unsatisfied));
+ $_ . ($s ? " ($s)" : '');
+ } @l;
+}
+
+sub removed_packages {
+ my ($urpm, $state, %options) = @_;
+
+ grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected} || {}};
+}
+sub translate_why_removed {
+ my ($urpm, $state, @l) = @_;
+
+ map { my ($from) = keys %{$state->{rejected}{$_}{closure}};
+ my ($whyk) = keys %{$state->{rejected}{$_}{closure}{$from}};
+ my ($whyv) = $state->{rejected}{$_}{closure}{$from}{$whyk};
+ my $frompkg = $urpm->search($from, strict_fullname => 1);
+ my $s;
+ for ($whyk) {
+ /old_requested/ and
+ $s .= N("in order to install %s", $frompkg ? scalar $frompkg->fullname : $from);
+ /unsatisfied/ and do {
+ foreach (@$whyv) {
+ $s and $s .= ', ';
+ if (/([^\[\s]*)(?:\[\*\])?(?:\[|\s+)([^\]]*)\]?$/) {
+ $s .= N("due to unsatisfied %s", "$1 $2");
+ } else {
+ $s .= N("due to missing %s", $_);
+ }
+ }
+ };
+ /conflicts/ and
+ $s .= N("due to conflicts with %s", $whyv);
+ /unrequested/ and
+ $s .= N("unrequested");
+ }
+ #- now insert the reason if available.
+ $_ . ($s ? " ($s)" : '');
+ } @l;
+}
+
1;
__END__
diff --git a/urpmi b/urpmi
index 4740ce6a..86c978fb 100755
--- a/urpmi
+++ b/urpmi
@@ -388,15 +388,10 @@ $urpm->resolve_dependencies($state, \%requested,
nodeps => $urpm->{options}{'allow-nodeps'} || $urpm->{options}{'allow-force'},
);
-my @ask_unselect = grep { $state->{rejected}{$_}{backtrack} } keys %{$state->{rejected} || {}};
+my @ask_unselect = $urpm->unselected_packages($state)
if (@ask_unselect) {
unless ($auto) {
- my $list = join "\n", map { my @froms = keys %{$state->{rejected}{$_}{backtrack}{closure} || {}};
- my @unsatisfied = @{$state->{rejected}{$_}{backtrack}{unsatisfied} || []};
- my $s = join ", ", ((map { N("due to missing %s", $_) } @froms),
- (map { N("due to unsatisfied %s", $_) } @unsatisfied));
- $_ . ($s ? " ($s)" : '');
- } sort { $a cmp $b } @ask_unselect;
+ my $list = join "\n", $urpm->translate_why_unselected($state, sort @ask_unselect);
my $msg = N("Some package requested cannot be installed:\n%s\ndo you agree ?", $list);
if ($X) {
gmessage($msg);
@@ -409,35 +404,10 @@ if (@ask_unselect) {
}
}
-my @ask_remove = grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected} || {}};
+my @ask_remove = $urpm->removed_packages($state);
if (@ask_remove) {
unless ($auto) {
- my $list = join "\n", map { my ($from) = keys %{$state->{rejected}{$_}{closure}};
- my ($whyk) = keys %{$state->{rejected}{$_}{closure}{$from}};
- my ($whyv) = $state->{rejected}{$_}{closure}{$from}{$whyk};
- my $frompkg = $urpm->search($from, strict_fullname => 1);
- my $s;
- for ($whyk) {
- /old_requested/ and
- $s .= N("in order to install %s", $frompkg ? scalar $frompkg->fullname : $from);
- /unsatisfied/ and do {
- foreach (@$whyv) {
- $s and $s .= ', ';
- if (/([^\[\s]*)(?:\[\*\])?(?:\[|\s+)([^\]]*)\]?$/) {
- $s .= N("due to unsatisfied %s", "$1 $2");
- } else {
- $s .= N("due to missing %s", $_);
- }
- }
- };
- /conflicts/ and
- $s .= N("due to conflicts with %s", $whyv);
- /unrequested/ and
- $s .= N("unrequested");
- }
- #- now insert the reason if available.
- $_ . ($s ? " ($s)" : '');
- } sort { $a cmp $b } @ask_remove;
+ my $list = join "\n", $urpm->translate_why_removed($state, sort @ask_remove);
if ($no_remove) {
my $msg = N("The installation cannot continue because the following packages
diff --git a/urpmi.spec b/urpmi.spec
index 0b27381e..234ed918 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 4.3
-Release: 14mdk
+Release: 15mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -202,6 +202,11 @@ $urpm->update_media;
%changelog
+* Fri Jun 13 2003 François Pons <fpons@mandrakesoft.com> 4.3-15mdk
+- fixed incorrect behaviour when no key_ids options are set.
+- created retrieve methods and translation methods for packages
+ unselected or removed.
+
* Fri Jun 13 2003 François Pons <fpons@mandrakesoft.com> 4.3-14mdk
- added key_ids global and per media option to list authorized
key ids.