summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rwxr-xr-xmdkapplet31
-rwxr-xr-xmdkapplet-upgrade-helper7
3 files changed, 39 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index f80c6a2c..42e64837 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+- mdkapplet
+ o display a "download all packages at once" option
+ o offer to select where to download packages
+
Version 2.77.5 - 8 September 2009, Aurelien Lefebvre
- mdkapplet-config
diff --git a/mdkapplet b/mdkapplet
index 7bfa7418..ebffcc94 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -246,10 +246,11 @@ foreach my $opt (@ARGV) {
}
}
-my $root;
+my ($root, $download_dir, $download_all);
{
my $temp_urpm = Rpmdrake::open_db::fast_open_urpmi_db();
$root = $temp_urpm->{root};
+ $download_dir = $temp_urpm->{cachedir};
}
my ($new_distro, $no_more_supported);
@@ -412,6 +413,16 @@ sub confirm_upgrade() {
local $mygtk2::left_padding = 0;
my $warn_me = text2bool($local_config{DO_NOT_ASK_FOR_DISTRO_UPGRADE});
my $w = new_portable_dialog(N("New version of Mandriva Linux distribution"));
+ my ($temp_dir, $box);
+
+ my $browse;
+ $browse = gtksignal_connect(
+ Gtk2::FileChooserButton->new(N("Browse"), 'select-folder'),
+ 'current-folder-changed' => sub {
+ $temp_dir = $_[0]->get_current_folder;
+ });
+ $browse->set_current_folder($download_dir);
+
my $res = fill_n_run_portable_dialog($w,
[
get_banner(),
@@ -422,12 +433,27 @@ sub confirm_upgrade() {
gtknew('Label_Left', text => N("Do you want to upgrade to the '\%s' distribution?",
$new_distro->{name} || $new_distro->{version}), @common),
gtknew('CheckButton', text => N("Do not ask me next time"), active_ref => \$warn_me),
+ gtknew('CheckButton', text => N("Download all packages at once") . "\n" .
+ N("(Warning: You will need quite a lot of free space)"),
+ active_ref => \$download_all, sensitive_ref => \$browse,
+ toggled => sub { $box->set_sensitive($download_all) },
+ ),
+ $box = gtknew('HBox', sensitive => $download_all,
+ children => [
+ 0, gtknew('Label_Left', text => N("Where to download packages:")),
+ 1 , $browse,
+ ]),
create_okcancel($w, N("Next"), N("Cancel")),
]);
setVar('DO_NOT_ASK_FOR_DISTRO_UPGRADE', bool2text($warn_me));
$local_config{DO_NOT_ASK_FOR_DISTRO_UPGRADE} = bool2text($warn_me);
- $res ? really_confirm_upgrade() : 0;
+ if ($res) {
+ $download_dir = $temp_dir;
+ really_confirm_upgrade();
+ } else {
+ return 0;
+ }
}
sub really_confirm_upgrade() {
@@ -470,6 +496,7 @@ sub upgrade() {
return if $mdv_update_pid;
return if !confirm_upgrade();
$mdv_update_pid = fork_exec('mdkapplet-upgrade-helper', "--new_distro_version=$new_distro->{version}",
+ if_($download_all, "--download-all=$download_dir"),
if_($root, "--urpmi-root=$root"));
}
diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper
index f7ba00c3..c04b9ee4 100755
--- a/mdkapplet-upgrade-helper
+++ b/mdkapplet-upgrade-helper
@@ -41,13 +41,16 @@ use Rpmdrake::open_db;
ugtk2::add_icon_path("/usr/share/mdkonline/pixmaps/");
my ($log_file);
-my $new_distro_version;
+my ($new_distro_version, $download_dir);
foreach my $opt (@ARGV) {
if ($opt =~ /--(rpm-root|urpmi-root)=(.*)/) {
$::rpmdrake_options{$1}[0] = $2;
} elsif ($opt =~ /--new_distro_version=(.*)/) {
$new_distro_version = $1;
+ } elsif ($opt =~ /--download-all=(.*)/) {
+ $download_dir = $1;
}
+
}
my $root = Rpmdrake::open_db::fast_open_urpmi_db()->{root};
@@ -85,6 +88,8 @@ sub check_available_free_space {
sub run_gurpmi() {
my @initial_args = ('--replacefiles', '--clean');
+ push @initial_args, "--download-all=$download_dir" if $download_dir;
+
while ($refork_gurpmi) {
my $ok = fork_gurpmi(@initial_args);