ci: Make fringe meson-install arguments optional

Both the subdir and prepare arguments are very specific to
building the extensions-tool subproject stand-alone. In order
to make the script more generic, turn those required arguments
into optional --subdir and --prepare ones.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2712>
This commit is contained in:
Florian Müllner 2023-03-20 02:01:33 +01:00 committed by Marge Bot
parent d97c667937
commit ea629cabbf
2 changed files with 21 additions and 7 deletions

View File

@ -68,11 +68,11 @@ workflow:
'C Development Tools and Libraries' && 'C Development Tools and Libraries' &&
./.gitlab-ci/install-meson-project.sh \ ./.gitlab-ci/install-meson-project.sh \
--subdir subprojects/extensions-tool/ \
--prepare ./generate-translations.sh \
-Dman=false \ -Dman=false \
https://gitlab.gnome.org/GNOME/gnome-shell.git \ https://gitlab.gnome.org/GNOME/gnome-shell.git \
main \ main &&
subprojects/extensions-tool/ \
./generate-translations.sh &&
dnf clean all dnf clean all

View File

@ -4,12 +4,14 @@ set -e
usage() { usage() {
cat <<-EOF cat <<-EOF
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT SUBDIR PREPARE Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
Check out and install a meson project Check out and install a meson project
Options: Options:
-Dkey=val Option to pass on to meson -Dkey=val Option to pass on to meson
--subdir Build subdirectory instead of whole project
--prepare Script to run before build
-h, --help Display this help -h, --help Display this help
@ -19,6 +21,8 @@ usage() {
TEMP=$(getopt \ TEMP=$(getopt \
--name=$(basename $0) \ --name=$(basename $0) \
--options='D:h' \ --options='D:h' \
--longoptions='subdir:' \
--longoptions='prepare:' \
--longoptions='help' \ --longoptions='help' \
-- "$@") -- "$@")
@ -26,6 +30,8 @@ eval set -- "$TEMP"
unset TEMP unset TEMP
MESON_OPTIONS=() MESON_OPTIONS=()
SUBDIR=.
PREPARE=:
while true; do while true; do
case "$1" in case "$1" in
@ -34,6 +40,16 @@ while true; do
shift 2 shift 2
;; ;;
--subdir)
SUBDIR=$2
shift 2
;;
--prepare)
PREPARE=$2
shift 2
;;
-h|--help) -h|--help)
usage usage
exit 0 exit 0
@ -46,15 +62,13 @@ while true; do
esac esac
done done
if [[ $# -lt 4 ]]; then if [[ $# -lt 2 ]]; then
usage usage
exit 1 exit 1
fi fi
REPO_URL="$1" REPO_URL="$1"
COMMIT="$2" COMMIT="$2"
SUBDIR="$3"
PREPARE="$4"
CHECKOUT_DIR=$(mktemp --directory) CHECKOUT_DIR=$(mktemp --directory)
trap "rm -rf $CHECKOUT_DIR" EXIT trap "rm -rf $CHECKOUT_DIR" EXIT