summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-04-11 15:46:21 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-04-11 15:46:21 +0000
commit1bfa385ccda5d88689afa83c55c15c50f8a912ac (patch)
tree4f85704725b1bd5db99077ce4aad279cf1540217 /urpm.pm
parent6a1138e799359bc21831b042374f9a4ce47300a7 (diff)
downloadurpmi-1bfa385ccda5d88689afa83c55c15c50f8a912ac.tar
urpmi-1bfa385ccda5d88689afa83c55c15c50f8a912ac.tar.gz
urpmi-1bfa385ccda5d88689afa83c55c15c50f8a912ac.tar.bz2
urpmi-1bfa385ccda5d88689afa83c55c15c50f8a912ac.tar.xz
urpmi-1bfa385ccda5d88689afa83c55c15c50f8a912ac.zip
Refactor the code that checks whether we're going to remove a basesystem package
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm40
1 files changed, 23 insertions, 17 deletions
diff --git a/urpm.pm b/urpm.pm
index 4c7a17df..8640edcc 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -3105,27 +3105,33 @@ sub find_packages_to_remove {
}
#- check if something needs to be removed.
- if ($options{callback_base} && %{$state->{rejected} || {}}) {
- my %basepackages;
-
- #- check if a package to be removed is a part of basesystem requires.
- $db->traverse_tag('whatprovides', [ 'basesystem' ], sub {
- my ($p) = @_;
- $basepackages{$p->fullname} = 0;
- });
-
- foreach (grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected}}) {
- exists $basepackages{$_} or next;
- ++$basepackages{$_};
- }
-
- grep { $_ } values %basepackages and
- $options{callback_base}->($urpm, grep { $basepackages{$_} } keys %basepackages) || return ();
- }
+ find_removed_from_basesystem($urpm, $db, $state, $options{callback_base})
+ or return ();
}
grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected}};
}
+sub find_removed_from_basesystem {
+ my ($urpm, $db, $state, $callback_base) = @_;
+ if ($callback_base && %{$state->{rejected} || {}}) {
+ my %basepackages;
+ #- check if a package to be removed is a part of basesystem requires.
+ $db->traverse_tag('whatprovides', [ 'basesystem' ], sub {
+ my ($p) = @_;
+ $basepackages{$p->fullname} = 0;
+ });
+ foreach (grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected}}) {
+ exists $basepackages{$_} or next;
+ ++$basepackages{$_};
+ }
+ warn "* $_ $basepackages{$_}\n" for keys %basepackages;
+ if (grep { $_ } values %basepackages) {
+ return $callback_base->($urpm, grep { $basepackages{$_} } keys %basepackages);
+ }
+ }
+ return 1;
+}
+
#- remove packages from node as remembered according to resolving done.
sub parallel_remove {
my ($urpm, $remove, %options) = @_;