| 1 |
#!/bin/env perl -w |
| 2 |
# |
| 3 |
# $Id: cpan_apply_updates 11860 2010-12-09 03:47:03Z skayser $ |
| 4 |
# |
| 5 |
# Copyright 2006 Cory Omand <comand@blastwave.org> |
| 6 |
# All rights reserved. Use is subject to license terms. |
| 7 |
# |
| 8 |
# Redistribution and/or use, with or without modification, is |
| 9 |
# permitted. This software is without warranty of any kind. The |
| 10 |
# author(s) shall not be liable in the event that use of the |
| 11 |
# software causes damage. |
| 12 |
# |
| 13 |
# cpan_apply_updates - process data created by cpan_check. Applies |
| 14 |
# version updates to module Makefiles, fetches new |
| 15 |
# sources, and updates checksums. |
| 16 |
# |
| 17 |
|
| 18 |
use strict; |
| 19 |
|
| 20 |
while (<>) { |
| 21 |
next if /^#/; |
| 22 |
chomp; |
| 23 |
my ($module, $newvers) = split /\|/, $_; |
| 24 |
next unless $module && $newvers; |
| 25 |
|
| 26 |
unless (-d $module) { |
| 27 |
print "Cannot find module directory: $module\n"; |
| 28 |
next; |
| 29 |
} |
| 30 |
print "Updating $module to $newvers\n"; |
| 31 |
my $rpat = "s/^(VERSION).*\$/\$1 = $newvers/"; |
| 32 |
system("perl -i.bak -plne '$rpat' $module/Makefile") |
| 33 |
and die "Failed to upgrade $module\n"; |
| 34 |
system("gmake -C $module update") |
| 35 |
and die "Failed to execute update target on $module\n"; |
| 36 |
} |