summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/bootstrap.py26
-rw-r--r--doc/future-designs/symlinks.org9
-rw-r--r--etc/repos.json8
3 files changed, 38 insertions, 5 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py
index 331950e5..e8d938aa 100755
--- a/bin/bootstrap.py
+++ b/bin/bootstrap.py
@@ -272,6 +272,30 @@ def prune_config(*, repos_file, empty_dir):
with open(repos_file, "w") as f:
json.dump(repos, f, indent=2)
+def copy_roots(*, repos_file, copy_dir):
+ with open(repos_file) as f:
+ repos = json.load(f)
+ for repo in repos["repositories"]:
+ desc = repos["repositories"][repo]
+ to_copy = desc.get("bootstrap", {}).get("copy")
+ if to_copy:
+ old_root = desc["repository"]["path"]
+ new_root = os.path.join(copy_dir, repo)
+ for x in to_copy:
+ src = os.path.join(old_root, x)
+ dst = os.path.join(new_root, x)
+ if os.path.isdir(src):
+ shutil.copytree(src, dst,
+ symlinks=False, dirs_exist_ok=True)
+ elif os.path.isfile(src):
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
+ shutil.copyfile(src, dst, follow_symlinks=True)
+ shutil.copymode(src, dst, follow_symlinks=True)
+ desc["repository"]["path"] = new_root
+ 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"
@@ -290,6 +314,8 @@ def bootstrap():
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)
+ copy_dir = os.path.join(WRKDIR, "copied_roots")
+ copy_roots(repos_file=os.path.join(src_wrkdir, REPOS), copy_dir=copy_dir)
dep_flags = setup_deps(src_wrkdir)
# handle proto
flags = ["-I", src_wrkdir] + dep_flags["include"] + ["-I", os.path.join(LOCALBASE, "include")]
diff --git a/doc/future-designs/symlinks.org b/doc/future-designs/symlinks.org
index d7e87c95..47ca5063 100644
--- a/doc/future-designs/symlinks.org
+++ b/doc/future-designs/symlinks.org
@@ -61,18 +61,19 @@ do contain symbolic links, e.g., shared libraries pointing to
the specific version (like ~libfoo.so.3~ as a symlink pointing to
~libfoo.so.3.1.4~) or detours through ~/etc/alternatives~.
-** Proposed treatment of symbolic links
-
-*** "Shopping list" for bootstrapping against pre-compiled dependencies
+** Implemented stop-gap: "shopping list" for bootstrapping
As a stop-gap measure to support building the tool itself against
pre-installed dependencies with the respective directories containing
symbolic links, or tools (like ~protoc~) being symbolic links (e.g.,
-to the specific version), repositories can specify a list of files
+to the specific version), repositories can specify, in the ~"copy"~
+attribute of the ~"local_bootstrap"~ parameter, a list of files
and directories to be copied as part of the bootstrapping process
to a fresh clean directory serving as root; during this copying,
symlinks are followed.
+** Proposed treatment of symbolic links
+
*** "Ignore-special" roots
To allow working with source trees containing symbolic links, we
diff --git a/etc/repos.json b/etc/repos.json
index 04b59b3c..a41f61d9 100644
--- a/etc/repos.json
+++ b/etc/repos.json
@@ -241,6 +241,10 @@
, "target_root": "import targets"
, "target_file_name": "TARGETS.protobuf"
, "bindings": {"rules": "rules-protobuf", "zlib": "zlib"}
+ , "local_bootstrap":
+ { "copy":
+ ["bin/protoc", "include/google/protobuf", "proto/google/protobuf"]
+ }
}
, "bazel_remote_apis":
{ "repository":
@@ -374,6 +378,8 @@
, "re2": "re2"
, "cares": "com_github_cares_cares"
}
+ , "local_bootstrap":
+ {"copy": ["bin/grpc_cpp_plugin", "include/grpc", "include/grpcpp"]}
}
, "com_github_libgit2_libgit2":
{ "repository":
@@ -393,7 +399,7 @@
, "patches": "patches"
}
, "bootstrap": {"include_dir": "include", "include_name": "."}
- , "local_bootstrap": {"local_path": "include"}
+ , "local_bootstrap": {"local_path": "include", "copy": ["git2.h", "git2"]}
}
, "catch2":
{ "repository":