Re: [m5-dev] changeset in m5: scons: Allow the build directory live under an ...

2011-04-20 Thread Gabe Black
It's probably a bit late to bring this up, but won't this remove -all- 
directories called build, not just -the- build directory? There's an os 
function that checks if two directories are the same. We can use that to 
compare the actual build directory with whatever we're recursing down. 
That would even catch hard links, I think, although hard linking your 
build directory would be a little weird.


Gabe

On 4/20/2011 11:20 AM, Brad Danofsky wrote:

changeset f52ece27e20d in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=f52ece27e20d
description:
scons: Allow the build directory live under an EXTRAS directory

diffstat:

  src/SConscript |  4 
  1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r ee4e795343bf -r f52ece27e20d src/SConscript
--- a/src/SConscriptTue Apr 19 18:45:23 2011 -0700
+++ b/src/SConscriptWed Apr 20 11:14:51 2011 -0700
@@ -320,6 +320,10 @@
  for extra_dir in extras_dir_list:
  prefix_len = len(dirname(extra_dir)) + 1
  for root, dirs, files in os.walk(extra_dir, topdown=True):
+# if build lives in the extras directory, don't walk down it
+if 'build' in dirs:
+dirs.remove('build')
+
  if 'SConscript' in files:
  build_dir = joinpath(env['BUILDDIR'], root[prefix_len:])
  SConscript(joinpath(root, 'SConscript'), variant_dir=build_dir)
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev
   


___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] changeset in m5: scons: Allow the build directory live under an ...

2011-04-20 Thread Steve Reinhardt
Yes, you are right and that is intentional.

Some of us discussed this (perhaps off-list), and Brad's earlier
version had another test similar to what you're proposing.  However,
you could have multiple build directories under your EXTRAS dir (e.g.,
extras/x86-64/build, extras/x86-32/build, and extras/arm/build) and
you wouldn't want to recurse down any of those since they would all
have undesirable SConscript symlinks, even though only one of them is
the one you're using.  So it seems there's no simple way to know if a
directory called 'build' should be traversed or not, but overall it
seemed like the odds of another random directory called 'build' being
a build directory was much much higher than the odds of it being
filled with source you really needed to compile, and as a bonus it
made the code simpler, so we went with the current version.

Plus there's always a workaround of don't name any of your source
directories 'build', which doesn't seem terribly onerous.

Steve

On Wed, Apr 20, 2011 at 7:22 PM, Gabe Black gbl...@eecs.umich.edu wrote:
 It's probably a bit late to bring this up, but won't this remove -all-
 directories called build, not just -the- build directory? There's an os
 function that checks if two directories are the same. We can use that to
 compare the actual build directory with whatever we're recursing down. That
 would even catch hard links, I think, although hard linking your build
 directory would be a little weird.

 Gabe

 On 4/20/2011 11:20 AM, Brad Danofsky wrote:

 changeset f52ece27e20d in /z/repo/m5
 details: http://repo.m5sim.org/m5?cmd=changeset;node=f52ece27e20d
 description:
        scons: Allow the build directory live under an EXTRAS directory

 diffstat:

  src/SConscript |  4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diffs (14 lines):

 diff -r ee4e795343bf -r f52ece27e20d src/SConscript
 --- a/src/SConscript    Tue Apr 19 18:45:23 2011 -0700
 +++ b/src/SConscript    Wed Apr 20 11:14:51 2011 -0700
 @@ -320,6 +320,10 @@
  for extra_dir in extras_dir_list:
      prefix_len = len(dirname(extra_dir)) + 1
      for root, dirs, files in os.walk(extra_dir, topdown=True):
 +        # if build lives in the extras directory, don't walk down it
 +        if 'build' in dirs:
 +            dirs.remove('build')
 +
          if 'SConscript' in files:
              build_dir = joinpath(env['BUILDDIR'], root[prefix_len:])
              SConscript(joinpath(root, 'SConscript'),
 variant_dir=build_dir)
 ___
 m5-dev mailing list
 m5-dev@m5sim.org
 http://m5sim.org/mailman/listinfo/m5-dev


 ___
 m5-dev mailing list
 m5-dev@m5sim.org
 http://m5sim.org/mailman/listinfo/m5-dev

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev