diff options
author | Mandrake <mandrake@mandriva.com> | 2006-12-08 18:15:32 +0000 |
---|---|---|
committer | Mandrake <mandrake@mandriva.com> | 2006-12-08 18:15:32 +0000 |
commit | 7a49e24ff0763aabc817ff299c3921a8c471c89f (patch) | |
tree | 423aca07c24a0ef3ee08416986dc6acbd473881d /gurpmi2 | |
parent | 97e2b4eb7e8734208d686b30c09921f497009f2f (diff) | |
download | urpmi-7a49e24ff0763aabc817ff299c3921a8c471c89f.tar urpmi-7a49e24ff0763aabc817ff299c3921a8c471c89f.tar.gz urpmi-7a49e24ff0763aabc817ff299c3921a8c471c89f.tar.bz2 urpmi-7a49e24ff0763aabc817ff299c3921a8c471c89f.tar.xz urpmi-7a49e24ff0763aabc817ff299c3921a8c471c89f.zip |
Copying release 1.5-2mdv2007.1 to pristine/ directory.
Diffstat (limited to 'gurpmi2')
-rwxr-xr-x | gurpmi2 | 68 |
1 files changed, 37 insertions, 31 deletions
@@ -12,11 +12,6 @@ BEGIN { #- set up a safe path and environment } use gurpmi; -use urpm::install; -use urpm::media; -use urpm::signature; -use urpm::get_pkgs; -use urpm::select; use Gtk2; #- GUI globals @@ -54,7 +49,6 @@ $> and fatal(N("Must be root")); #- Now, the graphical stuff. Gtk2->init; -Gtk2->croak_execeptions; #- Create main window @@ -73,27 +67,25 @@ my $urpm = configure_urpm(); my $state = {}; my %requested = $urpm->register_rpms(@all_rpms); if (@gurpmi::names) { - urpm::select::search_packages($urpm, \%requested, [ @gurpmi::names ]); + $urpm->search_packages(\%requested, [ @gurpmi::names ]); } -urpm::select::resolve_dependencies($urpm, +$urpm->resolve_dependencies( $state, \%requested, callback_choices => \&ask_choice, auto_select => $gurpmi::options{'auto-select'}, ); -my @ask_unselect = urpm::select::unselected_packages($urpm, $state); +my @ask_unselect = $urpm->unselected_packages($state); @ask_unselect ? ask_continue(N( "Some requested packages cannot be installed:\n%s\nContinue installation anyway?", - urpm::select::translate_why_unselected($urpm, $state, @ask_unselect) + join "\n", $urpm->translate_why_unselected($state, sort @ask_unselect) ), \&do_install) : do_install(); $mainw->show_all; Gtk2->main; -my ($rpm_lock, $urpmi_lock); - #- Creates and configure an urpm object for this application to use. sub configure_urpm() { my $urpm = new urpm; @@ -110,10 +102,14 @@ sub configure_urpm() { if ($nb_lines > 30) { $w = Gtk2::Dialog->new(N("Warning"), $mainw, [qw(modal destroy-with-parent)], N("Ok"), 'ok'); $w->vbox->add(my $f = Gtk2::Frame->new); - my $sw = create_scrolled_window(my $text = Gtk2::TextView->new); - $sw->set_border_width(2); + my $sw = Gtk2::ScrolledWindow->new(undef, undef); $f->add($sw); + $f->set_shadow_type('in'); + $sw->set_policy('automatic', 'automatic'); + my $text = Gtk2::TextView->new; + $sw->add($text); $text->get_buffer->set_text($message); + $sw->set_border_width(2); $_->show foreach $f, $sw, $text; $w->set_size_request(400, 400); } else { @@ -122,9 +118,9 @@ sub configure_urpm() { $w->run; $w->destroy; }; - $rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive'); - $urpmi_lock = urpm::lock::urpmi_db($urpm); - urpm::media::configure($urpm, + $urpm->exlock_rpm_db; + $urpm->shlock_urpmi_db; + $urpm->configure( root => $gurpmi::options{root}, media => $gurpmi::options{media}, searchmedia => $gurpmi::options{searchmedia}, @@ -190,11 +186,11 @@ sub ask_continue_blocking { sub do_install { wait_label(); - my @ask_remove = urpm::select::removed_packages($urpm, $state); + my @ask_remove = $urpm->removed_packages($state); @ask_remove ? ask_continue(N( "The following packages have to be removed for others to be upgraded:\n%s\nContinue installation anyway?", - urpm::select::translate_why_removed($urpm, $state, @ask_remove) + $urpm->translate_why_removed($state, @ask_remove) ), \&do_install_2) : goto &do_install_2; } @@ -215,7 +211,7 @@ sub do_install_2 () { sub do_install_3 () { wait_label(N("Package installation...")); - my ($local_sources, $list) = urpm::get_pkgs::selected2list($urpm, $state->{selected}); + my ($local_sources, $list) = $urpm->get_source_packages($state->{selected}); $local_sources || $list or $urpm->{fatal}(3, N("unable to get source packages, aborting")); my %sources = %$local_sources; my %error_sources; @@ -226,7 +222,8 @@ sub do_install_3 () { $progressbar->set_size_request(300, -1); $vbox->pack_start($progressbar, 0, 0, 0); change_mainw($vbox); - urpm::removable::copy_packages_of_removable_media($urpm, $list, \%sources, sub { + $urpm->copy_packages_of_removable_media($list, \%sources, + ask_for_medium => sub { my $w = Gtk2::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'warning', 'ok-cancel', N("Please insert the medium named \"%s\" on device [%s]", $_[0], $_[1]) ); @@ -234,8 +231,9 @@ sub do_install_3 () { $w->destroy; exit 0 if $response eq 'cancel'; 1; - }); - urpm::install::create_transaction($urpm, + } + ); + $urpm->create_transaction( $state, split_level => $urpm->{options}{'split-level'}, split_length => $urpm->{options}{'split-length'}, @@ -244,11 +242,14 @@ sub do_install_3 () { my $progress_nb; foreach my $set (@{$state->{transaction} || []}) { my (@transaction_list, %transaction_sources); - urpm::install::prepare_transaction($urpm, $set, $list, \%sources, \@transaction_list, \%transaction_sources); - urpm::get_pkgs::download_packages_of_distant_media($urpm, + $urpm->prepare_transaction($set, $list, \%sources, \@transaction_list, \%transaction_sources); + $urpm->download_packages_of_distant_media( \@transaction_list, \%transaction_sources, \%error_sources, + limit_rate => $urpm->{options}{'limit-rate'}, + compress => $urpm->{options}{compress}, + resume => $urpm->{options}{resume}, callback => sub { my ($mode, $file, $percent) = @_; if ($mode eq 'start') { @@ -265,7 +266,7 @@ sub do_install_3 () { ); my %transaction_sources_install = %{$urpm->extract_packages_to_install(\%transaction_sources, $state) || {}}; if ($urpm->{options}{'verify-rpm'} || grep { $_->{'verify-rpm'} } @{$urpm->{media}}) { - my @bad_signatures = urpm::signature::check($urpm, \%transaction_sources_install, \%transaction_sources); + my @bad_signatures = $urpm->check_sources_signatures(\%transaction_sources_install, \%transaction_sources, translate => 1); if (@bad_signatures) { ask_continue_blocking(N( "The following packages have bad signatures:\n%s\n\nDo you want to continue installation ?", @@ -300,10 +301,12 @@ sub do_install_3 () { } sync(); }; - my @l = urpm::install::install($urpm, + my @l = $urpm->install( $set->{remove} || [], \%transaction_sources_install, \%transaction_sources, + 'fork' => 0, #- do not fork (even if multiple transaction) because of X11 crash + translate_message => 1, oldpackage => $state->{oldpackage}, callback_inst => $callback_inst, callback_trans => $callback_inst, @@ -325,7 +328,10 @@ sub do_install_3 () { } $vbox = Gtk2::VBox->new(0, 5); $progress_label = Gtk2::Label->new('-'); - my $sw = create_scrolled_window($progress_label); + my $sw = Gtk2::ScrolledWindow->new(undef, undef); + $sw->add_with_viewport($progress_label); + $sw->set_shadow_type('in'); + $sw->set_policy('automatic', 'automatic'); $sw->set_size_request(500, 200); $vbox->pack_start($sw, 1, 1, 0); my $quit_button = Gtk2::Button->new(but(N("_Done"))); @@ -340,7 +346,7 @@ sub do_install_3 () { } else { $progress_label->set_label(N("Installation finished")); } - $urpmi_lock->unlock; - $rpm_lock->unlock; - urpm::removable::try_umounting_removables($urpm); + $urpm->unlock_urpmi_db; + $urpm->unlock_rpm_db; + $urpm->try_umounting_removables; } |