aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xedit-urpm-sources.pl64
-rwxr-xr-xrpmdrake47
-rw-r--r--rpmdrake.pm7
3 files changed, 60 insertions, 58 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl
index 64675e8c..72af314d 100755
--- a/edit-urpm-sources.pl
+++ b/edit-urpm-sources.pl
@@ -44,11 +44,11 @@ BEGIN { #- for mcc
BEGIN {
eval {
require ugtk2; ugtk2->import(qw(:all));
- require mygtk2; mygtk2->import(qw(gtknew gtkset))
+ require mygtk2; mygtk2->import(qw(gtknew gtkset));
};
if ($@) {
print "This program cannot be run in console mode ($@_).\n";
- _exit(0); #- skip ugtk2::END
+ POSIX::_exit(0); #- skip ugtk2::END
}
}
@@ -60,7 +60,7 @@ require_root_capability();
*urpm::msg::translate = \&common::translate;
my $urpm;
-my ($mainw, $remove, $edit, $list_tv);
+my ($mainw, $list_tv);
sub selrow {
my ($o_list_tv) = @_;
@@ -79,7 +79,7 @@ sub remove_row {
$model->remove($iter);
}
-sub easy_add_callback {
+sub easy_add_callback() {
#- cooker and community don't have update sources
my $want_base_distro = distro_type(0) eq 'updates' ? interactive_msg_(
N("Choose media type"),
@@ -140,7 +140,7 @@ Is it ok to continue?", $rpmdrake::mandrake_release),
return 1;
}
-sub add_callback {
+sub add_callback() {
my $w = ugtk2->new(N("Add a medium"), grab => 1, center => 1, transient => $mainw->{real_window});
my %radios_infos = (
local => { name => N("Local files"), url => N("Path:"), dirsel => 1 },
@@ -157,7 +157,7 @@ sub add_callback {
my ($count_nbs, %pages);
my $size_group = Gtk2::SizeGroup->new('horizontal');
my ($cb1, $cb2);
- map {
+ foreach (@radios_names_ordered) {
my $info = $radios_infos{$_};
my $url_entry = sub {
gtkpack_(
@@ -172,7 +172,6 @@ sub add_callback {
),
);
};
- my $tips = Gtk2::Tooltips->new;
my $checkbut_entry = sub {
my ($name, $label, $visibility, $callback, $tip) = @_;
my $w = [ gtksignal_connect(
@@ -229,7 +228,7 @@ sub add_callback {
}->(),
))
);
- } @radios_names_ordered;
+ }
$size_group->add_widget($_) foreach $cb1, $cb2;
my $checkok = sub {
@@ -318,7 +317,7 @@ really want to replace it?"), yesno => 1) or return 0;
return 0;
}
-sub options_callback {
+sub options_callback() {
my $w = ugtk2->new(N("Global options for package installation"), grab => 1, center => 1, transient => $mainw->{real_window});
my @verif_radio_infos = (
{ name => N("always"), value => 1 },
@@ -331,8 +330,8 @@ sub options_callback {
$w->{window},
gtkpack(
gtknew('VBox', spacing => 5),
- gtknew('HBox', children_loose => [ gtknew('Label', text => N("Verify RPMs to be installed:")), @verif_radio]),
- gtknew('HBox', children_loose => [ gtknew('Label', text => N("Download program to use:")), @downl_radio]),
+ gtknew('HBox', children_loose => [ gtknew('Label', text => N("Verify RPMs to be installed:")), @verif_radio ]),
+ gtknew('HBox', children_loose => [ gtknew('Label', text => N("Download program to use:")), @downl_radio ]),
gtkpack(
gtknew('HButtonBox'),
gtknew('Button', text => N("Cancel"), clicked => sub { Gtk2->main_quit }),
@@ -358,7 +357,7 @@ sub options_callback {
$w->main;
}
-sub remove_callback {
+sub remove_callback() {
my $row = selrow();
$row == -1 and return;
interactive_msg_(
@@ -372,7 +371,7 @@ sub remove_callback {
urpm::media::remove_media($urpm, [ $urpm->{media}[$row] ]);
urpm::media::write_urpmi_cfg($urpm);
remove_wait_msg($wait);
- return 1
+ return 1;
}
sub renum_media ($$$) {
@@ -380,25 +379,24 @@ sub renum_media ($$$) {
my @rows = map { $model->get_path($_)->to_string } @iters;
my @media = map { $urpm->{media}[$_] } @rows;
$urpm->{media}[$rows[$_]] = $media[1 - $_] foreach 0, 1;
- my $i = 1;
$model->swap(@iters);
urpm::media::write_config($urpm); $urpm = urpm->new; urpm::media::read_config($urpm);
}
-sub upwards_callback {
+sub upwards_callback() {
my ($model, $iter) = $list_tv->get_selection->get_selected; $model && $iter or return;
my $prev = $model->get_iter_from_string($model->get_path($iter)->to_string - 1);
defined $prev and renum_media($model, $iter, $prev);
}
-sub downwards_callback {
+sub downwards_callback() {
my ($model, $iter) = $list_tv->get_selection->get_selected; $model && $iter or return;
my $next = $model->iter_next($iter);
defined $next and renum_media($model, $iter, $next);
}
#- returns the name of the media for which edition failed, or undef on success
-sub edit_callback {
+sub edit_callback() {
my $row = selrow();
$row == -1 and return;
my $medium = $urpm->{media}[$row];
@@ -463,7 +461,7 @@ sub edit_callback {
return undef;
}
-sub update_callback {
+sub update_callback() {
update_sources_interactive($urpm, transient => $mainw->{real_window}, nolock => 1);
}
@@ -521,7 +519,7 @@ sub proxy_callback {
)
)
);
- $sg->add_widget($_) foreach ($proxyentry, $proxyuserentry, $proxypasswordentry);
+ $sg->add_widget($_) foreach $proxyentry, $proxyuserentry, $proxypasswordentry;
$proxybutton->signal_connect(
clicked => sub {
$proxyentry->set_sensitive($_[0]->get_active);
@@ -537,7 +535,7 @@ sub proxy_callback {
$w->main and curl_download::writeproxy($proxy, $proxy_user, $medium_name);
}
-sub parallel_read_sysconf {
+sub parallel_read_sysconf() {
my @conf;
foreach (cat_('/etc/urpmi/parallel.cfg')) {
my ($name, $protocol, $command) = /([^:]+):([^:]+):(.*)/ or print STDERR "Warning, unrecognized line in /etc/urpmi/parallel.cfg:\n$_";
@@ -668,21 +666,21 @@ sub edit_parallel {
{},
[ N("Group name:"), $name_entry = gtkentry($edited->{name}) ],
[ N("Protocol:"), gtknew('HBox', children_tight => [
- @protocols = gtkradio($edited->{protocol}, @protocols_names)]) ],
+ @protocols = gtkradio($edited->{protocol}, @protocols_names) ]) ],
[ N("Media limit:"),
gtknew('HBox', spacing => 5, children => [
1, gtknew('Frame', shadow_type => 'in', child =>
gtknew('ScrolledWindow', h_policy => 'never', child => $medias)),
0, gtknew('VBox', children_tight => [
gtksignal_connect(Gtk2::Button->new(but(N("Add"))), clicked => sub { $add_media->() }),
- gtksignal_connect(Gtk2::Button->new(but(N("Remove"))), clicked => sub { $remove_media->() })])]) ],
+ gtksignal_connect(Gtk2::Button->new(but(N("Remove"))), clicked => sub { $remove_media->() }) ]) ]) ],
[ N("Hosts:"),
gtknew('HBox', spacing => 5, children => [
1, gtknew('Frame', shadow_type => 'in', child =>
gtknew('ScrolledWindow', h_policy => 'never', child => $hosts)),
0, gtknew('VBox', children_tight => [
gtksignal_connect(Gtk2::Button->new(but(N("Add"))), clicked => sub { $add_host->() }),
- gtksignal_connect(Gtk2::Button->new(but(N("Remove"))), clicked => sub { $remove_host->() })])]) ]
+ gtksignal_connect(Gtk2::Button->new(but(N("Remove"))), clicked => sub { $remove_host->() }) ]) ]) ]
),
0, gtknew('HSeparator'),
0, gtkpack(
@@ -709,7 +707,7 @@ sub edit_parallel {
return 0;
}
-sub parallel_callback {
+sub parallel_callback() {
my $w = ugtk2->new(N("Configure parallel urpmi (distributed execution of urpmi)"), grab => 1, center => 1, transient => $mainw->{real_window});
my $list_ls = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String");
my $list = Gtk2::TreeView->new_with_model($list_ls);
@@ -740,11 +738,11 @@ sub parallel_callback {
0, gtkpack__(
gtknew('VBox', spacing => 5),
gtksignal_connect(
- $remove = Gtk2::Button->new(but(N("Remove"))),
+ Gtk2::Button->new(but(N("Remove"))),
clicked => sub { remove_parallel(selrow($list), $conf); $reread->() },
),
gtksignal_connect(
- $edit = Gtk2::Button->new(but(N("Edit..."))),
+ Gtk2::Button->new(but(N("Edit..."))),
clicked => sub {
my $row = selrow($list);
$row != -1 and edit_parallel($row, $conf);
@@ -767,7 +765,7 @@ sub parallel_callback {
$w->main;
}
-sub keys_callback {
+sub keys_callback() {
my $w = ugtk2->new(N("Manage keys for digital signatures of packages"), grab => 1, center => 1, transient => $mainw->{real_window});
my $media_list_ls = Gtk2::ListStore->new("Glib::String");
@@ -868,11 +866,11 @@ sub keys_callback {
0, gtkpack__(
gtknew('VBox', spacing => 5),
gtksignal_connect(
- $remove = Gtk2::Button->new(but(N("Add a key..."))),
+ Gtk2::Button->new(but(N("Add a key..."))),
clicked => \&$add_key,
),
gtksignal_connect(
- $remove = Gtk2::Button->new(but(N("Remove key"))),
+ Gtk2::Button->new(but(N("Remove key"))),
clicked => \&$remove_key,
)
)
@@ -887,7 +885,7 @@ sub keys_callback {
$w->main;
}
-sub mainwindow {
+sub mainwindow() {
$mainw = ugtk2->new(N("Configure media"), center => 1);
$::main_window = $mainw->{real_window};
@@ -994,11 +992,11 @@ sub mainwindow {
0, gtkpack__(
gtknew('VBox', spacing => 5),
gtksignal_connect(
- $remove = Gtk2::Button->new(but(N("Remove"))),
+ Gtk2::Button->new(but(N("Remove"))),
clicked => sub { remove_callback() and $reread_media->() },
),
gtksignal_connect(
- $edit = Gtk2::Button->new(but(N("Edit..."))),
+ Gtk2::Button->new(but(N("Edit..."))),
clicked => sub {
my $name = edit_callback(); defined $name and $reread_media->($name);
}
@@ -1075,4 +1073,6 @@ urpm::media::write_config($urpm);
writeconf();
+undef $lock;
+
myexit 0;
diff --git a/rpmdrake b/rpmdrake
index 984237b3..d52c226c 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -30,7 +30,7 @@ use common;
use POSIX qw(_exit);
use URPM;
use utf8;
-BEGIN { $::no_global_argv_parsing = 1 };
+BEGIN { $::no_global_argv_parsing = 1 }
use standalone;
BEGIN { #- we want to run this code before the Gtk->init of the use-my_gtk
@@ -122,7 +122,7 @@ eval {
};
if ($@) {
print "This program cannot be run in console mode.\n";
- _exit(0); #- skip ugtk2::END
+ POSIX::_exit(0); #- skip ugtk2::END
}
$MODE eq 'update' || $options{root} and require_root_capability();
@@ -142,7 +142,7 @@ sub init {
$mainw = ugtk2->new($title, %options);
$label = gtknew('Label', text => $initializing);
$progressbar = gtknew('ProgressBar', width => 300);
- gtkadd($mainw->{window}, $vbox = gtknew('VBox', spacing => 5, border_width => 6, children_tight => [ $label, $progressbar]));
+ gtkadd($mainw->{window}, $vbox = gtknew('VBox', spacing => 5, border_width => 6, children_tight => [ $label, $progressbar ]));
$mainw->{rwindow}->set_position('center-on-parent');
$mainw->sync;
}
@@ -471,7 +471,7 @@ sub extract_header {
if (-r $hdlist) {
my $packer;
require MDV::Packdrakeng;
- eval { $packer = MDV::Packdrakeng->open (archive => $hdlist, quiet => 1) } or do {
+ eval { $packer = MDV::Packdrakeng->open(archive => $hdlist, quiet => 1) } or do {
warn "Warning, hdlist seems corrupted ($@)\n";
goto header_non_available;
};
@@ -505,13 +505,13 @@ sub extract_header {
}
sub open_db {
- my ($force) = @_;
+ my ($o_force) = @_;
my $host;
log::explanations("opening the RPM database");
if ($options{parallel} && ((undef, $host) = @{$options{parallel}})) {
my $done if 0;
my $dblocation = "/var/cache/urpmi/distantdb/$host";
- if (!$done || $force) {
+ if (!$done || $o_force) {
print "syncing db from $host to $dblocation...";
mkdir_p "$dblocation/var/lib/rpm";
system "rsync -Sauz -e ssh $host:/var/lib/rpm/ $dblocation/var/lib/rpm";
@@ -561,7 +561,7 @@ sub do_search($$$$$$$) {
my $total_size = sum(
map {
my $pack;
- eval { require MDV::Packdrakeng; $pack = MDV::Packdrakeng->open (archive => $_, quiet => 1) } ? $pack->{toc_f_count} : 0;
+ eval { require MDV::Packdrakeng; $pack = MDV::Packdrakeng->open(archive => $_, quiet => 1) } ? $pack->{toc_f_count} : 0;
} @hdlists
);
my $searchstop;
@@ -650,7 +650,7 @@ sub format_field {
package Gtk2::Mdv::TextView;
sub new {
- my ($_class, $icon, $text, $o_options) = @_;
+ my ($_class) = @_;
my $w = mygtk2::gtknew('TextView');
my $time if 0;
require Time::HiRes;
@@ -672,12 +672,12 @@ sub new {
package main;
sub format_pkg_simplifiedinfo {
- my ($pkgs, $key, $urpm, $descriptions) = @_;
- my ($name, $version) = split_fullname($key);
+ my ($pkgs, $key, $_urpm, $descriptions) = @_;
+ my ($name, $_version) = split_fullname($key);
my $update_descr = $pkgs->{$key}{pkg}->flag_upgrade && $descriptions->{$name}{pre};
my $s = ugtk2::markup_to_TextView_format(join("\n", format_header($name . ' - ' . $pkgs->{$key}{summary}) .
# workaround gtk+ bug where GtkTextView wronly limit embedded widget size to bigger line's width (#25533):
- "\x{200b} \x{feff}" . (' ' x 120),
+ "\x{200b} \x{feff}" . ' ' x 120,
if_($update_descr, # is it an update?
format_field(N("Importance: ")) . escape_text_for_TextView_markup_format($descriptions->{$name}{importance}),
format_field(N("Reason for update: ")) . escape_text_for_TextView_markup_format(rpm_description($descriptions->{$name}{pre})),
@@ -729,7 +729,7 @@ sub format_pkg_info {
format_field(N("Currently installed version: ")) . find_installed_version($pkgs->{$key}{pkg}),
)
);
- my @max_info = ($changelog_first ? (@chglo, @files) : (@files, '', @chglo)) if @$max_info_in_descr;
+ my @max_info = @$max_info_in_descr && $changelog_first ? (@chglo, @files) : (@files, '', @chglo);
ugtk2::markup_to_TextView_format(join("\n", format_field(N("Name: ")) . $name,
format_field(N("Version: ")) . $version,
format_field(N("Architecture: ")) . $pkgs->{$key}{pkg}->arch,
@@ -775,7 +775,7 @@ sub run_treeview_dialog {
all_updates => sub {
my %pkgs = grep { my $p = $h->{installable}{$_}; $p->{pkg} && !$p->{selected} && $p->{pkg}->flag_installed && $p->{pkg}->flag_upgrade } keys %{$h->{installable}};
$pkgs = {
- (map { $_ => $h->{updates}->{$_} } keys %{$h->{updates}}),
+ (map { $_ => $h->{updates}{$_} } keys %{$h->{updates}}),
(map { $_ => $h->{installable}{$_} } keys %pkgs)
};
},
@@ -791,7 +791,7 @@ sub run_treeview_dialog {
$filter_methods{$importance} = sub {
$pkgs = $h->{updates};
$pkgs = { map { $_ => $pkgs->{$_} } grep {
- my ($name, $version) = split_fullname($_);
+ my ($name, $_version) = split_fullname($_);
$descriptions->{$name}{importance} eq $importance } keys %$pkgs };
};
}
@@ -808,6 +808,7 @@ sub run_treeview_dialog {
my $is_locale_available = sub {
any { $urpm->{depslist}[$_]->flag_selected } keys %{$urpm->{provides}{$_[0]} || {}} and return 1;
my $found;
+ print "\n\nBUG: $_\"$_\"\n";
$db->traverse_tag('name', [ $_ ], sub { $found ||= 1 });
return $found;
};
@@ -849,7 +850,7 @@ sub run_treeview_dialog {
my $pkg = $pkgs->{$_[0]};
my $urpm_obj = $pkg->{pkg};
$_[0] ? $pkg->{selected} ?
- ($urpm_obj->flag_installed ? ($urpm_obj->flag_upgrade ? 'to_install': 'to_remove') : 'to_install')
+ ($urpm_obj->flag_installed ? ($urpm_obj->flag_upgrade ? 'to_install' : 'to_remove') : 'to_install')
: ($urpm_obj->flag_installed ?
($urpm_obj->flag_upgrade ? 'to_update' : 'installed')
: ($urpm_obj->flag_base ? '/usr/share/rpmdrake/icons/base.png' : 'uninstalled')) : 'XXX';
@@ -964,7 +965,7 @@ or you already installed all of them."));
$w->{real_window},
undef,
[ map { my $pkg = $_;
- [ gtknew('HBox', children_tight => [ gtkset_selectable(gtknew('Label', text => $pkg),1)]),
+ [ gtknew('HBox', children_tight => [ gtkset_selectable(gtknew('Label', text => $pkg), 1) ]),
gtknew('Button', text => N("More information on package..."),
clicked => sub {
interactive_msg_(N("More information on package..."), $options->{get_info}->($pkg), scroll => 1);
@@ -1119,7 +1120,7 @@ or you already installed all of them."));
$tree = Gtk2::TreeView->new_with_model($tree_model);
$tree->get_selection->set_mode('browse');
- $tree->append_column(my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::MDV::CellRendererPixWithLabel->new, 'pixbuf' => 2, label => 0));
+ $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::MDV::CellRendererPixWithLabel->new, 'pixbuf' => 2, label => 0));
$tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 1));
$tree->set_headers_visible(0);
@@ -1127,7 +1128,7 @@ or you already installed all of them."));
$detail_list = Gtk2::TreeView->new_with_model($detail_list_model);
$detail_list->append_column(my $pixcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 1));
$pixcolumn->{is_pix} = 1;
- $detail_list->append_column(my $main_textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
+ $detail_list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0));
$detail_list_model->set_sort_column_id(0, 'ascending');
$detail_list->set_headers_visible(0);
$detail_list->set_rules_hint(1);
@@ -1202,8 +1203,8 @@ or you already installed all of them."));
return if $val eq $old_value; # workarounding gtk+ sending us sometimes twice events
$old_value = $val;
$default_list_mode = $rmodes{$val};
- if ($wanted_categories{$rmodes{$val}} and my @cat = @{$wanted_categories{$rmodes{$val}}}) {
- @{$mandrakeupdate_wanted_categories} = @cat;
+ if (my @cat = $wanted_categories{$rmodes{$val}} && @{$wanted_categories{$rmodes{$val}}}) {
+ @$mandrakeupdate_wanted_categories = @cat;
}
if (0) {
$reset_search->();
@@ -1235,7 +1236,7 @@ or you already installed all of them."));
{
$search_types_optionmenu->set_model(Gtk2::ListStore->new('Glib::String'));
my $search_types_renderer = Gtk2::CellRendererText->new;
- $search_types_optionmenu->pack_start($search_types_renderer, Glib::FALSE());
+ $search_types_optionmenu->pack_start($search_types_renderer, 0);
$search_types_optionmenu->set_attributes($search_types_renderer, text => 0);
my $iter = $search_types_optionmenu->get_model->iter_nth_child(undef, 0);
$iter = $search_types_optionmenu->get_model->insert(0);
@@ -1424,7 +1425,7 @@ Do you really want to install all the selected packages?"), yesno => 1)
clicked => sub { rpmdrake::open_help($MODE) },
),
1, gtknew('Label'),
- 0, my $select_button = gtksignal_connect(
+ 0, gtksignal_connect(
Gtk2::Button->new(but_(N("Select all"))),
clicked => sub {
return if !ref($options->{toggle_all});
@@ -2096,7 +2097,7 @@ sub perform_removal {
sub {
@results = $options{parallel}
? urpm::parallel::remove($urpm, \@toremove)
- : urpm::install::install($urpm,\@toremove, {}, {});
+ : urpm::install::install($urpm, \@toremove, {}, {});
open_db('force_sync');
},
);
diff --git a/rpmdrake.pm b/rpmdrake.pm
index 0cd546b9..400f2b78 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -39,6 +39,7 @@ use strict;
use c;
use POSIX qw(_exit);
use common;
+use Locale::gettext;
use curl_download;
@@ -87,7 +88,7 @@ unshift @::textdomains, 'rpmdrake', 'urpmi';
eval { require ugtk2; ugtk2->import(qw(:all)) };
if ($@) {
print "This program cannot be run in console mode.\n";
- _exit(0); #- skip ugtk2::END
+ POSIX::_exit(0); #- skip ugtk2::END
}
ugtk2::add_icon_path('/usr/share/rpmdrake/icons');
@@ -502,7 +503,7 @@ sub mirrors {
require timezone;
my $tz = ${timezone::read()}{timezone};
foreach my $mirror (@mirrors) {
- my ($land, $goodness);
+ my $goodness;
each_index { $_ = $u2l{$_} || $_; $_ eq $mirror->{country} and $goodness ||= 100-$::i } (map { if_($tz =~ /^$_$/, @{$t2l{$_}}) } keys %t2l), @$us;
$mirror->{goodness} = $goodness + rand();
$mirror->{country} = translate($mirror->{country});
@@ -615,7 +616,7 @@ by Mandriva Linux Official Updates.")), %options
sub make_url_mirror {
my ($mirror) = @_;
# because updates media do not provide media.cfg yet
- $mirror . '/media/main/updates'
+ $mirror . '/media/main/updates';
}
sub make_url_mirror_dist {