Skip to content

Commit e53ce79

Browse files
committed
bootc-ubuntu-setup: Check if packages exist before removal
The arm64 runners from Arm Limited don't have all the same packages as x86_64 runners (e.g. google-chrome-stable). This caused apt-get remove to fail with exit code 100. Fix by checking with dpkg -l before attempting removal. Also switch from regex patterns to globs since both apt and dpkg support fnmatch globs, avoiding the need for pattern conversion. Assisted-by: OpenCode (Claude claude-opus-4-5@20251101) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 1bdf943 commit e53ce79

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • common/.github/actions/bootc-ubuntu-setup

common/.github/actions/bootc-ubuntu-setup/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ runs:
1414
run: |
1515
set -xeuo pipefail
1616
sudo df -h
17-
unwanted_pkgs=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
17+
# Use globs for package patterns (apt and dpkg both support fnmatch globs)
18+
unwanted_pkgs=('aspnetcore-*' 'dotnet-*' 'llvm-*' 'php*' 'mongodb-*' 'mysql-*'
1819
azure-cli google-chrome-stable firefox mono-devel)
1920
unwanted_dirs=(/usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL)
2021
# Start background removal operations as systemd units; if this causes
@@ -30,9 +31,12 @@ runs:
3031
for x in ${unwanted_dirs[@]}; do
3132
runcleanup rm -rf "$x"
3233
done
33-
# Apt removals in foreground, as we can't parallelize these
34+
# Apt removals in foreground, as we can't parallelize these.
35+
# Only attempt removal if matching packages are installed.
3436
for x in ${unwanted_pkgs[@]}; do
35-
/bin/time -f '%E %C' sudo apt-get remove -y $x
37+
if dpkg -l "$x" >/dev/null 2>&1; then
38+
/bin/time -f '%E %C' sudo apt-get remove -y "$x"
39+
fi
3640
done
3741
# We really want support for heredocs
3842
- name: Update podman and install just

0 commit comments

Comments
 (0)