From dee8f31c89493647476e05aa6847ab77c727871a Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Thu, 20 Jul 2023 17:47:15 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Further=20preparations=20for=20auto?= =?UTF-8?q?matic=20package=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoupdate.sh | 20 ++++++++++++++++++++ update-new-version.sh | 26 +++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 autoupdate.sh diff --git a/autoupdate.sh b/autoupdate.sh new file mode 100755 index 0000000..f4a068b --- /dev/null +++ b/autoupdate.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -euo pipefail + +dir="$(find . -maxdepth 1 -type d -name "intellij-idea-*")" +pushd "$dir" || exit 1 + +check="$(uscan --dehs --no-download)" +status="$(echo "$check" | xmllint --xpath 'string(/dehs/status)' -)" + +if [[ "$status" != "newer package available" ]]; then + echo "No newer package available." + exit +fi + +new_version="$(echo "$check" | xmllint --xpath 'string(/dehs/upstream-version)' -)" + +popd + +./update-new-version.sh --autoupdate "$new_version" diff --git a/update-new-version.sh b/update-new-version.sh index e4db97b..21dee98 100755 --- a/update-new-version.sh +++ b/update-new-version.sh @@ -1,6 +1,8 @@ #!/bin/bash # # This script intends to decrease the effort of updating the package. +# +# Passing "--autoupdate" as first argument triggers automatic Git operations. set -euo pipefail @@ -16,7 +18,15 @@ DISTRIBUTION="lunar" last_tag=$(git describe --abbrev=0 --tags) old="${last_tag#?}" -new="$1" + +if [ "$1" = "--autoupdate" ]; then + new="$2" + autoupdate="y" +else + new="$1" + autoupdate="n" +fi + name="$(git config --get user.name)" email="$(git config --get user.email)" @@ -41,3 +51,17 @@ debuild -us -uc cd .. rm "$PACKAGE"_"$old"-* + +if [ "$autoupdate" = "n" ]; then + exit +fi + +git add -A +git commit -m "Upstream version $new" + +git switch main +git merge --ff-only version-"$new" +git push origin main + +git tag -a v"$new" "Upstream version $new" +git push --tags origin main