summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2019-09-12 13:43:07 -0700
committergVisor bot <gvisor-bot@google.com>2019-09-12 13:44:18 -0700
commit574eda88808138b2dd72ebe6bbca80a09a13c7fb (patch)
tree22b6a96c89d691071fd32e8cd8c23d6aa902e162
parente2528cae7662f291d762686b36cf2e7429b5b083 (diff)
Update repository directory structure.
Currently it will not work with apt out of the box, as we require the dists/ prefix, along with a distribution name. This tweaks the overall structure to allow for the same URL prefix to be used for all repositories, and enables multiple architectures. Fixes #852 PiperOrigin-RevId: 268756104
-rwxr-xr-xscripts/build.sh28
-rwxr-xr-xtools/make_repository.sh21
2 files changed, 33 insertions, 16 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 4a1cf730c..d73eaee77 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -32,12 +32,14 @@ fi
# Install installs artifacts.
install() {
- local dir="$1"
- mkdir -p "${dir}"
- cp -f "${runsc}" "${dir}"/runsc
- sha512sum "${dir}"/runsc | awk '{print $1 " runsc"}' > "${dir}"/runsc.sha512
+ local -r binaries_dir="$1"
+ local -r repo_dir="$2"
+ mkdir -p "${binaries_dir}"
+ cp -f "${runsc}" "${binaries_dir}"/runsc
+ sha512sum "${binaries_dir}"/runsc | awk '{print $1 " runsc"}' > "${binaries_dir}"/runsc.sha512
if [[ -v repo ]]; then
- rm -rf "${dir}"/repo && cp -a "${repo}" "$dir"/repo
+ rm -rf "${repo_dir}" && mkdir -p "$(dirname "${repo_dir}")"
+ cp -a "${repo}" "${repo_dir}"
fi
}
@@ -47,8 +49,11 @@ install() {
if [[ -v KOKORO_ARTIFACTS_DIR ]]; then
if [[ "${KOKORO_BUILD_NIGHTLY}" == "true" ]]; then
# The "latest" directory and current date.
- install "${KOKORO_ARTIFACTS_DIR}/nightly/latest"
- install "${KOKORO_ARTIFACTS_DIR}/nightly/$(date -Idate)"
+ stamp="$(date -Idate)"
+ install "${KOKORO_ARTIFACTS_DIR}/nightly/latest" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/nightly/main"
+ install "${KOKORO_ARTIFACTS_DIR}/nightly/${stamp}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/nightly/${stamp}"
else
# Is it a tagged release? Build that instead. In that case, we also try to
# update the base release directory, in case this is an update. Finally, we
@@ -60,11 +65,14 @@ if [[ -v KOKORO_ARTIFACTS_DIR ]]; then
for tag in ${tags}; do
name=$(echo "${tag}" | cut -d'-' -f2)
base=$(echo "${name}" | cut -d'.' -f1)
- install "${KOKORO_ARTIFACTS_DIR}/release/${name}"
+ install "${KOKORO_ARTIFACTS_DIR}/release/${name}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/${name}/main"
if [[ "${base}" != "${tag}" ]]; then
- install "${KOKORO_ARTIFACTS_DIR}/release/${base}"
+ install "${KOKORO_ARTIFACTS_DIR}/release/${base}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/${base}/main"
fi
- install "${KOKORO_ARTIFACTS_DIR}/release/latest"
+ install "${KOKORO_ARTIFACTS_DIR}/release/latest" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/latest/main"
done
fi
fi
diff --git a/tools/make_repository.sh b/tools/make_repository.sh
index ccebe27b3..b16ac6311 100755
--- a/tools/make_repository.sh
+++ b/tools/make_repository.sh
@@ -39,11 +39,18 @@ cleanup() {
trap cleanup EXIT
gpg --no-default-keyring --keyring "${keyring}" --import "${private_key}" >&2
-# Export the public key from the keyring.
-gpg --no-default-keyring --keyring "${keyring}" --armor --export "${signer}" > "${tmpdir}"/keyFile >&2
-
# Copy the packages, and ensure permissions are correct.
-cp -a "$@" "${tmpdir}" && chmod 0644 "${tmpdir}"/*
+for pkg in "$@"; do
+ name=$(basename "${pkg}" .deb)
+ name=$(basename "${name}" .changes)
+ arch=${name##*_}
+ if [[ "${name}" == "${arch}" ]]; then
+ continue # Not a regular package.
+ fi
+ mkdir -p "${tmpdir}"/binary-"${arch}"
+ cp -a "${pkg}" "${tmpdir}"/binary-"${arch}"
+done
+find "${tmpdir}" -type f -exec chmod 0644 {} \;
# Ensure there are no symlinks hanging around; these may be remnants of the
# build process. They may be useful for other things, but we are going to build
@@ -51,12 +58,14 @@ cp -a "$@" "${tmpdir}" && chmod 0644 "${tmpdir}"/*
find "${tmpdir}" -type l -exec rm -f {} \;
# Sign all packages.
-for file in "${tmpdir}"/*.deb; do
+for file in "${tmpdir}"/binary-*/*.deb; do
dpkg-sig -g "--no-default-keyring --keyring ${keyring}" --sign builder "${file}" >&2
done
# Build the package list.
-(cd "${tmpdir}" && apt-ftparchive packages . | gzip > Packages.gz)
+for dir in "${tmpdir}"/binary-*; do
+ (cd "${dir}" && apt-ftparchive packages . | gzip > Packages.gz)
+done
# Build the release list.
(cd "${tmpdir}" && apt-ftparchive release . > Release)