28 Commits

Author SHA1 Message Date
Florian Müllner
4cff5e4572 tools/toolbox: Work around systemd issue
systemd-sysext currently messes up SElinux labeling[0].

As a workaround, we can delegate to the systemd-sysext service
that doesn't exercise the same issue.

[0] https://github.com/systemd/systemd/issues/34387

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3498>
2024-12-05 12:57:30 +00:00
Florian Müllner
4847d8bc95 tools/toolbox: Document new sysext tooling
Add a small section to outline how to combine `meson-build.sh --sysext` and
`toolbox-sysext-install.sh` to install a system extension from our toolboxes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3498>
2024-12-05 12:57:30 +00:00
Florian Müllner
af96549515 tools/toolbox: Add toolbox-sysext-install.sh script
The new command will take an extension directory set up
with `meson-build --sysext` inside a toolbox, and turn
it into a merged system extension on the host.

Namely it will
 1. copy the extension directory from the container to the host
 2. set up the extension-release file expected by systemd-sysext
 3. compile gsettings schemas if necessary (using the merged
    schemas directory)
 4. install the extension to either runtime or system
 5. merge the extension

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3498>
2024-12-05 12:57:30 +00:00
Florian Müllner
886481beb1 tools/toolbox: Install sysext dependencies if necessary
While the toolbox image itself has all necessary dependencies to
build and run the shell, we still need them in the destdir when
building a system extension.

Achieve this by running .gitlab-ci/install-common-dependencies.sh
if it exists, which is the script that is used both for gnome-os
system extensions and mutter's CI image.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3498>
2024-12-05 12:57:30 +00:00
Florian Müllner
2df35aaa73 tools/toolbox: Add --sysext option to meson-build
When specified, the project is installed to a separate destdir
inside the container instead of the container's root filesystem.

This can be used to install several projects into a common extension
directory:

```
 $ (cd mutter; meson-build.sh --sysext) &&
   (cd gnome-shell; meson-build.sh --sysext)
```

We will later add a separate command to extract the directory
from the container and turn it into a system extension suitable
for use with systemd-sysext.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3498>
2024-12-05 12:57:30 +00:00
Florian Müllner
ae58a827b9 tools/toolbox: Skip install step with --dist
The dist command only needs an up-to-date build directory, it
does not require the project to be installed first.

While the install step is generally quick, leaving the container
file system alone can save a rebuild after the dist is done
(for instance when testing a branch, then temporarily switching
to the release branch for dist).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3497>
2024-10-09 11:30:16 +00:00
Florian Müllner
1b8f67055b tools/toolbox: Small refactor
Handing the various options to different meson commands in meson-build
gets a bit tedious. Instead of handling them all on the toplevel,
split out *_command() functions that generate the commandline for
the corresponding meson command.

That way, options are handled locally where they matter, which
makes future changes and additions a bit easier.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3497>
2024-10-09 11:30:16 +00:00
sorelz
9fc19c9cdb doc: Link to GNOME handbook tutorial for toolbox development
Link gnome-shell's toolbox README to the troubleshooting section
of the toolbox page at handbook.gnome.org, to make it easier to
find information on common toolbox development issues.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7598
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3424>
2024-07-30 12:44:40 -04:00
Florian Müllner
ea4f859547 tools/toolbox: Include subprojects in meson-build --dist
The main use of the --dist flag is as a fallback when the CI
dist job doesn't work for some reason. The gnome-shell tarball
now needs the --include-subprojects flag, and it doesn't hurt
for mutter/gnome-shell-extensions, so just add it when --dist
is specified.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3164>
2024-05-21 13:42:28 +00:00
Florian Müllner
a27ba309dd tools/toolbox: Expose --reconfigure meson flag
It turns out that nowadays meson updates don't always require
a full wipe of an existing build dir, but `--reconfigure` is
often enough. So let's expose that flag as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3187>
2024-02-12 13:48:00 +00:00
Paul Hollinsky
8e7d235513 tools/toolbox: Explicitly use /bin/bash
The script uses bash-specific language extensions which cause syntax
errors when run with /bin/sh -> /bin/dash.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3186>
2024-02-11 14:41:31 -08:00
Florian Müllner
77e3ea3451 docs: Use consistent spacing
Sometimes we use a blank line between heading and paragraph,
sometimes we don't. Settle on the former.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3122>
2024-01-27 22:22:11 +01:00
Florian Müllner
ab40b5c711 tools/toolbox: Remove prepare step when setting up classic
The classic styling is no longer build from a subproject, so
there aren't any submodules that need initializing anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3133>
2024-01-25 22:11:22 +00:00
Florian Müllner
655eb672d6 tools/toolbox: Add meson test convenience wrapper
It can be fairly tedious to enter a toolbox and invoke `meson test`
with the right build directory, so add a companion script to the
existing meson-build.sh to handle that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3114>
2024-01-15 17:27:46 +00:00
Florian Müllner
96ecdba855 tools/toolbox: Expose --wipe meson flag
It's useful when the existing build directory became invalid,
for instance after a meson update, and exposing it directly
from the wrapper script is more convenient than removing the
directory or entering the toolbox manually to invoke meson.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3113>
2024-01-15 17:18:09 +00:00
Florian Müllner
26e8408b92 tools/toolbox: Consistently handle option parsing failures
`getopt` already prints a message on parse errors, but it still
seems like good style to point to --help as we do elsewhere.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3113>
2024-01-15 17:18:09 +00:00
Florian Müllner
f1422dff83 tools/toolbox: Consistently abort on failure
Unlike the other scripts, meson-build currently doesn't set
the `-e` option. The script is mainly a wrapper around a single
toolbox call, but it means that any errors during option parsing
print a warning, but are otherwise ignored.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3113>
2024-01-15 17:18:09 +00:00
Florian Müllner
bb78a0083a doc: Add README for toolbox tooling
Now that we have a collection of scripts around the toolbox
workflow, it makes sense to add a brief overview over the
available tools.

For now it's just located in the corresponding tools folder,
but it gives us something to point to once we overhaul the
toplevel documentation as part of the wiki migration.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3040>
2023-12-04 16:30:14 +00:00
Florian Müllner
c4fcc82137 tools/toolbox: Add run convenience script
Wrapping the gnome-shell call with `dbus-run-session` is *mostly*
enough for testing, but not quite.

When running without gnome-session, the wayland display is not
propagated to the D-Bus daemon, so any app that is D-Bus activated
still opens in the host session.

This can be worked around by using a specific wayland-display name
and exporting it to the `dbus-run-session` environment up-front.

At this point the invocation is finicky enough to justify another
convenience script. This also gives us a place to expose some
useful features for testing, like forcing a right-to-left layout
or simulating the greeter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2935>
2023-12-01 15:58:21 +00:00
Florian Müllner
c22574c9b9 tools/toolbox: Add build convenience script
We don't require any build steps other than the standard meson
commands, but entering a toolbox and running 2-3 meson commands
still adds some friction.

Add a small convencience script that
 - finds the toplevel source directory (similar to `jhbuild make`)
 - enters the speficied toolbox (or the configured default)
 - automatically picks a build directory based on the toolbox name
 - builds and installs the project to /usr (inside the toolbox)

It also allows specifying meson -D options to change the build
configuration, and to optionally run `meson dist`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2935>
2023-12-01 15:58:21 +00:00
Florian Müllner
b739375bbd tools/toolbox: Set up first toolbox as default
Setting up more than one gnome-shell toolbox is uncommon, and users
shouldn't have to specify --set-default for other tools to pick the
right default.

It would be possible to detect the number of containers that were
created from the shell toolbox image, but the far easier option is
to just set up the first container as default.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2935>
2023-12-01 15:58:21 +00:00
Florian Müllner
5998036dc2 tools/toolbox: Allow to set new toolbox as default for other tools
When specified, write out a small config file that can be sourced
by other scripts to pick the default toolbox container.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2935>
2023-12-01 15:58:21 +00:00
Florian Müllner
464ad5aa95 tools/create-toolbox: Allow setting up support for GNOME Classic
As unbeloved as it is, it still needs testing. Make that a tad
bit less annoying by automating the setup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
2023-05-16 18:20:42 +00:00
Florian Müllner
3ab8c5d272 tools/create-toolbox: Allow enabling additional locales
Out of the box, the container images only support US English. It
can sometimes be necessary to use a different locale, so add
a convenience flag to enable support for additional locales.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
2023-05-16 18:20:42 +00:00
Florian Müllner
d9c627cf27 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>
2023-05-16 18:20:42 +00:00
Florian Müllner
241011313a tools/create-toolbox: Allow skipping mutter build
The container is useless for building or running gnome-shell unless
it includes the correct mutter version, so building it by default
makes sense.

However a manual build can be significantly faster when there's an
existing build dir, so add an option to skip the automatic build.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
2023-05-16 18:20:42 +00:00
Florian Müllner
36e9db4fb7 tools/create-toolbox: Allow replacing existing toolbox
A toolbox created by the script can be used as the base of a pet
container that is manually updated with new dependencies over time
and accumalates additional packages; or it can be used as a deposable
container that is recreated each time the dependencies change.

To make the latter case more convenient, add a --replace option
that deletes an existing toolbox before creating the new one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
2023-05-16 18:20:42 +00:00
Florian Müllner
8ea4e089c6 tools/create-toolbox: Add convenience script
The script is a thin wrapper around `toolbox create`, mainly to
avoid the tedious image names. In addition, it allows us to
ensure that the container includes a matching mutter version.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
2023-05-16 18:20:42 +00:00