solenv/bin/assemble-flatpak-appdata.sh |   17 +++++++++--------
 solenv/bin/assemble-flatpak-desktop.sh |   19 ++++++++++---------
 solenv/bin/assemble-flatpak.sh         |   13 ++++++++-----
 solenv/flatpak-manifest.in             |    2 +-
 4 files changed, 28 insertions(+), 23 deletions(-)

New commits:
commit 76d85a1364ce333d62be7e16665e2cf9f70ec024
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Oct 22 20:43:13 2025 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Wed Nov 19 08:18:22 2025 +0100

    Parametrize assemble-flatpak over the flatpak ID
    
    (solenv/bin/assemble-flatpak-desktop.sh in one place uses that parameterized
    value in a sed s command replacement text, which could potentially cause 
syntax
    errors.  But since flatpak IDs shall be formed from a restricted alphabet, 
that
    should not cause problems in practice.  Similarly, various places across the
    solenv/bin/assemble-flatpak*.sh scripts use that perameterized value in 
forming
    pathnames, and assume that it does not contain any slahses.)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192883
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Sarper Akdemir <[email protected]>
    (cherry picked from commit 15007243c11363c636d74c240946237da5a866b8)
    Conflicts:
            solenv/bin/assemble-flatpak-appdata.sh
            solenv/bin/assemble-flatpak-desktop.sh
            solenv/bin/assemble-flatpak.sh
            solenv/flatpak-manifest.in
    
    Change-Id: I5b4c031acf19b04ac8b501d9d8557924747fb38b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194174
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/solenv/bin/assemble-flatpak-appdata.sh 
b/solenv/bin/assemble-flatpak-appdata.sh
index 874f23e1fc27..e47fae2405fc 100755
--- a/solenv/bin/assemble-flatpak-appdata.sh
+++ b/solenv/bin/assemble-flatpak-appdata.sh
@@ -12,20 +12,21 @@
 #
 # Arguments:
 # $1  pathname, ending in a slash, of the directory into which to put the 
target
-#     org.libreoffice.LibreOffice.appdata.xml file
+#     $3.appdata.xml file
 # $2  "1" if a <releases> section shall be included in the target
-#     org.libreoffice.LibreOffice.appdata.xml file, "0" if not
+#     $3.appdata.xml file, "0" if not
+# $3  the flatpak ID
 
 set -e
 
-## org.libreoffice.LibreOffice.appdata.xml is manually derived from the various
+## $3.appdata.xml is manually derived from the various
 ## inst/share/metainfo/libreoffice-*.appdata.xml (at least recent GNOME 
Software
 ## doesn't show more than five screenshots anyway, so restrict to one each from
 ## the five libreoffice-*.appdata.xml: Writer, Calc, Impress, Draw, Base):
-cat <<\EOF >"${1?}"org.libreoffice.LibreOffice.appdata.xml
+cat <<EOF >"${1?}${3?}".appdata.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <component type="desktop">
- <id>org.libreoffice.LibreOffice</id>
+ <id>${3?}</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>MPL-2.0</project_license>
  <name>LibreOffice</name>
@@ -41,7 +42,7 @@ cat <<\EOF >"${1?}"org.libreoffice.LibreOffice.appdata.xml
   you can easily share documents with users of other popular office suites
   without worrying about compatibility.</p>
  </description>
- <launchable type="desktop-id">org.libreoffice.LibreOffice.desktop</launchable>
+ <launchable type="desktop-id">${3?}.desktop</launchable>
  <url type="homepage">http://www.libreoffice.org/discover/libreoffice/</url>
  <url type="bugtracker">https://bugs.documentfoundation.org/</url>
  <url type="donation">https://donate.libreoffice.org/</url>
@@ -83,7 +84,7 @@ EOF
 
 if [ "${2?}" = 1 ]
 then
- cat <<EOF >>"${1?}"org.libreoffice.LibreOffice.appdata.xml
+ cat <<EOF >>"${1?}${3?}".appdata.xml
  <releases>
   <release
     
version="${LIBO_VERSION_MAJOR?}.${LIBO_VERSION_MINOR?}.${LIBO_VERSION_MICRO?}.${LIBO_VERSION_PATCH?}"
@@ -92,6 +93,6 @@ then
 EOF
 fi
 
-cat <<\EOF >>"${1?}"org.libreoffice.LibreOffice.appdata.xml
+cat <<\EOF >>"${1?}${3?}".appdata.xml
 </component>
 EOF
diff --git a/solenv/bin/assemble-flatpak-desktop.sh 
b/solenv/bin/assemble-flatpak-desktop.sh
index 6d06de4fbbbe..411a7feb469a 100755
--- a/solenv/bin/assemble-flatpak-desktop.sh
+++ b/solenv/bin/assemble-flatpak-desktop.sh
@@ -14,29 +14,30 @@
 # $1  pathname, ending in a slash, of the directory containing the source 
libreoffice-*.desktop
 #     files
 # $2  pathname, ending in a slash, of the directory into which to put the 
target
-#     org.libreoffice.LibreOffice.*.desktop files
+#     $3.*.desktop files
+# $3  the flatpak ID
 
 set -e
 
-## libreoffice-*.desktop -> org.libreoffice.LibreOffice.*.desktop:
+## libreoffice-*.desktop -> $3.*.desktop:
 for i in "${1?}"libreoffice-*.desktop
 do
- sed -e 's/^Icon=libreoffice-/Icon=org.libreoffice.LibreOffice./' "$i" \
-  >"${2?}"org.libreoffice.LibreOffice."${i#"${1?}"libreoffice-}"
+ sed -e "s/^Icon=libreoffice-/Icon=${3?}./" "$i" \
+  >"${2?}${3?}"."${i#"${1?}"libreoffice-}"
 done
-mv "${2?}"org.libreoffice.LibreOffice.startcenter.desktop 
"${2?}"org.libreoffice.LibreOffice.desktop
+mv "${2?}${3?}".startcenter.desktop "${2?}${3?}".desktop
 
 # Flatpak .desktop exports take precedence over system ones due to
 # the order of XDG_DATA_DIRS - re-associating text/plain seems a bit much
-sed -i "s/text\/plain;//" "${2?}"org.libreoffice.LibreOffice.writer.desktop
+sed -i "s/text\/plain;//" "${2?}${3?}".writer.desktop
 
 desktop-file-edit --set-key=X-Endless-Alias 
--set-value=libreoffice-startcenter \
  --set-key=X-Flatpak-RenamedFrom 
--set-value='libreoffice-startcenter.desktop;' \
- "${2?}"org.libreoffice.LibreOffice.desktop
+ "${2?}${3?}".desktop
 for i in base calc draw impress math writer xsltfilter
 do
  desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-"$i" \
   --set-key=X-Flatpak-RenamedFrom \
-  --set-value="libreoffice-$i.desktop;org.libreoffice.LibreOffice-$i.desktop;" 
\
-  "${2?}"org.libreoffice.LibreOffice."$i".desktop
+  --set-value="libreoffice-$i.desktop;${3?}-$i.desktop;" \
+  "${2?}${3?}"."$i".desktop
 done
diff --git a/solenv/bin/assemble-flatpak.sh b/solenv/bin/assemble-flatpak.sh
index 9ef9fe1b7d9d..96cf6edb745b 100755
--- a/solenv/bin/assemble-flatpak.sh
+++ b/solenv/bin/assemble-flatpak.sh
@@ -9,7 +9,10 @@
 
 # Assemble Flatpak app files and metadata under /app/, copying from the
 # installation tree generated by 'make distro-pack-install' (at
-# $PREFIXDIR):
+# $PREFIXDIR).
+#
+# Arguments:
+# $1  the flatpak ID
 
 set -e
 
@@ -18,10 +21,10 @@ ln -s /app/libreoffice/program/soffice /app/bin/libreoffice
 
 mkdir -p /app/share/applications
 "${SRCDIR?}"/solenv/bin/assemble-flatpak-desktop.sh 
"${PREFIXDIR?}"/share/applications/ \
- /app/share/applications/
+ /app/share/applications/ "${1?}"
 
 ## icons/hicolor/*/apps/libreoffice-* ->
-## icons/hicolor/*/apps/org.libreoffice.LibreOffice-*:
+## icons/hicolor/*/apps/$1-*:
 mkdir -p /app/share/icons
 for i in "${PREFIXDIR?}"/share/icons/hicolor/*/apps/libreoffice-*
 do
@@ -30,7 +33,7 @@ do
  cp -a "$i" \
   "$(dirname 
/app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"$(basename
 "$i")"
  cp -a "$i" \
-  "$(dirname 
/app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/org.libreoffice.LibreOffice."${i##*/apps/libreoffice-}"
+  "$(dirname 
/app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"${1?}"."${i##*/apps/libreoffice-}"
 done
 
 mkdir -p /app/share/runtime/locale
@@ -67,7 +70,7 @@ do
 done
 
 mkdir -p /app/share/appdata
-"${SRCDIR?}"/solenv/bin/assemble-flatpak-appdata.sh /app/share/appdata/ 1
+"${SRCDIR?}"/solenv/bin/assemble-flatpak-appdata.sh /app/share/appdata/ 1 
"${1?}"
 
 ## see <https://github.com/flatpak/flatpak/blob/master/app/
 ## flatpak-builtins-build-finish.c> for further places where build-finish would
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 37405ea6613f..244ec3957051 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -899,7 +899,7 @@
                 "./autogen.sh --prefix=/run/build/libreoffice/inst 
--with-distro=LibreOfficeFlatpak",
                 "make check",
                 "make distro-pack-install",
-                "make cmd cmd='$(SRCDIR)/solenv/bin/assemble-flatpak.sh'",
+                "make cmd cmd='$(SRCDIR)/solenv/bin/assemble-flatpak.sh 
org.libreoffice.LibreOffice'",
                 "printf '<?xml version=\"1.0\"?>\n<oor:data 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; 
xmlns:oor=\"http://openoffice.org/2001/registry\";><dependency 
file=\"main\"/><oor:component-data oor:name=\"Common\" 
oor:package=\"org.openoffice.Office\"><node oor:name=\"Misc\"><prop 
oor:name=\"UseOpenCL\"><value>false</value></prop></node></oor:component-data></oor:data>'
 >/app/libreoffice/share/registry/flatpak.xcd"
             ]
         }

Reply via email to