bootstrap: fold getbuild_date into bootstrap AND build

unfrotunately we need a code copy for this because bootstrap must be
self contained. not too much to worry about since they are both in the
same repo so I expect people will grep for stuff (hopefully :D)
This commit is contained in:
Harald Sitter
2025-07-22 10:47:08 +02:00
parent 96c7c0d139
commit d7636083d5
3 changed files with 21 additions and 20 deletions

View File

@@ -5,6 +5,9 @@
# Bootstraps an Arch Linux Docker container to be ready for building KDE Linux.
# WARNING: DO NOT CALL INTO OTHER SCRIPTS HERE.
# This file needs to be self-contained because it gets run by the CI VM provisioning in isolation.
# Exit immediately if any command fails and print all commands before they are executed.
set -ex
@@ -38,7 +41,15 @@ SigLevel = Never
Server = https://cdn.kde.org/kde-linux/packaging/packages-debug/
EOF
./bootstrap_getbuild_date.sh
# Ensure the packages repo and the base image do not go out of sync
# by using the same snapshot date from build_date.txt for both
# WARNING: code copy in build.sh
BUILD_DATE=$(curl --fail --silent https://cdn.kde.org/kde-linux/packaging/build_date.txt)
if [ -z "$BUILD_DATE" ]; then
echo "ERROR: Could not fetch build_date.txt — refusing to build out-of-sync image." >&2
exit 1
fi
echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
# ParallelDownloads is enabled by default since pacman 7.0.0.r6.gc685ae6-2,
# so no need to uncomment or manually set it unless we want to change the value.

View File

@@ -1,18 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2024 Bruno Pajdek <brupaj@proton.me>
set -eux
SYSROOT=${SYSROOT:-/}
# Ensure the packages repo and the base image do not go out of sync
# by using the same snapshot date from build_date.txt for both
BUILD_DATE=$(curl --fail --silent https://cdn.kde.org/kde-linux/packaging/build_date.txt)
if [ -z "$BUILD_DATE" ]; then
echo "ERROR: Could not fetch build_date.txt — refusing to build out-of-sync image." >&2
exit 1
fi
echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$arch" > $SYSROOT/etc/pacman.d/mirrorlist

View File

@@ -61,7 +61,15 @@ export SYSTEMD_LOG_LEVEL=debug
cp /etc/pacman.conf mkosi.sandbox/etc
mkdir --parents mkosi.sandbox/etc/pacman.d
SYSROOT=mkosi.sandbox ./bootstrap_getbuild_date.sh
# Ensure the packages repo and the base image do not go out of sync
# by using the same snapshot date from build_date.txt for both
# WARNING: code copy in bootstrap.sh
BUILD_DATE=$(curl --fail --silent https://cdn.kde.org/kde-linux/packaging/build_date.txt)
if [ -z "$BUILD_DATE" ]; then
echo "ERROR: Could not fetch build_date.txt — refusing to build out-of-sync image." >&2
exit 1
fi
echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$arch" > mkosi.sandbox/etc/pacman.d/mirrorlist
# Make sure permissions are sound
./permission-fix.sh