Created
April 18, 2021 01:18
-
-
Save benkasminbullock/12c185e2922e5dd70da803c02471a421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/ben/software/install/bin/perl | |
use Z; | |
use Perl::Build 'add'; | |
my $ok = GetOptions ( | |
add => \my $add, | |
copy => \my $copy, | |
diff => \my $diff, | |
reversion => \my $reversion, | |
verbose => \my $verbose, | |
); | |
if (! $ok) { | |
print <<EOF; | |
--all - do a commit | |
--copy - copy from the repo | |
--diff - diff with repo | |
--reversion - update the versions | |
EOF | |
exit (1); | |
} | |
if ($add) { | |
add (); | |
exit; | |
} | |
if ($copy) { | |
copy (); | |
exit; | |
} | |
if ($diff) { | |
diff (); | |
exit; | |
} | |
if ($reversion) { | |
reversion (); | |
exit; | |
} | |
do_system ("perl Makefile.PL;make;make test"); | |
exit; | |
sub copy | |
{ | |
my $verbose = 1; | |
my $dir = '/home/ben/software/perl/perl-git/dist/ExtUtils-ParseXS'; | |
do_system ("cp -rf $dir/lib/ExtUtils/* $Bin/lib/ExtUtils", $verbose); | |
do_system ("cp -rf $dir/t/* $Bin/t/", $verbose); | |
# do_system ("cp -f $dir/Changes $Bin/Changes", $verbose); | |
} | |
sub reversion | |
{ | |
my $old_version = '3.43'; | |
my $new_version = '3.43_02'; | |
my @files = qw! | |
lib/ExtUtils/ParseXS.pm | |
lib/ExtUtils/ParseXS/Constants.pm | |
lib/ExtUtils/ParseXS/CountLines.pm | |
lib/ExtUtils/ParseXS/Eval.pm | |
lib/ExtUtils/ParseXS/Utilities.pm | |
lib/ExtUtils/Typemaps.pm | |
lib/ExtUtils/Typemaps/Cmd.pm | |
lib/ExtUtils/Typemaps/InputMap.pm | |
lib/ExtUtils/Typemaps/OutputMap.pm | |
lib/ExtUtils/Typemaps/Type.pm | |
!; | |
for my $file (@files) { | |
my $ifile = "$Bin/$file"; | |
my $text = read_text ($ifile); | |
die unless $text =~ /(VERSION.*'($old_version'))/; | |
my $old = $1; | |
my $new = $old; | |
$new =~ s!\Q$old_version!$new_version!; | |
$text =~ s!\Q$old!$new!; | |
write_text ($ifile, $text); | |
} | |
} | |
sub diff | |
{ | |
my $gdir = '~/software/perl/perl-git/dist/ExtUtils-ParseXS'; | |
for my $subdir (qw!lib/ExtUtils/ParseXS/ t/!) { | |
system ("diff --recursive $gdir/$subdir $subdir"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment