Further preparations for automatic package updates

Refs: #8
This commit is contained in:
Marcel Kapfer 2023-07-19 23:24:10 +02:00
parent fedd17ea8b
commit 76e7de6d53
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09
3 changed files with 43 additions and 25 deletions

20
autoupdate.sh Executable file
View file

@ -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"

View file

@ -1,6 +1,8 @@
#!/bin/bash #!/usr/bin/env bash
# #
# This script intends to decrease the effort of updating the package. # This script intends to decrease the effort of updating the package.
#
# Passing "--autoupdate" as first argument triggers automatic Git operations.
set -euo pipefail set -euo pipefail
@ -16,7 +18,15 @@ DISTRIBUTION="lunar"
last_tag=$(git describe --abbrev=0 --tags) last_tag=$(git describe --abbrev=0 --tags)
old="${last_tag#?}" old="${last_tag#?}"
if [ "$1" = "--autoupdate" ]; then
new="$2"
autogit="y"
else
new="$1" new="$1"
autogit="n"
fi
name="$(git config --get user.name)" name="$(git config --get user.name)"
email="$(git config --get user.email)" email="$(git config --get user.email)"
@ -41,3 +51,14 @@ debuild -us -uc
cd .. cd ..
rm "$PACKAGE"_"$old"-* rm "$PACKAGE"_"$old"-*
if [ "$autogit" = "n" ]; then
exit
fi
git switch main
git merge --ff-only version-"$new"
git push origin main
git tag -s v"$new" "Upstream version $new"
git push --tags origin main

View file

@ -1,23 +0,0 @@
#!/bin/bash
cd /tmp
if [[ -d intellij ]]; then
echo "An 'intellij' directory already exists. Aborting..."
fi
git clone -q https://gitlab.com/mmk2410/intellij-idea-community.git intellij
cd intellij
uscan --nodownload
RESULT=$?
if [[ $RESULT -eq 0 ]]; then
echo "New IntelliJ IDEA Version" | mail -s "New IntelliJ IDEA Version" opensource@mmk2410.org
fi
cd ..
rm -rf intellij
exit $RESULT