File indexing completed on 2024-04-14 05:02:34

0001 #!/bin/bash
0002 #
0003 # add/remove Plasma Mobile 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-plasma-mobile
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 cat <<EOM > $name
0030 # SPDX-FileCopyrightText: none
0031 # SPDX-License-Identifier: CC0-1.0
0032 
0033 require \${PN}.inc
0034 SRC_URI = "git://anongit.kde.org/${app};nobranch=1;protocol=https"
0035 SRCREV = "v\${PV}"
0036 S = "\${WORKDIR}/git"
0037 EOM
0038         git add $name
0039     done
0040     ;;
0041 add-tarball)
0042     # search for all non-staging inc files without underlines
0043     for recipe in $(find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/); do
0044         name=$(echo $recipe | sed -e "s,\.inc,_${version}.bb,")
0045         app=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)')
0046         url="https://download.kde.org/stable/plasma-mobile/${version}/${app}-${version}.tar.xz"
0047         sha256=$(curl -s "${url}.sha256" | cut -d" " -f1)
0048         echo "${url} : ${sha256}"
0049 # examples:
0050 #https://download.kde.org/stable/plasma-mobile/21.07/kclock-21.07.tar.xz
0051 #https://download.kde.org/stable/plasma-mobile/21.07/kclock-21.07.tar.xz.sha256
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 ${extraconfig}
0060 EOM
0061          git add $name
0062     done
0063     ;;
0064 remove)
0065     for recipe in `find $base -name "*_$version.bb"`; do
0066         git rm -f $recipe
0067     done
0068     ;;
0069 update)
0070     new_version=$3
0071     for recipe in `find $base -name "*_$version.bb"`; do
0072         new_recipe=`echo $recipe | sed -e "s,$version,$new_version,"`
0073         git mv $recipe $new_recipe
0074     done
0075     ;;
0076 *)
0077     usage $0
0078     ;;
0079 esac