5 # This is the version in configure.ac:
6 my $official_version = $ARGV[0];
7 my $lastrelease = "unknown";
10 if (-e
"_darcs/hashed_inventory") {
11 my $patches = `darcs changes --from-tag '$official_version' --count 2>/dev/null`;
13 # Looks like "darcs changes" does not support --count argument
14 $patches = grep(/^\S/, `darcs changes --from-tag '$official_version'`);
16 $patches = $patches - 1 if ($patches > 0);
18 if ($official_version =~ /pre(\d+)/) {
19 $state = "prerelease $1";
20 } elsif ($official_version =~ /rc(\d+)/) {
21 $state = "release candidate $1";
22 } elsif ($official_version =~ /^[0-9\.]+$/) {
27 } elsif ($patches > 1) {
28 $state = "+ $patches patches";
30 $state = "+ $patches patch";
33 if (open(X
,"darcs changes -t '^[0-9\.]+\$' --reverse |")) {
35 if (/tagged (\S+)$/) {
40 } elsif (open(FIN
,"release/STATE")) {
41 my $statestring = <FIN
>;
42 if ($statestring =~ /\((.+)\)/) {
48 print "$official_version ($state)\n";
50 if (open(FIN
,"src/ThisVersion.lhs.in") && open(FOUT
,">src/ThisVersion.lhs.tmp")) {
52 s/\@DARCS_VERSION_STATE\@/$state/g;
53 s/\@DARCS_VERSION\@/$official_version/g;
62 if (open(FIN
,"src/ThisVersion.lhs") && open(FTMP
,"src/ThisVersion.lhs.tmp")) {
64 read FIN
, $old, 10000;
65 read FTMP
, $new, 10000;
66 $replace = $old ne $new;
72 rename "src/ThisVersion.lhs.tmp", "src/ThisVersion.lhs";
74 unlink "src/ThisVersion.lhs.tmp";
77 if (open(FIN
,"doc/index.html.in") && open(FOUT
,">doc/index.html")) {
79 s/VERSION/$official_version/g;
80 s/RELEASE/$lastrelease/g;