wzugang / serf

Automatically exported from code.google.com/p/serf
Apache License 2.0
0 stars 0 forks source link

scons PREFIX doesn't create folder if it doesn't exist yet #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. scons /tmp/blablabla

Actual output:
scons: Reading SConscript files ...

scons: *** Directory path for option PREFIX does not exist: /tmp/blablabla
File "/Users/lgo/dev/serftrunk/SConstruct", line 133, in <module>

What is the expected output? What do you see instead?
Scons should just create that folder as (apparently) our previous build system 
did.

(Reported by danielsh on #svn-dev)

Original issue reported on code.google.com by lieven.govaerts@gmail.com on 12 Aug 2013 at 12:09

GoogleCodeExporter commented 9 years ago
The first step should be:
scons PREFIX=/tmp/blablabla

Original comment by lieven.govaerts@gmail.com on 12 Aug 2013 at 12:12

GoogleCodeExporter commented 9 years ago
This patch to SConstruct will solve the issue:

Index: SConstruct
===================================================================
--- SConstruct  (revision 2122)
+++ SConstruct  (working copy)
@@ -58,7 +58,7 @@ opts.AddVariables(
   PathVariable('PREFIX',
                'Directory to install under',
                default_prefix,
-               PathVariable.PathIsDir),
+               PathVariable.PathIsDirCreate),
   PathVariable('APR',
                "Path to apr-1-config, or to APR's install area",
                default_libdir,

With this patch scons will try to create the directory directly when reading 
the command line variables. The PREFIX option is best used at install time, 
when the user normally has access to the install location:
$ scons
$ scons check
$ sudo scons install PREFIX=/usr/local/new_directory

A remaining issue is that the PREFIX will be saved to .saved_config, and then 
reused at the next scons invocation. If the user returns the above recipe and 
then deletes /usr/local/new_directory for a clean rebuild, (s)he will get a 
permission denied error in step 1 '$ scons' because the user then doesn't have 
the necessary rights to create /usr/local/new_directory.

Original comment by lieven.govaerts@gmail.com on 12 Aug 2013 at 4:28

GoogleCodeExporter commented 9 years ago
Fixed in r2127, path is created when the 'install' target is specified. So this 
will now work:
$ scons PREFIX=/usr/local/new_directory
$ scons check
$ sudo scons install

/usr/local/new_directory will only be created in the last step.

Original comment by lieven.govaerts@gmail.com on 12 Aug 2013 at 7:01