File indexing completed on 2024-04-28 16:32:10
0001 #!/bin/bash 0002 # 0003 # add/remove KF5 release recipes 0004 # 0005 # SPDX-FileCopyrightText: 2017-2018 Volker Krause <vkrause@kde.org> 0006 # SPDX-FileCopyrightText: 2020 Andreas Cord-Landwehr <cordlandwehr@kde.org> 0007 # 0008 # SPDX-License-Identifier: MIT 0009 0010 function usage() 0011 { 0012 echo "$1 [add|add-tarball|remove] <version>" 0013 echo "$1 metainfo <version> [sourcedir]" 0014 exit 1 0015 } 0016 0017 function yaml() { 0018 python3 -c " 0019 import yaml 0020 metainfo=yaml.safe_load(open('$1')) 0021 if '$2' in metainfo: 0022 print(metainfo['$2']) 0023 else: 0024 print() 0025 " 0026 } 0027 0028 command=$1 0029 if [ -z "$command" ]; then usage $0; fi 0030 0031 version=$2 0032 if [ -z "$version" ]; then usage $0; fi 0033 0034 base=$(dirname $0)/../recipes-kf5 0035 rootdir=$PWD 0036 0037 case $command in 0038 add) 0039 # search for all non-staging inc files without underlines 0040 for recipe in $(find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/); do 0041 name=$(echo $recipe | sed -e "s,\.inc,_${version}.bb,") 0042 cat <<EOM > $name 0043 # SPDX-FileCopyrightText: none 0044 # SPDX-License-Identifier: CC0-1.0 0045 0046 require \${PN}.inc 0047 SRCREV = "v\${PV}" 0048 SRC_URI = "git://invent.kde.org/frameworks/\${BPN};nobranch=1;protocol=https" 0049 S = "\${WORKDIR}/git" 0050 EOM 0051 git add $name 0052 done 0053 ;; 0054 add-tarball) 0055 foldername=$(echo "${version}" | grep -o -E "^([0-9]+\.[0-9]+)") 0056 # search for all non-staging inc files without underlines 0057 for recipe in $(find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/); do 0058 name=$(echo $recipe | sed -e "s,\.inc,_${version}.bb,") 0059 framework=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)') 0060 0061 # due to historic reasons manual rewriting certain names 0062 extraconfig="" 0063 if [[ "${framework}" == "kirigami" ]]; then 0064 framework="kirigami2" 0065 extraconfig="S = \"\${WORKDIR}/kirigami2-\${PV}\"" 0066 fi 0067 0068 # deprecated modules are stored in portingAids folder 0069 portingAidSubfolder="" 0070 if [[ "$framework" == "kxmlrpcclient" ]] \ 0071 || [[ "$framework" == "kjs" ]] \ 0072 || [[ "$framework" == "kjsembed" ]] \ 0073 || [[ "$framework" == "kdesignerplugin" ]] \ 0074 || [[ "$framework" == "kdelibs4support" ]]; 0075 then 0076 portingAidSubfolder="portingAids/" 0077 fi 0078 url="https://download.kde.org/stable/frameworks/${foldername}/${portingAidSubfolder}${framework}-${version}.tar.xz" 0079 sha256=$(curl -s "${url}.sha256" | cut -d" " -f1) 0080 echo "${url} : ${sha256}" 0081 # examples: 0082 #https://download.kde.org/stable/frameworks/5.83/kconfig-5.83.0.tar.xz 0083 #https://download.kde.org/stable/frameworks/5.83/kconfig-5.83.0.tar.xz.sha256 0084 cat <<EOM > $name 0085 # SPDX-FileCopyrightText: none 0086 # SPDX-License-Identifier: CC0-1.0 0087 0088 require \${PN}.inc 0089 SRC_URI = "${url}" 0090 SRC_URI[sha256sum] = "${sha256}" 0091 ${extraconfig} 0092 EOM 0093 git add $name 0094 done 0095 ;; 0096 remove) 0097 for recipe in `find $base -name "*_$version.bb"`; do 0098 git rm -f $recipe 0099 done 0100 ;; 0101 metainfo) 0102 echo "Updating metainfo..." 0103 sourcedir=$3 0104 if [ -z "$sourcedir" ]; then 0105 sourcedir="$PWD/tmp"; 0106 fi 0107 if [ -d "$sourcedir" ]; then 0108 echo "Using existing source directory $sourcedir: repositories expected in subfolders" 0109 else 0110 mkdir -p $sourcedir 0111 fi 0112 for recipe in `find $base -regex ".*/[0-9a-zA-Z\-]+\.inc" | grep -v /staging/`; do 0113 framework=$(echo $recipe | grep -P -o '[0-9a-zA-Z\-]+(?=\.inc)') 0114 filename=$(echo $recipe | sed -e "s,\.inc,_metainfo\.inc,") 0115 url="https://invent.kde.org/frameworks/$framework.git" 0116 if [ -d "$sourcedir/$framework" ]; then 0117 cd $sourcedir/$framework 0118 git fetch > /dev/null 0119 cd $rootdir 0120 else 0121 git clone -c advice.detachedHead=false -q --branch v$version $url $sourcedir/$framework > /dev/null 0122 fi 0123 cd $sourcedir/$framework 0124 git show v$version:metainfo.yaml > ../$framework.yaml 0125 cd $rootdir 0126 description=$(yaml $sourcedir/$framework.yaml "description") 0127 if [[ $description == "" ]] ; then 0128 echo "WARNING: no description for $framework" 0129 fi 0130 cat <<EOM > $filename 0131 # SPDX-FileCopyrightText: none 0132 # SPDX-License-Identifier: CC0-1.0 0133 0134 SUMMARY = "$description" 0135 HOMEPAGE = "https://api.kde.org/frameworks/$framework/html/index.html" 0136 EOM 0137 git add $filename 0138 echo "$framework: DONE" 0139 done 0140 ;; 0141 *) 0142 usage $0 0143 ;; 0144 esac