summaryrefslogtreecommitdiff
blob: 5f4d5f998389b8db07f86dc22a10829ef9c5b7a9 (plain)
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
#!/usr/bin/env perl 

use strict;
use warnings;
# FILENAME: fixvdep.pl
# CREATED: 12/11/11 00:52:15 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Fix up version deps on a specific package in (a) given ebuild(s)

if ( not @ARGV or grep { /-h|--help/ } @ARGV ) {
    print <<"MSG";

    Usage:

    fixvdep.pl Perl-Module-Name oldformat newformat \@files;

    ie:

    fixdep.pl  Moose 0.91 0.910.0 ./*/*.ebuild

MSG
    exit 0;
}
my ( $pkg, $oldversion , $newversion , @files ) = @ARGV;
@ARGV = ();


my @subs = ( 
  
  ( sprintf 's/%s-%s\s*$/%s-%s/' , $pkg, $oldversion,$pkg,$newversion ),
  ( sprintf 's/%s-%s\s*"/%s-%s"/' , $pkg, $oldversion,$pkg,$newversion ),
  ( sprintf 's/%s-%s\s*(\).*$)/%s-%s \1/' , $pkg, $oldversion,$pkg,$newversion ),
  ( sprintf 's/%s\s*%s\s*$/%s %s/', $pkg, $oldversion, $pkg, $newversion ),
  ( sprintf 's/%s\s*%s\s*#\s*%s\s*$/%s %s/', 
      $pkg, $oldversion, $newversion, $pkg, $newversion ),
  ( sprintf 's/%s-%s\s*\$\(comment\s*%s\)\s*$/%s-%s/', $pkg, $oldversion, $newversion, $pkg, $newversion ),





);

for my $sub ( @subs ) {
  print "$sub\n";
  system('sed','-i', '-r', '-e', $sub , @files );
}