rpm/rpm-findlang-inject-metainfo.patch

56 lines
1.6 KiB
Diff

--- scripts/find-lang.sh.orig 2023-10-09 13:11:05.219604799 +0000
+++ scripts/find-lang.sh 2023-10-09 13:12:38.787433946 +0000
@@ -47,6 +47,7 @@ Additional options:
--with-man find localized man pages
--all-name match all package/domain names
--without-mo do not find locale files
+ --metainfo create a metainfo.xml file for AppStream
--generate-subpackages move language files in one sub package per language
EOF
exit 1
@@ -79,6 +80,7 @@ ALL_NAME=#
NO_ALL_NAME=
ONLY_C=#
NO_C=#
+METAINFO=#
while test $# -gt 0 ; do
case "${1}" in
--with-gnome )
@@ -134,6 +136,11 @@ while test $# -gt 0 ; do
NO_C=
shift
;;
+ --metainfo )
+ METAINFO=
+ METADESKID=${2}
+ shift 2
+ ;;
* )
if [ $MO_NAME != ${NAMES[$#]}.lang ]; then
NAMES[${#NAMES[@]}]=$MO_NAME
@@ -344,6 +351,24 @@ if ! grep -q / $MO_NAME_NEW; then
exit 1
fi
+if [ -z "${METAINFO}" ] ; then
+ # create a metainfo.xml file for METADESKID
+ mkdir -p ${TOP_DIR}/usr/share/appdata
+ cat > ${TOP_DIR}/usr/share/appdata/${METADESKID}-lang.metainfo.xml <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 openSUSE - file is auto-generated -->
+<component type="addon">
+ <id>${METADESKID}-lang</id>
+ <extends>${METADESKID}.desktop</extends>
+ <name>Translations</name>
+ <summary>Translate the user interface</summary>
+ <metadata_license>CC0-1.0</metadata_license>
+ <updatecontact>https://bugzilla.opensuse.org</updatecontact>
+</component>
+EOF
+ echo /usr/share/appdata/${METADESKID}-lang.metainfo.xml >> $MO_NAME_NEW
+fi
+
sort -u $MO_NAME_NEW >> $MO_NAME
rm -f $MO_NAME_NEW