diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-08-27 09:31:03 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-08-27 09:31:03 +0000 |
commit | a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b (patch) | |
tree | e8d761858135905cd1b2969210d42700a3230fe0 | |
parent | bd6d17563ff72a3777da12955dd0f87a30e0be79 (diff) | |
download | rpmdrake-a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b.tar rpmdrake-a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b.tar.gz rpmdrake-a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b.tar.bz2 rpmdrake-a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b.tar.xz rpmdrake-a3c7b1c49228ebcb07f8fffdecf3cfaf0035e53b.zip |
rename options as rpmdrake_options so that we can reuse urpm::args someday
-rw-r--r-- | Rpmdrake/gui.pm | 2 | ||||
-rwxr-xr-x | Rpmdrake/init.pm | 16 | ||||
-rwxr-xr-x | Rpmdrake/pkg.pm | 36 | ||||
-rwxr-xr-x | Rpmdrake/rpmnew.pm | 2 | ||||
-rwxr-xr-x | rpmdrake | 8 |
5 files changed, 32 insertions, 32 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index ea8177f3..bb75abc2 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -435,7 +435,7 @@ sub is_locale_available { sub callback_choices { my (undef, undef, undef, $choices) = @_; - return $choices->[0] if $::options{'auto'}; + return $choices->[0] if $::rpmdrake_options{'auto'}; foreach my $pkg (@$choices) { foreach ($pkg->requires_nosense) { /locales-/ or next; diff --git a/Rpmdrake/init.pm b/Rpmdrake/init.pm index efa3d094..0dfb467b 100755 --- a/Rpmdrake/init.pm +++ b/Rpmdrake/init.pm @@ -31,7 +31,7 @@ BEGIN { $::no_global_argv_parsing = 1 } use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(init warn_about_user_mode $changelog_first $default_list_mode %options $MODE); +our @EXPORT = qw(init warn_about_user_mode $changelog_first $default_list_mode %rpmdrake_options $MODE); BEGIN { #- we want to run this code before the Gtk->init of the use-my_gtk my $basename = sub { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }; @@ -84,31 +84,31 @@ if ($collation_locale) { } my $version = 1; -our %options; +our %rpmdrake_options; foreach (@ARGV) { /^-?-(\S+)$/ or next; my $val = $1; if ($val =~ /=/) { my ($name, $values) = split /=/, $val; my @values = split /,/, $values; - $options{$name} = \@values if @values; + $rpmdrake_options{$name} = \@values if @values; } else { if ($val eq 'version') { print "$0 $version\n"; exit(0); } - $options{$val} = 1; + $rpmdrake_options{$val} = 1; } } foreach my $option (qw(media mode parallel pkg-nosel pkg-sel search)) { - if (defined $options{$option} && !ref($options{$option})) { + if (defined $rpmdrake_options{$option} && !ref($rpmdrake_options{$option})) { warn "wrong usage of \"$option\" option!\n"; exit(-1); # too early for my_exit() } } -our $MODE = ref $options{mode} ? $options{mode}[0] : undef; +our $MODE = ref $rpmdrake_options{mode} ? $rpmdrake_options{mode}[0] : undef; unless ($MODE) { $MODE = 'install'; $0 =~ m|remove$| and $MODE = 'remove'; @@ -123,11 +123,11 @@ if ($MODE eq 'remove') { $default_list_mode = 'all_updates'; } -$MODE eq 'update' || $options{root} and require_root_capability(); +$MODE eq 'update' || $rpmdrake_options{root} and require_root_capability(); $::noborderWhenEmbedded = 1; our $changelog_first = $changelog_first_config->[0]; -$changelog_first = 1 if $options{'changelog-first'}; +$changelog_first = 1 if $rpmdrake_options{'changelog-first'}; sub warn_about_user_mode() { $> and (interactive_msg(N("Running in user mode"), diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index a59f1397..64e0c28e 100755 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -158,7 +158,7 @@ sub open_rpm_db { } URPM::DB::open($dblocation) or die "Couldn't open RPM DB"; } else { - URPM::DB::open($::options{'rpm-root'}->[0]) or die "Couldn't open RPM DB ($::options{'rpm-root'}->[0])"; + URPM::DB::open($::rpmdrake_options{'rpm-root'}->[0]) or die "Couldn't open RPM DB ($::rpmdrake_options{'rpm-root'}->[0])"; } } @@ -183,11 +183,11 @@ sub warn_about_media { my $update_name = 'update_source'; return if !member($::default_list_mode, qw(all_updates security bugfix normal)); - return if $::options{'no-media-update'}; + return if $::rpmdrake_options{'no-media-update'}; if (@update_medias > 0) { if (!$opts->{skip_updating_mu} && !$is_update_media_already_asked) { $is_update_media_already_asked = 1; - $::options{'no-confirmation'} or interactive_msg_with_banner(N("Confirmation"), + $::rpmdrake_options{'no-confirmation'} or interactive_msg_with_banner(N("Confirmation"), N("I need to contact the mirror to get latest update packages. Please check that your network is currently running. @@ -230,19 +230,19 @@ sub open_urpmi_db() { my $urpm = urpm->new; $urpm->{options}{'split-level'} ||= 20; $urpm->{options}{'split-length'} ||= 1; - $urpm->{options}{'no-verify-rpm'} = $::options{'no-verify-rpm'}; - $urpm->{options}{auto} = $::options{'auto'}; - urpm::set_files($urpm, $::options{'urpmi-root'}->[0]) if $::options{'urpmi-root'}->[0]; - urpm::args::set_root($urpm, $::options{'rpm-root'}->[0]) if $::options{'rpm-root'}->[0]; + $urpm->{options}{'no-verify-rpm'} = $::rpmdrake_options{'no-verify-rpm'}; + $urpm->{options}{auto} = $::rpmdrake_options{'auto'}; + urpm::set_files($urpm, $::rpmdrake_options{'urpmi-root'}->[0]) if $::rpmdrake_options{'urpmi-root'}->[0]; + urpm::args::set_root($urpm, $::rpmdrake_options{'rpm-root'}->[0]) if $::rpmdrake_options{'rpm-root'}->[0]; - $urpm::args::options{justdb} = $::options{justdb}; + $urpm::args::rpmdrake_options{justdb} = $::rpmdrake_options{justdb}; $urpm->{fatal} = sub { $error_happened = 1; interactive_msg(N("Fatal error"), N("A fatal error occurred: %s.", $_[1])); }; - my $media = ref $::options{media} ? join(',', @{$::options{media}}) : ''; + my $media = ref $::rpmdrake_options{media} ? join(',', @{$::rpmdrake_options{media}}) : ''; urpm::media::configure($urpm, media => $media); # urpmi only support one search media, hance we'll only support "Main backport": my ($searchmedia) = grep { $_->{ignore} && $_->{name} =~ /backport/i } @{$urpm->{media}}; @@ -343,7 +343,7 @@ sub get_pkgs { $pkg->pack_header; # needed in order to call methods on objects outside ->traverse }); my $group; - if ($::options{parallel} && (($group) = @{$::options{parallel}})) { + if ($::rpmdrake_options{parallel} && (($group) = @{$::rpmdrake_options{parallel}})) { urpm::media::configure($urpm, parallel => $group); } @@ -387,8 +387,8 @@ sub get_pkgs { Rpmdrake::gurpm::progress($level = 0.7); my @backports; - my %pkg_sel = map { $_ => 1 } @{$::options{'pkg-sel'} || []}; - my %pkg_nosel = map { $_ => 1 } @{$::options{'pkg-nosel'} || []}; + my %pkg_sel = map { $_ => 1 } @{$::rpmdrake_options{'pkg-sel'} || []}; + my %pkg_nosel = map { $_ => 1 } @{$::rpmdrake_options{'pkg-nosel'} || []}; $reset_update->(1); foreach my $pkg (@{$urpm->{depslist}}) { $update->(); @@ -397,7 +397,7 @@ sub get_pkgs { my $name = urpm_name($pkg); if (member($name, @requested) && any { $pkg->id >= $_->{start} && $pkg->id <= $_->{end} } @update_medias) { - if ($::options{'pkg-sel'} || $::options{'pkg-nosel'}) { + if ($::rpmdrake_options{'pkg-sel'} || $::rpmdrake_options{'pkg-nosel'}) { my $n = $name; $pkg_sel{$n} || $pkg_nosel{$n} or next; $pkg_sel{$n} and $selected = 1; @@ -414,9 +414,9 @@ sub get_pkgs { } $all_pkgs{urpm_name($pkg)} = { selected => $selected, pkg => $pkg }; } - if ($::options{'pkg-sel'} && $::options{'pkg-nosel'}) { - push @{$::options{'pkg-nosel'}}, @{$::options{'pkg-sel'}}; - delete $::options{'pkg-sel'}; + if ($::rpmdrake_options{'pkg-sel'} && $::rpmdrake_options{'pkg-nosel'}) { + push @{$::rpmdrake_options{'pkg-nosel'}}, @{$::rpmdrake_options{'pkg-sel'}}; + delete $::rpmdrake_options{'pkg-sel'}; } $all_pkgs{$_}{pkg}->set_flag_installed foreach @installed_pkgs; @@ -514,7 +514,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my $_flush_guard = Gtk2::GUI_Update_Guard->new; my $group; - return perform_parallel_install($urpm, $group, \$statusbar_msg_id) if $::options{parallel} && (($group) = @{$::options{parallel}}); + return perform_parallel_install($urpm, $group, \$statusbar_msg_id) if $::rpmdrake_options{parallel} && (($group) = @{$::rpmdrake_options{parallel}}); my $lock = urpm::lock::urpmi_db($urpm); my $rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive'); @@ -753,7 +753,7 @@ sub perform_removal { N("Please wait, removing packages..."), $::main_window, sub { - @results = $::options{parallel} + @results = $::rpmdrake_options{parallel} ? urpm::parallel::remove($urpm, \@toremove) : urpm::install::install($urpm, \@toremove, {}, {}, callback_report_uninst => sub { Rpmdrake::gurpm::label($_[0]) }, diff --git a/Rpmdrake/rpmnew.pm b/Rpmdrake/rpmnew.pm index 05577293..dbbd7c47 100755 --- a/Rpmdrake/rpmnew.pm +++ b/Rpmdrake/rpmnew.pm @@ -184,7 +184,7 @@ sub dialog_rpmnew { sub do_merge_if_needed() { - if ($options{'merge-all-rpmnew'}) { + if ($rpmdrake_options{'merge-all-rpmnew'}) { my %pkg2rpmnew; my $wait = wait_msg(N("Please wait, searching...")); print "Searching .rpmnew and .rpmsave files...\n"; @@ -392,7 +392,7 @@ sub run_treeview_dialog { if_(!$>, [ N("/_Options"), undef, undef, undef, '<Branch>' ], [ $auto_string, undef, sub { - $urpm->{options}{auto} = $::options{auto} = $check_boxes{$auto_string}->get_active if $check_boxes{$auto_string}; + $urpm->{options}{auto} = $::rpmdrake_options{auto} = $check_boxes{$auto_string}->get_active if $check_boxes{$auto_string}; }, undef, '<CheckItem>' ], [ N("/_Options") . N("/_Media Manager"), undef, sub { require Rpmdrake::edit_urpm_sources; @@ -435,7 +435,7 @@ sub run_treeview_dialog { %check_boxes = map { $_ => $factory->get_widget("<main>" . $get_path->($auto_string)); } ($auto_string); - $check_boxes{$auto_string}->set_active($::options{auto}) if !$>; + $check_boxes{$auto_string}->set_active($::rpmdrake_options{auto}) if !$>; $checkbox_show_autoselect = $factory->get_widget("<main>" . strip_first_underscore(N("/_Options"), N("/_Show automatically selected packages"))) and $checkbox_show_autoselect->set_active(!$dont_show_selections); @@ -511,7 +511,7 @@ sub run_treeview_dialog { ]); $w->{rwindow}->set_default_size($typical_width*2.7, 500) if !$::isEmbedded; - $find_entry->set_text($options{search}[0]) if $options{search}; + $find_entry->set_text($rpmdrake_options{search}[0]) if $rpmdrake_options{search}; $w->{rwindow}->show_all; $w->{rwindow}->set_sensitive(0); @@ -533,7 +533,7 @@ sub run_treeview_dialog { info => $info, status => $status, }; - $options->{init_callback} = $find_callback if $options{search}; + $options->{init_callback} = $find_callback if $rpmdrake_options{search}; ask_browse_tree_given_widgets_for_rpmdrake($options); } |