Commit 5e9656d9 authored by Robert Goldman's avatar Robert Goldman

Replacement for lisp version-bumper in perl.

Yucky, but I don't have time or energy to rebuild the CL one.
parent 13661959
#! /usr/bin/env perl
use FindBin;
use File::Slurper qw(read_text write_text);
our $old;
our $new;
our $asdf_dir = $FindBin::RealBin . "/../";
our $file = $asdf_dir . "version.lisp-expr";
our @transform_ref =
(
[ "version.lisp-expr", "\"", "\"" ],
[ "uiop/version.lisp-expr", "\"", "\"" ],
[ "asdf.asd", " :version \"", "\" ;; to be automatically updated by make bump-version" ],
[ "header.lisp", "This is ASDF ", ": Another System Definition Facility." ],
[ "upgrade.lisp", " (asdf-version \"", "\")" ],
[ "doc/asdf.texinfo", "Manual for Version ", "" ], );
if ($1 && $2) {
$old = $1;
$new = $2;
} elsif ($1) {
$new = $1;
$old = read_asdf_version();
} else {
$old = read_asdf_version();
$new = bump_asdf_version($old);
}
print STDERR "Bumping from $old to $new\n";
transform_files();
sub read_asdf_version {
open(FILE, $file);
my $str = <FILE>;
chomp $str;
print STDERR "Read version string $str from $file\n";
close FILE;
$str =~ s/"//g;
return $str;
}
sub bump_asdf_version {
my $oldver = shift;
my @fields = split/\./, $oldver;
$fields[$#fields]++;
return join('.', @fields);
}
sub transform_files {
foreach my $entryptr (@transform_ref) {
my @entry = @{$entryptr};
my $file = $entry[0];
print STDERR "Modifying file $file\n";
print STDERR "Prefix is $entry[1], suffix is $entry[2]\n";
my $regex = "(" . $entry[1] . ")" . "([0-9]+\.)+" . "(" . $entry[2] .")";
my $filename = $asdf_dir . $file;
my $data = read_text($filename);
$data =~ s/$regex/\1$new\3/;
write_text($filename, $data);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment