summaryrefslogtreecommitdiffhomepage
path: root/tools/make_repository.sh
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-04-24 14:10:28 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-24 14:11:42 -0700
commitc60613475c92185c9b15468d0de87b321ef2b4d7 (patch)
tree470683d83c53ee44c174a06b5f673e5e19e1a38f /tools/make_repository.sh
parentf13f26d17da56d585fd9857a81175bbd0be8ce60 (diff)
Standardize all Docker images.
This change moves all Docker images to a standard location, and abstracts the build process so that they can be maintained in an automated fashion. This also allows the images to be architecture-independent. All images will now be referred to by the test framework via the canonical `gvisor.dev/images/<name>`, where `<name>` is a function of the path within the source tree. In a subsequent change, continuous integration will be added so that the images will always be correct and available locally. In the end, using `bazel` for Docker containers is simply not possible. Given that we already have the need to use `make` with the base container (for Docker), we extend this approach to get more flexibility. This change also adds a self-documenting and powerful Makefile that is intended to replace the collection of scripts in scripts. Canonical (self-documenting) targets can be added here for targets that understand which images need to be loaded and/or built. PiperOrigin-RevId: 308322438
Diffstat (limited to 'tools/make_repository.sh')
-rwxr-xr-xtools/make_repository.sh31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/make_repository.sh b/tools/make_repository.sh
index 27ffbc9f3..c91fd283c 100755
--- a/tools/make_repository.sh
+++ b/tools/make_repository.sh
@@ -17,14 +17,37 @@
# Parse arguments. We require more than two arguments, which are the private
# keyring, the e-mail associated with the signer, and the list of packages.
if [ "$#" -le 3 ]; then
- echo "usage: $0 <private-key> <signer-email> <component> <root> <packages...>"
+ echo "usage: $0 <private-key> <signer-email> <root> <packages...>"
exit 1
fi
declare -r private_key=$(readlink -e "$1"); shift
declare -r signer="$1"; shift
-declare -r component="$1"; shift
declare -r root="$1"; shift
+# Ensure that we have the correct packages installed.
+function apt_install() {
+ while true; do
+ sudo apt-get update &&
+ sudo apt-get install -y "$@" &&
+ true
+ result="${?}"
+ case $result in
+ 0)
+ break
+ ;;
+ 100)
+ # 100 is the error code that apt-get returns.
+ ;;
+ *)
+ exit $result
+ ;;
+ esac
+ done
+}
+dpkg-sig --help >/dev/null || apt_install dpkg-sig
+apt-ftparchive --help >/dev/null || apt_install apt-utils
+xz --help >/dev/null || apt_install xz-utils
+
# Verbose from this point.
set -xeo pipefail
@@ -78,7 +101,7 @@ for dir in "${root}"/pool/*/binary-*; do
name=$(basename "${dir}")
arch=${name##binary-}
arches+=("${arch}")
- repo_packages="${tmpdir}"/"${component}"/"${name}"
+ repo_packages="${tmpdir}"/main/"${name}"
mkdir -p "${repo_packages}"
(cd "${root}" && apt-ftparchive --arch "${arch}" packages pool > "${repo_packages}"/Packages)
(cd "${repo_packages}" && cat Packages | gzip > Packages.gz)
@@ -91,7 +114,7 @@ APT {
FTPArchive {
Release {
Architectures "${arches[@]}";
- Components "${component}";
+ Components "main";
};
};
};