$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r79880 - in trunk/tools/build/v2: engine test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-05 14:31:20
Author: jurko
Date: 2012-08-05 14:31:19 EDT (Sun, 05 Aug 2012)
New Revision: 79880
URL: http://svn.boost.org/trac/boost/changeset/79880
Log:
Restored old Boost Jam '-v' version information screen to what it was like before revision [79779] as requested by Steven Watanabe. Boost Jam now reports its minimum supported path modification timestamp resolution using a new builtin JAM_TIMESTAMP_RESOLUTION variable. Updated Boost Build's internal testing system to correctly fetch this Boost Jam version information.
Text files modified: 
   trunk/tools/build/v2/engine/constants.c |   111 ++++++++++++++++++++------------------- 
   trunk/tools/build/v2/engine/constants.h |   103 ++++++++++++++++++------------------    
   trunk/tools/build/v2/engine/jam.c       |    22 +++----                                 
   trunk/tools/build/v2/test/BoostBuild.py |    37 +++++++++----                           
   4 files changed, 144 insertions(+), 129 deletions(-)
Modified: trunk/tools/build/v2/engine/constants.c
==============================================================================
--- trunk/tools/build/v2/engine/constants.c	(original)
+++ trunk/tools/build/v2/engine/constants.c	2012-08-05 14:31:19 EDT (Sun, 05 Aug 2012)
@@ -4,9 +4,6 @@
  * This file is part of Jam - see jam.c for Copyright information.
  */
 
-# include "constants.h"
-# include "object.h"
-
 /*
  * constants.c - constant objects
  *
@@ -17,59 +14,63 @@
  *
  */
 
+#include "constants.h"
+
+
 void constants_init( void )
 {
-    constant_empty             = object_new( "" );
-    constant_dot               = object_new( "." );
-    constant_plus              = object_new( "+" );
-    constant_star              = object_new( "*" );
-    constant_question_mark     = object_new( "?" );
-    constant_ok                = object_new( "ok" );
-    constant_true              = object_new( "true" );
-    constant_name              = object_new( "__name__" );
-    constant_bases             = object_new( "__bases__" );
-    constant_typecheck         = object_new( ".typecheck" );
-    constant_builtin           = object_new( "(builtin)" );
-    constant_HCACHEFILE        = object_new( "HCACHEFILE" );
-    constant_HCACHEMAXAGE      = object_new( "HCACHEMAXAGE" );
-    constant_HDRSCAN           = object_new( "HDRSCAN" );
-    constant_HDRRULE           = object_new( "HDRRULE" );
-    constant_BINDRULE          = object_new( "BINDRULE" );
-    constant_LOCATE            = object_new( "LOCATE" );
-    constant_SEARCH            = object_new( "SEARCH" );
-    constant_JAM_SEMAPHORE     = object_new( "JAM_SEMAPHORE" );
-    constant_TIMING_RULE       = object_new( "__TIMING_RULE__" );
-    constant_ACTION_RULE       = object_new( "__ACTION_RULE__" );
-    constant_JAMSHELL          = object_new( "JAMSHELL" );
-    constant_TMPDIR            = object_new( "TMPDIR" );
-    constant_TMPNAME           = object_new( "TMPNAME" );
-    constant_TMPFILE           = object_new( "TMPFILE" );
-    constant_STDOUT            = object_new( "STDOUT" );
-    constant_STDERR            = object_new( "STDERR" );
-    constant_JAMDATE           = object_new( "JAMDATE" );
-    constant_JAM_VERSION       = object_new( "JAM_VERSION" );
-    constant_JAMUNAME          = object_new( "JAMUNAME" );
-    constant_ENVIRON           = object_new( ".ENVIRON" );
-    constant_ARGV              = object_new( "ARGV" );
-    constant_all               = object_new( "all" );
-    constant_PARALLELISM       = object_new( "PARALLELISM" );
-    constant_KEEP_GOING        = object_new( "KEEP_GOING" );
-    constant_other             = object_new( "[OTHER]" );
-    constant_total             = object_new( "[TOTAL]" );
-    constant_FILE_DIRSCAN      = object_new( "FILE_DIRSCAN" );
-    constant_MAIN              = object_new( "MAIN" );
-    constant_MAIN_MAKE         = object_new( "MAIN_MAKE" );
-    constant_MAKE_MAKE0        = object_new( "MAKE_MAKE0" );
-    constant_MAKE_MAKE1        = object_new( "MAKE_MAKE1" );
-    constant_MAKE_MAKE0SORT    = object_new( "MAKE_MAKE0SORT" );
-    constant_BINDMODULE        = object_new( "BINDMODULE" );
-    constant_IMPORT_MODULE     = object_new( "IMPORT_MODULE" );
-    constant_BUILTIN_GLOB_BACK = object_new( "BUILTIN_GLOB_BACK" );
-    constant_timestamp         = object_new( "timestamp" );
-    constant_python            = object_new("__python__");
-    constant_python_interface  = object_new( "python_interface" );
-    constant_extra_pythonpath  = object_new( "EXTRA_PYTHONPATH" );
-    constant_MAIN_PYTHON       = object_new( "MAIN_PYTHON" );
+    constant_empty                    = object_new( "" );
+    constant_dot                      = object_new( "." );
+    constant_plus                     = object_new( "+" );
+    constant_star                     = object_new( "*" );
+    constant_question_mark            = object_new( "?" );
+    constant_ok                       = object_new( "ok" );
+    constant_true                     = object_new( "true" );
+    constant_name                     = object_new( "__name__" );
+    constant_bases                    = object_new( "__bases__" );
+    constant_typecheck                = object_new( ".typecheck" );
+    constant_builtin                  = object_new( "(builtin)" );
+    constant_HCACHEFILE               = object_new( "HCACHEFILE" );
+    constant_HCACHEMAXAGE             = object_new( "HCACHEMAXAGE" );
+    constant_HDRSCAN                  = object_new( "HDRSCAN" );
+    constant_HDRRULE                  = object_new( "HDRRULE" );
+    constant_BINDRULE                 = object_new( "BINDRULE" );
+    constant_LOCATE                   = object_new( "LOCATE" );
+    constant_SEARCH                   = object_new( "SEARCH" );
+    constant_JAM_SEMAPHORE            = object_new( "JAM_SEMAPHORE" );
+    constant_TIMING_RULE              = object_new( "__TIMING_RULE__" );
+    constant_ACTION_RULE              = object_new( "__ACTION_RULE__" );
+    constant_JAMSHELL                 = object_new( "JAMSHELL" );
+    constant_TMPDIR                   = object_new( "TMPDIR" );
+    constant_TMPNAME                  = object_new( "TMPNAME" );
+    constant_TMPFILE                  = object_new( "TMPFILE" );
+    constant_STDOUT                   = object_new( "STDOUT" );
+    constant_STDERR                   = object_new( "STDERR" );
+    constant_JAMDATE                  = object_new( "JAMDATE" );
+    constant_JAM_TIMESTAMP_RESOLUTION = object_new( "JAM_TIMESTAMP_RESOLUTION" );
+    constant_JAM_VERSION              = object_new( "JAM_VERSION" );
+    constant_JAMUNAME                 = object_new( "JAMUNAME" );
+    constant_ENVIRON                  = object_new( ".ENVIRON" );
+    constant_ARGV                     = object_new( "ARGV" );
+    constant_all                      = object_new( "all" );
+    constant_PARALLELISM              = object_new( "PARALLELISM" );
+    constant_KEEP_GOING               = object_new( "KEEP_GOING" );
+    constant_other                    = object_new( "[OTHER]" );
+    constant_total                    = object_new( "[TOTAL]" );
+    constant_FILE_DIRSCAN             = object_new( "FILE_DIRSCAN" );
+    constant_MAIN                     = object_new( "MAIN" );
+    constant_MAIN_MAKE                = object_new( "MAIN_MAKE" );
+    constant_MAKE_MAKE0               = object_new( "MAKE_MAKE0" );
+    constant_MAKE_MAKE1               = object_new( "MAKE_MAKE1" );
+    constant_MAKE_MAKE0SORT           = object_new( "MAKE_MAKE0SORT" );
+    constant_BINDMODULE               = object_new( "BINDMODULE" );
+    constant_IMPORT_MODULE            = object_new( "IMPORT_MODULE" );
+    constant_BUILTIN_GLOB_BACK        = object_new( "BUILTIN_GLOB_BACK" );
+    constant_timestamp                = object_new( "timestamp" );
+    constant_python                   = object_new("__python__");
+    constant_python_interface         = object_new( "python_interface" );
+    constant_extra_pythonpath         = object_new( "EXTRA_PYTHONPATH" );
+    constant_MAIN_PYTHON              = object_new( "MAIN_PYTHON" );
 }
 
 void constants_done( void )
@@ -102,6 +103,7 @@
     object_free( constant_STDOUT );
     object_free( constant_STDERR );
     object_free( constant_JAMDATE );
+    object_free( constant_JAM_TIMESTAMP_RESOLUTION );
     object_free( constant_JAM_VERSION );
     object_free( constant_JAMUNAME );
     object_free( constant_ENVIRON );
@@ -174,6 +176,7 @@
 OBJECT * constant_IMPORT_MODULE;
 OBJECT * constant_BUILTIN_GLOB_BACK;
 OBJECT * constant_timestamp;
+OBJECT * constant_JAM_TIMESTAMP_RESOLUTION;
 OBJECT * constant_python;
 OBJECT * constant_python_interface;
 OBJECT * constant_extra_pythonpath;
Modified: trunk/tools/build/v2/engine/constants.h
==============================================================================
--- trunk/tools/build/v2/engine/constants.h	(original)
+++ trunk/tools/build/v2/engine/constants.h	2012-08-05 14:31:19 EDT (Sun, 05 Aug 2012)
@@ -16,56 +16,57 @@
 void constants_init( void );
 void constants_done( void );
 
-extern OBJECT * constant_empty;              /* "" */
-extern OBJECT * constant_dot;                /* "." */
-extern OBJECT * constant_plus;               /* "+" */
-extern OBJECT * constant_star;               /* "*" */
-extern OBJECT * constant_question_mark;      /* "?" */
-extern OBJECT * constant_ok;                 /* "ok" */
-extern OBJECT * constant_true;               /* "true" */
-extern OBJECT * constant_name;               /* "__name__" */
-extern OBJECT * constant_bases;              /* "__bases__" */
-extern OBJECT * constant_typecheck;          /* ".typecheck" */
-extern OBJECT * constant_builtin;            /* "(builtin)" */
-extern OBJECT * constant_HCACHEFILE;         /* "HCACHEFILE" */
-extern OBJECT * constant_HCACHEMAXAGE;       /* "HCACHEMAXAGE" */
-extern OBJECT * constant_HDRSCAN;            /* "HDRSCAN" */
-extern OBJECT * constant_HDRRULE;            /* "HDRRULE" */
-extern OBJECT * constant_BINDRULE;           /* "BINDRULE" */
-extern OBJECT * constant_LOCATE;             /* "LOCATE" */
-extern OBJECT * constant_SEARCH;             /* "SEARCH" */
-extern OBJECT * constant_JAM_SEMAPHORE;      /* "JAM_SEMAPHORE" */
-extern OBJECT * constant_TIMING_RULE;        /* "__TIMING_RULE__" */
-extern OBJECT * constant_ACTION_RULE;        /* "__ACTION_RULE__" */
-extern OBJECT * constant_JAMSHELL;           /* "JAMSHELL" */
-extern OBJECT * constant_TMPDIR;             /* "TMPDIR" */
-extern OBJECT * constant_TMPNAME;            /* "TMPNAME" */
-extern OBJECT * constant_TMPFILE;            /* "TMPFILE" */
-extern OBJECT * constant_STDOUT;             /* "STDOUT" */
-extern OBJECT * constant_STDERR;             /* "STDERR" */
-extern OBJECT * constant_JAMDATE;            /* "JAMDATE" */
-extern OBJECT * constant_JAM_VERSION;        /* "JAM_VERSION" */
-extern OBJECT * constant_JAMUNAME;           /* "JAMUNAME" */
-extern OBJECT * constant_ENVIRON;            /* ".ENVIRON" */
-extern OBJECT * constant_ARGV;               /* "ARGV" */
-extern OBJECT * constant_all;                /* "all" */
-extern OBJECT * constant_PARALLELISM;        /* "PARALLELISM" */
-extern OBJECT * constant_KEEP_GOING;         /* "KEEP_GOING" */
-extern OBJECT * constant_other;              /* "[OTHER]" */
-extern OBJECT * constant_total;              /* "[TOTAL]" */
-extern OBJECT * constant_FILE_DIRSCAN;       /* "FILE_DIRSCAN" */
-extern OBJECT * constant_MAIN;               /* "MAIN" */
-extern OBJECT * constant_MAIN_MAKE;          /* "MAIN_MAKE" */
-extern OBJECT * constant_MAKE_MAKE0;         /* "MAKE_MAKE0" */
-extern OBJECT * constant_MAKE_MAKE1;         /* "MAKE_MAKE1" */
-extern OBJECT * constant_MAKE_MAKE0SORT;     /* "MAKE_MAKE0SORT" */
-extern OBJECT * constant_BINDMODULE;         /* "BINDMODULE" */
-extern OBJECT * constant_IMPORT_MODULE;      /* "IMPORT_MODULE" */
-extern OBJECT * constant_BUILTIN_GLOB_BACK;  /* "BUILTIN_GLOB_BACK" */
-extern OBJECT * constant_timestamp;          /* "timestamp" */
-extern OBJECT * constant_python;             /* "__python__" */
-extern OBJECT * constant_python_interface;   /* "python_interface" */
-extern OBJECT * constant_extra_pythonpath;   /* "EXTRA_PYTHONPATH" */
-extern OBJECT * constant_MAIN_PYTHON;        /* "MAIN_PYTHON" */
+extern OBJECT * constant_empty;                     /* "" */
+extern OBJECT * constant_dot;                       /* "." */
+extern OBJECT * constant_plus;                      /* "+" */
+extern OBJECT * constant_star;                      /* "*" */
+extern OBJECT * constant_question_mark;             /* "?" */
+extern OBJECT * constant_ok;                        /* "ok" */
+extern OBJECT * constant_true;                      /* "true" */
+extern OBJECT * constant_name;                      /* "__name__" */
+extern OBJECT * constant_bases;                     /* "__bases__" */
+extern OBJECT * constant_typecheck;                 /* ".typecheck" */
+extern OBJECT * constant_builtin;                   /* "(builtin)" */
+extern OBJECT * constant_HCACHEFILE;                /* "HCACHEFILE" */
+extern OBJECT * constant_HCACHEMAXAGE;              /* "HCACHEMAXAGE" */
+extern OBJECT * constant_HDRSCAN;                   /* "HDRSCAN" */
+extern OBJECT * constant_HDRRULE;                   /* "HDRRULE" */
+extern OBJECT * constant_BINDRULE;                  /* "BINDRULE" */
+extern OBJECT * constant_LOCATE;                    /* "LOCATE" */
+extern OBJECT * constant_SEARCH;                    /* "SEARCH" */
+extern OBJECT * constant_JAM_SEMAPHORE;             /* "JAM_SEMAPHORE" */
+extern OBJECT * constant_TIMING_RULE;               /* "__TIMING_RULE__" */
+extern OBJECT * constant_ACTION_RULE;               /* "__ACTION_RULE__" */
+extern OBJECT * constant_JAMSHELL;                  /* "JAMSHELL" */
+extern OBJECT * constant_TMPDIR;                    /* "TMPDIR" */
+extern OBJECT * constant_TMPNAME;                   /* "TMPNAME" */
+extern OBJECT * constant_TMPFILE;                   /* "TMPFILE" */
+extern OBJECT * constant_STDOUT;                    /* "STDOUT" */
+extern OBJECT * constant_STDERR;                    /* "STDERR" */
+extern OBJECT * constant_JAMDATE;                   /* "JAMDATE" */
+extern OBJECT * constant_JAM_TIMESTAMP_RESOLUTION;  /* "JAM_TIMESTAMP_RESOLUTION" */
+extern OBJECT * constant_JAM_VERSION;               /* "JAM_VERSION" */
+extern OBJECT * constant_JAMUNAME;                  /* "JAMUNAME" */
+extern OBJECT * constant_ENVIRON;                   /* ".ENVIRON" */
+extern OBJECT * constant_ARGV;                      /* "ARGV" */
+extern OBJECT * constant_all;                       /* "all" */
+extern OBJECT * constant_PARALLELISM;               /* "PARALLELISM" */
+extern OBJECT * constant_KEEP_GOING;                /* "KEEP_GOING" */
+extern OBJECT * constant_other;                     /* "[OTHER]" */
+extern OBJECT * constant_total;                     /* "[TOTAL]" */
+extern OBJECT * constant_FILE_DIRSCAN;              /* "FILE_DIRSCAN" */
+extern OBJECT * constant_MAIN;                      /* "MAIN" */
+extern OBJECT * constant_MAIN_MAKE;                 /* "MAIN_MAKE" */
+extern OBJECT * constant_MAKE_MAKE0;                /* "MAKE_MAKE0" */
+extern OBJECT * constant_MAKE_MAKE1;                /* "MAKE_MAKE1" */
+extern OBJECT * constant_MAKE_MAKE0SORT;            /* "MAKE_MAKE0SORT" */
+extern OBJECT * constant_BINDMODULE;                /* "BINDMODULE" */
+extern OBJECT * constant_IMPORT_MODULE;             /* "IMPORT_MODULE" */
+extern OBJECT * constant_BUILTIN_GLOB_BACK;         /* "BUILTIN_GLOB_BACK" */
+extern OBJECT * constant_timestamp;                 /* "timestamp" */
+extern OBJECT * constant_python;                    /* "__python__" */
+extern OBJECT * constant_python_interface;          /* "python_interface" */
+extern OBJECT * constant_extra_pythonpath;          /* "EXTRA_PYTHONPATH" */
+extern OBJECT * constant_MAIN_PYTHON;               /* "MAIN_PYTHON" */
 
 #endif
Modified: trunk/tools/build/v2/engine/jam.c
==============================================================================
--- trunk/tools/build/v2/engine/jam.c	(original)
+++ trunk/tools/build/v2/engine/jam.c	2012-08-05 14:31:19 EDT (Sun, 05 Aug 2012)
@@ -261,23 +261,13 @@
     /* Version info. */
     if ( ( s = getoptval( optv, 'v', 0 ) ) )
     {
-        timestamp fmt_resolution[ 1 ];
-        file_supported_fmt_resolution( fmt_resolution );
-
-        printf( "Boost.Jam  " );
-        printf( "Version %s. %s.\n", VERSION, OSMINOR );
-        printf( "\n" );
-        printf( "Minimum supported file modification timestamp resolution:\n" );
-        printf( "   %s seconds\n", timestamp_timestr( fmt_resolution ) );
-        printf( "\n" );
-        printf( "Copyright information:\n" );
+        printf( "Boost.Jam  Version %s. %s.\n", VERSION, OSMINOR );
         printf( "   Copyright 1993-2002 Christopher Seiwald and Perforce "
             "Software, Inc.\n" );
         printf( "   Copyright 2001 David Turner.\n" );
         printf( "   Copyright 2001-2004 David Abrahams.\n" );
         printf( "   Copyright 2002-2008 Rene Rivera.\n" );
         printf( "   Copyright 2003-2008 Vladimir Prus.\n" );
-
         return EXITOK;
     }
 
@@ -430,7 +420,15 @@
                              object_new( u.machine ) ), VAR_SET );
             }
         }
-#endif /* unix */
+#endif  /* unix */
+
+        /* Set JAM_TIMESTAMP_RESOLUTION. */
+        {
+            timestamp fmt_resolution[ 1 ];
+            file_supported_fmt_resolution( fmt_resolution );
+            var_set( root_module(), constant_JAM_TIMESTAMP_RESOLUTION, list_new(
+                object_new( timestamp_timestr( fmt_resolution ) ) ), VAR_SET );
+        }
 
         /* Load up environment variables. */
 
Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py	(original)
+++ trunk/tools/build/v2/test/BoostBuild.py	2012-08-05 14:31:19 EDT (Sun, 05 Aug 2012)
@@ -837,30 +837,43 @@
         by the used Boost Jam executable.
 
         """
-        p = subprocess.Popen([self.program[0], "-v"], stdout=subprocess.PIPE,
-            universal_newlines=True)
-        out, err = p.communicate()
+        dir = tempfile.mkdtemp("bjam_version_info")
+        try:
+            jam_script = "timestamp_resolution.jam"
+            f = open(os.path.join(dir, jam_script), "w")
+            try:
+                f.write("EXIT $(JAM_TIMESTAMP_RESOLUTION) : 0 ;")
+            finally:
+                f.close()
+            p = subprocess.Popen([self.program[0], "-d0", "-f%s" % jam_script],
+                stdout=subprocess.PIPE, cwd=dir, universal_newlines=True)
+            out, err = p.communicate()
+        finally:
+            shutil.rmtree(dir, ignore_errors=False)
+
         if p.returncode != 0:
             raise TestEnvironmentError("Unexpected return code (%s) when "
-                "detecting Boost Jam version information." % p.returncode)
+                "detecting Boost Jam's minimum supported path modification "
+                "timestamp resolution version information." % p.returncode)
         if err:
             raise TestEnvironmentError("Unexpected error output (%s) when "
-                "detecting Boost Jam version information." % err)
+                "detecting Boost Jam's minimum supported path modification "
+                "timestamp resolution version information." % err)
 
-        r = re.search("^Minimum supported file modification timestamp "
-            "resolution:\n\\s+([0-9]{2}):([0-9]{2}):([0-9]{2}\\.[0-9]{9}) "
-            "seconds$", out, re.MULTILINE)
+        r = re.match("([0-9]{2}):([0-9]{2}):([0-9]{2}\\.[0-9]{9})$", out)
         if not r:
             # Older Boost Jam versions did not report their minimum supported
-            # file modification timestamp resolution and did not actually
-            # support file modification timestamp resolutions finer than 1
+            # path modification timestamp resolution and did not actually
+            # support path modification timestamp resolutions finer than 1
             # second.
+            # TODO: Phase this support out to avoid such fallback code from
+            # possibly covering up other problems.
             return 1
         if r.group(1) != "00" or r.group(2) != "00":  # hours, minutes
             raise TestEnvironmentError("Boost Jam with too coarse minimum "
-                "supported file modification timestamp resolution (%s:%s:%s)."
+                "supported path modification timestamp resolution (%s:%s:%s)."
                 % (r.group(1), r.group(2), r.group(3)))
-        return float(r.group(3))   # seconds.nanoseconds
+        return float(r.group(3))  # seconds.nanoseconds
 
     def __ensure_newer_than_last_build(self, path):
         """