automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: version number cleanup


From: Tom Tromey
Subject: Patch: version number cleanup
Date: 08 Jun 2001 18:48:02 -0600

I've decided we have to go with a more rational version numbering
scheme.  So I'm checking this in.  It preserves backward compatibility
in all the important ways, I think.

Gary, you might want to roll this into 1.4-p4 or whatever.

In the future we'll be able to release 1.5.1, 1.5.2, etc, and these
won't be treated as alpha releases.

2001-06-08  Tom Tromey  <address@hidden>

        * tests/version4.test: New file.
        * automake.in (version_check): New sub.
        (handle_options): Use it.
        * tests/Makefile.am (AUTOMAKE_OPTIONS): Removed.
        (TESTS): Added version4.test.
        * m4/Makefile.am (AUTOMAKE_OPTIONS): Removed.
        * Makefile.am (AUTOMAKE_OPTIONS): Remove `gnits'.

Tom

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1136
diff -u -r1.1136 automake.in
--- automake.in 2001/06/03 17:16:40     1.1136
+++ automake.in 2001/06/09 00:28:25
@@ -1324,6 +1324,69 @@
 
 ################################################################
 
+# A helper which handles the logic of requiring a version number in
+# AUTOMAKE_OPTIONS.  Return 1 on error, 0 on success.
+sub version_check ($$$$)
+{
+    my ($rmajor, $rminor, $ralpha, $rfork) = ($1, $2, $3, $4);
+
+    &prog_error ("version is incorrect: $VERSION")
+       if $VERSION !~ /(\d+)\.(\d+)([a-z]?)-?([A-Za-z0-9]+)?/;
+
+    my ($tmajor, $tminor, $talpha, $tfork) = ($1, $2, $3, $4);
+
+    $rfork ||= '';
+    $tfork ||= '';
+
+    my $rminorminor = 0;
+    my $tminorminor = 0;
+
+    # Some versions were labelled like `1.4-p3a'.  This is the same as
+    # an alpha release labelled `1.4.3a'.  However, a version like
+    # `1.4g' is the same as `1.4.99g'.  Yes, this sucks.  Moral:
+    # always listen to the users.
+    if ($rfork =~ /p([0-9]+)([a-z]?)/)
+    {
+       $rminorminor = $1;
+       # `1.4a-p3b' never existed.  But we'll accept it anyway.
+       $ralpha = $ralpha || $2 || '';
+       $rfork = '';
+    }
+    if ($tfork =~ /p([0-9]+)([a-z]?)/)
+    {
+       $tminorminor = $1;
+       # `1.4a-p3b' never existed.  But we'll accept it anyway.
+       $talpha = $talpha || $2 || '';
+       $tfork = '';
+    }
+
+    $rminorminor = 99 if $ralpha ne '' && $rminorminor == 0;
+    $tminorminor = 99 if $talpha ne '' && $tminorminor == 0;
+
+    # 2.0 is better than 1.0.
+    # 1.2 is better than 1.1.
+    # 1.2a is better than 1.2.
+    # If we require 3.4n-foo then we require something
+    # >= 3.4n, with the `foo' fork identifier.
+    # The $r* variables are what the user specified.
+    # The $t* variables denote automake itself.
+    if ($rmajor > $tmajor
+       || ($rmajor == $tmajor && $rminor > $tminor)
+       || ($rminor == $tminor && $rminor == $tminor
+           && $rminorminor > $tminorminor)
+       || ($rminor == $tminor && $rminor == $tminor
+           && $rminorminor == $tminorminor
+           && $ralpha gt $talpha)
+       || ($rfork ne '' && $rfork ne $tfork))
+    {
+       &am_line_error ('AUTOMAKE_OPTIONS',
+                       "require version $_, but have $VERSION");
+       return 1;
+    }
+
+    return 0;
+}
+
 # Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
 sub handle_options
 {
@@ -1364,32 +1427,10 @@
            elsif (/(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/)
            {
                # Got a version number.
-
-               my ($rmajor, $rminor, $ralpha, $rfork) = ($1, $2, $3, $4);
-
-               &prog_error ("version is incorrect: $VERSION")
-                 if $VERSION !~ /(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/;
-
-               my ($tmajor, $tminor, $talpha, $tfork) = ($1, $2, $3, $4);
-
-               $rfork ||= '';
-               $tfork ||= '';
-
-               # 2.0 is better than 1.0.
-               # 1.2 is better than 1.1.
-               # 1.2a is better than 1.2.
-               # If we require 3.4n-foo then we require something
-               # >= 3.4n, with the `foo' fork identifier.
-               if ($rmajor > $tmajor
-                   || ($rmajor == $tmajor && $rminor > $tminor)
-                   || ($rminor == $tminor && $rminor == $tminor
-                       && $ralpha gt $talpha)
-                   || ($rfork ne '' && $rfork ne $tfork))
-                 {
-                   &am_line_error ('AUTOMAKE_OPTIONS',
-                                   "require version $_, but have $VERSION");
+               if (version_check ($1, $2, $3, $4))
+               {
                    return 1;
-                 }
+               }
            }
            else
            {
Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.174
diff -u -r1.174 Makefile.am
--- Makefile.am 2001/05/29 00:28:35     1.174
+++ Makefile.am 2001/06/09 00:28:25
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = gnits 1.4 dist-bzip2
+AUTOMAKE_OPTIONS = 1.4 dist-bzip2
 
 ## We need `.' in SUBDIRS because we want `check' to build `.' before
 ## tests.
Index: ./m4/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.am,v
retrieving revision 1.31
diff -u -r1.31 Makefile.am
--- Makefile.am 2001/05/29 00:28:36     1.31
+++ Makefile.am 2001/06/09 00:28:25
@@ -1,7 +1,5 @@
 ## Process this file with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = gnits
-
 m4datadir = $(datadir)/aclocal
 m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \
 error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \
Index: ./tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.306
diff -u -r1.306 Makefile.am
--- Makefile.am 2001/06/03 17:16:40     1.306
+++ Makefile.am 2001/06/09 00:28:25
@@ -1,7 +1,5 @@
 ## Process this file with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = gnits
-
 XFAIL_TESTS = subdir5.test
 
 TESTS =        \
@@ -285,6 +283,7 @@
 version.test \
 version2.test \
 version3.test \
+version4.test \
 vpath.test \
 vtexi.test \
 vtexi2.test \
Index: tests/version4.test
===================================================================
RCS file: version4.test
diff -N version4.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ version4.test       Fri Jun  8 17:28:25 2001
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+# Test to make sure we are compatible with the 1.4-p1 series.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = 1.4-p3
+END
+
+$AUTOMAKE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]