check_logfiles: 3.7.5.1
[omd.git] / packages / perl-modules / download_package
blob3df51499462ee08a6022f1c69d854d5543f20f22
1 #!/usr/bin/perl
3 use warnings;
4 use strict;
5 use lib 'lib';
6 use BuildHelper;
8 BEGIN {
9 for my $val (qw/PERL5LIB PERL_MB_OPT PERL_LOCAL_LIB_ROOT PERL_MM_OPT/) {
10 delete $ENV{$val} if defined $ENV{$val};
14 ####################################
15 # gather list
16 my $modules = [];
17 for my $module (@ARGV) {
18 if(-d $module) {
19 my $meta = BuildHelper::get_meta_for_dir($module);
20 my $deps = BuildHelper::get_deps_from_meta($meta);
21 push @{$modules}, keys %{$deps};
23 elsif(-f $module) {
24 my $dir = BuildHelper::unpack($module);
25 my $meta = BuildHelper::get_meta_for_dir($dir);
26 my $deps = BuildHelper::get_deps_from_meta($meta);
27 push @{$modules}, keys %{$deps};
28 } else {
29 push @{$modules}, $module;
33 ####################################
34 # download modules
35 my $downloaded;
36 chdir('src') or die("cannot change dir 'src': $!");
37 for my $module (@{$modules}) {
38 if($module =~ m/^[\w\.\-\+]+(\.gz|\.zip|\.tgz)$/g) {
39 BuildHelper::download_src($module);
40 print "downloaded $module\n";
41 next;
43 $module =~ s/\//::/g;
44 $module =~ s/\-/::/g;
45 $module =~ s/\.pm$//g;
46 print $module." is a core module\n" if BuildHelper::is_core_module($module);
47 $downloaded = BuildHelper::download_module($module, undef, 1);
49 chdir('..') or die("cannot change dir '..': $!");
51 exit unless defined $downloaded;
53 # print result of all downloaded files
54 if(scalar @{$downloaded} > 0) {
55 print "\n";
56 print "please add the following tarballs to the Makefile:\n";
57 print join("\n", @{$downloaded});
58 print "\n";
59 } else {
60 print "no new packages downloaded\n";