diff options
| author | Carlos Maiolino <[email protected]> | 2024-05-31 10:55:57 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2024-05-31 10:55:57 +0200 |
| commit | c24810c3d5f07c076241b8fd5d912c1136c2cf80 (patch) | |
| tree | 6c1f906de6212897559a28260d28670233988dd8 /bin/xfs-release.sh | |
| parent | 47b7016ed5ac6dd8efc041060d62e632e937a6d2 (diff) | |
Add a few extra scripts and move them to bin/
Diffstat (limited to 'bin/xfs-release.sh')
| -rwxr-xr-x | bin/xfs-release.sh | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/bin/xfs-release.sh b/bin/xfs-release.sh new file mode 100755 index 0000000..105c4a6 --- /dev/null +++ b/bin/xfs-release.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +#Maintainer info +MAINTAINER_EMAIL="[email protected]" +MAINTAINER_NAME="Carlos Maiolino" + +SOURCE=$PWD + +#Files +VERSION_FILE="$SOURCE/VERSION" +CONFIGURE_FILE="$SOURCE/configure.ac" +DEBIAN_FILE="$SOURCE/debian/changelog" +CHANGES_FILE="$SOURCE/doc/CHANGES" + +VER_MAJ="$1" +VER_MIN="$2" +VER_REV="$3" + +REL_VER="$VER_MAJ.$VER_MIN.$VER_REV" +REL_TAG="v$VER_MAJ.$VER_MIN.$VER_REV" + +#OLD_VER here points to the previous released tag +OLD_TAG=$4 + +usage() { + echo "./xfsprogs_release.sh <mav_ver> <min_ver> <revision> <old_git_tag>" + exit +} + +## UPDATE VERSIONING ## +update_version_file() { + sed -i -e "s/^PKG_MAJOR=.*/PKG_MAJOR=$VER_MAJ/" $VERSION_FILE + sed -i -e "s/^PKG_MINOR=.*/PKG_MINOR=$VER_MIN/" $VERSION_FILE + sed -i -e "s/^PKG_REVISION=.*/PKG_REVISION=$VER_REV/" $VERSION_FILE +} + +update_configure_file() { + CONF_AC="AC_INIT([xfsprogs],[$REL_VER],[[email protected]])" + sed -i "s/^AC_INIT.*/$CONF_AC/" $CONFIGURE_FILE +} + +# Update is done in 'reverse order', so the script can always update the first +# line of the file, just to KISS. +update_debian_changelog() { + sed -i "1s/^/\n/" $DEBIAN_FILE + sed -i "1s/^/ -- Nathan Scott <[email protected]> $(date -R)\n/" $DEBIAN_FILE + sed -i "1s/^/\n/" $DEBIAN_FILE + + sed -i "1s/^/ * New upstream release\n/" $DEBIAN_FILE + sed -i "1s/^/\n/" $DEBIAN_FILE + sed -i "1s/^/xfsprogs ($VER_MAJ.$VER_MIN.$VER_REV) unstable; urgency=low\n/" $DEBIAN_FILE +} + +update_changes_file() { + + TMP_FILE=$(mktemp) + git log --oneline --reverse --format="%s (%an)" $OLD_TAG.. > $TMP_FILE + + while read -r line; do + sed -i "1s/^/\t$line\n/" $CHANGES_FILE + done < $TMP_FILE + + rm -f $TMP_FILE +} + +create_signed_tag() { + git tag -s -u $MAINTAINER_EMAIL -m "Release $REL_RAG" $REL_TAG +} + +create_and_push_tarball() { + kup put xfsprogs-$REL_VER.tar.gz xfsprogs-$REL_VER.tar.sign \ + pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-$REL_VER.tar.gz +} + +is_xfsprogs_repo() { + if [ -a $SOURCE/README ] && \ + [ "$(head -1 $SOURCE/README)" == "XFS User Tools README" ]; then + return 0 + else + echo "Current dir not a xfsprogs repository" + usage + exit 1 + fi +} + + +### PROGRAM STARTS HERE ### +# Ensure we are withing a xfsprogs repository: +is_xfsprogs_repo + +# MAJ, MIN, REV, OLD_TAG +if [ $# -ne 4 ]; then + echo "Invalid number of arguments" + usage + exit 1 +fi + +# Update files for new release + +#echo "Updating config.ac file..." +#update_configure_file +#echo "...done" +#echo +#echo "Updating debian changelog..." +#update_debian_changelog +#echo "...done" +#echo +#echo "Updating VERSION file..." +#update_version_file +#echo "...done" +#echo + +#echo "Commiting changes..." +#git add $VERSION_FILE $CONFIGURE_FILE $DEBIAN_FILE +# +#git commit -s -m "xfsprogs: Release $REL_TAG" \ +#-m "Update all the necessary files for a $REL_TAG release." +update_changes_file |
