|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70179 - in trunk/tools/build/v2: build engine util
From: ghost_at_[hidden]
Date: 2011-03-19 08:30:51
Author: vladimir_prus
Date: 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
New Revision: 70179
URL: http://svn.boost.org/trac/boost/changeset/70179
Log:
Make sure the directory for config.log exists.
This fixes a problem whereby when building the first time
in a fresh source tree, output of configuration checks goes
to stdout, because we tried to create config.log in as-yet
nonexistent building directory.
Text files modified:
trunk/tools/build/v2/build/configure.jam | 11 +++++------
trunk/tools/build/v2/engine/builtins.c | 19 +++++++++++++++++++
trunk/tools/build/v2/engine/builtins.h | 1 +
trunk/tools/build/v2/engine/filemac.c | 5 +++++
trunk/tools/build/v2/engine/filent.c | 5 +++++
trunk/tools/build/v2/engine/filesys.h | 1 +
trunk/tools/build/v2/engine/fileunix.c | 5 +++++
trunk/tools/build/v2/util/path.jam | 16 ++++++++++++++++
8 files changed, 57 insertions(+), 6 deletions(-)
Modified: trunk/tools/build/v2/build/configure.jam
==============================================================================
--- trunk/tools/build/v2/build/configure.jam (original)
+++ trunk/tools/build/v2/build/configure.jam 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -17,6 +17,8 @@
import property ;
import property-set ;
import "class" : new ;
+import common ;
+import path ;
rule log-summary ( )
{
@@ -185,12 +187,9 @@
# should never be called by users.
rule set-log-file ( log-file )
{
- # FIXME: remove this check as soon as Boost regression tests
- # start using trunk bjam
- if FILE_OPEN in [ RULENAMES ]
- {
- .log-fd = [ FILE_OPEN $(log-file) : "w" ] ;
- }
+ path.makedirs [ path.parent $(log-file) ] ;
+
+ .log-fd = [ FILE_OPEN $(log-file) : "w" ] ;
}
# Frontend rules
Modified: trunk/tools/build/v2/engine/builtins.c
==============================================================================
--- trunk/tools/build/v2/engine/builtins.c (original)
+++ trunk/tools/build/v2/engine/builtins.c 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -399,6 +399,11 @@
bind_builtin( "SELF_PATH", builtin_self_path, 0, args );
}
+ {
+ char * args [] = { "path", 0 };
+ bind_builtin( "MAKEDIR", builtin_makedir, 0, args );
+ }
+
/* Initialize builtin modules. */
init_set();
init_path();
@@ -1757,6 +1762,20 @@
}
}
+LIST *builtin_makedir( PARSE *parse, FRAME *frame )
+{
+ LIST *path = lol_get(frame->args, 0);
+
+ if (file_mkdir(path->string) == 0)
+ {
+ LIST *result = list_new (0, newstr(path->string));
+ return result;
+ }
+ else
+ {
+ return L0;
+ }
+}
#ifdef HAVE_PYTHON
Modified: trunk/tools/build/v2/engine/builtins.h
==============================================================================
--- trunk/tools/build/v2/engine/builtins.h (original)
+++ trunk/tools/build/v2/engine/builtins.h 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -61,6 +61,7 @@
LIST *builtin_pad( PARSE *parse, FRAME *frame );
LIST *builtin_precious( PARSE *parse, FRAME *frame );
LIST *builtin_self_path( PARSE *parse, FRAME *frame );
+LIST *builtin_makedir( PARSE *parse, FRAME *frame );
void backtrace( FRAME *frame );
extern int last_update_now_status;
Modified: trunk/tools/build/v2/engine/filemac.c
==============================================================================
--- trunk/tools/build/v2/engine/filemac.c (original)
+++ trunk/tools/build/v2/engine/filemac.c 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -157,6 +157,11 @@
return S_ISREG( statbuf.st_mode ) ? 1 : 0;
}
+int file_mkdir(char *pathname)
+{
+ return mkdir(pathname, 0766);
+}
+
/*
* file_archscan() - scan an archive for files.
Modified: trunk/tools/build/v2/engine/filent.c
==============================================================================
--- trunk/tools/build/v2/engine/filent.c (original)
+++ trunk/tools/build/v2/engine/filent.c 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -32,6 +32,7 @@
# include <io.h>
# include <sys/stat.h>
# include <ctype.h>
+# include <direct.h>
/*
* filent.c - scan directories and archives on NT
@@ -243,6 +244,10 @@
return ff->is_file;
}
+int file_mkdir(char *pathname)
+{
+ return _mkdir(pathname);
+}
/*
* file_archscan() - scan an archive for files
Modified: trunk/tools/build/v2/engine/filesys.h
==============================================================================
--- trunk/tools/build/v2/engine/filesys.h (original)
+++ trunk/tools/build/v2/engine/filesys.h 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -30,6 +30,7 @@
void file_build1(PATHNAME *f, string* file) ;
int file_is_file(char* filename);
+int file_mkdir(char *pathname);
typedef struct file_info_t file_info_t ;
struct file_info_t
Modified: trunk/tools/build/v2/engine/fileunix.c
==============================================================================
--- trunk/tools/build/v2/engine/fileunix.c (original)
+++ trunk/tools/build/v2/engine/fileunix.c 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -17,6 +17,7 @@
# include "pathsys.h"
# include "newstr.h"
# include <stdio.h>
+# include <sys/stat.h>
#if defined(sun) || defined(__sun) || defined(linux)
# include <unistd.h> /* needed for read and close prototype */
@@ -253,6 +254,10 @@
return ff->is_file;
}
+int file_mkdir(char* pathname)
+{
+ return mkdir(pathname, 0766);
+}
/*
* file_archscan() - scan an archive for files
Modified: trunk/tools/build/v2/util/path.jam
==============================================================================
--- trunk/tools/build/v2/util/path.jam (original)
+++ trunk/tools/build/v2/util/path.jam 2011-03-19 08:30:49 EDT (Sat, 19 Mar 2011)
@@ -465,6 +465,22 @@
return $(result) ;
}
+rule makedirs ( path )
+{
+ local result = true ;
+ if ! [ exists $(path) ]
+ {
+ if [ makedirs [ parent $(path) ] ]
+ {
+ if ! [ MAKEDIR $(path) ]
+ {
+ errors.error "Could not create directory '$(path)'" ;
+ result = ;
+ }
+ }
+ }
+ return $(result) ;
+}
# Converts native Windows paths into our internal canonic path representation.
# Supports 'invalid' paths containing multiple successive path separator
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk