diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AdminPanel/Rpmdragora/gui.pm | 2 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/pkg.pm | 35 | ||||
-rw-r--r-- | lib/AdminPanel/rpmdragora.pm | 11 |
3 files changed, 25 insertions, 23 deletions
diff --git a/lib/AdminPanel/Rpmdragora/gui.pm b/lib/AdminPanel/Rpmdragora/gui.pm index 25416ce..0a7d09f 100644 --- a/lib/AdminPanel/Rpmdragora/gui.pm +++ b/lib/AdminPanel/Rpmdragora/gui.pm @@ -251,7 +251,7 @@ sub get_url_link { my $url = $upkg->url || $pkg->{url}; if (!$url) { - open_rpm_db()->traverse_tag_find('name', $upkg->name, sub { $url = $_[0]->url }); + open_rpm_db()->traverse_tag_find('name', $upkg->name, sub { $url = $_[0]->url; return ($url ? 1 : 0) }); } return if !$url; diff --git a/lib/AdminPanel/Rpmdragora/pkg.pm b/lib/AdminPanel/Rpmdragora/pkg.pm index ff86c17..380595e 100644 --- a/lib/AdminPanel/Rpmdragora/pkg.pm +++ b/lib/AdminPanel/Rpmdragora/pkg.pm @@ -52,6 +52,7 @@ use urpm::get_pkgs; use urpm::select; use urpm::main_loop; use urpm::args qw(); +use urpm::util; my $loc = AdminPanel::rpmdragora::locale(); @@ -125,9 +126,11 @@ sub extract_header { my ($local_source, %xml_info_pkgs, $bar_id); my $_statusbar_clean_guard = MDK::Common::Func::before_leaving { $bar_id and statusbar_msg_remove($bar_id) }; my $dir = urpm::file_from_local_url($medium->{url}); + print "p->filename: ". $p->filename."\n"; $local_source = "$dir/" . $p->filename if $dir; - print "local_source: $local_source\n"; + print "local_source: " . ($local_source ? $local_source : "") . "\n"; + if ($local_source && -e $local_source) { $bar_id = statusbar_msg($loc->N("Getting information from %s...", $dir), 0); $urpm->{log}("getting information from rpms from $dir"); @@ -195,9 +198,10 @@ sub extract_header { sub find_installed_version { my ($p) = @_; - my $version; - open_rpm_db()->traverse_tag_find('name', $p->name, sub { $version = $_[0]->EVR }); - $version || $loc->N("(none)"); + + my $version = $loc->N("(none)"); + open_rpm_db()->traverse_tag_find('name', $p->name, sub { $version = $_[0]->EVR; return ($version ? 1 : 0) }) if $p; + return $version; } my $canceled; @@ -205,12 +209,12 @@ sub download_callback { my ($gurpm, $mode, $file, $percent, $total, $eta, $speed) = @_; $canceled = 0; if ($mode eq 'start') { - $gurpm->label($loc->N("Downloading package `%s'...", basename($file))); + $gurpm->label($loc->N("Downloading package `%s'...", urpm::util::basename($file))); $gurpm->validate_cancel(but($loc->N("Cancel")), sub { $canceled = 1 }); } elsif ($mode eq 'progress') { $gurpm->label( join("\n", - $loc->N("Downloading package `%s'...", basename($file)), + $loc->N("Downloading package `%s'...", urpm::util::basename($file)), (defined $total && defined $eta ? $loc->N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed) : $loc->N(" %s%% completed, speed = %s", $percent, $speed) @@ -557,15 +561,16 @@ sub get_pkgs { my $backports = $medium->{searchmedia} ? \@inactive_backports : \@active_backports; - - foreach my $pkg_id ($medium->{start} .. $medium->{end}) { - next if !$pkg_id; - my $pkg = $urpm->{depslist}[$pkg_id]; - $pkg->flag_upgrade or next; - my $name = $pkg->fullname; - push @$backports, $name; - $all_pkgs{$name} = { pkg => $pkg, is_backport => 1 }; - } + if (defined($medium->{start}) || defined($medium->{end})) { + foreach my $pkg_id ($medium->{start} .. $medium->{end}) { + next if !$pkg_id; + my $pkg = $urpm->{depslist}[$pkg_id]; + $pkg->flag_upgrade or next; + my $name = $pkg->fullname; + push @$backports, $name; + $all_pkgs{$name} = { pkg => $pkg, is_backport => 1 }; + } + } } my @updates = @requested; # selecting updates by default but skipped ones (MageiaUpdate only): diff --git a/lib/AdminPanel/rpmdragora.pm b/lib/AdminPanel/rpmdragora.pm index 4af30e5..59dd237 100644 --- a/lib/AdminPanel/rpmdragora.pm +++ b/lib/AdminPanel/rpmdragora.pm @@ -381,11 +381,7 @@ sub fatal_msg { } sub wait_msg { - my ($msg, %options) = @_; - - if (ref \%options) { - warnings::warn("AdminPanel::rpmdragora::wait_msg: options parameter is deprecated, and discarded"); - } + my $msg = shift; my $label = $msg ? $msg : $loc->N("Please wait"); @@ -434,11 +430,12 @@ sub slow_func ($&) { } sub statusbar_msg { + my ($msg, $o_timeout) = @_; + unless ($::statusbar) { #- fallback if no status bar - my $msg = shift; return wait_msg($msg); } - my ($msg, $o_timeout) = @_; + $::statusbar->setLabel($msg); #- always use the same context description for now #my $cx = $::statusbar->get_context_id("foo"); |