[gnome-build-meta/valentindavid/os-release: 3/3] Fix os-release files in bootable images




commit a2a7d8b7ac5b43b20610322270d1958f6c0094bb
Author: Valentin David <valentin david codethink co uk>
Date:   Mon Aug 24 12:09:46 2020 +0200

    Fix os-release files in bootable images

 elements/flatpak/platform-image.bst                |  1 +
 elements/flatpak/sdk-image.bst                     |  1 +
 elements/sdk-platform.bst                          |  1 -
 elements/sdk/os-release.bst                        | 31 ++---------
 elements/vm/deps-devel.bst                         |  7 ++-
 elements/vm/deps.bst                               |  1 +
 elements/vm/os-release-devel.bst                   | 14 +++++
 elements/vm/os-release-user.bst                    | 14 +++++
 files/os-release/compose.sh                        |  7 +++
 files/os-release/issue                             |  1 -
 files/os-release/issue.in                          |  1 +
 files/os-release/issue.net                         |  1 -
 files/os-release/issue.net.in                      |  1 +
 files/os-release/meson.build                       | 64 ++++++++++++++++++++++
 files/os-release/meson_options.txt                 |  5 ++
 files/os-release/org.gnome.Platform.appdata.xml.in |  2 +-
 files/os-release/org.gnome.Sdk.appdata.xml.in      |  2 +-
 files/os-release/os-release                        |  5 --
 files/os-release/os-release-symlink.sh             |  3 +
 files/os-release/os-release.bootable.in            |  8 +++
 files/os-release/os-release.flatpak.in             |  7 +++
 21 files changed, 139 insertions(+), 38 deletions(-)
---
diff --git a/elements/flatpak/platform-image.bst b/elements/flatpak/platform-image.bst
index 971eaa32..bc1f9470 100644
--- a/elements/flatpak/platform-image.bst
+++ b/elements/flatpak/platform-image.bst
@@ -2,6 +2,7 @@ kind: compose
 build-depends:
 - platform-manifest.bst
 - sdk-platform.bst
+- sdk/os-release.bst
 - freedesktop-sdk.bst:components/python3-usercustomize.bst
 - freedesktop-sdk.bst:components/python3-sitecustomize.bst
 - freedesktop-sdk.bst:multiarch/multiarch-platform.bst
diff --git a/elements/flatpak/sdk-image.bst b/elements/flatpak/sdk-image.bst
index 732d0d1f..f87a0821 100644
--- a/elements/flatpak/sdk-image.bst
+++ b/elements/flatpak/sdk-image.bst
@@ -1,6 +1,7 @@
 kind: compose
 build-depends:
 - sdk.bst
+- sdk/os-release.bst
 - sdk-manifest.bst
 - freedesktop-sdk.bst:components/python3-usercustomize.bst
 - freedesktop-sdk.bst:components/python3-sitecustomize.bst
diff --git a/elements/sdk-platform.bst b/elements/sdk-platform.bst
index d619601a..d85d5b65 100644
--- a/elements/sdk-platform.bst
+++ b/elements/sdk-platform.bst
@@ -41,7 +41,6 @@ depends:
 - sdk/libsecret.bst
 - sdk/libsoup.bst
 - sdk/libwpe.bst
-- sdk/os-release.bst
 - sdk/pango.bst
 - sdk/pinentry.bst
 - sdk/pipewire.bst
diff --git a/elements/sdk/os-release.bst b/elements/sdk/os-release.bst
index 4594c5f8..c2b7e415 100644
--- a/elements/sdk/os-release.bst
+++ b/elements/sdk/os-release.bst
@@ -1,32 +1,13 @@
-kind: manual
+kind: meson
 sources:
 - kind: local
   path: files/os-release
 build-depends:
+- freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
 - sdk/appstream-glib.bst
 depends:
 - freedesktop-sdk.bst:bootstrap-import.bst
-config:
-  build-commands:
-  - |
-    for i in *.in; do
-      sed "s/@@SDK_BRANCH@@/%{branch}/g" "${i}" >"$(basename "${i}" .in)"
-    done
-
-  install-commands:
-  - |
-    mkdir -p "%{install-root}%{indep-libdir}"
-    install os-release "%{install-root}%{indep-libdir}"
-    mkdir -p "%{install-root}%{sysconfdir}"
-    ln -s "$(realpath --relative-to="%{install-root}%{sysconfdir}" 
"%{install-root}%{indep-libdir}/os-release")" %{install-root}%{sysconfdir}/os-release
-
-    mkdir -p "%{install-root}%{sysconfdir}"
-    install issue "%{install-root}%{sysconfdir}"
-    install issue.net "%{install-root}%{sysconfdir}"
-
-    mkdir -p "%{install-root}%{datadir}/appdata"
-    install org.gnome.Platform.appdata.xml "%{install-root}%{datadir}/appdata"
-    install org.gnome.Sdk.appdata.xml "%{install-root}%{datadir}/appdata"
-
-    appstream-compose --basename=org.gnome.Platform --prefix=%{install-root}%{prefix} --origin=flatpak 
org.gnome.Platform
-    appstream-compose --basename=org.gnome.Sdk --prefix=%{install-root}%{prefix} --origin=flatpak 
org.gnome.Sdk
+variables:
+  meson-local: >-
+    -Dbranch=%{branch}
+    -Dmode=flatpak
diff --git a/elements/vm/deps-devel.bst b/elements/vm/deps-devel.bst
index 705f5f84..dcf0e1d5 100644
--- a/elements/vm/deps-devel.bst
+++ b/elements/vm/deps-devel.bst
@@ -3,9 +3,10 @@ kind: stack
 runtime-depends:
 - sdk.bst
 - core/meta-gnome-core-developer-tools.bst
-- vm/common-deps.bst
-- vm/initramfs.bst
-- vm/buildstream/buildstream.bst
 - vm/buildstream/bst-external.bst
+- vm/buildstream/buildstream.bst
+- vm/common-deps.bst
 - vm/git-lfs.bst
+- vm/initramfs.bst
+- vm/os-release-devel.bst
 - freedesktop-sdk.bst:components/podman.bst
diff --git a/elements/vm/deps.bst b/elements/vm/deps.bst
index 16251332..3cf03b6e 100644
--- a/elements/vm/deps.bst
+++ b/elements/vm/deps.bst
@@ -3,3 +3,4 @@ kind: stack
 runtime-depends:
 - vm/common-deps.bst
 - vm/initramfs.bst
+- vm/os-release-user.bst
diff --git a/elements/vm/os-release-devel.bst b/elements/vm/os-release-devel.bst
new file mode 100644
index 00000000..9c4d421c
--- /dev/null
+++ b/elements/vm/os-release-devel.bst
@@ -0,0 +1,14 @@
+kind: meson
+sources:
+- kind: local
+  path: files/os-release
+build-depends:
+- freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
+- sdk/appstream-glib.bst
+depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+variables:
+  meson-local: >-
+    -Dbranch=%{branch}
+    -Dmode=bootable
+    -Dvariant=user
diff --git a/elements/vm/os-release-user.bst b/elements/vm/os-release-user.bst
new file mode 100644
index 00000000..9c4d421c
--- /dev/null
+++ b/elements/vm/os-release-user.bst
@@ -0,0 +1,14 @@
+kind: meson
+sources:
+- kind: local
+  path: files/os-release
+build-depends:
+- freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
+- sdk/appstream-glib.bst
+depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+variables:
+  meson-local: >-
+    -Dbranch=%{branch}
+    -Dmode=bootable
+    -Dvariant=user
diff --git a/files/os-release/compose.sh b/files/os-release/compose.sh
new file mode 100644
index 00000000..78b41781
--- /dev/null
+++ b/files/os-release/compose.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+exec appstream-compose \
+     --basename="$1" \
+     --prefix="${MESON_INSTALL_DESTDIR_PREFIX}" \
+     --origin=flatpak "${1}" \
+     --output-dir="${MESON_INSTALL_DESTDIR_PREFIX}/share/app-info/xmls"
diff --git a/files/os-release/issue.in b/files/os-release/issue.in
new file mode 100644
index 00000000..d6cf452e
--- /dev/null
+++ b/files/os-release/issue.in
@@ -0,0 +1 @@
+@ISSUE_NAME@ @SDK_BRANCH@ \n \l
diff --git a/files/os-release/issue.net.in b/files/os-release/issue.net.in
new file mode 100644
index 00000000..b8c502a7
--- /dev/null
+++ b/files/os-release/issue.net.in
@@ -0,0 +1 @@
+@ISSUE_NAME@ @SDK_BRANCH@ %h
diff --git a/files/os-release/meson.build b/files/os-release/meson.build
new file mode 100644
index 00000000..411d37bd
--- /dev/null
+++ b/files/os-release/meson.build
@@ -0,0 +1,64 @@
+project('gnome-build-meta-os-release')
+
+conf_data = configuration_data({
+  'SDK_BRANCH': get_option('branch')
+})
+
+if get_option('mode') == 'bootable'
+    conf_data.set('ISSUE_NAME', 'GNOME OS')
+    conf_data.set('VARIANT_ID', get_option('variant'))
+    if get_option('variant') == 'devel'
+      conf_data.set('VARIANT', 'Development')
+      conf_data.set('FULL_NAME', 'GNOME OS Development')
+    elif get_option('variant') == 'user'
+      conf_data.set('VARIANT', 'User')
+      conf_data.set('FULL_NAME', 'GNOME OS')
+    endif
+
+    configure_file(
+        input : 'os-release.bootable.in',
+        output : 'os-release',
+        configuration : conf_data,
+        install_dir : get_option('prefix') / 'lib'
+    )
+else
+    conf_data.set('ISSUE_NAME', 'GNOME Platform')
+    configure_file(
+        input : 'org.gnome.Platform.appdata.xml.in',
+        output : 'org.gnome.Platform.appdata.xml',
+        configuration : conf_data,
+        install_dir : get_option('datadir') / 'appdata'
+    )
+    configure_file(
+        input : 'org.gnome.Sdk.appdata.xml.in',
+        output : 'org.gnome.Sdk.appdata.xml',
+        configuration : conf_data,
+        install_dir : get_option('datadir') / 'appdata'
+    )
+
+    configure_file(
+        input : 'os-release.flatpak.in',
+        output : 'os-release',
+        configuration : conf_data,
+        install_dir : get_option('prefix') / 'lib'
+    )
+
+    meson.add_install_script('compose.sh', 'org.gnome.Platform')
+    meson.add_install_script('compose.sh', 'org.gnome.Sdk')
+endif
+
+configure_file(
+   input : 'issue.net.in',
+    output : 'issue.net',
+    configuration : conf_data,
+    install_dir : get_option('sysconfdir')
+)
+
+configure_file(
+   input : 'issue.in',
+    output : 'issue',
+    configuration : conf_data,
+    install_dir : get_option('sysconfdir')
+)
+
+meson.add_install_script('os-release-symlink.sh', get_option('sysconfdir'))
diff --git a/files/os-release/meson_options.txt b/files/os-release/meson_options.txt
new file mode 100644
index 00000000..176fc644
--- /dev/null
+++ b/files/os-release/meson_options.txt
@@ -0,0 +1,5 @@
+option('branch', type : 'string', value : 'master')
+option('mode',  type : 'combo',
+       choices : ['bootable', 'flatpak'], value : 'flatpak')
+option('variant',  type : 'combo',
+       choices : ['user', 'devel'], value : 'user')
diff --git a/files/os-release/org.gnome.Platform.appdata.xml.in 
b/files/os-release/org.gnome.Platform.appdata.xml.in
index 0bd92859..d342cfbc 100644
--- a/files/os-release/org.gnome.Platform.appdata.xml.in
+++ b/files/os-release/org.gnome.Platform.appdata.xml.in
@@ -5,7 +5,7 @@
   <metadata_license>CC0</metadata_license>
   <!-- FIXME -->
   <project_license>GPL-2.0+</project_license>
-  <name>GNOME Application Platform version @@SDK_BRANCH@@</name>
+  <name>GNOME Application Platform version @SDK_BRANCH@</name>
   <summary>Shared libraries used by GNOME applications</summary>
   <description>
     <p>
diff --git a/files/os-release/org.gnome.Sdk.appdata.xml.in b/files/os-release/org.gnome.Sdk.appdata.xml.in
index f623a2bf..3de302dc 100644
--- a/files/os-release/org.gnome.Sdk.appdata.xml.in
+++ b/files/os-release/org.gnome.Sdk.appdata.xml.in
@@ -5,7 +5,7 @@
   <metadata_license>CC0</metadata_license>
   <!-- FIXME -->
   <project_license>GPL-2.0+</project_license>
-  <name>GNOME Software Development Kit version @@SDK_BRANCH@@</name>
+  <name>GNOME Software Development Kit version @SDK_BRANCH@</name>
   <summary>Tools and headers for developing applications using the GNOME application platform</summary>
   <description>
     <p>
diff --git a/files/os-release/os-release-symlink.sh b/files/os-release/os-release-symlink.sh
new file mode 100644
index 00000000..4e4e8d89
--- /dev/null
+++ b/files/os-release/os-release-symlink.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+ln -sr "${MESON_INSTALL_DESTDIR_PREFIX}/lib/os-release" "${DESTDIR}${1}"
diff --git a/files/os-release/os-release.bootable.in b/files/os-release/os-release.bootable.in
new file mode 100644
index 00000000..3165cabd
--- /dev/null
+++ b/files/os-release/os-release.bootable.in
@@ -0,0 +1,8 @@
+NAME="GNOME OS"
+VERSION_ID=@SDK_BRANCH@
+ID=org.gnome.gnomeos
+PRETTY_NAME="@FULL_NAME@ (@SDK_BRANCH@)"
+BUG_REPORT_URL="https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/new";
+HOME_URL="https://www.gnome.org/";
+VARIANT="@VARIANT@"
+VARIANT_ID=@VARIANT_ID@
diff --git a/files/os-release/os-release.flatpak.in b/files/os-release/os-release.flatpak.in
new file mode 100644
index 00000000..ff451c15
--- /dev/null
+++ b/files/os-release/os-release.flatpak.in
@@ -0,0 +1,7 @@
+NAME=GNOME
+VERSION="@SDK_BRANCH@ (Flatpak runtime)"
+VERSION_ID=@SDK_BRANCH@
+ID=org.gnome.Platform
+PRETTY_NAME="GNOME @SDK_BRANCH@ (Flatpak runtime)"
+BUG_REPORT_URL="https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/new";
+HOME_URL="https://www.gnome.org/";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]