2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

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.


[SVN r70179]
This commit is contained in:
Vladimir Prus
2011-03-19 12:30:49 +00:00
parent d6ee98e478
commit 241361971c
8 changed files with 57 additions and 6 deletions

View File

@@ -17,6 +17,8 @@ import sequence ;
import property ;
import property-set ;
import "class" : new ;
import common ;
import path ;
rule log-summary ( )
{
@@ -185,12 +187,9 @@ rule builds ( metatarget-reference : properties * : what ? : retry ? )
# 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

View File

@@ -399,6 +399,11 @@ void load_builtins()
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_self_path( PARSE *parse, FRAME *frame )
}
}
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

View File

@@ -61,6 +61,7 @@ LIST *builtin_file_open( PARSE *parse, FRAME *frame );
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;

View File

@@ -157,6 +157,11 @@ int file_is_file( char * filename )
return S_ISREG( statbuf.st_mode ) ? 1 : 0;
}
int file_mkdir(char *pathname)
{
return mkdir(pathname, 0766);
}
/*
* file_archscan() - scan an archive for files.

View File

@@ -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 @@ int file_is_file(char* filename)
return ff->is_file;
}
int file_mkdir(char *pathname)
{
return _mkdir(pathname);
}
/*
* file_archscan() - scan an archive for files

View File

@@ -30,6 +30,7 @@ int file_time( char *filename, time_t *time );
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

View File

@@ -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 @@ int file_is_file(char* filename)
return ff->is_file;
}
int file_mkdir(char* pathname)
{
return mkdir(pathname, 0766);
}
/*
* file_archscan() - scan an archive for files

View File

@@ -465,6 +465,22 @@ rule programs-path ( )
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