Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / perl-modules / update_modules
blob406b8e964e4dad9439f85a1e5162f4367b20ce14
1 #!/usr/bin/perl
3 use warnings;
4 use strict;
5 use Data::Dumper;
6 use lib 'lib';
7 use BuildHelper;
9 my @modules;
10 my($deps,$files) = BuildHelper::get_all_deps();
11 chdir('src') or die("cannot change into src dir: $!");
12 if(scalar @ARGV == 0) {
13 @modules = sort glob('*');
14 } else {
15 @modules = @ARGV;
18 my($x,$max) = (1, scalar @modules);
19 for my $file (@modules) {
20 printf("*** (%3s/%s) ", $x, $max) if $max > 1;
21 $x++;
22 printf "%-55s", $file;
24 if(!-f $file) {
25 my $newfile = BuildHelper::module_to_file($file, $files);
26 if($newfile) {
27 $file = $newfile;
28 } else {
29 die("no idea how to handle $file");
33 if($file =~ m/^MongoDB/mx) {
34 print "skipped, broken since 0.46 on redhat 5.8\n";
35 next;
37 if($file =~ m/^ExtUtils\-Depends\-/mx) {
38 print "skipped, cpan points to wrong module\n";
39 next;
41 if($file =~ m/^File-Temp\-/mx) {
42 print "skipped, broken since 0.22\n";
43 next;
45 if($file =~ m/^Module-Build\-/mx) {
46 print "skipped, newer version requires dependecies which fail on old platforms\n";
47 next;
49 if($file =~ m/^GD\-/mx) {
50 print "skipped, requires new Module:Build, see above\n";
51 next;
53 if($file =~ m/^Moose\-/mx) {
54 print "skipped, breaks Excel::Template::Plus::TT with 'Class::MOP::load_class is deprecated'\n";
55 next;
57 if($file =~ m/^Nagios\-Plugin\-/mx) {
58 print "skipped\n";
59 next;
61 if($file =~ m/^ExtUtils\-Manifest\-/mx) {
62 print "skipped, broken symlinks in make distcheck\n";
63 next;
66 my($modname,$modversion) = BuildHelper::file_to_module($file);
67 my $urlpath = BuildHelper::get_url_for_module($modname);
68 my $tarball = $urlpath;
69 $tarball =~ s/^.*\///g;
70 $tarball =~ s/%2B/+/g;
71 $tarball =~ s/0\.29a\.tar\.gz/0.29.tar.gz/g;
72 my($newname,$newversion) = BuildHelper::file_to_module($tarball);
74 if(-f $tarball || BuildHelper::version_compare($modversion, $newversion)) {
75 print "no updates\n";
76 } else {
77 print "updated: $newversion\n";
78 my $downloaded = BuildHelper::download_module($modname, 0, 1, 1);
79 if(scalar @{$downloaded} != 1) {
80 die("download failed: ".Dumper($downloaded));
82 my $new = shift @{$downloaded};
83 `sed -i ../Makefile -e 's|$file|$new|'`;
84 `git rm $file`;
85 `git add $new`;