fix(gschema-overrides): Get rid of files module dependency (#120)

* chore(gschema-overrides): Get rid of `files` module dependency

Gschema.override files are now placed in /config/gschema-override folder.

* chore(gschema-overrides): Don't use 1st slash for new override location in docs

* chore: Use `zz1-` prefix instead of `z1-`

It ensures that no gschema override will bypass user one with override starting with letter z.
This commit is contained in:
fiftydinar 2024-02-05 11:46:13 +01:00 committed by GitHub
parent 03ac42e16f
commit 67619ce418
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 9 deletions

View file

@ -7,9 +7,10 @@ This module is similar to using `dconf` configuration, but is better because it
What does this module do?
- It copies all content from `/usr/share/glib-2.0/schemas`, except existing gschema.overrides to avoid conflicts, into temporary test location.
- It copies your gschema.overrides you provided in this module from `/usr/share/glib-2.0/schemas` into temporary test location.
- It copies your gschema.overrides you provided in this module from `config/gschema-overrides` into temporary test location.
- It tests them for errors in temporary test location by using `glib-compile-schemas` with `--strict` flag. If errors are found, build will fail.
- If test is passed successfully, compile gschema using `glib-compile-schemas` in `/usr/share/glib-2.0/schemas` to include your changes.
- If test is passed successfully, it copies your gschema.overrides to `/usr/share/glib-2.0/schemas`.
- It compiles gschema using `glib-compile-schemas` in `/usr/share/glib-2.0/schemas` location to include your changes.
Temporary test location is:
@ -17,15 +18,15 @@ Temporary test location is:
## Usage
To use this module, you need to include your gschema.override file(s) in this location:
To use this module, you need to include your gschema.override file(s) in this location (make folder if it doesn't exist):
`/usr/share/glib-2.0/schemas`
`config/gschema-overrides`
Then you need to include those file(s) in recipe file, like in example configuration.
It is highly recommended to use `z1-` prefix before your gschema.override name, to ensure that your changes are going to be applied.
It is highly recommended to use `zz1-` prefix before your gschema.override name, to ensure that your changes are going to be applied.
Also don't forget to rename your file(s) too with this prefix in `/usr/share/glib-2.0/schemas`.
Also don't forget to rename your file(s) too with this prefix in `config/gschema-overrides`.
## Creating gschema.override files
@ -82,4 +83,4 @@ dconf format:
```
[org/gnome/desktop/app-folders/folders/Utilities]
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0]
```
```

View file

@ -4,6 +4,7 @@ set -euo pipefail
get_yaml_array INCLUDE '.include[]' "$1"
schema_include_location="/tmp/config/gschema-overrides"
schema_test_location="/tmp/bluebuild-schema-test"
schema_location="/usr/share/glib-2.0/schemas"
gschema_extension=false
@ -39,11 +40,15 @@ if [[ ${#INCLUDE[@]} -gt 0 ]] && $gschema_extension; then
mkdir -p "$schema_test_location" "$schema_location"
find "$schema_location" -type f ! -name "*.gschema.override" -exec cp {} "$schema_test_location" \;
for file in "${INCLUDE[@]}"; do
file_path="${schema_location}/${file//$'\n'/}"
file_path="${schema_include_location}/${file//$'\n'/}"
cp "$file_path" "$schema_test_location"
done
echo "Running error-checking test for your gschema-overrides. If test fails, build also fails."
glib-compile-schemas --strict "$schema_test_location"
echo "Compiling gschema to include your changes with gschema-override"
for file in "${INCLUDE[@]}"; do
file_path="${schema_test_location}/${file//$'\n'/}"
cp "$file_path" "$schema_location"
done
glib-compile-schemas "$schema_location" &>/dev/null
fi

View file

@ -4,4 +4,4 @@ readme: https://raw.githubusercontent.com/ublue-os/bling/main/modules/gschema-ov
example: |
type: gschema-overrides
include:
- z1-myoverride.gschema.override # test & compile the override file /usr/share/glib-2.0/schemas/z1-myoverride.gschema.override
- zz1-myoverride.gschema.override # test & compile the override file included in config/gschema-overrides/zz1-myoverride.gschema.override