upd.sh: check appliability of patches

This commit is contained in:
Mikhail Novosyolov 2021-11-28 23:23:15 +03:00
parent 983dcda7c5
commit cf52b012a2

17
upd.sh
View file

@ -1,11 +1,15 @@
#!/usr/bin/env bash
# Script to partly automate updating this package
# sudo dnf install /usr/bin/rpmbuild /usr/bin/spectool /usr/bin/rpmspec /usr/bin/git /usr/bin/curl /usr/bin/abf
set -x
set -e
set -f
set -u
# try to avoid asking for password in `sudo mount -t tmpfs <...>`
#sudo echo
spec=chromium-browser-stable.spec
old_version="$(rpmspec -q --srpm --qf '%{version}' "$spec")"
@ -31,6 +35,15 @@ sed -E -i'' "$spec" \
--
spectool --get-files --source 0,1101,1102 "$spec"
# check appliability of patches
patches_ok=0
# unpack >8 GiB of source code, I do not have so much RAM to store it in tmpfs
tmp="$(mktemp --tmpdir=/var/tmp -d)"
#sudo mount -t tmpfs -o size=30G tmpfs "$tmp"
trap 'if [ "$patches_ok" = 1 ]; then rm -fr "$tmp"; fi' EXIT
rpmbuild --define "_sourcedir $PWD" --define "_builddir $tmp" -bp "$spec" && patches_ok=1
sed -i'' .abf.yml -e '/^ chromium-/d' -e '/^ msspi-/d'
abf put -n
# abf put erronously uploads *.json
@ -40,3 +53,7 @@ sed -i'' .abf.yml -e '/^ master_preferences.json/d'
PAGER='' git diff
# can be copypasted for a commit message
echo "upd: $old_version -> $latest_version"
if [ "$patches_ok" = 0 ]; then
echo "PATCHES require attention!"
fi