build/flatpak: Drop 'gimp_app_version' hardcoding

Now, the script reads the major.minor version automatically from the main
meson.build file, reducing maintenance work, which is already especially
high regarding flatpak because of the natural hashes updates etc.

Also, a small organization made to make the code more humanly readable.
This commit is contained in:
Bruno Lopes 2024-01-18 09:13:12 -03:00
parent ab9f8146da
commit 107887f929
3 changed files with 23 additions and 19 deletions

View file

@ -890,6 +890,10 @@ packaging-win-x86:
## To learn more about the CI, go to https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
flatpak:
# XXX This job is mostly the same as .flatpak job of
# flatpak_ci_initiative.yml so far, except that we removed the
# automatic tests since rebuilding plug-ins was not working and
# one of the test (save-and-export) requires plug-ins to be built.
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
stage: gimp
tags:
@ -902,7 +906,6 @@ flatpak:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Flatpak package.*/'
variables:
GIT_SUBMODULE_STRATEGY: normal
# Replace with your manifest path
MANIFEST_PATH: "build/flatpak/org.gimp.GIMP-nightly.json"
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
@ -910,7 +913,7 @@ flatpak:
FLATPAK_MODULE: "gimp"
APP_ID: "org.gimp.GIMP"
BUNDLE: "gimp-git.flatpak"
script:
before_script:
# Report the installed versions of the runtime
- flatpak info org.gnome.Platform
- flatpak info org.gnome.Sdk
@ -918,26 +921,27 @@ flatpak:
# Print the date, since appstream depends on local timezone
- date && date -u
# Set GIMP app version (major.minor)
- GIMP_VERSION=$(grep version meson.build | head -1 | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
- echo $GIMP_VERSION
- GIMP_APP_VERSION=$(echo $GIMP_VERSION | sed 's/\([0-9]\+\.[0-9]\+\)\..*/\1/')
- echo $GIMP_APP_VERSION
- sed -i "s/GIMP_APP_VERSION/${GIMP_APP_VERSION}/g" ${MANIFEST_PATH}
# GNOME script to customize the manifest
- rewrite-flatpak-manifest ${MANIFEST_PATH} ${FLATPAK_MODULE} ${CONFIG_OPTS}
# Our script is too long for Gitlab and ends up with:
# > Job's log exceeded limit of 16777216 bytes.
# > Job execution will continue but no more output will be collected.
# To make debugging actually possible, let's save logs as a file.
script:
# Build deps and GIMP
# (Our script is too long for Gitlab and no complete output would be collected
# To make debugging actually possible, let's save logs as a file.)
- flatpak-builder --user --disable-rofiles-fuse flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
2>&1 | tee flatpak-builder.log
# Generate a Flatpak bundle
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
- tar cf repo.tar repo/
# XXX This job is mostly the same as .flatpak job of
# flatpak_ci_initiative.yml so far, except that I removed the
# automatic tests inside the Flatpak env at the end. The reason is
# that this part suddenly stopped working (even though the flatpak
# itself is functional) because the rebuild somehow was not
# rebuilding plug-ins. Yet one of the test (save-and-export)
# requires plug-ins to be built.
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
when: always
paths:
- flatpak-builder.log

View file

@ -139,7 +139,7 @@ Note 2
or even install it. Just run it directly from your build directory:
```sh
flatpak-builder --run "${INSTALLDIR}" org.gimp.GIMP-nightly.json gimp-2.99
flatpak-builder --run "${INSTALLDIR}" org.gimp.GIMP-nightly.json gimp-X.XX
```
## Maintaining the manifests

View file

@ -4,7 +4,7 @@
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gimp-2.99",
"command": "gimp-GIMP_APP_VERSION",
"separate-locales": false,
"rename-desktop-file": "gimp.desktop",
"rename-icon": "gimp",
@ -826,8 +826,8 @@
"-Dcheck-update=no"
],
"cleanup": [
"/bin/gimptool-2.99",
"/bin/gimp-console-2.99"
"/bin/gimptool-GIMP_APP_VERSION",
"/bin/gimp-console-GIMP_APP_VERSION"
],
"sources": [
{