CI: align Multi-Arch versions when ports.ubuntu.com lags behind
The arm64 mirror had an older libpcre2 than the amd64 one already in the runner image; Multi-Arch: same packages need one version on both, so apt refused. tools/ci-apt.sh pins the packages apt names (and their siblings from the same source) to the arm64 version on both architectures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,13 +53,9 @@ jobs:
|
|||||||
$libs $(for l in $libs; do printf '%s:arm64 ' "$l"; done)
|
$libs $(for l in $libs; do printf '%s:arm64 ' "$l"; done)
|
||||||
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
||||||
libgstreamer1.0-0:arm64 libgstreamer-plugins-base1.0-0:arm64"
|
libgstreamer1.0-0:arm64 libgstreamer-plugins-base1.0-0:arm64"
|
||||||
if ! apt-get install -y --no-install-recommends $pkgs >/tmp/apt.log 2>&1; then
|
# tools/ci-apt.sh: when ports.ubuntu.com lags behind, it aligns the
|
||||||
# Show why (usually a Multi-Arch package whose amd64 and arm64
|
# Multi-Arch libraries on both architectures to the arm64 version.
|
||||||
# versions differ while ports.ubuntu.com lags behind).
|
sh "$W/src/tools/ci-apt.sh" $pkgs
|
||||||
sed -n '/following packages have unmet/,$p' /tmp/apt.log | head -60
|
|
||||||
tail -20 /tmp/apt.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path --target aarch64-unknown-linux-gnu
|
curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path --target aarch64-unknown-linux-gnu
|
||||||
"$CARGO_HOME/bin/cargo" install -q --locked --git "$SDK_GIT" --tag "$SDK_TAG" sf-pack
|
"$CARGO_HOME/bin/cargo" install -q --locked --git "$SDK_GIT" --tag "$SDK_TAG" sf-pack
|
||||||
|
|||||||
41
tools/ci-apt.sh
Executable file
41
tools/ci-apt.sh
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# apt-get install for the CI's two architectures (amd64 + arm64 multiarch).
|
||||||
|
#
|
||||||
|
# ports.ubuntu.com (arm64) often lags behind the main mirror (amd64). A
|
||||||
|
# "Multi-Arch: same" library must have one version on both architectures, so
|
||||||
|
# when the image already has a newer amd64 build (libpcre2, glib...) apt
|
||||||
|
# gives up ("held broken packages"). Then this script takes the arm64
|
||||||
|
# packages apt complains about, and pins every installed package of the same
|
||||||
|
# source package on both architectures to the arm64 candidate version
|
||||||
|
# (a downgrade on amd64), and tries again.
|
||||||
|
#
|
||||||
|
# Usage: tools/ci-apt.sh <packages...>
|
||||||
|
set -u
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
pins=""
|
||||||
|
for try in 1 2 3 4; do
|
||||||
|
if apt-get install -y --no-install-recommends --allow-downgrades "$@" $pins >/tmp/apt.log 2>&1; then
|
||||||
|
[ -n "$pins" ] && echo "installed with aligned versions:$pins"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
names=$(sed -n 's/.*Depends: \([a-z0-9.+-]*\):arm64.*/\1/p' /tmp/apt.log | sort -u)
|
||||||
|
if [ -z "$names" ] || [ "$try" = 4 ]; then
|
||||||
|
sed -n '/following packages have unmet/,$p' /tmp/apt.log | head -60
|
||||||
|
tail -20 /tmp/apt.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
for n in $names; do
|
||||||
|
src=$(apt-cache show "$n:arm64" 2>/dev/null | sed -n 's/^Source: \([^ ]*\).*/\1/p' | head -1)
|
||||||
|
[ -n "$src" ] || src=$n
|
||||||
|
ver=$(apt-cache policy "$n:arm64" | sed -n 's/^ *Candidate: //p')
|
||||||
|
[ -n "$ver" ] && [ "$ver" != "(none)" ] || continue
|
||||||
|
# The package itself and its installed siblings from the same source.
|
||||||
|
sibs=$(dpkg-query -W -f '${Package} ${source:Package}\n' 2>/dev/null | awk -v s="$src" '$2 == s { print $1 }' | sed 's/:.*//' | sort -u)
|
||||||
|
for p in $n $sibs; do
|
||||||
|
v=$(apt-cache policy "$p:arm64" | sed -n 's/^ *Candidate: //p')
|
||||||
|
[ -n "$v" ] && [ "$v" != "(none)" ] || v=$ver
|
||||||
|
case " $pins " in *" $p=$v "*) ;; *) pins="$pins $p=$v $p:arm64=$v" ;; esac
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo "apt: aligning to the arm64 versions:$pins"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user