third_party/sandboxroot: use macros for bazeldnf
Change-Id: I055b377dc3b5580d442abcba939d8b720cb42ad9
Reviewed-on: https://review.monogon.dev/c/monogon/+/2183
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/WORKSPACE b/WORKSPACE
index 5e00a6a..2792da4 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -415,17 +415,17 @@
)
# bazeldnf is used to generate our sandbox root.
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
http_archive(
name = "bazeldnf",
- sha256 = "404fc34e6bd3b568a7ca6fbcde70267d43830d0171d3192e3ecd83c14c320cfc",
- strip_prefix = "bazeldnf-0.5.4",
+ sha256 = "c6aecb167e41e923aeaa629443dabb7dc37462d96db928c3e91e2b019160e710",
urls = [
- "https://github.com/rmohr/bazeldnf/archive/v0.5.4.tar.gz",
- "https://storage.googleapis.com/builddeps/404fc34e6bd3b568a7ca6fbcde70267d43830d0171d3192e3ecd83c14c320cfc",
+ "https://github.com/rmohr/bazeldnf/releases/download/v0.5.7/bazeldnf-v0.5.7.tar.gz",
],
)
-load("@bazeldnf//:deps.bzl", "bazeldnf_dependencies", "rpm")
+load("@bazeldnf//:deps.bzl", "bazeldnf_dependencies")
bazeldnf_dependencies()
diff --git a/third_party/sandboxroot/regenerate.sh b/third_party/sandboxroot/regenerate.sh
index 7224d4e..cadaf17 100755
--- a/third_party/sandboxroot/regenerate.sh
+++ b/third_party/sandboxroot/regenerate.sh
@@ -83,8 +83,6 @@
EOF
-echo > ${DIR}/repositories.bzl.in
-
# Create new sandbox root
bazel ${BAZEL_ARGS} \
run //:bazeldnf -- rpmtree \
@@ -92,28 +90,15 @@
--name sandbox \
--nobest \
--buildfile third_party/sandboxroot/BUILD.bazel.in \
- --workspace third_party/sandboxroot/repositories.bzl.in \
+ --to-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies \
${PKGS[@]}
# Verify package signatures
bazel ${BAZEL_ARGS} run //:bazeldnf -- verify \
--repofile third_party/sandboxroot/repo.yaml \
- --workspace third_party/sandboxroot/repositories.bzl.in
-
-# Write out repositories.bzl and clean up.
-#
-# Ideally, bazeldnf would support the format natively:
-# https://github.com/rmohr/bazeldnf/issues/26
-cat <<EOF > ${DIR}/repositories.bzl
-load("@bazeldnf//:deps.bzl", "rpm")
-
-def sandbox_dependencies():
-$(cat ${DIR}/repositories.bzl.in | sed 's/^/ /')
-EOF
+ --from-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies
mv ${DIR}/BUILD.bazel.in ${DIR}/BUILD.bazel
-rm ${DIR}/repositories.bzl.in
-
# Mirror everything
bazel ${BAZEL_ARGS} \