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 15007243c11363c636d74c240946237da5a866b8
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Oct 22 20:43:13 2025 +0200
Commit:     Sarper Akdemir <[email protected]>
CommitDate: Thu Oct 23 11:59:52 2025 +0200

    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.)
    
    Change-Id: I5b4c031acf19b04ac8b501d9d8557924747fb38b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192883
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Sarper Akdemir <[email protected]>

diff --git a/solenv/bin/assemble-flatpak-appdata.sh 
b/solenv/bin/assemble-flatpak-appdata.sh
index 51354ec4c474..20003f5c1f60 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
-#     com.collabora.CollaboraOffice.appdata.xml file
+#     $3.appdata.xml file
 # $2  "1" if a <releases> section shall be included in the target
-#     com.collabora.CollaboraOffice.appdata.xml file, "0" if not
+#     $3.appdata.xml file, "0" if not
+# $3  the flatpak ID
 
 set -e
 
-## com.collabora.CollaboraOffice.appdata.xml is manually derived from the 
various
+## $3.appdata.xml is manually derived from the various
 ## inst/share/metainfo/collaboraoffice-*.appdata.xml (at least recent GNOME 
Software
 ## doesn't show more than five screenshots anyway, so restrict to one each from
 ## the five collaboraoffice-*.appdata.xml: Writer, Calc, Impress, Draw, Base):
-cat <<\EOF >"${1?}"com.collabora.CollaboraOffice.appdata.xml
+cat <<EOF >"${1?}${3?}".appdata.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <component type="desktop">
- <id>com.collabora.CollaboraOffice</id>
+ <id>${3?}</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>MPL-2.0</project_license>
  <name>Collabora Office</name>
@@ -41,7 +42,7 @@ cat <<\EOF >"${1?}"com.collabora.CollaboraOffice.appdata.xml
   you can easily share documents with users of other popular office suites
   without worrying about compatibility.</p>
  </description>
- <launchable 
type="desktop-id">com.collabora.CollaboraOffice.desktop</launchable>
+ <launchable type="desktop-id">${3?}.desktop</launchable>
  <url type="homepage">https://collabora.com</url>
  <screenshots>
   <screenshot type="default">
@@ -77,7 +78,7 @@ EOF
 
 if [ "${2?}" = 1 ]
 then
- cat <<EOF >>"${1?}"com.collabora.CollaboraOffice.appdata.xml
+ cat <<EOF >>"${1?}${3?}".appdata.xml
  <releases>
   <release
     
version="${LIBO_VERSION_MAJOR?}.${LIBO_VERSION_MINOR?}.${LIBO_VERSION_MICRO?}.${LIBO_VERSION_PATCH?}"
@@ -86,6 +87,6 @@ then
 EOF
 fi
 
-cat <<\EOF >>"${1?}"com.collabora.CollaboraOffice.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 6346223a8f86..378a886af923 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 
collaboraoffice-*.desktop
 #     files
 # $2  pathname, ending in a slash, of the directory into which to put the 
target
-#     com.collabora.CollaboraOffice.*.desktop files
+#     $3.*.desktop files
+# $3  the flatpak ID
 
 set -e
 
-## collaboraoffice-*.desktop -> com.collabora.CollaboraOffice.*.desktop:
+## collaboraoffice-*.desktop -> $3.*.desktop:
 for i in "${1?}"collaboraoffice-*.desktop
 do
- sed -e 's/^Icon=collaboraoffice-/Icon=com.collabora.CollaboraOffice./' "$i" \
-  >"${2?}"com.collabora.CollaboraOffice."${i#"${1?}"collaboraoffice-}"
+ sed -e "s/^Icon=collaboraoffice-/Icon=${3?}./" "$i" \
+  >"${2?}${3?}"."${i#"${1?}"collaboraoffice-}"
 done
-mv "${2?}"com.collabora.CollaboraOffice.startcenter.desktop 
"${2?}"com.collabora.CollaboraOffice.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?}"com.collabora.CollaboraOffice.writer.desktop
+sed -i "s/text\/plain;//" "${2?}${3?}".writer.desktop
 
 desktop-file-edit --set-key=X-Endless-Alias 
--set-value=collaboraoffice-startcenter \
  --set-key=X-Flatpak-RenamedFrom 
--set-value='collaboraoffice-startcenter.desktop;' \
- "${2?}"com.collabora.CollaboraOffice.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=collaboraoffice-"$i" \
   --set-key=X-Flatpak-RenamedFrom \
-  
--set-value="collaboraoffice-$i.desktop;com.collabora.CollaboraOffice-$i.desktop;"
 \
-  "${2?}"com.collabora.CollaboraOffice."$i".desktop
+  --set-value="collaboraoffice-$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 27d4c894c8f4..01c190f8d159 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/collaboraoffice/program/soffice 
/app/bin/collaboraoffice
 
 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/collaboraoffice-* ->
-## icons/hicolor/*/apps/com.collabora.CollaboraOffice-*:
+## icons/hicolor/*/apps/$1-*:
 mkdir -p /app/share/icons
 for i in "${PREFIXDIR?}"/share/icons/hicolor/*/apps/collaboraoffice-*
 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/}")"/com.collabora.CollaboraOffice."${i##*/apps/collaboraoffice-}"
+  "$(dirname 
/app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"${1?}"."${i##*/apps/collaboraoffice-}"
 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 7e43d25636b3..5240e085292a 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -884,7 +884,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 
com.collabora.CollaboraOffice'",
                 "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/collaboraoffice/share/registry/flatpak.xcd"
             ]
         }

Reply via email to