feat(builder): auto-compile GSettings schemas during build#1740
feat(builder): auto-compile GSettings schemas during build#1740123123213weqw wants to merge 1 commit into
Conversation
Applications that depend on gsettings require a compiled gschemas.compiled binary in share/glib-2.0/schemas to function at runtime. Previously linglong only ran glib-compile-schemas at install time (OSTreeRepo::updateSharedInfo), which means the tool had to be present on every end-user machine. Add a compile-schemas.sh builder helper that runs glib-compile-schemas on $PREFIX/share/glib-2.0/schemas as part of the POST BUILD PROCESS section of the generated entry.sh, right after the user build script and symbol stripping. This ships the compiled schemas inside the package so glib-compile-schemas is no longer required at install time. The script is a no-op when no schemas directory exists and gracefully skips (with a warning) when glib-compile-schemas is unavailable, so packages without gsettings dependencies are unaffected. Closes OpenAtom-Linyaps#679 Signed-off-by: 王越 <1939455790@qq.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 123123213weqw The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @123123213weqw. Thanks for your PR. I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Code Review
This pull request introduces automatic compilation of GSettings schemas during the build process by adding a new helper script, compile-schemas.sh, and integrating it into the post-build process. Feedback suggests optimizing the helper script to check for the actual presence of .gschema.xml files before verifying the existence of glib-compile-schemas, which prevents false-positive warnings when no schemas are present.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if [ ! -d "$schema_dir" ]; then | ||
| exit 0 | ||
| fi |
There was a problem hiding this comment.
If the $schema_dir directory exists but contains no .gschema.xml files, running glib-compile-schemas is unnecessary and might trigger warnings or errors. Furthermore, if glib-compile-schemas is missing, a false-positive warning will be printed even if there are no schemas to compile.
We can use Bash's nullglob to check if there are actually any .gschema.xml files present before proceeding.
| if [ ! -d "$schema_dir" ]; then | |
| exit 0 | |
| fi | |
| if [ ! -d "$schema_dir" ]; then | |
| exit 0 | |
| fi | |
| shopt -s nullglob | |
| schemas=("$schema_dir"/*.gschema.xml) | |
| if [ ${#schemas[@]} -eq 0 ]; then | |
| exit 0 | |
| fi |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Summary
Resolves #679.
Applications that depend on gsettings require a compiled
gschemas.compiledbinary inshare/glib-2.0/schemasto function at runtime. Until now linglong only ranglib-compile-schemasat install time (OSTreeRepo::updateSharedInfo), which forced the tool to be present on every end-user machine.This PR makes
ll-builderautomatically compile GSettings schemas at build time so the compiled binary is shipped inside the package.Changes
misc/libexec/linglong/builder/helper/compile-schemas.sh(new) — helper script that:$PREFIX/share/glib-2.0/schemasdoes not exist (no overhead for apps without gsettings).glib-compile-schemasis unavailable.glib-compile-schemason the schemas directory.misc/CMakeLists.txt— registers the new script inconfigure_filesand theinstall(PROGRAMS …)list (kept in sorted order alongside the other builder helpers).libs/linglong/src/linglong/builder/linglong_builder.cpp(generateEntryScript) — appendscompile-schemas.shto the POST BUILD PROCESS section of the generatedentry.sh, immediately after the user build script and optional symbol stripping. The call runs unconditionally (not gated onskipStripSymbols).How it works
During
ll-builder build, the generated entry script now ends with:The script runs inside the build container where
glib-compile-schemasis part of the glib development packages, so no extra host dependency is introduced.Verification
bash -n compile-schemas.sh— syntax OK.glib-compile-schemasmissing → warning on stderr, exit 0.glib-compile-schemaspresent →gschemas.compiledcreated, exit 0.git diff --check— no whitespace errors.Full CMake build and CTest could not be executed in this environment (no compiler toolchain installed); the change is limited to a new shell script, two CMake list entries, and a three-line C++ edit that follows existing patterns.