File indexing completed on 2024-04-21 05:08:04

0001 #!/bin/bash
0002 #
0003 # add/remove KDE Gear release recipes
0004 #
0005 # SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
0006 # SPDX-FileCopyrightText: 2021 Andreas Cord-Landwehr <cordlandwehr@kde.org>
0007 #
0008 # SPDX-License-Identifier: MIT
0009 
0010 function usage()
0011 {
0012     echo "$1 [add|add-tarball|remove|update] <version> [<new version>]"
0013     exit 1
0014 }
0015 
0016 command=$1
0017 if [ -z "$command" ]; then usage $0; fi
0018 
0019 version=$2
0020 if [ -z "$version" ]; then usage $0; fi
0021 
0022 base=`dirname $0`/../recipes-application
0023 
0024 case $command in
0025 add)
0026     for recipe in `find $base -name "*.inc" | grep -v /staging/`; do
0027         name=`echo $recipe | sed -e "s,\.inc,_${version}.bb,"`
0028         module=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=/[0-9a-zA-Z\-]+\.inc)')
0029         app=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)')
0030 cat <<EOM > $name
0031 # SPDX-FileCopyrightText: none
0032 # SPDX-License-Identifier: CC0-1.0
0033 
0034 require \${PN}.inc
0035 SRC_URI = "git://invent.kde.org/${module}/${app};nobranch=1;protocol=https"
0036 SRCREV = "v\${PV}"
0037 S = "\${WORKDIR}/git"
0038 EOM
0039         git add $name
0040     done
0041     ;;
0042 add-tarball)
0043     # search for all non-staging inc files without underlines
0044     for recipe in $(find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/); do
0045         name=$(echo $recipe | sed -e "s,\.inc,_${version}.bb,")
0046         app=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)')
0047         url="https://download.kde.org/stable/release-service/${version}/src/${app}-${version}.tar.xz"
0048         sha256=$(curl -s "${url}.sha256" | cut -d" " -f1)
0049         echo "${url} : ${sha256}"
0050 # examples:
0051 #https://download.kde.org/stable/release-service/21.08.0/src/akonadi-21.08.0.tar.xz
0052 cat <<EOM > $name
0053 # SPDX-FileCopyrightText: none
0054 # SPDX-License-Identifier: CC0-1.0
0055 
0056 require \${PN}.inc
0057 SRC_URI = "${url}"
0058 SRC_URI[sha256sum] = "${sha256}"
0059 EOM
0060          git add $name
0061     done
0062     ;;
0063 remove)
0064     for recipe in `find $base -name "*_$version.bb"`; do
0065         git rm -f $recipe
0066     done
0067     ;;
0068 update)
0069     new_version=$3
0070     for recipe in `find $base -name "*_$version.bb"`; do
0071         new_recipe=`echo $recipe | sed -e "s,$version,$new_version,"`
0072         git mv $recipe $new_recipe
0073     done
0074     ;;
0075 *)
0076     usage $0
0077     ;;
0078 esac