tools/create-toolbox: Optionally create Builder config

It is possible to run gnome-shell nested from gnome-builder,
but the setup is fairly tedious.

Add another option to the script to generate a suitable
.buildconfig file.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
This commit is contained in:
Florian Müllner 2023-03-17 10:32:33 +01:00 committed by Marge Bot
parent 241011313a
commit d9c627cf27

View File

@ -18,6 +18,7 @@ usage() {
-v, --version=VERSION Create container for stable version VERSION -v, --version=VERSION Create container for stable version VERSION
(like 44) instead of the main branch (like 44) instead of the main branch
-r, --replace Replace an existing container -r, --replace Replace an existing container
-b, --builder Set up GNOME Builder configuration
--skip-mutter Do not build mutter --skip-mutter Do not build mutter
-h, --help Display this help -h, --help Display this help
@ -33,12 +34,33 @@ toolbox_run() {
toolbox run --container $NAME "$@" toolbox run --container $NAME "$@"
} }
create_builder_config() {
local container_id=$(podman container inspect --format='{{.Id}}' $NAME)
local top_srcdir=$(realpath $(dirname $0)/../..)
local wayland_display=builder-wayland-0
cat >> $top_srcdir/.buildconfig <<-EOF
[toolbox-$NAME]
name=$NAME Toolbox
runtime=podman:$container_id
prefix=/usr
run-command=dbus-run-session gnome-shell --nested --wayland-display=$wayland_display
[toolbox-$NAME.runtime_environment]
WAYLAND_DISPLAY=$wayland_display
G_MESSAGES_DEBUG=GNOME Shell
XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
EOF
}
TEMP=$(getopt \ TEMP=$(getopt \
--name $(basename $0) \ --name $(basename $0) \
--options 'n:v:rh' \ --options 'n:v:rbh' \
--longoptions 'name:' \ --longoptions 'name:' \
--longoptions 'version:' \ --longoptions 'version:' \
--longoptions 'replace' \ --longoptions 'replace' \
--longoptions 'builder' \
--longoptions 'skip-mutter' \ --longoptions 'skip-mutter' \
--longoptions 'help' \ --longoptions 'help' \
-- "$@") -- "$@")
@ -65,6 +87,11 @@ while true; do
shift shift
;; ;;
-b|--builder)
SETUP_BUILDER=1
shift
;;
--skip-mutter) --skip-mutter)
SKIP_MUTTER=1 SKIP_MUTTER=1
shift shift
@ -94,3 +121,5 @@ podman pull $TOOLBOX_IMAGE:$TAG
toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME
[[ $SKIP_MUTTER ]] || toolbox_run update-mutter [[ $SKIP_MUTTER ]] || toolbox_run update-mutter
[[ $SETUP_BUILDER ]] && create_builder_config