PKGBUILDs/devel/apply-versions.sh

54 lines
1.9 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-03-21 21:27:12 +01:00
set -e # abort on first error
shopt -s nullglob
source "$(dirname $0)/versions.sh"
2018-03-21 21:27:12 +01:00
for pkgbuild_file in "${PKGBUILD_DIR:-.}"/*/*/PKGBUILD; do
trimmed_path=${pkgbuild_file#${PKGBUILD_DIR:-.}/}
2018-03-21 21:27:12 +01:00
project_name=${trimmed_path%%/*}
variant=${trimmed_path%/PKGBUILD}
variant=${variant#$project_name/}
# skip Git packages
[ ${variant##*-} == 'git' ] && continue
2020-12-19 21:30:33 +01:00
# skip android packages (for now)
[ ${variant%%-*} == 'android' ] && continue
2020-10-20 10:57:38 +02:00
# skip some of the packages
[[ $project_name == 'qt5-quick1' # removed from official releases
|| $project_name == 'qt5-webkit' # even revived version is dead
|| $project_name == 'qt5-webview' # does not build for Windows, would require qt5-webengine
|| $project_name == 'qt5-canvas3d' # removed from official releases
2020-10-20 10:57:38 +02:00
|| $project_name == 'qt6-3d' # removed in beta1
|| $variant == 'mingw-w64-test' # just our own 'test' package (not used anymore)
2019-06-14 19:09:09 +02:00
]] && continue
2018-03-21 21:27:12 +01:00
2020-10-20 10:57:38 +02:00
# treat all qt5-*/qt6-* packages as qt5/qt6
start=${project_name%%-*}
for qtver in 5 6; do
[[ $start == "qt$qtver" ]] && project_name="qt$qtver" && break
done
2018-03-21 21:27:12 +01:00
# skip packages with unknown version
version=${versions[$project_name]}
[[ $version ]] || continue
# skip if version doesn't differ
source "$pkgbuild_file"
[[ $version == $pkgver ]] && continue
2020-10-20 10:57:38 +02:00
[[ $version == $_qtver ]] && continue
2020-09-16 18:35:50 +02:00
pattern='(apple-darwin-.*|android-.*-(c\+\+utilities|qtutilities|passwordfile|passwordmanager))'
[[ $pkgname =~ $pattern ]] && continue
2018-03-21 21:27:12 +01:00
2020-01-28 21:12:38 +01:00
# check if template exists and modify template instead
template=$pkgbuild_file.sh.ep
[[ -f $template ]] && pkgbuild_file=$template
2018-03-21 21:27:12 +01:00
# apply new version
2020-10-20 10:57:38 +02:00
sed -i -e "s/^\(_qtver\|pkgver\)=[^\$].*/\1=$version/" -e "s/pkgrel=.*/pkgrel=1/" "$pkgbuild_file"
2018-03-21 21:27:12 +01:00
chmod 644 "$pkgbuild_file"
echo "$trimmed_path -> $version"
done