Module: Mesa
Branch: main
Commit: e4d6da5ba30cd544014b017b1b16645e866088ad
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4d6da5ba30cd544014b017b1b16645e866088ad

Author: David Heidelberg <david.heidelb...@collabora.com>
Date:   Sun Oct 22 17:07:51 2023 +0200

ci: bashify scripts, use arrays

Signed-off-by: David Heidelberg <david.heidelb...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25843>

---

 .gitlab-ci/container/cross_build.sh                |  86 ++++++-----
 .gitlab-ci/container/debian/android_build.sh       |  14 +-
 .gitlab-ci/container/debian/arm64_build.sh         | 119 ++++++++-------
 .gitlab-ci/container/debian/arm_test.sh            |  29 ++--
 .gitlab-ci/container/debian/ppc64el_build.sh       |   2 +-
 .gitlab-ci/container/debian/s390x_build.sh         |  10 +-
 .gitlab-ci/container/debian/x86_32_build.sh        |   2 +-
 .gitlab-ci/container/debian/x86_64_build-base.sh   | 124 +++++++--------
 .gitlab-ci/container/debian/x86_64_build.sh        |  84 +++++-----
 .gitlab-ci/container/debian/x86_64_test-android.sh |  42 +++--
 .gitlab-ci/container/debian/x86_64_test-base.sh    | 170 ++++++++++-----------
 .gitlab-ci/container/debian/x86_64_test-gl.sh      | 111 +++++++-------
 .gitlab-ci/container/debian/x86_64_test-vk.sh      | 116 +++++++-------
 .gitlab-ci/container/lava_build.sh                 | 120 ++++++++-------
 14 files changed, 520 insertions(+), 509 deletions(-)

diff --git a/.gitlab-ci/container/cross_build.sh 
b/.gitlab-ci/container/cross_build.sh
index 8d7ab694de5..483488f93cb 100644
--- a/.gitlab-ci/container/cross_build.sh
+++ b/.gitlab-ci/container/cross_build.sh
@@ -8,56 +8,58 @@ export DEBIAN_FRONTEND=noninteractive
 export LLVM_VERSION="${LLVM_VERSION:=15}"
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL=" \
-        "
+EPHEMERAL=(
+)
+
+DEPS=(
+    "crossbuild-essential-$arch"
+    "pkgconf:$arch"
+    "libasan8:$arch"
+    "libdrm-dev:$arch"
+    "libelf-dev:$arch"
+    "libexpat1-dev:$arch"
+    "libffi-dev:$arch"
+    "libpciaccess-dev:$arch"
+    "libstdc++6:$arch"
+    "libvulkan-dev:$arch"
+    "libx11-dev:$arch"
+    "libx11-xcb-dev:$arch"
+    "libxcb-dri2-0-dev:$arch"
+    "libxcb-dri3-dev:$arch"
+    "libxcb-glx0-dev:$arch"
+    "libxcb-present-dev:$arch"
+    "libxcb-randr0-dev:$arch"
+    "libxcb-shm0-dev:$arch"
+    "libxcb-xfixes0-dev:$arch"
+    "libxdamage-dev:$arch"
+    "libxext-dev:$arch"
+    "libxrandr-dev:$arch"
+    "libxshmfence-dev:$arch"
+    "libxxf86vm-dev:$arch"
+    "libwayland-dev:$arch"
+)
 
 dpkg --add-architecture $arch
 apt-get update
 
-apt-get install -y --no-remove \
-        $EXTRA_LOCAL_PACKAGES \
-        $STABLE_EPHEMERAL \
-        crossbuild-essential-$arch \
-        pkgconf:$arch \
-        libasan8:$arch \
-        libdrm-dev:$arch \
-        libelf-dev:$arch \
-        libexpat1-dev:$arch \
-        libffi-dev:$arch \
-        libpciaccess-dev:$arch \
-        libstdc++6:$arch \
-        libvulkan-dev:$arch \
-        libx11-dev:$arch \
-        libx11-xcb-dev:$arch \
-        libxcb-dri2-0-dev:$arch \
-        libxcb-dri3-dev:$arch \
-        libxcb-glx0-dev:$arch \
-        libxcb-present-dev:$arch \
-        libxcb-randr0-dev:$arch \
-        libxcb-shm0-dev:$arch \
-        libxcb-xfixes0-dev:$arch \
-        libxdamage-dev:$arch \
-        libxext-dev:$arch \
-        libxrandr-dev:$arch \
-        libxshmfence-dev:$arch \
-        libxxf86vm-dev:$arch \
-        libwayland-dev:$arch
+apt-get install -y --no-remove "${DEPS[@]}" "${EPHEMERAL[@]}" \
+    $EXTRA_LOCAL_PACKAGES
 
 if [[ $arch != "armhf" ]]; then
     # We don't need clang-format for the crossbuilds, but the installed amd64
     # package will conflict with libclang. Uninstall clang-format (and its
     # problematic dependency) to fix.
-    apt-get remove -y clang-format-${LLVM_VERSION} libclang-cpp${LLVM_VERSION}
+    apt-get remove -y "clang-format-${LLVM_VERSION}" 
"libclang-cpp${LLVM_VERSION}"
 
     # llvm-*-tools:$arch conflicts with python3:amd64. Install dependencies 
only
     # with apt-get, then force-install llvm-*-{dev,tools}:$arch with dpkg to 
get
     # around this.
     apt-get install -y --no-remove --no-install-recommends \
-            libclang-cpp${LLVM_VERSION}:$arch \
-            libgcc-s1:$arch \
-            libtinfo-dev:$arch \
-            libz3-dev:$arch \
-            llvm-${LLVM_VERSION}:$arch \
+            "libclang-cpp${LLVM_VERSION}:$arch" \
+            "libgcc-s1:$arch" \
+            "libtinfo-dev:$arch" \
+            "libz3-dev:$arch" \
+            "llvm-${LLVM_VERSION}:$arch" \
             zlib1g
 fi
 
@@ -68,19 +70,19 @@ fi
 
 
 # dependencies where we want a specific version
-EXTRA_MESON_ARGS="--cross-file=/cross_file-${arch}.txt -D 
libdir=lib/$(dpkg-architecture -A $arch -qDEB_TARGET_MULTIARCH)"
+MULTIARCH_PATH=$(dpkg-architecture -A $arch -qDEB_TARGET_MULTIARCH)
+export EXTRA_MESON_ARGS="--cross-file=/cross_file-${arch}.txt -D 
libdir=lib/${MULTIARCH_PATH}"
 . .gitlab-ci/container/build-libdrm.sh
 
 . .gitlab-ci/container/build-wayland.sh
 
-apt-get purge -y \
-        $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/container_post_build.sh
 
 # This needs to be done after container_post_build.sh, or apt-get breaks in 
there
 if [[ $arch != "armhf" ]]; then
-    apt-get download llvm-${LLVM_VERSION}-{dev,tools}:$arch
-    dpkg -i --force-depends llvm-${LLVM_VERSION}-*_${arch}.deb
-    rm llvm-${LLVM_VERSION}-*_${arch}.deb
+    apt-get download llvm-"${LLVM_VERSION}"-{dev,tools}:"$arch"
+    dpkg -i --force-depends llvm-"${LLVM_VERSION}"-*_"${arch}".deb
+    rm llvm-"${LLVM_VERSION}"-*_"${arch}".deb
 fi
diff --git a/.gitlab-ci/container/debian/android_build.sh 
b/.gitlab-ci/container/debian/android_build.sh
index 177504b80d4..a2dc9b77401 100644
--- a/.gitlab-ci/container/debian/android_build.sh
+++ b/.gitlab-ci/container/debian/android_build.sh
@@ -3,13 +3,13 @@
 
 set -ex
 
-EPHEMERAL="\
-         autoconf \
-         rdfind \
-         unzip \
-         "
+EPHEMERAL=(
+    autoconf
+    rdfind
+    unzip
+)
 
-apt-get install -y --no-remove $EPHEMERAL
+apt-get install -y --no-remove "${EPHEMERAL[@]}"
 
 # Fetch the NDK and extract just the toolchain we want.
 ndk=$ANDROID_NDK
@@ -106,4 +106,4 @@ done
 cd ..
 rm -rf $LIBELF_VERSION
 
-apt-get purge -y $EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
diff --git a/.gitlab-ci/container/debian/arm64_build.sh 
b/.gitlab-ci/container/debian/arm64_build.sh
index b03bdab0602..f646334ac25 100644
--- a/.gitlab-ci/container/debian/arm64_build.sh
+++ b/.gitlab-ci/container/debian/arm64_build.sh
@@ -10,65 +10,66 @@ apt-get -y install ca-certificates
 sed -i -e 's/http:\/\/deb/https:\/\/deb/g' /etc/apt/sources.list.d/*
 apt-get update
 
-# Ephemeral packages (installed for this script and removed again at
-# the end)
-STABLE_EPHEMERAL=" \
-        libssl-dev \
-        "
+# Ephemeral packages (installed for this script and removed again at the end)
+EPHEMERAL=(
+    libssl-dev
+)
 
-apt-get -y install \
-       ${STABLE_EPHEMERAL} \
-       apt-utils \
-       android-libext4-utils \
-       autoconf \
-       automake \
-       bc \
-       bison \
-       ccache \
-       cmake \
-       curl \
-       debootstrap \
-       fastboot \
-       flex \
-       g++ \
-       git \
-       glslang-tools \
-       kmod \
-       libasan8 \
-       libdrm-dev \
-       libelf-dev \
-       libexpat1-dev \
-       libvulkan-dev \
-       libx11-dev \
-       libx11-xcb-dev \
-       libxcb-dri2-0-dev \
-       libxcb-dri3-dev \
-       libxcb-glx0-dev \
-       libxcb-present-dev \
-       libxcb-randr0-dev \
-       libxcb-shm0-dev \
-       libxcb-xfixes0-dev \
-       libxdamage-dev \
-       libxext-dev \
-       libxrandr-dev \
-       libxshmfence-dev \
-       libxxf86vm-dev \
-       libwayland-dev \
-       libwayland-egl-backend-dev \
-       llvm-${LLVM_VERSION}-dev \
-       ninja-build \
-       meson \
-       openssh-server \
-       pkgconf \
-       python3-mako \
-       python3-pil \
-       python3-pip \
-       python3-requests \
-       python3-setuptools \
-       u-boot-tools \
-       xz-utils \
-       zlib1g-dev \
-       zstd
+DEPS=(
+    apt-utils
+    android-libext4-utils
+    autoconf
+    automake
+    bc
+    bison
+    ccache
+    cmake
+    curl
+    debootstrap
+    fastboot
+    flex
+    g++
+    git
+    glslang-tools
+    kmod
+    libasan8
+    libdrm-dev
+    libelf-dev
+    libexpat1-dev
+    libvulkan-dev
+    libx11-dev
+    libx11-xcb-dev
+    libxcb-dri2-0-dev
+    libxcb-dri3-dev
+    libxcb-glx0-dev
+    libxcb-present-dev
+    libxcb-randr0-dev
+    libxcb-shm0-dev
+    libxcb-xfixes0-dev
+    libxdamage-dev
+    libxext-dev
+    libxrandr-dev
+    libxshmfence-dev
+    libxxf86vm-dev
+    libwayland-dev
+    libwayland-egl-backend-dev
+    "llvm-${LLVM_VERSION}-dev"
+    ninja-build
+    meson
+    openssh-server
+    pkgconf
+    python3-mako
+    python3-pil
+    python3-pip
+    python3-requests
+    python3-setuptools
+    u-boot-tools
+    xz-utils
+    zlib1g-dev
+    zstd
+)
+
+apt-get -y install "${DEPS[@]}" "${EPHEMERAL[@]}"
 
 pip3 install --break-system-packages 
git+http://gitlab.freedesktop.org/freedesktop/ci-templates@ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2
 
@@ -81,6 +82,6 @@ arch=armhf
 
 . .gitlab-ci/container/build-wayland.sh
 
-apt-get purge -y $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/debian/arm_test.sh 
b/.gitlab-ci/container/debian/arm_test.sh
index f0ab7bd33fe..8f3f432c5ac 100644
--- a/.gitlab-ci/container/debian/arm_test.sh
+++ b/.gitlab-ci/container/debian/arm_test.sh
@@ -9,23 +9,26 @@ set -e
 set -o xtrace
 
 ############### Install packages for baremetal testing
+DEPS=(
+    cpio
+    curl
+    fastboot
+    netcat-openbsd
+    openssh-server
+    procps
+    python3-distutils
+    python3-minimal
+    python3-serial
+    rsync
+    snmp
+    zstd
+)
+
 apt-get install -y ca-certificates
 sed -i -e 's/http:\/\/deb/https:\/\/deb/g' /etc/apt/sources.list.d/*
 apt-get update
 
-apt-get install -y --no-remove \
-        cpio \
-        curl \
-        fastboot \
-        netcat-openbsd \
-        openssh-server \
-        procps \
-        python3-distutils \
-        python3-minimal \
-        python3-serial \
-        rsync \
-        snmp \
-        zstd
+apt-get install -y --no-remove "${DEPS[@]}"
 
 # setup SNMPv2 SMI MIB
 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
diff --git a/.gitlab-ci/container/debian/ppc64el_build.sh 
b/.gitlab-ci/container/debian/ppc64el_build.sh
index 6c8b2282a5c..23db25cb75a 100644
--- a/.gitlab-ci/container/debian/ppc64el_build.sh
+++ b/.gitlab-ci/container/debian/ppc64el_build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 arch=ppc64el
 
diff --git a/.gitlab-ci/container/debian/s390x_build.sh 
b/.gitlab-ci/container/debian/s390x_build.sh
index b1353a364b8..adabfd0e483 100644
--- a/.gitlab-ci/container/debian/s390x_build.sh
+++ b/.gitlab-ci/container/debian/s390x_build.sh
@@ -1,16 +1,18 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -e
 
 arch=s390x
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL="libssl-dev"
+EPHEMERAL=(
+    libssl-dev
+)
 
-apt-get -y install "$STABLE_EPHEMERAL"
+apt-get -y install "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/build-mold.sh
 
-apt-get purge -y "$STABLE_EPHEMERAL"
+apt-get purge -y "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/cross_build.sh
diff --git a/.gitlab-ci/container/debian/x86_32_build.sh 
b/.gitlab-ci/container/debian/x86_32_build.sh
index 404fe9cac1b..f6030f6577a 100644
--- a/.gitlab-ci/container/debian/x86_32_build.sh
+++ b/.gitlab-ci/container/debian/x86_32_build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 arch=i386
 
diff --git a/.gitlab-ci/container/debian/x86_64_build-base.sh 
b/.gitlab-ci/container/debian/x86_64_build-base.sh
index 32a9a24dfcf..a3e190b71e2 100644
--- a/.gitlab-ci/container/debian/x86_64_build-base.sh
+++ b/.gitlab-ci/container/debian/x86_64_build-base.sh
@@ -12,69 +12,71 @@ sed -i -e 's/http:\/\/deb/https:\/\/deb/g' 
/etc/apt/sources.list.d/*
 
 # Ephemeral packages (installed for this script and removed again at
 # the end)
-STABLE_EPHEMERAL=" \
-        "
+EPHEMERAL=(
+)
+
+DEPS=(
+    apt-utils
+    bison
+    ccache
+    curl
+    "clang-format-${LLVM_VERSION}"
+    dpkg-cross
+    findutils
+    flex
+    g++
+    cmake
+    gcc
+    git
+    glslang-tools
+    kmod
+    "libclang-${LLVM_VERSION}-dev"
+    "libclang-cpp${LLVM_VERSION}-dev"
+    "libclang-common-${LLVM_VERSION}-dev"
+    libelf-dev
+    libepoxy-dev
+    libexpat1-dev
+    libgtk-3-dev
+    "libllvm${LLVM_VERSION}"
+    libomxil-bellagio-dev
+    libpciaccess-dev
+    libunwind-dev
+    libva-dev
+    libvdpau-dev
+    libvulkan-dev
+    libx11-dev
+    libx11-xcb-dev
+    libxext-dev
+    libxml2-utils
+    libxrandr-dev
+    libxrender-dev
+    libxshmfence-dev
+    libxxf86vm-dev
+    libwayland-egl-backend-dev
+    make
+    ninja-build
+    openssh-server
+    pkgconf
+    python3-mako
+    python3-pil
+    python3-pip
+    python3-ply
+    python3-requests
+    python3-setuptools
+    qemu-user
+    valgrind
+    x11proto-dri2-dev
+    x11proto-gl-dev
+    x11proto-randr-dev
+    xz-utils
+    zlib1g-dev
+    zstd
+)
 
 apt-get update
 
-apt-get install -y --no-remove \
-        $EXTRA_LOCAL_PACKAGES \
-        $STABLE_EPHEMERAL \
-        apt-utils \
-        bison \
-        ccache \
-        curl \
-        clang-format-${LLVM_VERSION} \
-        dpkg-cross \
-        findutils \
-        flex \
-        g++ \
-        cmake \
-        gcc \
-        git \
-        glslang-tools \
-        kmod \
-        libclang-${LLVM_VERSION}-dev \
-        libclang-cpp${LLVM_VERSION}-dev \
-        libclang-common-${LLVM_VERSION}-dev \
-        libelf-dev \
-        libepoxy-dev \
-        libexpat1-dev \
-        libgtk-3-dev \
-        libllvm${LLVM_VERSION} \
-        libomxil-bellagio-dev \
-        libpciaccess-dev \
-        libunwind-dev \
-        libva-dev \
-        libvdpau-dev \
-        libvulkan-dev \
-        libx11-dev \
-        libx11-xcb-dev \
-        libxext-dev \
-        libxml2-utils \
-        libxrandr-dev \
-        libxrender-dev \
-        libxshmfence-dev \
-        libxxf86vm-dev \
-        libwayland-egl-backend-dev \
-        make \
-        ninja-build \
-        openssh-server \
-        pkgconf \
-        python3-mako \
-        python3-pil \
-        python3-pip \
-        python3-ply \
-        python3-requests \
-        python3-setuptools \
-        qemu-user \
-        valgrind \
-        x11proto-dri2-dev \
-        x11proto-gl-dev \
-        x11proto-randr-dev \
-        xz-utils \
-        zlib1g-dev \
-        zstd
+apt-get install -y --no-remove "${DEPS[@]}" "${EPHEMERAL[@]}" \
+        $EXTRA_LOCAL_PACKAGES
 
 # Needed for ci-fairy, this revision is able to upload files to S3
 pip3 install --break-system-packages 
git+http://gitlab.freedesktop.org/freedesktop/ci-templates@ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2
@@ -86,6 +88,6 @@ pip3 install --break-system-packages meson==1.2.0
 
 ############### Uninstall ephemeral packages
 
-apt-get purge -y $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/debian/x86_64_build.sh 
b/.gitlab-ci/container/debian/x86_64_build.sh
index 67ee1a762a5..3cc9e48c512 100644
--- a/.gitlab-ci/container/debian/x86_64_build.sh
+++ b/.gitlab-ci/container/debian/x86_64_build.sh
@@ -12,49 +12,52 @@ export DEBIAN_FRONTEND=noninteractive
 export LLVM_VERSION="${LLVM_VERSION:=15}"
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL=" \
-      autoconf \
-      automake \
-      autotools-dev \
-      bzip2 \
-      libtool \
-      libssl-dev \
-      "
+EPHEMERAL=(
+    autoconf
+    automake
+    autotools-dev
+    bzip2
+    libtool
+    libssl-dev
+)
+
+DEPS=(
+    check
+    "clang-${LLVM_VERSION}"
+    libasan8
+    libarchive-dev
+    libdrm-dev
+    "libclang-cpp${LLVM_VERSION}-dev"
+    libgbm-dev
+    libglvnd-dev
+    liblua5.3-dev
+    libxcb-dri2-0-dev
+    libxcb-dri3-dev
+    libxcb-glx0-dev
+    libxcb-present-dev
+    libxcb-randr0-dev
+    libxcb-shm0-dev
+    libxcb-sync-dev
+    libxcb-xfixes0-dev
+    libxcb1-dev
+    libxml2-dev
+    "llvm-${LLVM_VERSION}-dev"
+    ocl-icd-opencl-dev
+    python3-pip
+    python3-venv
+    procps
+    spirv-tools
+    shellcheck
+    strace
+    time
+    yamllint
+    zstd
+)
 
 apt-get update
 
 apt-get install -y --no-remove \
-      $STABLE_EPHEMERAL \
-      check \
-      clang-${LLVM_VERSION} \
-      libasan8 \
-      libarchive-dev \
-      libdrm-dev \
-      libclang-cpp${LLVM_VERSION}-dev \
-      libgbm-dev \
-      libglvnd-dev \
-      liblua5.3-dev \
-      libxcb-dri2-0-dev \
-      libxcb-dri3-dev \
-      libxcb-glx0-dev \
-      libxcb-present-dev \
-      libxcb-randr0-dev \
-      libxcb-shm0-dev \
-      libxcb-sync-dev \
-      libxcb-xfixes0-dev \
-      libxcb1-dev \
-      libxml2-dev \
-      llvm-${LLVM_VERSION}-dev \
-      ocl-icd-opencl-dev \
-      python3-pip \
-      python3-venv \
-      procps \
-      spirv-tools \
-      shellcheck \
-      strace \
-      time \
-      yamllint \
-      zstd
+      "${DEPS[@]}" "${EPHEMERAL[@]}"
 
 
 . .gitlab-ci/container/container_pre_build.sh
@@ -98,7 +101,6 @@ RUSTFLAGS='-L native=/usr/local/lib' cargo install \
 
 ############### Uninstall the build software
 
-apt-get purge -y \
-      $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/debian/x86_64_test-android.sh 
b/.gitlab-ci/container/debian/x86_64_test-android.sh
index c2715309d40..74ac1b6182f 100644
--- a/.gitlab-ci/container/debian/x86_64_test-android.sh
+++ b/.gitlab-ci/container/debian/x86_64_test-android.sh
@@ -1,7 +1,6 @@
 #!/usr/bin/env bash
 # The relative paths in this file only become valid at runtime.
 # shellcheck disable=SC1091
-# shellcheck disable=SC2086 # we want word splitting
 
 set -e
 set -o xtrace
@@ -9,20 +8,22 @@ set -o xtrace
 export DEBIAN_FRONTEND=noninteractive
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL=" \
-      ccache \
-      unzip \
-      dpkg-dev \
-      build-essential:native \
-      config-package-dev \
-      debhelper-compat \
-      cmake \
-      ninja-build \
-      "
-
+EPHEMERAL=(
+   build-essential:native
+   ccache
+   cmake
+   config-package-dev
+   debhelper-compat
+   dpkg-dev
+   ninja-build
+   unzip
+)
+
+DEPS=(
+    iproute2
+)
 apt-get install -y --no-remove --no-install-recommends \
-      $STABLE_EPHEMERAL \
-      iproute2
+      "${DEPS[@]}" "${EPHEMERAL[@]}"
 
 ############### Building ...
 
@@ -33,9 +34,9 @@ apt-get install -y --no-remove --no-install-recommends \
 # Fetch the NDK and extract just the toolchain we want.
 ndk=$ANDROID_NDK
 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
-  -o $ndk.zip https://dl.google.com/android/repository/$ndk-linux.zip
-unzip -d / $ndk.zip
-rm $ndk.zip
+  -o "$ndk.zip" "https://dl.google.com/android/repository/$ndk-linux.zip";
+unzip -d / "$ndk.zip"
+rm "$ndk.zip"
 
 ############### Build dEQP runner
 
@@ -91,9 +92,6 @@ usermod -a -G kvm,cvdnetwork root
 
 rm -rf "/${ndk:?}"
 
-ccache --show-stats
-
-apt-get purge -y \
-      $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
-apt-get autoremove -y --purge
\ No newline at end of file
+. .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/debian/x86_64_test-base.sh 
b/.gitlab-ci/container/debian/x86_64_test-base.sh
index f40b0b62b65..64a7680bfc6 100644
--- a/.gitlab-ci/container/debian/x86_64_test-base.sh
+++ b/.gitlab-ci/container/debian/x86_64_test-base.sh
@@ -16,49 +16,88 @@ sed -i -e 's/http:\/\/deb/https:\/\/deb/g' 
/etc/apt/sources.list.d/*
 
 export LLVM_VERSION="${LLVM_VERSION:=15}"
 
-# Ephemeral packages (installed for this script and removed again at
-# the end)
-STABLE_EPHEMERAL=" \
-      autoconf \
-      automake \
-      bc \
-      bison \
-      bzip2 \
-      ccache \
-      cmake \
-      clang-${LLVM_VERSION} \
-      flex \
-      glslang-tools \
-      g++ \
-      libasound2-dev \
-      libcap-dev \
-      libclang-cpp${LLVM_VERSION}-dev \
-      libdrm-dev \
-      libegl-dev \
-      libelf-dev \
-      libepoxy-dev \
-      libgbm-dev \
-      libpciaccess-dev \
-      libssl-dev
-      libvulkan-dev \
-      libwayland-dev \
-      libx11-xcb-dev \
-      libxext-dev \
-      llvm-${LLVM_VERSION}-dev \
-      make \
-      meson \
-      openssh-server \
-      patch \
-      pkgconf \
-      protobuf-compiler \
-      python3-dev \
-      python3-pip \
-      python3-setuptools \
-      python3-wheel \
-      spirv-tools \
-      wayland-protocols \
-      xz-utils \
-      "
+# Ephemeral packages (installed for this script and removed again at the end)
+EPHEMERAL=(
+    autoconf
+    automake
+    bc
+    bison
+    bzip2
+    ccache
+    cmake
+    "clang-${LLVM_VERSION}"
+    flex
+    glslang-tools
+    g++
+    libasound2-dev
+    libcap-dev
+    "libclang-cpp${LLVM_VERSION}-dev"
+    libdrm-dev
+    libegl-dev
+    libelf-dev
+    libepoxy-dev
+    libgbm-dev
+    libpciaccess-dev
+    libssl-dev
+    libvulkan-dev
+    libwayland-dev
+    libx11-xcb-dev
+    libxext-dev
+    "llvm-${LLVM_VERSION}-dev"
+    make
+    meson
+    openssh-server
+    patch
+    pkgconf
+    protobuf-compiler
+    python3-dev
+    python3-pip
+    python3-setuptools
+    python3-wheel
+    spirv-tools
+    wayland-protocols
+    xz-utils
+)
+
+DEPS=(
+    apt-utils
+    curl
+    git
+    git-lfs
+    inetutils-syslogd
+    iptables
+    jq
+    libasan8
+    libdrm2
+    libexpat1
+    "libllvm${LLVM_VERSION}"
+    liblz4-1
+    libpng16-16
+    libpython3.11
+    libvulkan1
+    libwayland-client0
+    libwayland-server0
+    libxcb-ewmh2
+    libxcb-randr0
+    libxcb-xfixes0
+    libxkbcommon0
+    libxrandr2
+    libxrender1
+    python3-mako
+    python3-numpy
+    python3-packaging
+    python3-pil
+    python3-requests
+    python3-six
+    python3-yaml
+    socat
+    vulkan-tools
+    waffle-utils
+    xauth
+    xvfb
+    zlib1g
+    zstd
+)
 
 apt-get update
 apt-get dist-upgrade -y
@@ -66,48 +105,9 @@ apt-get dist-upgrade -y
 apt-get install --purge -y \
       sysvinit-core libelogind0
 
-apt-get install -y --no-remove \
-      apt-utils \
-      curl \
-      git \
-      git-lfs \
-      inetutils-syslogd \
-      iptables \
-      jq \
-      libasan8 \
-      libdrm2 \
-      libexpat1 \
-      libllvm${LLVM_VERSION} \
-      liblz4-1 \
-      libpng16-16 \
-      libpython3.11 \
-      libvulkan1 \
-      libwayland-client0 \
-      libwayland-server0 \
-      libxcb-ewmh2 \
-      libxcb-randr0 \
-      libxcb-xfixes0 \
-      libxkbcommon0 \
-      libxrandr2 \
-      libxrender1 \
-      python3-mako \
-      python3-numpy \
-      python3-packaging \
-      python3-pil \
-      python3-requests \
-      python3-six \
-      python3-yaml \
-      socat \
-      vulkan-tools \
-      waffle-utils \
-      xauth \
-      xvfb \
-      zlib1g \
-      zstd
-
-apt-get install -y --no-install-recommends \
-      $STABLE_EPHEMERAL
+apt-get install -y --no-remove "${DEPS[@]}"
 
+apt-get install -y --no-install-recommends "${EPHEMERAL[@]}"
 
 . .gitlab-ci/container/container_pre_build.sh
 
@@ -151,7 +151,7 @@ pip3 install --break-system-packages yq
 . .gitlab-ci/container/build-deqp-runner.sh
 
 
-apt-get purge -y $STABLE_EPHEMERAL
+apt-get purge -y "${EPHEMERAL[@]}"
 
 rm -rf /root/.rustup
 
diff --git a/.gitlab-ci/container/debian/x86_64_test-gl.sh 
b/.gitlab-ci/container/debian/x86_64_test-gl.sh
index 1eaef9f874f..5f09fcfd036 100644
--- a/.gitlab-ci/container/debian/x86_64_test-gl.sh
+++ b/.gitlab-ci/container/debian/x86_64_test-gl.sh
@@ -10,60 +10,62 @@ export LLVM_VERSION="${LLVM_VERSION:=15}"
 apt-get install -y libelogind0  # this interfere with systemd deps, install 
separately
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL=" \
-      bzip2 \
-      ccache \
-      clang-${LLVM_VERSION} \
-      cmake \
-      g++ \
-      glslang-tools \
-      libasound2-dev \
-      libcap-dev \
-      libclang-cpp${LLVM_VERSION}-dev \
-      libdrm-dev \
-      libgles2-mesa-dev \
-      libpciaccess-dev \
-      libpng-dev \
-      libudev-dev \
-      libvulkan-dev \
-      libwaffle-dev \
-      libwayland-dev \
-      libx11-xcb-dev \
-      libxcb-dri2-0-dev \
-      libxkbcommon-dev \
-      libxrandr-dev \
-      libxrender-dev \
-      llvm-${LLVM_VERSION}-dev \
-      make \
-      meson \
-      ocl-icd-opencl-dev \
-      patch \
-      pkgconf \
-      python3-distutils \
-      xz-utils \
-      "
+EPHEMERAL=(
+    bzip2
+    ccache
+    "clang-${LLVM_VERSION}"
+    cmake
+    g++
+    glslang-tools
+    libasound2-dev
+    libcap-dev
+    "libclang-cpp${LLVM_VERSION}-dev"
+    libdrm-dev
+    libgles2-mesa-dev
+    libpciaccess-dev
+    libpng-dev
+    libudev-dev
+    libvulkan-dev
+    libwaffle-dev
+    libwayland-dev
+    libx11-xcb-dev
+    libxcb-dri2-0-dev
+    libxkbcommon-dev
+    libxrandr-dev
+    libxrender-dev
+    "llvm-${LLVM_VERSION}-dev"
+    make
+    meson
+    ocl-icd-opencl-dev
+    patch
+    pkgconf
+    python3-distutils
+    xz-utils
+)
+
+DEPS=(
+    clinfo
+    iptables
+    "libclang-common-${LLVM_VERSION}-dev"
+    "libclang-cpp${LLVM_VERSION}"
+    libcap2
+    libegl1
+    libepoxy0
+    libfdt1
+    libxcb-shm0
+    ocl-icd-libopencl1
+    python3-lxml
+    python3-renderdoc
+    python3-simplejson
+    spirv-tools
+    sysvinit-core
+    weston
+)
 
 apt-get update
 
-apt-get install -y --no-remove \
-      $EXTRA_LOCAL_PACKAGES \
-      $STABLE_EPHEMERAL \
-      clinfo \
-      iptables \
-      libclang-common-${LLVM_VERSION}-dev \
-      libclang-cpp${LLVM_VERSION} \
-      libcap2 \
-      libegl1 \
-      libepoxy0 \
-      libfdt1 \
-      libxcb-shm0 \
-      ocl-icd-libopencl1 \
-      python3-lxml \
-      python3-renderdoc \
-      python3-simplejson \
-      spirv-tools \
-      sysvinit-core \
-      weston
+apt-get install -y --no-remove "${DEPS[@]}" "${EPHEMERAL[@]}" \
+      $EXTRA_LOCAL_PACKAGES
 
 
 . .gitlab-ci/container/container_pre_build.sh
@@ -86,9 +88,6 @@ DEQP_TARGET=surfaceless . .gitlab-ci/container/build-deqp.sh
 
 ############### Uninstall the build software
 
-ccache --show-stats
+apt-get purge -y "${EPHEMERAL[@]}"
 
-apt-get purge -y \
-      $STABLE_EPHEMERAL
-
-apt-get autoremove -y --purge
+. .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/debian/x86_64_test-vk.sh 
b/.gitlab-ci/container/debian/x86_64_test-vk.sh
index 793f377a1e0..66b71bfef97 100644
--- a/.gitlab-ci/container/debian/x86_64_test-vk.sh
+++ b/.gitlab-ci/container/debian/x86_64_test-vk.sh
@@ -11,60 +11,63 @@ export DEBIAN_FRONTEND=noninteractive
 apt-get install -y libelogind0  # this interfere with systemd deps, install 
separately
 
 # Ephemeral packages (installed for this script and removed again at the end)
-STABLE_EPHEMERAL=" \
-      ccache \
-      cmake \
-      g++ \
-      glslang-tools \
-      libexpat1-dev \
-      gnupg2 \
-      libdrm-dev \
-      libgbm-dev \
-      libgles2-mesa-dev \
-      liblz4-dev \
-      libpciaccess-dev \
-      libudev-dev \
-      libvulkan-dev \
-      libwaffle-dev \
-      libx11-xcb-dev \
-      libxcb-ewmh-dev \
-      libxcb-keysyms1-dev \
-      libxkbcommon-dev \
-      libxrandr-dev \
-      libxrender-dev \
-      libzstd-dev \
-      meson \
-      p7zip \
-      patch \
-      pkgconf \
-      python3-dev \
-      python3-distutils \
-      python3-pip \
-      python3-setuptools \
-      python3-wheel \
-      software-properties-common \
-      wine64-tools \
-      xz-utils \
-      "
+EPHEMERAL=(
+    ccache
+    cmake
+    g++
+    glslang-tools
+    libexpat1-dev
+    gnupg2
+    libdrm-dev
+    libgbm-dev
+    libgles2-mesa-dev
+    liblz4-dev
+    libpciaccess-dev
+    libudev-dev
+    libvulkan-dev
+    libwaffle-dev
+    libx11-xcb-dev
+    libxcb-ewmh-dev
+    libxcb-keysyms1-dev
+    libxkbcommon-dev
+    libxrandr-dev
+    libxrender-dev
+    libzstd-dev
+    meson
+    p7zip
+    patch
+    pkgconf
+    python3-dev
+    python3-distutils
+    python3-pip
+    python3-setuptools
+    python3-wheel
+    software-properties-common
+    wine64-tools
+    xz-utils
+)
+
+DEPS=(
+    curl
+    libepoxy0
+    libxcb-shm0
+    pciutils
+    python3-lxml
+    python3-simplejson
+    sysvinit-core
+    weston
+    xwayland
+    wine
+    wine64
+    xinit
+    xserver-xorg-video-amdgpu
+    xserver-xorg-video-ati
+)
+
+apt-get update
 
 apt-get install -y --no-remove --no-install-recommends \
-      $STABLE_EPHEMERAL \
-      curl \
-      libepoxy0 \
-      libxcb-shm0 \
-      pciutils \
-      python3-lxml \
-      python3-simplejson \
-      sysvinit-core \
-      weston \
-      xwayland \
-      wine \
-      wine64 \
-      xinit \
-      xserver-xorg-video-amdgpu \
-      xserver-xorg-video-ati
-
-apt-get update -q
+      "${DEPS[@]}" "${EPHEMERAL[@]}"
 
 ############### Install DXVK
 
@@ -118,11 +121,6 @@ PIGLIT_BUILD_TARGETS="piglit_replayer" . 
.gitlab-ci/container/build-piglit.sh
 
 ############### Uninstall the build software
 
-ccache --show-stats
+apt-get purge -y "${EPHEMERAL[@]}"
 
-apt-get purge -y \
-      $STABLE_EPHEMERAL
-
-apt-get autoremove -y --purge
-
-#dpkg -r --force-depends "mesa-vulkan-drivers" "mesa-vdpau-drivers" 
"mesa-va-drivers" "libgl1-mesa-dri" "libglx-mesa0" "vdpau-driver-all" 
"va-driver-all" "libglx0" "libgl1" "libvdpau-va-gl1" "libglu1-mesa" 
"libegl-mesa0" "libgl1-mesa-dri" "libglapi-mesa" "libosmesa6"
+. .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/lava_build.sh 
b/.gitlab-ci/container/lava_build.sh
index 65804d28642..8c53b250982 100755
--- a/.gitlab-ci/container/lava_build.sh
+++ b/.gitlab-ci/container/lava_build.sh
@@ -62,6 +62,19 @@ elif [[ "$DEBIAN_ARCH" = "armhf" ]]; then
     DEVICE_TREES+=" tegra124-jetson-tk1.dtb"
     KERNEL_IMAGE_NAME="zImage"
     . .gitlab-ci/container/create-cross-file.sh armhf
+    CONTAINER_ARCH_PACKAGES=(
+      libegl1-mesa-dev:armhf
+      libelf-dev:armhf
+      libgbm-dev:armhf
+      libgles2-mesa-dev:armhf
+      libpng-dev:armhf
+      libudev-dev:armhf
+      libvulkan-dev:armhf
+      libwaffle-dev:armhf
+      libwayland-dev:armhf
+      libx11-xcb-dev:armhf
+      libxkbcommon-dev:armhf
+    )
 else
     GCC_ARCH="x86_64-linux-gnu"
     KERNEL_ARCH="x86_64"
@@ -69,7 +82,9 @@ else
     DEFCONFIG="arch/x86/configs/x86_64_defconfig"
     DEVICE_TREES=""
     KERNEL_IMAGE_NAME="bzImage"
-    ARCH_PACKAGES="libasound2-dev libcap-dev libfdt-dev libva-dev 
wayland-protocols p7zip"
+    CONTAINER_ARCH_PACKAGES=(
+      libasound2-dev libcap-dev libfdt-dev libva-dev wayland-protocols p7zip
+    )
 fi
 
 # Determine if we're in a cross build.
@@ -89,66 +104,55 @@ if [[ -e /cross_file-$DEBIAN_ARCH.txt ]]; then
     export CROSS_COMPILE="${GCC_ARCH}-"
 fi
 
+# no need to remove these at end, image isn't saved at the end
+CONTAINER_EPHEMERAL=(
+    automake
+    bc
+    "clang-${LLVM_VERSION}"
+    cmake
+    curl
+    mmdebstrap
+    git
+    glslang-tools
+    libdrm-dev
+    libegl1-mesa-dev
+    libxext-dev
+    libfontconfig-dev
+    libgbm-dev
+    libgl-dev
+    libgles2-mesa-dev
+    libglu1-mesa-dev
+    libglx-dev
+    libpng-dev
+    libssl-dev
+    libudev-dev
+    libvulkan-dev
+    libwaffle-dev
+    libwayland-dev
+    libx11-xcb-dev
+    libxcb-dri2-0-dev
+    libxkbcommon-dev
+    libwayland-dev
+    ninja-build
+    openssh-server
+    patch
+    protobuf-compiler
+    python-is-python3
+    python3-distutils
+    python3-mako
+    python3-numpy
+    python3-serial
+    python3-venv
+    unzip
+    zstd
+)
+
 apt-get update
 apt-get install -y --no-remove \
                   -o Dpkg::Options::='--force-confdef' -o 
Dpkg::Options::='--force-confold' \
-                   ${EXTRA_LOCAL_PACKAGES} \
-                   ${ARCH_PACKAGES} \
-                   automake \
-                   bc \
-                   clang-${LLVM_VERSION} \
-                   cmake \
-                  curl \
-                   mmdebstrap \
-                   git \
-                   glslang-tools \
-                   libdrm-dev \
-                   libegl1-mesa-dev \
-                   libxext-dev \
-                   libfontconfig-dev \
-                   libgbm-dev \
-                   libgl-dev \
-                   libgles2-mesa-dev \
-                   libglu1-mesa-dev \
-                   libglx-dev \
-                   libpng-dev \
-                   libssl-dev \
-                   libudev-dev \
-                   libvulkan-dev \
-                   libwaffle-dev \
-                   libwayland-dev \
-                   libx11-xcb-dev \
-                   libxcb-dri2-0-dev \
-                   libxkbcommon-dev \
-                   libwayland-dev \
-                   ninja-build \
-                   openssh-server \
-                   patch \
-                   protobuf-compiler \
-                   python-is-python3 \
-                   python3-distutils \
-                   python3-mako \
-                   python3-numpy \
-                   python3-serial \
-                   python3-venv \
-                   unzip \
-                   zstd
-
-
-if [[ "$DEBIAN_ARCH" = "armhf" ]]; then
-    apt-get install -y --no-remove \
-                       libegl1-mesa-dev:armhf \
-                       libelf-dev:armhf \
-                       libgbm-dev:armhf \
-                       libgles2-mesa-dev:armhf \
-                       libpng-dev:armhf \
-                       libudev-dev:armhf \
-                       libvulkan-dev:armhf \
-                       libwaffle-dev:armhf \
-                       libwayland-dev:armhf \
-                       libx11-xcb-dev:armhf \
-                       libxkbcommon-dev:armhf
-fi
+                  "${CONTAINER_EPHEMERAL[@]}" \
+                   "${CONTAINER_ARCH_PACKAGES[@]}" \
+                   ${EXTRA_LOCAL_PACKAGES}
 
 ROOTFS=/lava-files/rootfs-${DEBIAN_ARCH}
 mkdir -p "$ROOTFS"

Reply via email to