aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-15 10:30:56 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-15 10:30:56 +0000
commit888018ec998231ca6bf6311acb0b69024711472b (patch)
treeecf11f37ca68cdc6fb577a78f4834bf04b6c552e
parentf13d1a637d5fb5ac98f0b971be131b0d9035a565 (diff)
downloadrpmdrake-888018ec998231ca6bf6311acb0b69024711472b.tar
rpmdrake-888018ec998231ca6bf6311acb0b69024711472b.tar.gz
rpmdrake-888018ec998231ca6bf6311acb0b69024711472b.tar.bz2
rpmdrake-888018ec998231ca6bf6311acb0b69024711472b.tar.xz
rpmdrake-888018ec998231ca6bf6311acb0b69024711472b.zip
Integrate code from the obsolete gurpm.pm
-rwxr-xr-xrpmdrake80
-rw-r--r--rpmdrake.spec2
2 files changed, 70 insertions, 12 deletions
diff --git a/rpmdrake b/rpmdrake
index 5ecbc4c1..2fba77a0 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -43,7 +43,6 @@ use strict;
use lib qw(/usr/lib/libDrakX);
use common;
use rpmdrake;
-use gurpm;
#- This is needed because text printed by Gtk2 will always be encoded
#- in UTF-8; we first check if LC_ALL is defined, because if it is,
@@ -56,7 +55,7 @@ if ($collation_locale) {
} else {
$collation_locale = setlocale(LC_COLLATE);
$collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8");
-};
+}
our %options;
our $MODE = 'install';
@@ -86,12 +85,68 @@ foreach (@ARGV) {
$::isStandalone = 1;
+package gurpm;
+
+ugtk2->import(':all');
+
+our ($mainw, $label, $progressbar, $vbox, $cancel, $hbox_cancel);
+
+sub init {
+ my ($title, $initializing, %options) = @_;
+ $mainw = ugtk2->new($title, %options);
+ $label = Gtk2::Label->new($initializing);
+ $progressbar = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1);
+ gtkadd($mainw->{window}, gtkpack__($vbox = gtkset_border_width(Gtk2::VBox->new(0, 5),6), $label, $progressbar));
+ $mainw->{rwindow}->set_position('center');
+ $mainw->sync;
+}
+
+sub label {
+ $label->set($_[0]);
+ select(undef, undef, undef, 0.1); #- hackish :-(
+ $mainw->flush;
+}
+
+sub progress {
+ $progressbar->set_fraction($_[0]);
+ $mainw->flush;
+}
+
+sub end {
+ $mainw and $mainw->destroy;
+ $mainw = undef;
+ $cancel = undef; #- in case we'll do another one later
+}
+
+sub validate_cancel {
+ my ($cancel_msg, $cancel_cb) = @_;
+ if (!$cancel) {
+ gtkpack__($vbox,
+ $hbox_cancel = gtkpack__(create_hbox(),
+ $cancel = gtksignal_connect(Gtk2::Button->new($cancel_msg), clicked => \&$cancel_cb)));
+ }
+ $cancel->set_sensitive(1);
+ $cancel->show;
+}
+
+sub invalidate_cancel {
+ $cancel and $cancel->set_sensitive(0);
+}
+
+sub invalidate_cancel_forever {
+ $hbox_cancel or return;
+ $hbox_cancel->destroy;
+ $mainw->shrink_topwindow;
+}
+
+package main;
+
my $w;
my $changelog_first;
-sub interactive_msg_ { interactive_msg(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) };
-sub interactive_list_ { interactive_list(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) };
-sub wait_msg_ { wait_msg(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) };
+sub interactive_msg_ { interactive_msg(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) }
+sub interactive_list_ { interactive_list(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) }
+sub wait_msg_ { wait_msg(@_, if_(exists $w->{rwindow}, transient => $w->{rwindow})) }
$> and (interactive_msg_(N("Running in user mode"),
N("You are launching this program as a normal user.
@@ -224,7 +279,7 @@ sub rpm_description {
sub myformatList {
my $r = formatList(40, @_);
$r =~ s/(.{50}\S*)\s/$1\n/g;
- $r
+ $r;
}
sub split_fullname { $_[0] =~ /^(.*)-([^-]+-[^-]+)$/ }
@@ -486,7 +541,7 @@ sub run_treeview_dialog {
@keys = grep {
my ($name) = split_fullname($_);
member($descriptions->{$name}{importance}, @$mandrakeupdate_wanted_categories)
- || ! $descriptions->{$name}{importance}
+ || ! $descriptions->{$name}{importance};
} @keys;
if (@keys == 0) {
$add_node->('', N("(none)"), { nochild => 1 });
@@ -1384,10 +1439,13 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-(
gurpm::label(N("Verifying packages signatures..."));
my $total = @rpms_install + @rpms_upgrade;
my $progress;
- my @invalid_sources = to_utf8($urpm->check_sources_signatures(\%sources_install, \%sources, translate => 1, basename => 1,
- callback => sub {
- gurpm::progress(++$progress/$total);
- }));
+ my @invalid_sources = to_utf8($urpm->check_sources_signatures(
+ \%sources_install, \%sources,
+ translate => 1, basename => 1,
+ callback => sub {
+ gurpm::progress(++$progress/$total);
+ },
+ ));
if (@invalid_sources) {
interactive_msg_(N("Rpmdrake"),
N("The following packages have bad signatures:\n\n%s\n\nDo you want to continue installation?",
diff --git a/rpmdrake.spec b/rpmdrake.spec
index 2341f915..732ce7ad 100644
--- a/rpmdrake.spec
+++ b/rpmdrake.spec
@@ -17,7 +17,7 @@ License: GPL
Source0: %name-%version.tar.bz2
Summary: Mandrakelinux graphical front end for choosing packages for installion/removal
Requires: perl-MDK-Common >= 1.1.18-2mdk
-Requires: urpmi >= 4.6.4-4mdk gurpmi >= 4.6.4-4mdk
+Requires: urpmi >= 4.6.8-1mdk
Requires: perl-URPM >= 1.03-1mdk
Requires: drakxtools >= 10.1-11mdk
Requires: rpmtools >= 5.0.5