[Cryptech-Commits] [user/sra/alpha-releng/omnibus] branch master updated: Tweak build-shadow-tree.py to adjust an existing tree as well as creating a new one.

git at cryptech.is git at cryptech.is
Wed Jun 29 03:09:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository user/sra/alpha-releng/omnibus.

The following commit(s) were added to refs/heads/master by this push:
       new  c07e57d   Tweak build-shadow-tree.py to adjust an existing tree as well as creating a new one.
c07e57d is described below

commit c07e57d9bd3f5fad8eb36dcda5144a0a2b6224e9
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Tue Jun 28 23:07:03 2016 -0400

    Tweak build-shadow-tree.py to adjust an existing tree as well as creating a new one.
    
    Original design intent was that the build tree be created once then
    left alone, but this turns out to be short-sighted: we really don't
    want to have to re-synthesize all of the Verilog code just because
    somebody added a new C file to the firmware.
---
 Makefile             |  4 +---
 build-shadow-tree.py | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 5d62630..0ff5e25 100644
--- a/Makefile
+++ b/Makefile
@@ -58,9 +58,7 @@ sandblast: clean
 
 firmware: shadow ${FIRMWARE_TARBALL}
 
-shadow: build
-
-build:
+shadow:
 	./build-shadow-tree.py
 
 ${FIRMWARE_TARBALL}: ${BITSTREAM} $(sort ${ELVES} ${ELVES:.elf=.bin})
diff --git a/build-shadow-tree.py b/build-shadow-tree.py
index e86ba85..378797f 100755
--- a/build-shadow-tree.py
+++ b/build-shadow-tree.py
@@ -17,14 +17,16 @@ import os
 source_root = "source"
 build_root  = "build"
 
-os.mkdir(build_root)
+if not os.path.isdir(build_root):
+    os.mkdir(build_root)
 
 for source_head, dirs, files in os.walk(source_root):
     build_head = build_root + source_head[len(source_root):]
 
     for dn in dirs:
         d = os.path.join(build_head, dn)
-        os.mkdir(d)
+        if not os.path.isdir(d):
+            os.mkdir(d)
 
     for fn in files:
         if fn == ".git":
@@ -33,4 +35,12 @@ for source_head, dirs, files in os.walk(source_root):
         s = os.path.join(source_head, fn)
         s = os.path.abspath(s)
         s = os.path.relpath(s, build_head)
-        os.symlink(s, d)
+        if not os.path.islink(d):
+            os.symlink(s, d)
+
+    for extra in set(os.listdir(build_head)) - set(dirs) - set(files):
+        d = os.path.join(build_head, extra)
+        if os.path.islink(d):
+            os.unlink(d)
+        elif os.path.isdir(d) and not os.listdir(d):
+            os.rmdir(d)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list