summaryrefslogtreecommitdiffstats
path: root/bin/h5vers
blob: a72895c3429b0fe13b90e69cd3938f1f409ed82b (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
#! /bin/sh
perl -x -S $0 "$@"
exit

#! perl
require 5.003;
use strict;

# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5.  The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html.  COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page.  It can also be found at
# http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
# Robb Matzke <matzke@llnl.gov>
# 17 July 1998

### Purpose
# Increments the hdf5 version number by changing the value of
# constants in the src/H5public.h file.  The new version number is
# printed on the standard output. An alternate source file name can be
# specified as an argument.  In any case, the original file is saved
# by appending a tilde `~' to the name.

### Usage:
# h5vers [OPTIONS] [FILE]

# Without options this program only displays the current version and
# doesn't modify any files or create backups.  The default is to print
# the version number like X.Y.Z-A where X is the major version number,
# Y is the minor version number, Z is the release number, and A is
# a short annotation string (the `-' is printed only if A is not empty).
# If the `-v' switch is given the version will be printed like:
#
#    version X.Y release Z (A)
#
# The space and parentheses around A are only printed if A is not empty.
#
# The `-s VERSION' switch will set the version as specified.  If the
# string contains a dotted triple then it will be used as the version
# number, otherwise up to three numbers will be read from the end of
# the string and used as the major version, minor version, and release
# number.  If any numbers are missing then zero is assumed.  This
# allows versions to be specified like `-s "version 2.1 release 8"' or
# `-s hdf5-2.1.8.tar.bz2'.  If the new version is less than the old
# version then a warning message is generated on standard error. The
# annotation string, A, is set only if it appears immediately after the
# third number, separated by a dash (e.g., `1.2.3-pre1') or in parentheses
# (e.g., `version 1.2 release 3 (pre1)').
#
# The `-i [major|minor|release|annot|last]' option increments the major
# number, minor number, release number, or annotation string. The `last'
# switch increments the annotation string if present, otherwise the
# release number. If the release number is incremented then the annotation
# string is cleared.  If the minor number is incremented then the release
# number is set to zero and the annotation string is cleared; if the major
# number is incremented then the minor and release numbers are set to zero
# and the annotation string is cleared.
#
# If a file is specified then that file is used instead of
# ./H5public.h or ./src/H5public.h.
#
# If the version number is changed (either `-s' or `-i' was used on
# the command line) then the first line of the README.txt and RELEASE.txt files
# one directory above the H5public.h file is also modified so it looks
# something like: This is hdf5-1.2.3-pre1 currently under development.
# The AC_INIT macro in configure.ac will also change in this case to be
# something like: AC_INIT([HDF5], [hdf5-1.2.3-pre1], [help@hdfgroup.org])
# Version changes are also reflected in the Windows-maintained H5pubconf.h
# file.
#
# Whenever the version changes, this script will increment the revision
# field in HDF5's libtool shared library version in config/lt_vers.am,
# which is included in src/Makefile.am.  Incrementing the revision field
# indicates that the source code has changed since the last version
# (which it probably has).
##############################################################################

sub getvers {
  local ($_) = @_;
  my (@vers);

  ($vers[0]) = /^\#\s*define\s+H5_VERS_MAJOR\s+(\d+)/m;
  ($vers[1]) = /^\#\s*define\s+H5_VERS_MINOR\s+(\d+)/m;
  ($vers[2]) = /^\#\s*define\s+H5_VERS_RELEASE\s+(\d+)/m;
  ($vers[3]) = /^\#\s*define\s+H5_VERS_SUBRELEASE\s+\"([^\"]*)\"/m;
  return @vers;
}

sub setvers {
  my ($contents, @vers) = @_;
  $_[0] =~ s/^(\#\s*define\s+H5_VERS_MAJOR\s+)\d+/$1$vers[0]/m;
  $_[0] =~ s/^(\#\s*define\s+H5_VERS_MINOR\s+)\d+/$1$vers[1]/m;
  $_[0] =~ s/^(\#\s*define\s+H5_VERS_RELEASE\s+)\d+/$1$vers[2]/m;
  $_[0] =~ s/^(\#\s*define\s+H5_VERS_SUBRELEASE\s+\")[^\"]*/$1$vers[3]/m;
  $_[0] =~ s/^(\#\s*define\s+H5_VERS_INFO\s+\")[^\"]*/
    sprintf("%sHDF5 library version: %d.%d.%d%s%s", $1, @vers[0,1,2],
	    $vers[3]?"-":"", $vers[3])/me;
}

sub usage {
  my ($prog) = $0 =~ /([^\/]+)$/;
  print STDERR <<EOF;
Usage: $prog [OPTS] [FILE]
    -i major|minor|release|annot
        Increment specified version component and set following components
        to zero.
    -s VERSION
        Set the version as specified. The version number can be embedded in
        some other string such as \"hdf5-1.1.0-pre1.tar.bz2\" or even
        \"this is HDF5 library version 1.1 release 0 (pre1)\" for convenience.
    -v
        Instead of displaying only a dotted triple version number a line such
        as \"version 1.1 release 0 (pre1)\" will be printed.
    FILE
        The name of the file that contains version information.  This is
        seldom necessary since files H5public.h, src/H5public.h and
        ../src/H5public.h are automatically checked.
EOF
  exit 1;
}


my ($verbose, $set, $inc, $file, $rc);
my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h");
while ($_ = shift) {
  $_ eq "-s" && do {
    die "-s switch needs a version number\n" unless @ARGV;
    $set = shift;
    next;
  };

  $_ eq "-i" && do {
    if (@ARGV && $ARGV[0]=~/^(major|minor|release|annot)$/) {
      $inc = shift;
    } else {
      $inc = "last";
    }
    next;
  };

  $_ eq "-v" && do {
    $verbose = 1;
    next;
  };

  /^-(h|\?|-?help)$/ && usage;
  /^-/ && die "unrecognized option: $_\n";
  die "only one file name can be specified\n" if $file;
  $file = $_;
}
die "mutually exclusive options given\n" if $set && $inc;

# Determine file to use as H5public.h, README.txt,
# release_docs/RELEASE.txt, configure.ac, windows/src/H5pubconf.h
# config/lt_vers.am and config/cmake/scripts/HDF5config.cmake. 
# The README.txt, release_docs/RELEASE.txt, configure.ac, 
# windows/src/H5pubconf.h, config/lt_vers.am and
# config/cmake/scripts/HDF5config.cmake
# files are always in the directory above H5public.h
unless ($file) {
  for (@files) {
    ($file=$_,last) if -f $_;
  }
}
die "unable to find source files\n" unless defined $file;
die "unable to read file: $file\n" unless -r $file;
# config/lt_vers.am
my $LT_VERS = $file;
$LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/;
die "unable to read file: $LT_VERS\n" unless -r $file;
# config/cmake/scripts/HDF5config.cmake
my $HDF5CONFIGCMAKE = $file;
$HDF5CONFIGCMAKE =~ s/[^\/]*$/..\/config\/cmake\/scripts\/HDF5config.cmake/;
die "unable to read file: $HDF5CONFIGCMAKE\n" unless -r $file;
# README.txt
my $README = $file;
$README =~ s/[^\/]*$/..\/README.txt/;
die "unable to read file: $README\n" unless -r $file;
# release_docs/RELEASE.txt
my $RELEASE = $file;
$RELEASE =~ s/[^\/]*$/..\/release_docs\/RELEASE.txt/;
die "unable to read file: $RELEASE\n" unless -r $file;
# configure.ac
my $CONFIGURE = $file;
$CONFIGURE =~ s/[^\/]*$/..\/configure.ac/;
die "unable to read file: $CONFIGURE\n" unless -r $file;
# cpp_doc_config
my $CPP_DOC_CONFIG = $file;
$CPP_DOC_CONFIG =~ s/[^\/]*$/..\/c++\/src\/cpp_doc_config/;
die "unable to read file: $CPP_DOC_CONFIG\n"  unless -r $file;
my $H5_JAVA = $file;
$H5_JAVA =~ s/[^\/]*$/..\/java\/src\/hdf\/hdf5lib\/H5.java/;
die "unable to read file: $H5_JAVA\n" unless -r $file;
my $TESTH5_JAVA = $file;
$TESTH5_JAVA =~ s/[^\/]*$/..\/java\/test\/TestH5.java/; 
die "unable to read file: $TESTH5_JAVA\n" unless -r $file;
my $REPACK_LAYOUT_PLUGIN_VERSION = $file;
$REPACK_LAYOUT_PLUGIN_VERSION =~ s/[^\/]*$/..\/tools\/test\/h5repack\/testfiles\/h5repack_layout.h5-plugin_version_test.ddl/;
die "unable to read file: $REPACK_LAYOUT_PLUGIN_VERSION\n" unless -r $file;

# Get the current version number.
open FILE, $file or die "unable to open $file: $!\n";
my ($contents) = join "", <FILE>;
close FILE;
my (@curver) = getvers $contents;

# Determine the new version number.
my @newver; #new version
if ($set) {
  if ($set =~ /(\d+)\.(\d+)\.(\d+)(-([a-zA-Z]\w*))?/) {
    @newver = ($1, $2, $3, $5);
  } elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)(\s*\(([a-zA-Z]\w*)\))?\D*$/) {
    @newver = ($1, $2, $3, $5);
  } elsif ($set =~ /(\d+)\D+(\d+)\D*$/) {
    @newver = ($1, $2, 0, "");
  } elsif ($set =~ /(\d+)\D*$/) {
    @newver = ($1, 0, 0, "");
  } else {
    die "illegal version number specified: $set\n";
  }
} elsif ($inc) {
  $inc = $curver[3] eq "" ? 'release' : 'annot' if $inc eq 'last';
  if ($inc eq "major") {
    $newver[0] = $curver[0]+1;
    @newver[1,2,3] = (0,0,"");
  } elsif ($inc eq "minor") {
    $newver[0] = $curver[0];
    $newver[1] = $curver[1]+1;
    @newver[2,3] = (0,"");
  } elsif ($inc eq "release") {
    @newver[0,1] = @curver[0,1];
    $newver[2] = $curver[2]+1;
    $newver[3] = "";
  } elsif ($inc eq "annot") {
    @newver[0,1,2] = @curver[0,1,2];
    $newver[3] = $curver[3];
    $newver[3] =~ s/(\d+)\D*$/$1+1/e or
      die "Annotation \"".$newver[3]."\" cannot be incremented.\n";
  } else {
    die "unknown increment field: $inc\n";
  }
} else {
  # Nothing to do but print result
  $README = "";
  $RELEASE = "";
  $CONFIGURE = "";
  $CPP_DOC_CONFIG = "";
  $LT_VERS = "";       
  $HDF5CONFIGCMAKE = "";
  @newver = @curver;
}

# Note if the version increased or decreased
my $version_increased="";
# Print a warning if the version got smaller (don't check annot field)
if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] <
    $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
  printf STDERR "Warning: version decreased from %d.%d.%d to %d.%d.%d\n",
    @curver[0,1,2], @newver[0,1,2];
}
if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] >
    $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
  $version_increased="true";
}

# Update the version number if it changed.
if ($newver[0]!=$curver[0] ||
    $newver[1]!=$curver[1] ||
    $newver[2]!=$curver[2] ||
    $newver[3]ne$curver[3]) {
  setvers $contents, @newver or die "unable to set version\n";
  rename $file, "$file~" or die "unable to save backup file\n";
  open FILE, ">$file" or die "unable to open $file but backup saved!\n";
  print FILE $contents;
  close FILE;
}

# Update the libtool shared library version in src/Makefile.am if
# the version number has increased.
if ($LT_VERS && $version_increased) {
  open FILE, $LT_VERS or die "$LT_VERS: $!\n";
  my ($contentsy) = join "", <FILE>;
  close FILE;

  local($_) = $contentsy;

# As of the HDF5 v1.8.16 release, h5vers should not increment
# the LT_VERS numbers, so the next 6 lines are commented out.
# A future version may copy the numbers to H5public.h, so this
# section is retained for future reference.
#  my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
#  my $new_lt_revision = $lt_revision+1;
#  ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;

#  open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
#  print FILE $contentsy;
#  close FILE;
}

# Update the README.txt file
if ($README) {
  open FILE, $README or die "$README: $!\n";
  my @contents = <FILE>;
  close FILE;
  $contents[0] = sprintf("HDF5 version %d.%d.%d%s %s",
			 @newver[0,1,2],
			 $newver[3] eq "" ? "" : "-".$newver[3],
			 "currently under development\n");
  open FILE, ">$README" or die "$README: $!\n";
  print FILE @contents;
  close FILE;
}

# Update the release_docs/RELEASE.txt file
if ($RELEASE) {
  open FILE, $RELEASE or die "$RELEASE: $!\n";
  my @contents = <FILE>;
  close FILE;
  $contents[0] = sprintf("HDF5 version %d.%d.%d%s %s",
			 @newver[0,1,2],
			 $newver[3] eq "" ? "" : "-".$newver[3],
			 "currently under development\n");
  open FILE, ">$RELEASE" or die "$RELEASE: $!\n";
  print FILE @contents;
  close FILE;
}

# Update the c++/src/cpp_doc_config file
if ($CPP_DOC_CONFIG) {
  my $data = read_file($CPP_DOC_CONFIG);
  my $sub_rel_ver_str = (
     $newver[3] eq "" 
     ? sprintf("%s", "") 
     : sprintf("%s", "-".$newver[3].", currently under development")
     );
  my $version_string = sprintf("\"%d.%d.%d%s%s\"",
                               @newver[0,1,2],
                               $sub_rel_ver_str);
  $data =~ s/PROJECT_NUMBER\s*=.*/PROJECT_NUMBER         = $version_string/;

  write_file($CPP_DOC_CONFIG, $data);  
}

# Update the config/cmake/scripts/HDF5config.cmake file
if ($HDF5CONFIGCMAKE) {
  my $data = read_file($HDF5CONFIGCMAKE);
#  my $sub_rel_ver_str = "";
  my $sub_rel_ver_str = (
     $newver[3] eq "" 
     ? sprintf("\"%s\"", "") 
     : sprintf("\"%s\"", "-".$newver[3].", currently under development")
     );
  my $version_string = sprintf("\"%d.%d.%d\"", @newver[0,1,2]);

  $data =~ s/set \(CTEST_SOURCE_VERSION .*\)/set \(CTEST_SOURCE_VERSION $version_string\)/;
  $data =~ s/set \(CTEST_SOURCE_VERSEXT .*\)/set \(CTEST_SOURCE_VERSEXT $sub_rel_ver_str\)/;

  write_file($HDF5CONFIGCMAKE, $data);  
}

# Update the java/src/hdf/hdflib/H5.java file
if ($H5_JAVA) {
  my $data = read_file($H5_JAVA);
#  my $sub_rel_ver_str = "";
  my $sub_rel_ver_str = (
     $newver[3] eq ""
     ? sprintf("\"%s\"", "")
     : sprintf("\"%s\"", "-".$newver[3].", currently under development")
     );
  my $version_string1 = sprintf("\"%d.%d.%d\"", @newver[0,1,2]);
  my $version_string2 = sprintf("\"%d, %d, %d\"", @newver[0,1,2]);

  $data =~ s/ * \@version HDF5 .* <BR>/ * \@version HDF5 $version_string1 <BR>/;
  $data =~ s/    public final static int LIB_VERSION\[\] = { \d*, \d*, \d* };/    public final static int LIB_VERSION\[\] = { $version_string2  };/;        

  write_file($H5_JAVA, $data);
}

# Update the java/test/TestH5.java file
if ($TESTH5_JAVA) {
  my $data = read_file($TESTH5_JAVA);
#  my $sub_rel_ver_str = "";
  my $sub_rel_ver_str = (
     $newver[3] eq ""
     ? sprintf("\"%s\"", "")
     : sprintf("\"%s\"", "-".$newver[3].", currently under development")
     );
  my $version_string1 = sprintf("\"%d, %d, %d\"", @newver[0,1,2]);
  my $version_string2 = sprintf("\"int majnum = %d, minnum = %d, relnum = %d\"", @newver[0,1,2]);

  $data =~ s/        int libversion\[\] = { .* };/        int libversion\[\] = { $version_string1 };/;
  $data =~ s/        int majnum = \d*, minnum = \d*, relnum = \d*;/        $version_string2;/;        

  write_file($TESTH5_JAVA, $data);
}

# Update the tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl file
if ($REPACK_LAYOUT_PLUGIN_VERSION) {
  my $data = read_file($REPACK_LAYOUT_PLUGIN_VERSION);
  my $version_string = sprintf("%d %d %d", @newver[0,1,2]);

  $data =~ s/            PARAMS { 9 \d* \d* \d* }/            PARAMS { 9 $version_string }/g;

  write_file($REPACK_LAYOUT_PLUGIN_VERSION, $data);
}

# helper function to read the file for updating c++/src/cpp_doc_config, 
# config/cmake/scripts/HDF5Config.cmake, and java files.
# The version string in that file is not at the top, so the string replacement
# is not for the first line, and reading/writing the entire file as one string
# facilitates the substring replacement.
#Presumably these will also work for resetting the version in HDF5config.cmake.
sub read_file {
   my ($filename) = @_;

    open my $in, $filename or die "Could not open '$filename' for reading $!";
    local $/ = undef;
    my $all = <$in>;
    close $in;

    return $all;
}

# helper function to write the file for updating c++/src/cpp_doc_config, 
# config/cmake/scripts/HDF5config.cmake and java files.
sub write_file {
    my ($filename, $content) = @_;

    open my $out, ">$filename" or die "Could not open '$filename' for writing $!";;
    print $out $content;
    close $out;

    return;
}


sub gen_configure {
  my ($name, $conf) = @_;

  open FILE, $conf or die "$conf: $!\n";
  my @contents = <FILE>;
  close FILE;

  for (my $i = 0; $i < $#contents; ++$i) {
    if ($contents[$i] =~ /^AC_INIT/) {
      $contents[$i] = sprintf("AC_INIT([$name], [%d.%d.%d%s], [help\@hdfgroup.org])\n",
                              @newver[0,1,2],
                              $newver[3] eq "" ? "" : "-".$newver[3]);
      last;
    }
  }

  open FILE, ">$conf" or die "$conf: $!\n";
  print FILE @contents;
  close FILE;

  $conf =~ /^(.*?)\/?configure.ac$/;

  if ($1) {
    $rc = system("cd $1 && ./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
  } else {
    $rc = system("./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
  }
  if ($rc) {
    printf("./autogen.sh failed with exit code %d. Aborted.\n", $rc);
    exit 1;
  }
}

# Update the configure.ac files and regenerate them
gen_configure("HDF5", $CONFIGURE) if $CONFIGURE;

sub gen_h5pubconf {
    my ($name, $pubconf, @vers) = @_;

    my $namelc = lc($name);
    my $nameuc = uc($name);

    open FILE, $pubconf or die "$pubconf: $!\n";
    my @contents = <FILE>;
    close FILE;

    for (my $i = 0; $i < $#contents; ++$i) {
	if ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE\s+/) {
	    $contents[$i] = "\#define H5_PACKAGE \"$namelc\"\n";
	} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_NAME\s+/) {
	    $contents[$i] = "\#define H5_PACKAGE_NAME \"$nameuc\"\n";
	} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_STRING\s+/) {
	    $contents[$i] = sprintf("\#define H5_PACKAGE_STRING \"$nameuc %d.%d.%d%s\"\n",
				    @vers[0,1,2],
				    $newver[3] eq "" ? "" : "-".$newver[3]);
	} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_TARNAME\s+/) {
	    $contents[$i] = "\#define H5_PACKAGE_TARNAME \"$namelc\"\n";
	} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_VERSION\s+/) {
	    $contents[$i] = sprintf("\#define H5_PACKAGE_VERSION \"%d.%d.%d%s\"\n",
				    @vers[0,1,2],
				    $newver[3] eq "" ? "" : "-".$newver[3]);
	} elsif ($contents[$i] =~ /\#\s*define\s+H5_VERSION\s+/) {
	    $contents[$i] = sprintf("\#define H5_VERSION \"%d.%d.%d%s\"\n",
				    @vers[0,1,2],
				    $newver[3] eq "" ? "" : "-".$newver[3]);
	}
    }

    open FILE, ">$pubconf" or die "$pubconf: $!\n";
    print FILE @contents;
    close FILE;
}

# Print the new version number
if ($verbose) {
  printf("version %d.%d release %d%s\n", @newver[0,1,2],
	 $newver[3] eq "" ? "" : " (".$newver[3].")");
} else {
  printf("%d.%d.%d%s\n", @newver[0,1,2],
	 $newver[3] eq "" ? "" : "-".$newver[3]);
}

exit 0;

# Because the first line of this file looks like a Bourne shell script, we
# must tell XEmacs explicitly that this is really a perl script.
#
# Local Variables:
# mode:perl
# End: