Hello community,

here is the log from the commit of package extra-cmake-modules for 
openSUSE:Factory checked in at 2020-12-15 12:27:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/extra-cmake-modules (Old)
 and      /work/SRC/openSUSE:Factory/.extra-cmake-modules.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "extra-cmake-modules"

Tue Dec 15 12:27:56 2020 rev:84 rq:855403 version:5.77.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/extra-cmake-modules/extra-cmake-modules.changes  
2020-11-23 10:26:06.793066542 +0100
+++ 
/work/SRC/openSUSE:Factory/.extra-cmake-modules.new.2328/extra-cmake-modules.changes
        2020-12-15 12:29:47.727971833 +0100
@@ -1,0 +2,15 @@
+Sat Dec  5 18:56:09 UTC 2020 - Christophe Giboudeaux <[email protected]>
+
+- Update to 5.77.0
+  * New feature release
+  * For more details please see:
+  * https://kde.org/announcements/kde-frameworks-5.77.0
+- Changes since 5.76.0:
+  * clang-format: No space before initializer list
+  * Fix category extraction from desktop files
+  * Define install dir variable for file templates
+  * Add fastlane metadata generation for Android builds
+  * (Qt)WaylandScanner: Properly mark files as SKIP_AUTOMOC
+  * Fix updating of apptemplate tars
+
+-------------------------------------------------------------------

Old:
----
  extra-cmake-modules-5.76.0.tar.xz
  extra-cmake-modules-5.76.0.tar.xz.sig

New:
----
  extra-cmake-modules-5.77.0.tar.xz
  extra-cmake-modules-5.77.0.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ extra-cmake-modules.spec ++++++
--- /var/tmp/diff_new_pack.EW1duN/_old  2020-12-15 12:29:48.383972362 +0100
+++ /var/tmp/diff_new_pack.EW1duN/_new  2020-12-15 12:29:48.383972362 +0100
@@ -16,7 +16,7 @@
 #
 
 
-%define _tar_path 5.76
+%define _tar_path 5.77
 # Full KF5 version (e.g. 5.33.0)
 %{!?_kf5_version: %global _kf5_version %{version}}
 # Last major and minor KF5 version (e.g. 5.33)
@@ -29,7 +29,7 @@
 # Only needed for the package signature condition
 %bcond_without lang
 Name:           extra-cmake-modules
-Version:        5.76.0
+Version:        5.77.0
 Release:        0
 Summary:        CMake modules
 License:        BSD-3-Clause

++++++ extra-cmake-modules-5.76.0.tar.xz -> extra-cmake-modules-5.77.0.tar.xz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-cmake-modules-5.76.0/CMakeLists.txt 
new/extra-cmake-modules-5.77.0/CMakeLists.txt
--- old/extra-cmake-modules-5.76.0/CMakeLists.txt       2020-11-01 
11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/CMakeLists.txt       2020-12-04 
21:30:12.000000000 +0100
@@ -11,7 +11,7 @@
 # Preliminary setup
 #
 
-set(VERSION "5.76.0") # handled by release scripts
+set(VERSION "5.77.0") # handled by release scripts
 
 if (POLICY CMP0048)
     cmake_policy(SET CMP0048 NEW)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/find-modules/FindQtWaylandScanner.cmake 
new/extra-cmake-modules-5.77.0/find-modules/FindQtWaylandScanner.cmake
--- old/extra-cmake-modules-5.76.0/find-modules/FindQtWaylandScanner.cmake      
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/find-modules/FindQtWaylandScanner.cmake      
2020-12-04 21:30:12.000000000 +0100
@@ -117,8 +117,6 @@
                                     BASENAME ${ARGS_BASENAME})
 
     get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE)
-    set(_ccode 
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-client-protocol.c")
-    set(_cheader 
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-client-protocol.h")
     set(_header "${CMAKE_CURRENT_BINARY_DIR}/qwayland-${ARGS_BASENAME}.h")
     set(_code "${CMAKE_CURRENT_BINARY_DIR}/qwayland-${ARGS_BASENAME}.cpp")
 
@@ -132,7 +130,7 @@
         COMMAND ${QtWaylandScanner_EXECUTABLE} client-code ${_infile} "" 
${_prefix} > ${_code}
         DEPENDS ${_infile} ${_header} VERBATIM)
 
-    set_property(SOURCE ${_header} ${_code} ${_cheader} ${_ccode} PROPERTY 
SKIP_AUTOMOC ON)
+    set_property(SOURCE ${_header} ${_code} PROPERTY SKIP_AUTOMOC ON)
 
     list(APPEND ${out_var} "${_code}")
     set(${out_var} ${${out_var}} PARENT_SCOPE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/find-modules/FindWaylandScanner.cmake 
new/extra-cmake-modules-5.77.0/find-modules/FindWaylandScanner.cmake
--- old/extra-cmake-modules-5.76.0/find-modules/FindWaylandScanner.cmake        
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/find-modules/FindWaylandScanner.cmake        
2020-12-04 21:30:12.000000000 +0100
@@ -134,7 +134,8 @@
 
     get_filename_component(_infile ${ARGS_PROTOCOL} ABSOLUTE)
     set(_server_header 
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-server-protocol.h")
-    set_property(SOURCE ${_server_header} PROPERTY SKIP_AUTOMOC ON)
+    set(_server_code 
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${ARGS_BASENAME}-protocol.c")
+    set_property(SOURCE ${_server_header} ${_server_code} PROPERTY 
SKIP_AUTOMOC ON)
     set_source_files_properties(${_server_header} GENERATED)
 
     add_custom_command(OUTPUT "${_server_header}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/kde-modules/KDEInstallDirs.cmake 
new/extra-cmake-modules-5.77.0/kde-modules/KDEInstallDirs.cmake
--- old/extra-cmake-modules-5.76.0/kde-modules/KDEInstallDirs.cmake     
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/kde-modules/KDEInstallDirs.cmake     
2020-12-04 21:30:12.000000000 +0100
@@ -573,8 +573,12 @@
 _define_relative(KXMLGUI5DIR DATAROOTDIR "kxmlgui5"
     "kxmlgui .rc files"
     KXMLGUI_INSTALL_DIR)
-_define_relative(KTEMPLATESDIR DATAROOTDIR "kdevappwizard/templates"
-    "Kapptemplate and Kdevelop templates")
+_define_relative(KAPPTEMPLATESDIR DATAROOTDIR "kdevappwizard/templates"
+    "KAppTemplate and KDevelop templates"
+    KDE_INSTALL_KTEMPLATESDIR
+    )
+_define_relative(KFILETEMPLATESDIR DATAROOTDIR "kdevfiletemplates/templates"
+    "KDevelop file templates")
 _define_relative(LOGGINGCATEGORIESDIR DATAROOTDIR "qlogging-categories5"
     "Qt Logging categories files")
 _define_relative(JARDIR "" "jar"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/kde-modules/KDEPackageAppTemplates.cmake 
new/extra-cmake-modules-5.77.0/kde-modules/KDEPackageAppTemplates.cmake
--- old/extra-cmake-modules-5.76.0/kde-modules/KDEPackageAppTemplates.cmake     
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/kde-modules/KDEPackageAppTemplates.cmake     
2020-12-04 21:30:12.000000000 +0100
@@ -84,32 +84,29 @@
     endif()
 
     foreach(_templateName ${ARG_TEMPLATES})
-
         get_filename_component(_tmp_file ${_templateName} ABSOLUTE)
         get_filename_component(_baseName ${_tmp_file} NAME_WE)
         set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2)
 
-        file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
-        set(_deps)
-        foreach(_file ${_files})
-            get_filename_component(_fileName ${_file} NAME)
-            string(COMPARE NOTEQUAL ${_fileName} .kdev_ignore _v1)
-            string(REGEX MATCH "\\.svn" _v2 ${_fileName})
-            if(WIN32)
-                string(REGEX MATCH "_svn" _v3 ${_fileName})
-            else(WIN32)
-                set(_v3 FALSE)
-            endif()
-            if (_v1 AND NOT _v2 AND NOT _v3)
-                set(_deps ${_deps} ${_file})
-            endif ()
-        endforeach()
-
+        # CONFIGURE_DEPENDS is only available for cmake >= 3.12
+        if(NOT CMAKE_VERSION VERSION_LESS "3.12.0")
+            # also enlist directories as deps to catch file removals
+            file(GLOB_RECURSE _subdirs_entries LIST_DIRECTORIES true 
CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
+        else()
+            file(GLOB_RECURSE _subdirs_entries LIST_DIRECTORIES true 
"${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
+            # custom code to implement CONFIGURE_DEPENDS
+            foreach(_direntry ${_subdirs_entries})
+                if(IS_DIRECTORY ${_direntry})
+                    set_property(DIRECTORY APPEND PROPERTY 
CMAKE_CONFIGURE_DEPENDS ${_direntry})
+                endif()
+            endforeach()
+        endif()
         add_custom_target(${_baseName} ALL DEPENDS ${_template})
 
         add_custom_command(OUTPUT ${_template}
              COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} .
              WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+             DEPENDS ${_subdirs_entries}
         )
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/kde-modules/clang-format.cmake 
new/extra-cmake-modules-5.77.0/kde-modules/clang-format.cmake
--- old/extra-cmake-modules-5.76.0/kde-modules/clang-format.cmake       
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/kde-modules/clang-format.cmake       
2020-12-04 21:30:12.000000000 +0100
@@ -53,6 +53,9 @@
 # format C++11 braced lists like function calls
 Cpp11BracedListStyle: true
 
+# do not put a space before C++11 braced lists
+SpaceBeforeCpp11BracedList: false
+
 # remove empty lines
 KeepEmptyLinesAtTheStartOfBlocks: false
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/toolchain/ECMAndroidDeployQt.cmake 
new/extra-cmake-modules-5.77.0/toolchain/ECMAndroidDeployQt.cmake
--- old/extra-cmake-modules-5.76.0/toolchain/ECMAndroidDeployQt.cmake   
2020-11-01 11:30:10.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/toolchain/ECMAndroidDeployQt.cmake   
2020-12-04 21:30:12.000000000 +0100
@@ -1,5 +1,6 @@
 cmake_minimum_required (VERSION 3.7 FATAL_ERROR)
 find_package(Qt5Core REQUIRED)
+find_package(Python3 COMPONENTS Interpreter REQUIRED)
 
 function(ecm_androiddeployqt QTANDROID_EXPORTED_TARGET 
ECM_ADDITIONAL_FIND_ROOT_PATH)
     set(EXPORT_DIR 
"${CMAKE_BINARY_DIR}/${QTANDROID_EXPORTED_TARGET}_build_apk/")
@@ -64,6 +65,12 @@
 
     if (NOT TARGET create-apk)
         add_custom_target(create-apk)
+        if (NOT DEFINED ANDROID_FASTLANE_METADATA_OUTPUT_DIR)
+            set(ANDROID_FASTLANE_METADATA_OUTPUT_DIR 
${CMAKE_BINARY_DIR}/fastlane)
+        endif()
+        add_custom_target(create-fastlane
+            COMMAND Python3::Interpreter 
${CMAKE_CURRENT_LIST_DIR}/generate-fastlane-metadata.py --output 
${ANDROID_FASTLANE_METADATA_OUTPUT_DIR} --source ${CMAKE_SOURCE_DIR}
+        )
     endif()
 
     if (NOT DEFINED ANDROID_APK_OUTPUT_DIR)
@@ -88,4 +95,5 @@
         COMMAND adb install -r 
"${ANDROID_APK_OUTPUT_DIR}/${QTANDROID_EXPORTED_TARGET}-${CMAKE_ANDROID_ARCH_ABI}.apk"
     )
     add_dependencies(create-apk ${CREATEAPK_TARGET_NAME})
+    add_dependencies(${CREATEAPK_TARGET_NAME} create-fastlane)
 endfunction()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/extra-cmake-modules-5.76.0/toolchain/generate-fastlane-metadata.py 
new/extra-cmake-modules-5.77.0/toolchain/generate-fastlane-metadata.py
--- old/extra-cmake-modules-5.76.0/toolchain/generate-fastlane-metadata.py      
1970-01-01 01:00:00.000000000 +0100
+++ new/extra-cmake-modules-5.77.0/toolchain/generate-fastlane-metadata.py      
2020-12-04 21:30:12.000000000 +0100
@@ -0,0 +1,329 @@
+#!/usr/bin/env python3
+#
+# SPDX-FileCopyrightText: 2018-2020 Aleix Pol Gonzalez <[email protected]>
+# SPDX-FileCopyrightText: 2019-2020 Ben Cooksley <[email protected]>
+# SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Generates fastlane metadata for Android apps from appstream files.
+#
+
+import argparse
+import glob
+import io
+import os
+import re
+import requests
+import subprocess
+import sys
+import tempfile
+import xdg.DesktopEntry
+import xml.etree.ElementTree as ET
+import yaml
+import zipfile
+
+# Constants used in this script
+languageMap = {
+    None: "en-US",
+    "ca": "ca-ES"
+}
+
+# Android appdata.xml textual item parser
+# This function handles reading standard text entries within an Android 
appdata.xml file
+# In particular, it handles splitting out the various translations, and 
converts some HTML to something which F-Droid can make use of
+def readText(elem, found):
+    # Determine the language this entry is in
+    lang = elem.get('{http://www.w3.org/XML/1998/namespace}lang')
+    if lang == 'x-test':
+        return
+
+    # Do we have any text for this language yet?
+    # If not, get everything setup
+    if not lang in found:
+        found[lang] = ""
+
+    # Do we have a HTML List Item?
+    if elem.tag == 'li':
+        found[lang] += "ยท "
+
+    # If there is text available, we'll want to extract it
+    # Additionally, if this element has any children, make sure we read those 
as well
+    # It isn't clear if it is possible for an item to not have text, but to 
have children which do have text
+    # The code will currently skip these if they're encountered
+    if elem.text:
+        found[lang] += elem.text
+        for child in elem:
+            readText(child, found)
+
+    # Finally, if this element is a HTML Paragraph (p) or HTML List Item (li) 
make sure we add a new line for presentation purposes
+    if elem.tag == 'li' or elem.tag == 'p':
+        found[lang] += "\n"
+
+
+# Create the various Fastlane format files per the information we've 
previously extracted
+# These files are laid out following the Fastlane specification (links below)
+# 
https://github.com/fastlane/fastlane/blob/2.28.7/supply/README.md#images-and-screenshots
+# https://docs.fastlane.tools/actions/supply/
+def createFastlaneFile( applicationName, filenameToPopulate, fileContent ):
+    # Go through each language and content pair we've been given
+    for lang, text in fileContent.items():
+        # First, do we need to amend the language id, to turn the Android 
language ID into something more F-Droid/Fastlane friendly?
+        languageCode = languageMap.get(lang, lang)
+
+        # Next we need to determine the path to the directory we're going to 
be writing the data into
+        repositoryBasePath = arguments.output
+        path = os.path.join( repositoryBasePath, 'metadata',  applicationName, 
languageCode )
+
+        # Make sure the directory exists
+        os.makedirs(path, exist_ok=True)
+
+        # Now write out file contents!
+        with open(path + '/' + filenameToPopulate, 'w') as f:
+            f.write(text)
+
+# Create the summary appname.yml file used by F-Droid to summarise this 
particular entry in the repository
+# see https://f-droid.org/en/docs/Build_Metadata_Reference/
+def createYml(appname, data):
+    # Prepare to retrieve the existing information
+    info = {}
+
+    # Determine the path to the appname.yml file
+    repositoryBasePath = arguments.output
+    path = os.path.join( repositoryBasePath, 'metadata', appname + '.yml' )
+
+    # Update the categories first
+    # Now is also a good time to add 'KDE' to the list of categories as well
+    info['Categories'] = data['categories'][None] + ['KDE']
+
+    # Update the general sumamry as well
+    info['Summary'] = data['summary'][None]
+
+    # Check to see if we have a Homepage...
+    if 'url-homepage' in data:
+        info['WebSite'] = data['url-homepage'][None]
+
+    # What about a bug tracker?
+    if 'url-bugtracker' in data:
+        info['IssueTracker'] = data['url-bugtracker'][None]
+
+    if 'project_license' in data:
+        info["License"] = data['project_license'][None]
+
+    if 'source-repo' in data:
+        info['SourceCode'] = data['source-repo']
+
+    # static data
+    info['Donate'] = 'https://kde.org/community/donations/'
+    info['Translation'] = 'https://l10n.kde.org/'
+
+    # Finally, with our updates completed, we can save the updated appname.yml 
file back to disk
+    with open(path, 'w') as output:
+        yaml.dump(info, output, default_flow_style=False)
+
+# Download screenshots referenced in the appstream data
+# see 
https://f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/
+def downloadScreenshots(applicationName, data):
+    if not 'screenshots' in data:
+        return
+
+    basePath = arguments.output
+    path = os.path.join(basePath, 'metadata',  applicationName, 'en-US', 
'images', 'phoneScreenshots')
+    os.makedirs(path, exist_ok=True)
+
+    for screenshot in data['screenshots']:
+        fileName = screenshot[screenshot.rindex('/') + 1:]
+        r = requests.get(screenshot)
+        with open(os.path.join(path, fileName), 'wb') as f:
+            f.write(r.content)
+
+# Put all metadata for the given application name into an archive
+# We need this to easily transfer the entire metadata to the signing machine 
for integration
+# into the F-Droid nightly repository
+def createMetadataArchive(applicationName):
+    srcPath = os.path.join(arguments.output, 'metadata')
+    archive = zipfile.ZipFile(os.path.join(srcPath, 'fastlane-' + 
applicationName + '.zip'), 'w')
+    archive.write(os.path.join(srcPath, applicationName + '.yml'), 
applicationName + '.yml')
+
+    oldcwd = os.getcwd()
+    os.chdir(srcPath)
+    for file in glob.iglob(applicationName + '/**', recursive=True):
+        archive.write(file, file)
+    os.chdir(oldcwd)
+
+# Main function for extracting metadata from APK files
+def processApkFile(apkFilepath):
+    # First, determine the name of the application we have here
+    # This is needed in order to locate the metadata files within the APK that 
have the information we need
+
+    # Prepare the aapt (Android SDK command) to inspect the provided APK
+    commandToRun = "aapt dump badging %s" % (apkFilepath)
+    manifest = subprocess.check_output( commandToRun, shell=True 
).decode('utf-8')
+    # Search through the aapt output for the name of the application
+    result = re.search(' name=\'([^\']*)\'', manifest)
+    applicationName = result.group(1)
+
+    # Attempt to look within the APK provided for the metadata information we 
will need
+    with zipfile.ZipFile(apkFilepath, 'r') as contents:
+        appdataFile = contents.open("assets/share/metainfo/%s.appdata.xml" % 
applicationName)
+        desktopFileContent = None
+        try:
+            desktopFileContent = 
contents.read("assets/share/applications/%s.desktop" % applicationName)
+        except:
+            None
+        processAppstreamData(applicationName, appdataFile.read(), 
desktopFileContent)
+
+# Extract meta data from appstream/desktop file contents
+def processAppstreamData(applicationName, appstreamData, desktopData):
+    data = {}
+    # Within this file we look at every entry, and where possible try to 
export it's content so we can use it later
+    root = ET.fromstring(appstreamData)
+    for child in root:
+        # Make sure we start with a blank slate for this entry
+        output = {}
+
+        # Grab the name of this particular attribute we're looking at
+        # Within the Fastlane specification, it is possible to have several 
items with the same name but as different types
+        # We therefore include this within our extracted name for the 
attribute to differentiate them
+        tag = child.tag
+        if 'type' in child.attrib:
+            tag += '-' + child.attrib['type']
+
+        # Have we found some information already for this particular attribute?
+        if tag in data:
+            output = data[tag]
+
+        # Are we dealing with category information here?
+        # If so, then we need to look into this items children to find out all 
the categories this APK belongs in
+        if tag == 'categories':
+            cats = []
+            for x in child:
+                cats.append(x.text)
+            output = { None: cats }
+
+        # screenshot links
+        elif tag == 'screenshots':
+            output = []
+            for screenshot in child:
+                if screenshot.tag == 'screenshot':
+                    for image in screenshot:
+                        if image.tag == 'image':
+                            output.append(image.text)
+
+        # Otherwise this is just textual information we need to extract
+        else:
+            readText(child, output)
+
+        # Save the information we've gathered!
+        data[tag] = output
+
+    # Did we find any categories?
+    # Sometimes we don't find any within the Fastlane information, but without 
categories the F-Droid store isn't of much use
+    # In the event this happens, fallback to the *.desktop file for the 
application to see if it can provide any insight.
+    if not 'categories' in data and desktopData:
+        # The Python XDG extension/wrapper requires that it be able to read 
the file itself
+        # To ensure it is able to do this, we transfer the content of the file 
from the APK out to a temporary file to keep it happy
+        (fd, path) = tempfile.mkstemp(suffix=applicationName + ".desktop")
+        handle = open(fd, "wb")
+        handle.write(desktopData)
+        handle.close()
+        # Parse the XDG format *.desktop file, and extract the categories 
within it
+        desktopFile = xdg.DesktopEntry.DesktopEntry(path)
+        data['categories'] = { None: desktopFile.getCategories() }
+
+    # Try to figure out the source repository
+    if arguments.source and os.path.exists(os.path.join(arguments.source, 
'.git')):
+        output = subprocess.check_output('git remote show -n origin', 
shell=True, cwd = arguments.source).decode('utf-8')
+        result = re.search(' Fetch URL: (.*)\n', output)
+        data['source-repo'] = result.group(1)
+
+    # write meta data
+    createFastlaneFile( applicationName, "title.txt", data['name'] )
+    createFastlaneFile( applicationName, "short_description.txt", 
data['summary'] )
+    createFastlaneFile( applicationName, "full_description.txt", 
data['description'] )
+    createYml(applicationName, data)
+    downloadScreenshots(applicationName, data)
+    createMetadataArchive(applicationName)
+
+# Generate metadata for the given appstream and desktop files
+def processAppstreamFile(appstreamFileName, desktopFileName):
+    appstreamFile = open(appstreamFileName, "rb");
+    desktopData = None
+    if desktopFileName and os.path.exists(desktopFileName):
+        desktopFile = open(desktopFileName, "rb");
+        desktopData = desktopFile.read();
+    applicationName = os.path.basename(appstreamFileName)[:-12]
+    processAppstreamData(applicationName, appstreamFile.read(), desktopData)
+
+# scan source directory for manifests/metadata we can work with
+def scanSourceDir():
+    files = glob.iglob(arguments.source + "/**/AndroidManifest.xml*", 
recursive=True)
+    for file in files:
+        # third-party libraries might contain AndroidManifests which we are 
not interested in
+        if "3rdparty" in file:
+            continue
+
+        # find application id from manifest files
+        root = ET.parse(file)
+        appname = root.getroot().attrib['package']
+        is_app = False
+        prefix = '{http://schemas.android.com/apk/res/android}'
+        for md in root.findall("application/activity/meta-data"):
+            if md.attrib[prefix + 'name'] == 'android.app.lib_name':
+                is_app = True
+
+        if not appname or not is_app:
+            continue
+
+        # now that we have the app id, look for matching appdata/desktop files
+        appdataFiles = glob.iglob(arguments.source + "/**/" + appname + 
".appdata.xml", recursive=True)
+        appdataFile = None
+        for f in appdataFiles:
+            appdataFile = f;
+            break;
+        if not appdataFile:
+            continue
+
+        desktopFiles = glob.iglob(arguments.source + "/**/" + appname + 
".desktop", recursive=True)
+        desktopFile = None
+        for f in desktopFiles:
+            desktopFile = f;
+            break;
+
+        processAppstreamFile(appdataFile, desktopFile)
+
+
+### Script Commences
+
+# Parse the command line arguments we've been given
+parser = argparse.ArgumentParser(description='Generate fastlane metadata for 
Android apps from appstream metadata')
+parser.add_argument('--apk', type=str, required=False, help='APK file to 
extract metadata from')
+parser.add_argument('--appstream', type=str, required=False, help='Appstream 
file to extract metadata from')
+parser.add_argument('--desktop', type=str, required=False, help='Desktop file 
to extract additional metadata from')
+parser.add_argument('--source', type=str, required=False, help='Source 
directory to find metadata in')
+parser.add_argument('--output', type=str, required=True, help='Path to which 
the metadata output should be written to')
+arguments = parser.parse_args()
+
+# ensure the output path exists
+os.makedirs(arguments.output, exist_ok=True)
+
+# if we have an appstream file explicitly specified, let's use that one
+if arguments.appstream and os.path.exists(arguments.appstream):
+    processAppstreamFile(arguments.appstream, arguments.desktop)
+    sys.exit(0)
+
+# else, if we have an APK, try to find the appstream file in there
+# this ensures compatibility with the old metadata generation
+if arguments.apk and os.path.exists(arguments.apk):
+    processApkFile(arguments.apk)
+    sys.exit(0)
+
+# else, look in the source dir for appstream/desktop files
+# this follows roughly what get-apk-args from binary factory does
+if arguments.source and os.path.exists(arguments.source):
+    scanSourceDir()
+    sys.exit(0)
+
+# else: missing arguments
+print("Either one of --appstream, --apk or --source have to be provided!")
+sys.exit(1)
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to