summaryrefslogtreecommitdiff
path: root/bin/bootstrap.py
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-01-24 15:16:36 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-01-24 17:55:28 +0100
commit703737f43b2ddabea4174062749a056b01595976 (patch)
tree5a079b20f1de173a9dfb64a4d40da205bbc553f9 /bin/bootstrap.py
parentc5aecdb15685bcbae02ced7586dd927482bf7ce5 (diff)
downloadjustbuild-703737f43b2ddabea4174062749a056b01595976.tar.gz
bin/boostrap.py: support dropping of repositories
Not all repositories mentioned in the repository configuration are needed to boostrap just (e.g., because they are used for testing). Support dropping dependencies for bootstrapping by replacing them by a reference to an empty directory and in this way have less files that need to be fetched.
Diffstat (limited to 'bin/bootstrap.py')
-rwxr-xr-xbin/bootstrap.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py
index 211570a2..12a97807 100755
--- a/bin/bootstrap.py
+++ b/bin/bootstrap.py
@@ -237,6 +237,17 @@ def config_to_local(*, repos_file, link_targets_file):
with open(link_targets_file, "w") as f:
json.dump(target, f, indent=2)
+def prune_config(*, repos_file, empty_dir):
+ with open(repos_file) as f:
+ repos = json.load(f)
+ for repo in repos["repositories"]:
+ desc = repos["repositories"][repo]
+ if desc.get("bootstrap", {}).get("drop"):
+ desc["repository"] = {"type": "file", "path": empty_dir}
+ os.unlink(repos_file)
+ with open(repos_file, "w") as f:
+ json.dump(repos, f, indent=2)
+
def bootstrap():
if LOCAL_DEPS:
print("Bootstrap build in %r from sources %r against LOCALBASE %r"
@@ -252,6 +263,9 @@ def bootstrap():
repos_file =os.path.join(src_wrkdir, REPOS),
link_targets_file=os.path.join(src_wrkdir, LOCAL_LINK_DIRS_MODULE, "TARGETS")
)
+ empty_dir = os.path.join(WRKDIR, "empty_directory")
+ os.makedirs(empty_dir)
+ prune_config(repos_file=os.path.join(src_wrkdir, REPOS), empty_dir=empty_dir)
dep_flags = setup_deps(src_wrkdir)
# handle proto
flags = ["-I", src_wrkdir] + dep_flags["include"] + ["-I", os.path.join(LOCALBASE, "include")]