summaryrefslogtreecommitdiffstats
path: root/urpm.pm
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 /urpm.pm
parent50acfe2c3b02fde7f51e8c1b37bac4d60fce324e (diff)
downloadurpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.gz
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.bz2
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.xz
urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.zip
4.3-15mdk
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm53
1 files changed, 53 insertions, 0 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__