From 3c326532cfa0ea3b0dec44eb2cd99179a1c72243 Mon Sep 17 00:00:00 2001 From: Andreas Cord-Landwehr Date: Fri, 1 Jan 2021 13:09:10 +0100 Subject: [PATCH] Add metainfo option to release script --- scripts/kf5-release.sh | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/kf5-release.sh b/scripts/kf5-release.sh index 57fd036..92ee225 100755 --- a/scripts/kf5-release.sh +++ b/scripts/kf5-release.sh @@ -10,9 +10,21 @@ function usage() { echo "$1 [add|remove] " + echo "$1 metainfo" exit 1 } +function yaml() { + python3 -c " +import yaml +metainfo=yaml.safe_load(open('$1')) +if '$2' in metainfo: + print(metainfo['$2']) +else: + print() +" +} + command=$1 if [ -z "$command" ]; then usage $0; fi @@ -23,7 +35,8 @@ base=`dirname $0`/../recipes-kf5 case $command in add) - for recipe in `find $base -name "*.inc" | grep -v /staging/`; do + # search for all non-staging inc files without underlines + for recipe in `find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/`; do name=`echo $recipe | sed -e "s,\.inc,_${version}.bb,"` cat < $name # SPDX-FileCopyrightText: none @@ -40,6 +53,27 @@ remove) git rm -f $recipe done ;; +metainfo) + echo "Updating metainfo..." + for recipe in `find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/`; do + framework=`echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)'` + filename=`echo $recipe | sed -e "s,\.inc,_metainfo\.inc,"` + url="https://invent.kde.org/frameworks/$framework/-/raw/v$version/metainfo.yaml" + curl $url > /tmp/$framework + description=$(yaml /tmp/$framework "description") + if [[ $description == "" ]] ; then + echo "WARNING: no description for $framework" + fi +cat < $filename +# SPDX-FileCopyrightText: none +# SPDX-License-Identifier: CC0-1.0 + +SUMMARY ?= "$description" +HOMEPAGE ?= "https://api.kde.org/frameworks/$framework/html/index.html" +EOM + git add $filename + done + ;; *) usage $0 ;;