blob: 8f026923adb620dec801acdef812b52ba083e5d1 [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 # Clang/LLVM (for EFI toolchain)
40 "clang"
41 "llvm"
42 "lld"
43
44 # image_gcp rule
45 "tar"
46
47 # ktest
48 "qemu-system-x86-core"
Tim Windelschmidt492434a2024-10-22 14:29:55 +020049 "qemu-img"
Leopold7fbf1042023-01-06 19:57:37 +010050
51 # musl-host-gcc
52 "rsync"
53 "xz"
54
55 # Packages included to stabilize SAT solution when there are equal scores.
56 "fedora-release-identity-container"
57 "coreutils-single"
Tim Windelschmidtf69d84b2024-07-03 20:32:19 +020058 "curl"
59 "libcurl"
Leopold7fbf1042023-01-06 19:57:37 +010060 "glibc-langpack-en"
61 "selinux-policy-minimum"
62)
63
64DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
65REPO=third_party/sandboxroot/repo.yaml
66BAZEL_ARGS="--noworkspace_rc --bazelrc ${DIR}/../../.bazelrc.sandboxroot"
67
68# Fetch latest repository metadata
69bazel ${BAZEL_ARGS} run //:bazeldnf -- fetch --repofile $REPO
70
71# Write BUILD.bazel template
72cat <<EOF > ${DIR}/BUILD.bazel.in
73load("@bazeldnf//:deps.bzl", "rpmtree")
74load("@bazeldnf//:def.bzl", "bazeldnf")
75
76bazeldnf(
77 name = "sandboxroot",
78 command = "sandbox",
79 tar = ":sandbox",
80)
81
82EOF
83
Leopold7fbf1042023-01-06 19:57:37 +010084# Create new sandbox root
85bazel ${BAZEL_ARGS} \
86 run //:bazeldnf -- rpmtree \
87 --repofile third_party/sandboxroot/repo.yaml \
88 --name sandbox \
89 --nobest \
90 --buildfile third_party/sandboxroot/BUILD.bazel.in \
Tim Windelschmidta5588e12023-09-20 19:43:15 +020091 --to-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies \
Leopold7fbf1042023-01-06 19:57:37 +010092 ${PKGS[@]}
93
94# Verify package signatures
95bazel ${BAZEL_ARGS} run //:bazeldnf -- verify \
96 --repofile third_party/sandboxroot/repo.yaml \
Tim Windelschmidta5588e12023-09-20 19:43:15 +020097 --from-macro third_party/sandboxroot/repositories.bzl%sandbox_dependencies
Leopold7fbf1042023-01-06 19:57:37 +010098
99mv ${DIR}/BUILD.bazel.in ${DIR}/BUILD.bazel
Serge Bazanski77b87a62023-04-03 15:24:27 +0200100
101# Mirror everything
102bazel ${BAZEL_ARGS} \
Serge Bazanski8111b902024-06-04 14:33:40 +0000103 run //third_party/sandboxroot/mirror sync