summaryrefslogtreecommitdiffstats
path: root/makerelease.sh
blob: bb14a9c30a19b83e053fc5480244e7412aca9d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

srcdir="$(dirname "$0")"
[ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"

srcdir="$srcdir" # git repos root

die() { echo "$*"; exit 1; }

# Import the makerelease.lib
# https://bues.ch/cgit/misc.git/plain/makerelease.lib
for path in $(echo "$PATH" | tr ':' ' '); do
	[ -f "$MAKERELEASE_LIB" ] && break
	MAKERELEASE_LIB="$path/makerelease.lib"
done
[ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."

hook_get_version()
{
	local file="$1/libtoprammer/main.py"
	local major="$(cat "$file" | grep -e VERSION_MAJOR | head -n1 | cut -d'=' -f2)"
	local minor="$(cat "$file" | grep -e VERSION_MINOR | head -n1 | cut -d'=' -f2)"
	[ -n "$major" -a -n "$minor" ] ||\
		die "Failed to get version"
	version="$(printf '%d.%d' "$major" "$minor")"
}

project=toprammer
default_archives=py-sdist-xz
makerelease "$@"
bues.ch cgit interface