2016-09-19 22:18:45 +02:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2017-06-02 18:20:04 +02:00
|
|
|
# Copies patches from QT_GIT_REPOS_DIR to default
|
|
|
|
# variant of specified repo and outputs altered source and
|
2016-09-19 22:18:45 +02:00
|
|
|
# md5sums arrays
|
|
|
|
|
2017-01-23 21:37:13 +01:00
|
|
|
#set -euxo pipefail
|
2016-09-19 22:18:45 +02:00
|
|
|
set -e # abort on first error
|
|
|
|
shopt -s nullglob
|
|
|
|
|
2017-01-23 21:37:13 +01:00
|
|
|
if ! [[ $1 ]]; then
|
2017-06-02 18:20:04 +02:00
|
|
|
echo 'No Qt repo specified - must be specified like eg. base or multimedia.'
|
2017-07-31 22:27:37 +02:00
|
|
|
echo "Usage: $0 repo [variant=mingw-w64]"
|
2017-01-23 21:37:13 +01:00
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pkg="qt5-$1"
|
|
|
|
repo="qt$1"
|
2017-07-31 22:27:37 +02:00
|
|
|
variant="${2:-mingw-w64}"
|
|
|
|
dest="${DEFAULT_PKGBUILDS_DIR}/${pkg}/${variant}"
|
2017-01-23 21:37:13 +01:00
|
|
|
wd="${QT_GIT_REPOS_DIR}/${repo}"
|
2016-09-19 22:18:45 +02:00
|
|
|
|
2017-06-02 18:20:04 +02:00
|
|
|
if ! [[ -d $wd ]]; then
|
|
|
|
echo "\$QT_GIT_REPOS_DIR/$repo is no directory."
|
|
|
|
exit -2
|
|
|
|
fi
|
|
|
|
if ! [[ -d $dest ]]; then
|
2017-07-31 22:27:37 +02:00
|
|
|
echo "\$DEFAULT_PKGBUILDS_DIR/$pkg/${variant} is no directory."
|
2017-06-02 18:20:04 +02:00
|
|
|
exit -3
|
|
|
|
fi
|
|
|
|
|
2016-09-19 22:18:45 +02:00
|
|
|
source "$dest/PKGBUILD"
|
|
|
|
|
|
|
|
new_sources=()
|
|
|
|
new_md5sums=()
|
|
|
|
file_index=0
|
|
|
|
for source in "${source[@]}"; do
|
|
|
|
[ "${source: -6}" != .patch ] && \
|
|
|
|
new_sources+=("$source") \
|
2017-06-02 18:20:04 +02:00
|
|
|
new_md5sums+=("${sha256sums[$file_index]}")
|
2016-09-19 22:18:45 +02:00
|
|
|
file_index=$((file_index + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
patches=("$dest"/*.patch)
|
2017-01-23 21:37:13 +01:00
|
|
|
#for patch in "${patches[@]}"; do
|
|
|
|
# new_sources+=("$patch")
|
|
|
|
#done
|
2016-09-19 22:18:45 +02:00
|
|
|
|
|
|
|
for patch in "${patches[@]}"; do
|
2017-01-23 21:37:13 +01:00
|
|
|
[[ -f $patch ]] && rm "$patch"
|
2016-09-19 22:18:45 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
pushd "$wd" > /dev/null
|
2017-07-31 22:27:37 +02:00
|
|
|
git checkout "${pkgver}-${variant}"
|
2017-06-02 18:20:04 +02:00
|
|
|
remote=
|
2017-07-31 22:27:37 +02:00
|
|
|
for maybe_remote in 'origin' 'upstream' 'martchus'; do
|
2017-06-02 18:20:04 +02:00
|
|
|
if git remote get-url $maybe_remote; then
|
|
|
|
remote=$maybe_remote
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2017-07-31 22:27:37 +02:00
|
|
|
git format-patch "v${pkgver}" --output-directory "$dest"
|
2016-09-19 22:18:45 +02:00
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
new_patches=("$dest"/*.patch)
|
|
|
|
for patch in "${new_patches[@]}"; do
|
|
|
|
new_sources+=("$patch")
|
2017-06-02 18:20:04 +02:00
|
|
|
sum=$(sha256sum "$patch")
|
2016-09-19 22:18:45 +02:00
|
|
|
new_md5sums+=(${sum%% *})
|
|
|
|
done
|
|
|
|
|
2017-01-23 21:37:13 +01:00
|
|
|
echo -n "source=(\"${new_sources[0]}\""
|
2016-09-19 22:18:45 +02:00
|
|
|
for source in "${new_sources[@]:1}"; do
|
|
|
|
echo
|
|
|
|
echo -n " '${source##*/}'"
|
|
|
|
done
|
|
|
|
echo ')'
|
|
|
|
|
2017-06-02 18:20:04 +02:00
|
|
|
echo -n "sha256sums=('${new_md5sums[0]}'"
|
2016-09-19 22:18:45 +02:00
|
|
|
for sum in "${new_md5sums[@]:1}"; do
|
|
|
|
echo
|
2017-06-02 18:20:04 +02:00
|
|
|
echo -n " '${sum}'"
|
2016-09-19 22:18:45 +02:00
|
|
|
done
|
|
|
|
echo ')'
|