From 17a3874ab1e9bf647b04febb1eec4c33434289ec Mon Sep 17 00:00:00 2001 From: Elysia <1391048988@qq.com> Date: Thu, 18 Dec 2025 17:54:50 +0800 Subject: [PATCH] chore: Added a fallback mechanism for build failures. (ref #2706) --- sdata/dist-fedora/SPECS/quickshell-git.spec | 2 -- sdata/dist-fedora/install-deps.sh | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sdata/dist-fedora/SPECS/quickshell-git.spec b/sdata/dist-fedora/SPECS/quickshell-git.spec index e90bdebe2..5167a1ae3 100644 --- a/sdata/dist-fedora/SPECS/quickshell-git.spec +++ b/sdata/dist-fedora/SPECS/quickshell-git.spec @@ -63,8 +63,6 @@ Wayland and X11. %endif -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_BUILD_TYPE=Release \ - -DDISTRIBUTOR="Fedora COPR (errornointernet/quickshell)" \ - -DDISTRIBUTOR_DEBUGINFO_AVAILABLE=YES \ -DGIT_REVISION=%{commit} \ -DINSTALL_QML_PREFIX=%{_lib}/qt6/qml %cmake_build diff --git a/sdata/dist-fedora/install-deps.sh b/sdata/dist-fedora/install-deps.sh index 7e43ff0f4..ffa54e60f 100644 --- a/sdata/dist-fedora/install-deps.sh +++ b/sdata/dist-fedora/install-deps.sh @@ -1,6 +1,6 @@ # This script is meant to be sourced. # It's not for directly running. - +set -ex # ------------------------- # CONFIG # ------------------------- @@ -39,13 +39,19 @@ function install_RPMS() { x spectool -g -C "$rpmbuildroot/SOURCES" "$spec_file" # Install build dependencies r x sudo dnf builddep -y "$spec_file" - # Build the RPM with proper quoting preserved - x rpmbuild -bb --define "_topdir $rpmbuildroot" "$spec_file" + # Build the RPM package locally. If it fails, download it from COPR. + if ! rpmbuild -bb --define "_topdir $rpmbuildroot" --define "debug_package %{nil}" "$spec_file"; then + printf "${STY_RED}Local build encountered an issue. Downloading $(basename "$spec_file" .spec) from COPR. Report the issue to Discussions pls.${STY_RST}\n" + sudo dnf install -y $(basename "$spec_file" .spec) + nolock_qs=true + fi done mapfile -t -d '' local_rpms < <(find "$rpmbuildroot/RPMS" -maxdepth 2 -type f -name '*.rpm' -not -name '*debug*' -print0) - echo -e "${STY_BLUE}Next command:${STY_RST} sudo dnf install ${local_rpms[@]} -y" - r x sudo dnf install "${local_rpms[@]}" -y + if [[ ${#local_rpms[@]} -ge 1 ]]; then + echo -e "${STY_BLUE}Next command:${STY_RST} sudo dnf install ${local_rpms[@]} -y" + r x sudo dnf install "${local_rpms[@]}" -y + fi x cd ${REPO_ROOT} } @@ -100,7 +106,7 @@ while IFS= read -r deps_list_key; do done < <(echo "$deps_data" | yq '.groups | keys[]? | select(length > 0)') # Add back versionlock at the end -v sudo dnf versionlock add quickshell-git +[ -n $nolock_qs ] || v sudo dnf versionlock add quickshell-git || true echo -e "\n========================================" echo "All installations are completed."