aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2016-06-16 21:13:07 +0200
committerMatteo Pasotti <matteo.pasotti@gmail.com>2016-06-16 21:13:07 +0200
commit9f5e49082da0e769114bd4db43056f7fae04aeff (patch)
treedfa5f74bc6b6227c29d50b304cf902c2ba628cc6 /lib/ManaTools
parent310a55009bef99e2ff54f7d103abea727993a5fc (diff)
downloadmanatools-9f5e49082da0e769114bd4db43056f7fae04aeff.tar
manatools-9f5e49082da0e769114bd4db43056f7fae04aeff.tar.gz
manatools-9f5e49082da0e769114bd4db43056f7fae04aeff.tar.bz2
manatools-9f5e49082da0e769114bd4db43056f7fae04aeff.tar.xz
manatools-9f5e49082da0e769114bd4db43056f7fae04aeff.zip
- no longer extends Module as it's not going to use GUI
Diffstat (limited to 'lib/ManaTools')
-rw-r--r--lib/ManaTools/Module/PkgDownloader.pm24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/ManaTools/Module/PkgDownloader.pm b/lib/ManaTools/Module/PkgDownloader.pm
index 43c3d9db..2c1cd8f2 100644
--- a/lib/ManaTools/Module/PkgDownloader.pm
+++ b/lib/ManaTools/Module/PkgDownloader.pm
@@ -26,10 +26,11 @@ use Term::ANSIColor qw(:constants);
use Moose;
use Moose::Autobox;
use ManaTools::Shared::urpmi_backend::DB;
+use ManaTools::Shared qw(trim);
with 'MooseX::Getopt';
-extends qw( ManaTools::Module );
+# extends qw( ManaTools::Module );
my $PKG_QUERYMAKER = "urpmq";
my $QUERY_LISTMEDIA_PARM = "--list-media";
@@ -38,12 +39,6 @@ my $QUERY_LOOKFORSRPM_PARM = "--sourcerpm";
my $QUERY_PKG_FULL = "-f";
my $DLDER = "--wget";
-has '+name' => (
- default => 'urpm-downloader',
- required => 0,
- init_arg => undef,
-);
-
has 'use_wget' => (
is => 'rw',
isa => 'Bool',
@@ -72,6 +67,7 @@ has 'packagelist' => (
is => 'rw',
isa => 'Str',
required => 1,
+ default => sub { return ""; },
);
has 'packages' => (
@@ -82,8 +78,13 @@ has 'packages' => (
sub process_args {
my ($self, $pkglist) = @_;
- for(split(/\s/,$pkglist)){
- push @{$self->packages()}, $_;
+ return 0 if(ManaTools::Shared::trim($pkglist)=~m/^$/g);
+ my @items = split(/\s/,$pkglist);
+ if(scalar(@items)>0){
+ for(@items){
+ push @{$self->packages()}, $_;
+ }
+ return 1;
}
}
@@ -143,7 +144,10 @@ sub start {
}
} $rpmbackend->get_active_media($urpm,$self->srpm());
- $self->process_args($self->packagelist());
+ if(!$self->process_args($self->packagelist()))
+ {
+ return 4;
+ }
if(scalar(@media_urls) lt 1)