File rpm-findlang-inject-metainfo.patch of Package rpm

Index: scripts/find-lang.sh
===================================================================
--- scripts/find-lang.sh.orig
+++ scripts/find-lang.sh
@@ -11,6 +11,8 @@
 #in tact and are included with any redistribution of this file or any
 #work based on this file.
 
+# 2016-05-19 Dominique Leuenberger <dimstar@suse.de>
+#   * Add support to create a metainfo.xml for -lang packages
 # 2004-06-20 Arkadiusz Miƛkiewicz <arekm@pld-linux.org>
 #   * merge PLD changes, kde, all-name (mkochano,pascalek@PLD)
 # 1999-10-19 Artur Frysiak <wiget@pld-linux.org>
@@ -37,6 +39,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
 EOF
 exit 1
 }
@@ -66,6 +69,7 @@ ALL_NAME=#
 NO_ALL_NAME=
 ONLY_C=#
 NO_C=#
+METAINFO=0
 
 while test $# -gt 0 ; do
     case "${1}" in
@@ -114,6 +118,11 @@ while test $# -gt 0 ; do
 		NO_C=
 		shift
 		;;
+	--metainfo )
+		METAINFO=1
+		METADESKID=${2}
+		shift 2
+		;;
 	* )
 		MO_NAME=${1}
 		shift
@@ -278,6 +287,24 @@ if ! grep -q / $MO_NAME_NEW; then
 	exit 1
 fi
 
+if [ "${METAINFO}" -gt 0 ]; 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