From 0d647bb1d6e9c7c582f17d3509d1555223de0b73 Mon Sep 17 00:00:00 2001 From: Martin Abente Lahaye Date: Thu, 11 Jul 2024 12:07:37 -0400 Subject: [PATCH] ci: Move installation of common dependencies to a separate script Since we would be building custom images and system extensions, having a centralize script has the following advantages: 1. Provides a single place to add/bump dependencies. 2. Allows us to automatically stop building dependencies for GNOME OS that has been updated to a recent-enough version. See https://discourse.gnome.org/t/towards-a-better-way-to-hack-and-test-your-system-components/21075 See https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/837 Part-of: --- .gitlab-ci.yml | 12 +--- .gitlab-ci/install-common-dependencies.sh | 81 +++++++++++++++++++++++ 2 files changed, 82 insertions(+), 11 deletions(-) create mode 100755 .gitlab-ci/install-common-dependencies.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2b83241e..20b4d58ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -128,21 +128,11 @@ variables: https://gitlab.gnome.org/jadahl/catch.git \ main - ./.gitlab-ci/install-meson-project.sh \ - https://gitlab.freedesktop.org/wayland/wayland.git \ - 1.23.0 - ./.gitlab-ci/install-meson-project.sh \ https://gitlab.gnome.org/GNOME/gi-docgen.git \ main - ./.gitlab-ci/install-meson-project.sh \ - https://gitlab.freedesktop.org/wayland/wayland-protocols.git \ - 1.36 - - ./.gitlab-ci/install-meson-project.sh \ - https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git \ - master + ./.gitlab-ci/install-common-dependencies.sh rpm -e --nodeps gnome-bluetooth-libs-devel \ mutter mutter-devel \ diff --git a/.gitlab-ci/install-common-dependencies.sh b/.gitlab-ci/install-common-dependencies.sh new file mode 100755 index 000000000..4b1dc3dd6 --- /dev/null +++ b/.gitlab-ci/install-common-dependencies.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -e + +usage() { + cat <<-EOF + Usage: $(basename $0) [OPTION…] + + Install common dependencies to a base image or system extension + + Options: + --libdir Setup the projects with a different libdir + --destdir Install the projects to an additional destdir + + -h, --help Display this help + + EOF +} + +TEMP=$(getopt \ + --name=$(basename $0) \ + --options='' \ + --longoptions='libdir:' \ + --longoptions='destdir:' \ + --longoptions='help' \ + -- "$@") + +eval set -- "$TEMP" +unset TEMP + +OPTIONS=() + +while true; do + case "$1" in + --libdir) + OPTIONS+=( --libdir=$2 ) + shift 2 + ;; + + --destdir) + OPTIONS+=( --destdir=$2 ) + shift 2 + ;; + + -h|--help) + usage + exit 0 + ;; + + --) + shift + break + ;; + esac +done + +SCRIPTS_DIR="$(dirname $0)" + +if ! pkgconf --atleast-version 1.23.0 wayland-server +then + ./$SCRIPTS_DIR/install-meson-project.sh \ + "${OPTIONS[@]}" \ + https://gitlab.freedesktop.org/wayland/wayland.git \ + 1.23.0 +fi + +if ! pkgconf --atleast-version 1.36 wayland-protocols +then + ./$SCRIPTS_DIR/install-meson-project.sh \ + "${OPTIONS[@]}" \ + https://gitlab.freedesktop.org/wayland/wayland-protocols.git \ + 1.36 +fi + +if ! gsettings get org.gnome.desktop.interface accent-color >/dev/null 2>&1 +then + ./$SCRIPTS_DIR/install-meson-project.sh \ + "${OPTIONS[@]}" \ + https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git \ + master +fi