blob: cadaf17a8214f7ea02f2234dad4599718f401241 [file] [log] [blame]
Leopold7fbf1042023-01-06 19:57:37 +01001#!/usr/bin/env bash
2set -euo pipefail
3
4# Tell wrapper to not touch sandbox
5export MONOGON_SYSROOT_REBUILD=1
6
7# Packages to install. Make sure to document the reason for including each package.
8PKGS=(
9 # Common base toolchain used across the tree.
10 "binutils"
11 "gcc"
12 "python3"
13 "python-unversioned-command"
14 "glibc-static"
15
Tim Windelschmidt8e7df7b2023-03-30 15:02:35 +020016 # Required to build static CGO binaries
17 # see monogon-dev/monogon#192
18 "libstdc++-static"
19
Leopold7fbf1042023-01-06 19:57:37 +010020 # Kernel build
21 "flex"
22 "bison"
23 "elfutils-libelf-devel"
24 "openssl-devel"
25 "diffutils"
26 "bc"
27 "perl"
28 "lz4"
29
30 # EDK2
31 "libuuid-devel"
32 "util-linux"
33 "nasm"
34 "acpica-tools"
35
Serge Bazanski0f1939a2023-02-23 09:36:10 +000036 # patch tool, as used by gazelle
37 "patch"
38
Leopold7fbf1042023-01-06 19:57:37 +010039 # TPM emulator for testing
40 "swtpm-tools"
41
42 # Clang/LLVM (for EFI toolchain)
43 "clang"
44 "llvm"
45 "lld"
46
47 # image_gcp rule
48 "tar"
49
50 # ktest
51 "qemu-system-x86-core"
52
53 # musl-host-gcc
54 "rsync"
55 "xz"
56
57 # Packages included to stabilize SAT solution when there are equal scores.
58 "fedora-release-identity-container"
59 "coreutils-single"
60 "curl-minimal"
61 "libcurl-minimal"
62 "glibc-langpack-en"
63 "selinux-policy-minimum"
64)
65
66DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
67REPO=third_party/sandboxroot/repo.yaml
68BAZEL_ARGS="--noworkspace_rc --bazelrc ${DIR}/../../.bazelrc.sandboxroot"
69
70# Fetch latest repository metadata
71bazel ${BAZEL_ARGS} run //:bazeldnf -- fetch --repofile $REPO
72
73# Write BUILD.bazel template
74cat <<EOF > ${DIR}/BUILD.bazel.in
75load("@bazeldnf//:deps.bzl", "rpmtree")
76load("@bazeldnf//:def.bzl", "bazeldnf")
77
78bazeldnf(
79 name = "sandboxroot",
80 command = "sandbox",
81 tar = ":sandbox",
82)
83
84EOF
85
Leopold7fbf1042023-01-06 19:57:37 +010086# Create new sandbox root
87bazel ${BAZEL_ARGS} \
88 run //:bazeldnf -- rpmtree \
89 --repofile third_party/sandboxroot/repo.yaml \
90 --name sandbox \
91 --nobest \
92 --buildfile third_party/sandboxroot/BUILD.bazel.in \
Tim Windelschmidta5588e12023-09-20 19:43:15 +020093 --to-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies \
Leopold7fbf1042023-01-06 19:57:37 +010094 ${PKGS[@]}
95
96# Verify package signatures
97bazel ${BAZEL_ARGS} run //:bazeldnf -- verify \
98 --repofile third_party/sandboxroot/repo.yaml \
Tim Windelschmidta5588e12023-09-20 19:43:15 +020099 --from-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies
Leopold7fbf1042023-01-06 19:57:37 +0100100
101mv ${DIR}/BUILD.bazel.in ${DIR}/BUILD.bazel
Serge Bazanski77b87a62023-04-03 15:24:27 +0200102
103# Mirror everything
104bazel ${BAZEL_ARGS} \
105 run //third_party/sandboxroot/mirror sync