summaryrefslogtreecommitdiff
path: root/bin/bootstrap.py
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-10-26 14:54:36 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-10-26 18:09:06 +0200
commit4e1887c8f496528081214446ea055a10be8e5b86 (patch)
treef3c4242199177af9b5e563ba3d9c34d9f932c3f3 /bin/bootstrap.py
parenta29128d4e5ba64bf09f67a7cffea6925af01e0e4 (diff)
downloadjustbuild-4e1887c8f496528081214446ea055a10be8e5b86.tar.gz
Bootstrap: allow setting build configuration
When constructing the build configuration for the bootstrap build is just, start with the value of the environment variable JUST_BUILD_CONF, if set, instead of the empty object. While there, also propagate SOURCE_DATE_EPOCH from the environment to the build configuration.
Diffstat (limited to 'bin/bootstrap.py')
-rwxr-xr-xbin/bootstrap.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py
index 4b83e033..098662d7 100755
--- a/bin/bootstrap.py
+++ b/bin/bootstrap.py
@@ -37,14 +37,24 @@ LOCAL_LINK_DIRS_MODULE = "src/buildtool/main"
LOCAL_LINK_DIRS_TARGET = "just"
# architecture related configuration (global variables)
+CONF = {}
+if 'JUST_BUILD_CONF' in os.environ:
+ CONF = json.loads(os.environ['JUST_BUILD_CONF'])
+
ARCHS = {
'i686':'x86',
'x86_64':'x86_64',
'arm':'arm',
'aarch64':'arm64'
}
-MACH = platform.machine()
-CONF = ('{"ARCH":"%s"}' % (ARCHS[MACH],)) if MACH in ARCHS else '{}'
+if "ARCH" not in CONF:
+ MACH = platform.machine()
+ if MACH in ARCHS:
+ CONF["ARCH"] = ARCHS[MACH]
+if 'SOURCE_DATE_EPOCH' in os.environ:
+ CONF['SOURCE_DATE_EPOCH'] = int(os.environ['SOURCE_DATE_EPOCH'])
+
+CONF_STRING = json.dumps(CONF)
# relevant directories (global variables)
@@ -250,7 +260,7 @@ def bootstrap():
GRAPH = os.path.join(WRKDIR, "graph.json")
TO_BUILD = os.path.join(WRKDIR, "to_build.json")
run([
- bootstrap_just, "analyse", "-C", CONF_FILE, "-D", CONF, "--dump-graph", GRAPH,
+ bootstrap_just, "analyse", "-C", CONF_FILE, "-D", CONF_STRING, "--dump-graph", GRAPH,
"--dump-artifacts-to-build", TO_BUILD, MAIN_MODULE, MAIN_TARGET
],
cwd=src_wrkdir)
@@ -265,7 +275,7 @@ def bootstrap():
cwd=src_wrkdir)
OUT = os.path.join(WRKDIR, "out")
run([
- "./out-boot/%s" % (MAIN_STAGE, ), "install", "-C", CONF_FILE, "-D", CONF, "-o", OUT,
+ "./out-boot/%s" % (MAIN_STAGE, ), "install", "-C", CONF_FILE, "-D", CONF_STRING, "-o", OUT,
"--local-build-root", LOCAL_ROOT, MAIN_MODULE, MAIN_TARGET
],
cwd=src_wrkdir)