diff options
author | Matteo Pasotti <matteo.pasotti@gmail.com> | 2016-06-16 21:13:07 +0200 |
---|---|---|
committer | Matteo Pasotti <matteo.pasotti@gmail.com> | 2016-06-16 21:13:07 +0200 |
commit | 9f5e49082da0e769114bd4db43056f7fae04aeff (patch) | |
tree | dfa5f74bc6b6227c29d50b304cf902c2ba628cc6 | |
parent | 310a55009bef99e2ff54f7d103abea727993a5fc (diff) | |
download | manatools-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
-rw-r--r-- | lib/ManaTools/Module/PkgDownloader.pm | 24 | ||||
-rwxr-xr-x | scripts/urpm-downloader | 2 |
2 files changed, 15 insertions, 11 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) diff --git a/scripts/urpm-downloader b/scripts/urpm-downloader index 6497554c..a06f4e7a 100755 --- a/scripts/urpm-downloader +++ b/scripts/urpm-downloader @@ -21,7 +21,7 @@ use Modern::Perl '2011'; use autodie; use ManaTools::Module::PkgDownloader; -my $pkgdlManager = ManaTools::Module::PkgDownloader->new_with_options(); +my $pkgdlManager = ManaTools::Module::PkgDownloader->new(); $pkgdlManager->start(); 1; |