From 0706273c76e64d982c5ec7a23d50b5ac4afacac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Petter=20Ska=CC=8Alerud?= Date: Tue, 20 May 2025 11:03:53 +0200 Subject: [PATCH] Coin, FFmpeg: Fool-proof fix_ffmpeg_dependencies.sh This script has previously failed under some configurations, while also failing to stop provisioning. This patch enables fast-fail behavior, catches potential issues with missing executables early with a descriptive error message. This should allow us to detect if the required packages are missing in the future, and stop provisioning accordingly. This patch also installs the necessary packages on the relevant CI build targets. Task-number: QTBUG-136930 Pick-to: 6.10 6.9 6.8 Change-Id: I7c781264ad67508d19fd44556a9caf0f201638d4 Reviewed-by: Assam Boudjelthia --- .../common/shared/fix_ffmpeg_dependencies.sh | 21 +++++++++++++++++-- .../qtci-macos-14-arm/27-binutils.sh | 9 ++++++++ .../qtci-macos-14-arm/28-patchelf.sh | 7 +++++++ .../qtci-macos-14-x86_64/27-binutils.sh | 9 ++++++++ .../qtci-macos-15-x86_64/27-binutils.sh | 9 ++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100755 coin/provisioning/qtci-macos-14-arm/27-binutils.sh create mode 100755 coin/provisioning/qtci-macos-14-arm/28-patchelf.sh create mode 100755 coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh create mode 100755 coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh diff --git a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh index bfc04a91..5e492d2e 100755 --- a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh +++ b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh @@ -2,16 +2,33 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -set -x +set -euox pipefail lib_dir="$1/lib" additional_suffix="${2:-}" set_rpath="${3:-yes}" +# readelf and patchelf are prerequisite tools for this script. Check +# that they are available. if [ "$(uname -s)" = "Darwin" ]; then # Under Homebrew, binutils package is not symlinked into PATH. # This lets us use readelf provided by Homebrew. - readelf() { "$(brew --prefix binutils)/bin/readelf" "$@"; } + readelf_homebrew_path="$(brew --prefix binutils)/bin/readelf" + if [[ ! -x "$readelf_homebrew_path" ]]; then + echo "Found no valid readelf executable. It is possible it was not correctly installed through Homebrew." + exit 1 + fi + readelf() { "$readelf_homebrew_path" "$@"; } +fi + +if ! command -v readelf; then + echo "Found no valid readelf command. It is possible it was not correctly installed." + exit 1 +fi + +if ! command -v patchelf; then + echo "Found no valid patchelf command. It is possible it was not correctly installed." + exit 1 fi ffmpeg_libs=("avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale") diff --git a/coin/provisioning/qtci-macos-14-arm/27-binutils.sh b/coin/provisioning/qtci-macos-14-arm/27-binutils.sh new file mode 100755 index 00000000..c4c74e7b --- /dev/null +++ b/coin/provisioning/qtci-macos-14-arm/27-binutils.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +#Copyright (C) 2025 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +# binutils is installed with an error: The formula built, but is not symlinked into /usr/local +# To avoid stopping the configuration due to this problem, "|| true" is added. +brew install binutils || true diff --git a/coin/provisioning/qtci-macos-14-arm/28-patchelf.sh b/coin/provisioning/qtci-macos-14-arm/28-patchelf.sh new file mode 100755 index 00000000..414ed936 --- /dev/null +++ b/coin/provisioning/qtci-macos-14-arm/28-patchelf.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +#Copyright (C) 2025 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +brew install patchelf diff --git a/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh new file mode 100755 index 00000000..c4c74e7b --- /dev/null +++ b/coin/provisioning/qtci-macos-14-x86_64/27-binutils.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +#Copyright (C) 2025 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +# binutils is installed with an error: The formula built, but is not symlinked into /usr/local +# To avoid stopping the configuration due to this problem, "|| true" is added. +brew install binutils || true diff --git a/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh new file mode 100755 index 00000000..c4c74e7b --- /dev/null +++ b/coin/provisioning/qtci-macos-15-x86_64/27-binutils.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +#Copyright (C) 2025 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +# binutils is installed with an error: The formula built, but is not symlinked into /usr/local +# To avoid stopping the configuration due to this problem, "|| true" is added. +brew install binutils || true