From 93606256c71233d2472ca4be7dccf10f1b759c16 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 20 Feb 2004 11:22:30 +0000 Subject: lock urpmi database while running (#6828) --- edit-urpm-sources.pl | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'edit-urpm-sources.pl') diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl index 46ad56ab..62293fc2 100755 --- a/edit-urpm-sources.pl +++ b/edit-urpm-sources.pl @@ -164,7 +164,7 @@ really want to replace it?"), yesno => 1) or return 0; $urpm->remove_selected_media; } add_medium_and_check($urpm, - { probe_with => $probe }, + { probe_with => $probe, nolock => 1 }, $i{name}, $make_url{$type}, $i{hdlist}, update => $type eq 'security'); return 1; } @@ -179,7 +179,7 @@ sub remove_callback { standalone::explanations("Removing medium $name"); $urpm->select_media($name); $urpm->remove_selected_media; - $urpm->update_media(noclean => 1); + $urpm->update_media(noclean => 1, nolock => 1); remove_wait_msg($wait); } @@ -212,14 +212,14 @@ sub edit_callback { standalone::explanations("Removing medium $name"); $urpm->select_media($name); $urpm->remove_selected_media; - add_medium_and_check($urpm, {}, $name, $url, $with_hdlist, update => $update); + add_medium_and_check($urpm, { nolock => 1 }, $name, $url, $with_hdlist, update => $update); return 1; } return 0; } sub update_callback { - update_sources_interactive($urpm, transient => $mainw->{rwindow}); + update_sources_interactive($urpm, transient => $mainw->{rwindow}, nolock => 1); } sub proxy_callback { @@ -605,11 +605,11 @@ sub mainwindow { my %action2fun; %action2fun = ( update_source => sub { slow_func(N("Please wait, updating media..."), - sub { $urpm->update_media(noclean => 1) }); + sub { $urpm->update_media(noclean => 1, nolock => 1) }); }, generate_hdlist => sub { slow_func(N("Please wait, generating hdlist..."), - sub { $urpm->update_media(noclean => 1, force => 1) }); + sub { $urpm->update_media(noclean => 1, force => 1, nolock => 1) }); }); $menu->append(gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label($text)), activate => sub { @@ -677,6 +677,19 @@ or to perform updates.")), yesno => 1) or myexit -1; push @$already_splashed, basename($0); } +{ + $urpm = urpm->new; + local $urpm->{fatal} = sub { + interactive_msg('rpmdrake', +N("Packages database is locked. Please close other applications +working with packages database (do you have another media +manager on another desktop, or are you currently installing +packages as well?).")); + myexit -1; + }; + $urpm->exlock_urpmi_db; +} + mainwindow(); $urpm->write_config; -- cgit v1.2.1