diff options
-rw-r--r-- | Rpmdrake/gui.pm | 10 | ||||
-rwxr-xr-x | Rpmdrake/pkg.pm | 13 | ||||
-rwxr-xr-x | rpmdrake | 4 |
3 files changed, 13 insertions, 14 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index 1ae979dc..daa39bb8 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -458,7 +458,7 @@ sub closure_removal { sub is_locale_available { any { $urpm->{depslist}[$_]->flag_selected } keys %{$urpm->{provides}{$_[0]} || {}} and return 1; my $found; - $db->traverse_tag('name', [ $_ ], sub { $found ||= 1 }); + open_db()->traverse_tag('name', [ $_ ], sub { $found ||= 1 }); return $found; } @@ -574,7 +574,7 @@ sub toggle_nodes { $widget, sub { @requested = $urpm->resolve_requested( - $db, $urpm->{state}, + open_db(), $urpm->{state}, { map { $pkgs->{$_}{pkg}->id => 1 } @nodes }, callback_choices => \&callback_choices, ); @@ -585,7 +585,7 @@ sub toggle_nodes { N("To satisfy dependencies, the following package(s) also need\nto be installed:\n\n"), \@nodes, \@nodes_with_deps)) { @nodes_with_deps = (); - $urpm->disable_selected($db, $urpm->{state}, @requested); + $urpm->disable_selected(open_db(), $urpm->{state}, @requested); goto packages_selection_ok; } @@ -615,14 +615,14 @@ sub toggle_nodes { } else { my @unrequested; slow_func($widget, - sub { @unrequested = $urpm->disable_selected($db, $urpm->{state}, + sub { @unrequested = $urpm->disable_selected(open_db(), $urpm->{state}, map { $pkgs->{$_}{pkg} } @nodes) }); @nodes_with_deps = map { urpm_name($_) } @unrequested; if (!$deps_msg->(N("Some packages need to be removed"), N("Because of their dependencies, the following package(s) must be\nunselected now:\n\n"), \@nodes, \@nodes_with_deps)) { @nodes_with_deps = (); - $urpm->resolve_requested($db, $urpm->{state}, { map { $_->id => 1 } @unrequested }); + $urpm->resolve_requested(open_db(), $urpm->{state}, { map { $_->id => 1 } @unrequested }); goto packages_unselection_ok; } packages_unselection_ok: diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 1bdc38b6..dd2dd478 100755 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -44,14 +44,13 @@ use urpm::select; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(extract_header find_installed_version formatlistpkg get_pkgs open_db parse_compssUsers_flat perform_installation perform_removal run_rpm $db); +our @EXPORT = qw(extract_header find_installed_version formatlistpkg get_pkgs open_db parse_compssUsers_flat perform_installation perform_removal run_rpm); use mygtk2 qw(gtknew); use ugtk2 qw(:all); use Gtk2::Pango; use Gtk2::Gdk::Keysyms; -our $db; sub parse_compssUsers_flat() { my (%compssUsers, $category); @@ -153,9 +152,9 @@ sub open_db { $done = 1; print "done.\n"; } - $db = URPM::DB::open($dblocation) or die "Couldn't open RPM DB"; + URPM::DB::open($dblocation) or die "Couldn't open RPM DB"; } else { - $db = URPM::DB::open or die "Couldn't open RPM DB"; + URPM::DB::open or die "Couldn't open RPM DB"; } } @@ -163,7 +162,7 @@ sub open_db { sub find_installed_version { my ($p) = @_; my @version; - $db->traverse_tag('name', [ $p->name ], sub { push @version, $_[0]->version . '-' . $_[0]->release }); + open_db()->traverse_tag('name', [ $p->name ], sub { push @version, $_[0]->version . '-' . $_[0]->release }); @version ? join(',', sort @version) : N("(none)"); } @@ -303,7 +302,7 @@ Then, restart %s.", $rpmdrake::myname_update)), myexit(-1); my @base = ("basesystem", split /,\s*/, $urpm->{global_config}{'prohibit-remove'}); my (%base, %basepackages); - my $db = $db; + my $db = open_db(); my $sig_handler = sub { undef $db; exit 3 }; local $SIG{INT} = $sig_handler; local $SIG{QUIT} = $sig_handler; @@ -475,7 +474,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( # select packages to install for !update mode: if (!$probe_only_for_updates) { - $urpm->resolve_requested($db, $state, { map { $_->id => undef } grep { $_->flag_selected } @{$urpm->{depslist}} }, callback_choices => \&Rpmdrake::gui::callback_choices); + $urpm->resolve_requested(open_db(), $state, { map { $_->id => undef } grep { $_->flag_selected } @{$urpm->{depslist}} }, callback_choices => \&Rpmdrake::gui::callback_choices); } my ($local_sources, $list) = urpm::get_pkgs::selected2list($urpm, @@ -71,7 +71,7 @@ sub do_search($$$$$$$) { N("Please wait, searching..."), $w->{real_window}, sub { - $db->traverse(sub { + open_db()->traverse(sub { push @search_results, map { if_($_ =~ $entry_rx, urpm_name($_[0])) } $_[0]->files; }); @search_results = grep { exists $pkgs->{$_} } uniq(@search_results); @@ -361,7 +361,7 @@ sub run_treeview_dialog { [ N("/_File") . N("/_Reset the selection"), undef, sub { if ($MODE ne 'remove') { $urpm->disable_selected( - $db, $urpm->{state}, + open_db(), $urpm->{state}, map { if_($pkgs->{$_}{selected}, $pkgs->{$_}{pkg}) } keys %$pkgs, ); } |