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

0001 #!/bin/bash
0002 #
0003 # add/remove Plasma release recipes
0004 #
0005 # SPDX-FileCopyrightText: 2018-2019 Volker Krause <vkrause@kde.org>
0006 # SPDX-FileCopyrightText: 2020-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-plasma
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         app=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)')
0029         lsremote=$(git ls-remote --exit-code https://anongit.kde.org/${app} v${version})
0030         if [ $? -eq 2 ]; then
0031             echo "No remote tag found for ${app}, recipe will be invalid"
0032         fi
0033         revision=$(echo ${lsremote} | cut -d ' ' -f1)
0034 cat <<EOM > $name
0035 # SPDX-FileCopyrightText: none
0036 # SPDX-License-Identifier: CC0-1.0
0037 
0038 require \${PN}.inc
0039 SRC_URI += "git://anongit.kde.org/${app};nobranch=1;protocol=https"
0040 SRCREV = "${revision}"
0041 S = "\${WORKDIR}/git"
0042 EOM
0043         git add $name
0044     done
0045     ;;
0046 add-tarball)
0047     # search for all non-staging inc files without underlines
0048     for recipe in $(find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/); do
0049         name=$(echo $recipe | sed -e "s,\.inc,_${version}.bb,")
0050         app=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)')
0051         url="https://download.kde.org/stable/plasma/${version}/${app}-${version}.tar.xz"
0052         sha256=$(curl -s "${url}.sha256" | cut -d" " -f1)
0053         echo "${url} : ${sha256}"
0054 # examples:
0055 #https://download.kde.org/stable/plasma/5.22.5/bluedevil-5.22.5.tar.xz
0056 #https://download.kde.org/stable/plasma/5.22.5/bluedevil-5.22.5.tar.xz.sha256
0057 cat <<EOM > $name
0058 # SPDX-FileCopyrightText: none
0059 # SPDX-License-Identifier: CC0-1.0
0060 
0061 require \${PN}.inc
0062 SRC_URI += "${url}"
0063 SRC_URI[sha256sum] = "${sha256}"
0064 ${extraconfig}
0065 EOM
0066          git add $name
0067     done
0068     ;;
0069 remove)
0070     for recipe in `find $base -name "*_$version.bb"`; do
0071         git rm -f $recipe
0072     done
0073     ;;
0074 update)
0075     new_version=$3
0076     for recipe in `find $base -name "*_$version.bb"`; do
0077         new_recipe=`echo $recipe | sed -e "s,$version,$new_version,"`
0078         git mv $recipe $new_recipe
0079     done
0080     ;;
0081 *)
0082     usage $0
0083     ;;
0084 esac