Update helper scripts for mingw-w64-qt5-* packages

This commit is contained in:
Martchus 2017-10-13 19:04:11 +02:00
parent e19236b071
commit 3dcd7abd1b
4 changed files with 99 additions and 36 deletions

29
devel/qt5/rebase-patches.sh Executable file
View File

@ -0,0 +1,29 @@
#set -euxo pipefail
set -e # abort on first error
shopt -s nullglob
if ! [[ $1 ]] || ! [[ $2 ]]; then
echo 'No version specified, must specify the new and old version, eg. 5.9.2 5.9.1'
echo "Usage: $0 newversion oldversion"
exit -1
fi
newversion="$1"
oldversion="$2"
remote=
for maybe_remote in 'martchus' 'origin'; do
if git remote get-url $maybe_remote; then
remote=$maybe_remote
break
fi
done
if ! [[ $remote ]]; then
echo "Unable to detect remote"
exit -2
fi
git remote update
git checkout -b "$newversion-mingw-w64" "v$newversion"
git cherry-pick "v$oldversion..$oldversion"-mingw-w64
git push -u $maybe_remote "$newversion-mingw-w64"

16
devel/qt5/update-all-patches.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/bash
# Copies patches from QT_GIT_REPOS_DIR to default
# variant of all repos and updates sources and checksums
#set -euxo pipefail
set -e # abort on first error
shopt -s nullglob
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for r in "$QT_GIT_REPOS_DIR/qt"*; do
repo="${r##*/qt}"
[[ $repo == '5ct' || $repo == '5ct-code' || $repo == 'repotools' || $repo == 'webkit' ]] && continue
echo "Updating repository $repo ..."
"$scriptdir/update-patches.sh" "$repo"
done

View File

@ -1,8 +1,7 @@
#!/usr/bin/bash #!/usr/bin/bash
# Copies patches from QT_GIT_REPOS_DIR to default # Copies patches from QT_GIT_REPOS_DIR to default
# variant of specified repo and outputs altered source and # variant of specified repo and updates sources and checksums
# md5sums arrays
#set -euxo pipefail #set -euxo pipefail
set -e # abort on first error set -e # abort on first error
@ -35,50 +34,73 @@ new_sources=()
new_md5sums=() new_md5sums=()
file_index=0 file_index=0
for source in "${source[@]}"; do for source in "${source[@]}"; do
[ "${source: -6}" != .patch ] && \ [ "${source: -6}" != .patch ] && \
new_sources+=("$source") \ new_sources+=("$source") \
new_md5sums+=("${sha256sums[$file_index]}") new_md5sums+=("${sha256sums[$file_index]}")
file_index=$((file_index + 1)) file_index=$((file_index + 1))
done done
patches=("$dest"/*.patch) patches=("$dest"/*.patch)
#for patch in "${patches[@]}"; do
# new_sources+=("$patch")
#done
for patch in "${patches[@]}"; do for patch in "${patches[@]}"; do
[[ -f $patch ]] && rm "$patch" [[ -f $patch ]] && rm "$patch"
done done
pushd "$wd" > /dev/null pushd "$wd" > /dev/null
git checkout "${pkgver}-${variant}" git status # do some Git stuff just to check whether it is a Git repo
remote= if ! git checkout "${pkgver}-${variant}"; then
for maybe_remote in 'origin' 'upstream' 'martchus'; do echo "No patches required for $1, skipping."
if git remote get-url $maybe_remote; then exit 0
remote=$maybe_remote fi
break
fi
done
git format-patch "v${pkgver}" --output-directory "$dest" git format-patch "v${pkgver}" --output-directory "$dest"
popd > /dev/null popd > /dev/null
new_patches=("$dest"/*.patch) new_patches=("$dest"/*.patch)
for patch in "${new_patches[@]}"; do for patch in "${new_patches[@]}"; do
new_sources+=("$patch") new_sources+=("$patch")
sum=$(sha256sum "$patch") sum=$(sha256sum "$patch")
new_md5sums+=(${sum%% *}) new_md5sums+=(${sum%% *})
done done
echo -n "source=(\"${new_sources[0]}\"" # preserve first src line to keep variables unevaluated
newsrc=$(grep 'source=(' "$dest/PKGBUILD")
[[ $newsrc ]] || newsrc="source=(${new_sources[0]}"
for source in "${new_sources[@]:1}"; do for source in "${new_sources[@]:1}"; do
echo newsrc+="\n '${source##*/}'"
echo -n " '${source##*/}'"
done done
echo ')' newsrc+=')'
echo -n "sha256sums=('${new_md5sums[0]}'" newsums="sha256sums=('${new_md5sums[0]}'"
for sum in "${new_md5sums[@]:1}"; do for sum in "${new_md5sums[@]:1}"; do
echo newsums+="\n '${sum}'"
echo -n " '${sum}'"
done done
echo ')' newsums+=')'
# apply changes
mv "$dest/PKGBUILD" "$dest/PKGBUILD.bak"
awk -v newsrc="$newsrc" -v newsums="$newsums" '
/^[[:blank:]]*source(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ {
if (!s) {
print newsrc
s++
}
next
}
/^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ {
if (!w) {
print newsums
w++
}
next
}
1
END {
if (!s) {
print newsrc
}
if (!w) {
print newsums
}
}
' "$dest/PKGBUILD.bak" > "$dest/PKGBUILD"

View File

@ -5,11 +5,7 @@
set -e # abort on first error set -e # abort on first error
master="${1:-mingw-w64}" master="${1:-mingw-w64}"
if [[ ! $master ]]; then if [ $# -gt 1 ]; then
# no default here to prevent unintented use
echo "Error: no master specified"
exit -1
elif [ $# -gt 1 ]; then
echo "Error: too many arguments specified" echo "Error: too many arguments specified"
echo "Usage: $0 master_dir" echo "Usage: $0 master_dir"
exit -2 exit -2
@ -18,9 +14,9 @@ elif [[ ! -d $master ]]; then
exit -3 exit -3
fi fi
for dir in *; do for dir in mingw-w64 mingw-w64-*; do
if [[ $dir != $master ]] && [[ -d $dir ]]; then if [[ $dir != $master ]] && [[ -d $dir ]]; then
rm "$dir/"* # clean first (files might have been remove in master) rm "$dir/"* # clean first (files might have been removed in master)
cp "$master/"* "$dir" cp "$master/"* "$dir"
sed -e '/pkgname=mingw-w64-qt5-base/{c\pkgname=mingw-w64-qt5-base'${dir#mingw-w64} -e ';d}' "$master/PKGBUILD" > "$dir/PKGBUILD" sed -e '/pkgname=mingw-w64-qt5-base/{c\pkgname=mingw-w64-qt5-base'${dir#mingw-w64} -e ';d}' "$master/PKGBUILD" > "$dir/PKGBUILD"
fi fi