From d7636083d599eda82a607e912c0404ccfc2fea57 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 22 Jul 2025 10:47:08 +0200 Subject: [PATCH] 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) --- bootstrap.sh | 13 ++++++++++++- bootstrap_getbuild_date.sh | 18 ------------------ build.sh | 10 +++++++++- 3 files changed, 21 insertions(+), 20 deletions(-) delete mode 100755 bootstrap_getbuild_date.sh diff --git a/bootstrap.sh b/bootstrap.sh index 171f2dc..e367f82 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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. diff --git a/bootstrap_getbuild_date.sh b/bootstrap_getbuild_date.sh deleted file mode 100755 index 6d928b3..0000000 --- a/bootstrap_getbuild_date.sh +++ /dev/null @@ -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 -# SPDX-FileCopyrightText: 2024 Bruno Pajdek - -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 diff --git a/build.sh b/build.sh index 53e5ef9..e278612 100755 --- a/build.sh +++ b/build.sh @@ -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