aboutsummaryrefslogtreecommitdiff
path: root/scripts/build-shadow-tree.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-12-14 00:56:24 -0500
committerRob Austein <sra@hactrn.net>2016-12-14 00:56:24 -0500
commitb94f9f9d3816d3cd26a4cc8f3da9f4616bd05a35 (patch)
treefbeb9b09ce998632986b2ad623adc832f795e6bf /scripts/build-shadow-tree.py
parenteb5aaecab2b988f3ff4d36817fb56aca5a30aebb (diff)
Support multiple packages corresponding to multiple releng branches.
We want to be able to provide packaged builds of development branches. The most straightforward way to do this is a 1:1 correspondence between branches in the releng tree and variant package names. We adopt a simple convention: the base package name corresponds to the master branch, all other branches are named with the base package name followed by the branch name. So the master branch is the cryptech-alpha package, the ksng branch is the cryptech-alpha-ksng branch, and so forth. This isn't a perfect solution, but it's probably good enough. In order to do this, we need to generate the debian/control file at build-time, so that we can generate the list of conflicting packages. This commit also pulls in a few changes that had collected on the master branches of various repositories, chiefly because a few of them were necessary to get it the build to run at all.
Diffstat (limited to 'scripts/build-shadow-tree.py')
-rwxr-xr-xscripts/build-shadow-tree.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/build-shadow-tree.py b/scripts/build-shadow-tree.py
new file mode 100755
index 0000000..378797f
--- /dev/null
+++ b/scripts/build-shadow-tree.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# Create a symlink build tree like the old X11 project "lndir" program.
+#
+# Reason for this is simple: synthesizing the Alpha RTL code takes a
+# looong time, so we don't want to do it unnecessarily, but we also
+# don't want to include all of the intermediate files from the
+# synthesis in the source tarball. So we symlink a shadow build tree
+# off to the side, do the synthesis there.
+#
+# We could construct this symlink tree by hand, but that's fragile, so
+# we'd probably write a script to do it anyway, so we might as well
+# just use the script to build the shadow tree and have done with it.
+
+import os
+
+source_root = "source"
+build_root = "build"
+
+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)
+ if not os.path.isdir(d):
+ os.mkdir(d)
+
+ for fn in files:
+ if fn == ".git":
+ continue
+ d = os.path.join(build_head, fn)
+ s = os.path.join(source_head, fn)
+ s = os.path.abspath(s)
+ s = os.path.relpath(s, build_head)
+ 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)