forked from sni/thruk_libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_modules
More file actions
executable file
·87 lines (80 loc) · 2.41 KB
/
update_modules
File metadata and controls
executable file
·87 lines (80 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
use lib 'lib';
use BuildHelper;
my @modules;
my($deps,$files) = BuildHelper::get_all_deps();
chdir('src') or die("cannot change into src dir: $!");
if(scalar @ARGV == 0) {
@modules = sort glob('*');
} else {
@modules = @ARGV;
}
my($x,$max) = (1, scalar @modules);
for my $file (@modules) {
printf("*** (%3s/%s) ", $x, $max) if $max > 1;
$x++;
printf "%-55s", $file;
if(!-f $file) {
my $newfile = BuildHelper::module_to_file($file, $files);
if($newfile) {
$file = $newfile;
} else {
die("no idea how to handle $file");
}
}
if($file =~ m/^MongoDB/mx) {
print "skipped, broken since 0.46 on redhat 5.8\n";
next;
}
if($file =~ m/^ExtUtils\-Depends\-/mx) {
print "skipped, cpan points to wrong module\n";
next;
}
if($file =~ m/^File-Temp\-/mx) {
print "skipped, broken since 0.22\n";
next;
}
if($file =~ m/^Module-Build\-/mx) {
print "skipped, newer version requires dependecies which fail on old platforms\n";
next;
}
if($file =~ m/^GD\-/mx) {
print "skipped, requires new Module:Build, see above\n";
next;
}
if($file =~ m/^Moose\-/mx) {
print "skipped, breaks Excel::Template::Plus::TT with 'Class::MOP::load_class is deprecated'\n";
next;
}
if($file =~ m/^Nagios\-Plugin\-/mx) {
print "skipped\n";
next;
}
if($file =~ m/^ExtUtils\-Manifest\-/mx) {
print "skipped, broken symlinks in make distcheck\n";
next;
}
my($modname,$modversion) = BuildHelper::file_to_module($file);
my $urlpath = BuildHelper::get_url_for_module($modname);
my $tarball = $urlpath;
$tarball =~ s/^.*\///g;
$tarball =~ s/%2B/+/g;
$tarball =~ s/0\.29a\.tar\.gz/0.29.tar.gz/g;
my($newname,$newversion) = BuildHelper::file_to_module($tarball);
if(-f $tarball || BuildHelper::version_compare($modversion, $newversion)) {
print "no updates\n";
} else {
print "updated: $newversion\n";
my $downloaded = BuildHelper::download_module($modname, 0, 1, 1);
if(scalar @{$downloaded} != 1) {
die("download failed: ".Dumper($downloaded));
}
my $new = shift @{$downloaded};
`sed -i ../Makefile -e 's|$file|$new|'`;
`git rm $file`;
`git add $new`;
}
}