File: UpdateVersion

package info (click to toggle)
gri 2.12.26-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 5,952 kB
  • ctags: 2,396
  • sloc: cpp: 36,598; sh: 4,196; lisp: 3,764; perl: 1,362; ansic: 1,046; makefile: 606
file content (67 lines) | stat: -rwxr-xr-x 2,188 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl
# Script run to update version number in all relevant files
require "getopts.pl";
&Getopts('hv:');
sub get_current_version_number() 
{
    $version = `awk '(/VERSION =/) {print \$3}' Makefile.in`;
    chop($version);
}
sub usage ()
{
    get_current_version_number();
    print 
	"UpdateVersion:  Script run to update version number in all relevant files

USAGE: For example, to update all files to Version 2.6.0:

     ./UpdateVersion -v 2.6.0

 Then erase all .bak after looking at diffs.
 Eventually, I'll trust it and will remove the .bak file creation.

Options: 
      -v VERSION
      -h :  display this message.

ToDo: Handle release date in version.cc
      Put prior version in comments in version.cc.

NOTE: present version number is $version\n";
}

die "This script is disabled, pending updates.  (For example, some
files are moved, and others are not manually updated anymore.)";

exit usage() if ($opt_h || ! $opt_v || ($opt_v == ""));

die "CVSROOT not defined" if (! defined($ENV{'CVSROOT'}));
die "CVSROOT not pointing to cvs.gri.sourceforge.net" 
    if (! $ENV{'CVSROOT'} =~ /cvs.gri.sourceforge.net/);

$CVSmsg = " is read-only.
Are you sure the file is checked out for edit?  Do:
# cvs edit Makefile.in gri.spec gri.cmd version.cc doc/gri.texim
";

die "Makefile.in $CVSmsg" if (! -w "Makefile.in");
die "gri.cmd $CVSmsg" if (! -w "gri.cmd");
die "version.cc $CVSmsg" if (! -w "version.cc");
die "doc/gri.texim $CVSmsg" if (! -w "doc/gri.texim");

# Get current version number
get_current_version_number();

die "Version is up-to-date" if ($opt_v eq $version);

$regexp = $version;
$regexp =~ s/\./\\./g;

`perl -pi.bak -e 's/(version $regexp)$/(version $opt_v)/' gri.cmd`
`perl -pi.bak -e 's/VERSION = $regexp/VERSION = $opt_v/' Makefile.in`
`perl -pi.bak -e 's/%define griversion $regexp/%define griversion $opt_v/g' gri.spec`
`perl -pi.bak -e 's/\@set GRI-VERSION $regexp/\@set GRI-VERSION $opt_v/`;
`perl -pi.bak -e 's/_gri_number\\[\\] = "$regexp"/_gri_number[] = "$opt_v"/' version.cc`;
print "CAUTION: Dan modified this script 2002-nov-23 because it was
too aggressive (doing global changes in the files), but it has NOT
been tested yet !!\n";