summaryrefslogtreecommitdiff
path: root/textproc/libkolabxml/files/create_libkolabxml_release.sh
diff options
context:
space:
mode:
authorJason E. Hale <jhale@FreeBSD.org>2023-09-22 21:53:59 -0400
committerJason E. Hale <jhale@FreeBSD.org>2023-09-22 22:10:25 -0400
commit04cfaff8c84d18d6ce14583ae6a24c0e5b2f0e88 (patch)
tree91e60dd65eefb1ae6295206adbf4ac81531ddf0c /textproc/libkolabxml/files/create_libkolabxml_release.sh
parentx11-wm/hyprland: update to 0.30.0 (diff)
textproc/libkolabxml: Update to 1.2.1
Upstream doesn't seem to put out pre-made releases anymore and the distfiles are gone for the previous version as it is, so we're rolling our own now from the official git repository. Add script and 'create-distfile' target to make future updates easier. Update WWW and LICENSE
Diffstat (limited to 'textproc/libkolabxml/files/create_libkolabxml_release.sh')
-rw-r--r--textproc/libkolabxml/files/create_libkolabxml_release.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/textproc/libkolabxml/files/create_libkolabxml_release.sh b/textproc/libkolabxml/files/create_libkolabxml_release.sh
new file mode 100644
index 000000000000..97aa044ded9e
--- /dev/null
+++ b/textproc/libkolabxml/files/create_libkolabxml_release.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Creates and updates a git checkout in ${BASE_DIRECTORY} for libkolabxml.
+# After that, a new distfile for the ports tree is created.
+
+PROJECT=libkolabxml
+BASE_DIRECTORY="$1"
+VERSION="$2"
+
+# Remote libkolabxml git repository
+REPO="https://git.kolab.org/diffusion/LKX/${PROJECT}.git"
+# Local checkout
+CHECKOUT="${BASE_DIRECTORY}/${PROJECT}"
+# Use the default branch
+BRANCH=master
+
+# Make sure we can use ${BASE_DIRECTORY}
+if [ ! -d "${BASE_DIRECTORY}" ] || [ ! -w "${BASE_DIRECTORY}" ] ; then
+ echo "Directory '${BASE_DIRECTORY}' does not exist"
+ exit 1
+fi
+
+# Init a new git checkout if it is missing
+if [ ! -d "${CHECKOUT}" ] ; then
+ git -C "${BASE_DIRECTORY}" clone "${REPO}"
+fi
+
+# Update the checkout of the required branch
+git -C "${CHECKOUT}" checkout "${BRANCH}" && \
+git -C "${CHECKOUT}" pull --ff-only --rebase --autostash && \
+git -C "${CHECKOUT}" fetch --tags
+if [ $? -ne 0 ] ; then
+ echo "Failed to update ${CHECKOUT}"
+ exit 1
+fi
+
+# Set up information for the distfile
+DISTNAME="${PROJECT}-${VERSION}"
+DISTFILE="${BASE_DIRECTORY}/${DISTNAME}.tar.xz"
+
+# Tar and compress distfile
+git -C ${CHECKOUT} archive --format=tar --prefix="${DISTNAME}/" "${DISTNAME}" | xz > "${DISTFILE}"
+if [ $? -ne 0 ] ; then
+ echo "Failed to create tarball ${DISTFILE}"
+ exit 1
+fi
+
+# Print out distfile information
+echo -e "Distfile:\t${DISTFILE}"