~strahinja/ste

747980434219b5ed175ff9331d51412de8c88a7a — Страхиња Радић 29 days ago 840b245 v0.7.2
Add got(1) support
3 files changed, 46 insertions(+), 12 deletions(-)

M INSTALL
M lib/makedate
M lib/makeversion
M INSTALL => INSTALL +8 -0
@@ 27,6 27,14 @@ Install
	$ su
	# make install

With got[1]:

	$ got clone https://git.sr.ht/~strahinja/ste
	$ got checkout ste.git
	$ cd ste
	$ su
	# make install


Persistent build configuration file
-----------------------------------

M lib/makedate => lib/makedate +23 -6
@@ 1,12 1,29 @@
#!/bin/sh -x
# vim: set ft=bash:
FALLBACKDATE=${FALLBACKDATE:-unknown}
LC_ALL=C
export LC_ALL
user=$(unalias ls >/dev/null 2>&1 || true; \
	command ls -ld . | awk '{print $3}')
e_user=$(id -un)
if [ -d .git ] && command -v git >/dev/null 2>&1; then
case "$(uname -s)" in
	*OpenBSD*)
		DATEARGS='-j +%B,\ %d\ %Y'
		;;
	*)
		DATEARGS='+%B,\ %d\ %Y'
		;;
esac

if [ -d .got ] && command -v got >/dev/null 2>&1; then
	got tag -l |
	awk '
	/^date: / {
		sub(/^date: /,"",$0)
		print strftime("%B %d, %Y")
		exit
	}' >date.new
elif [ -d .git ] && command -v git >/dev/null 2>&1; then
	LC_ALL=C
	export LC_ALL
	user=$(unalias ls >/dev/null 2>&1 || true; \
		command ls -ld . | awk '{print $3}')
	e_user=$(id -un)
	if [ "$e_user" = "$user" ]; then
		git log --format=format:%cd \
			--date=format:"%B %d, %Y" -1 @ >date.new

M lib/makeversion => lib/makeversion +15 -6
@@ 1,12 1,21 @@
#!/bin/sh -x
# vim: set ft=bash:
FALLBACKVER=${FALLBACKVER:-unknown}
LC_ALL=C
export LC_ALL
user=$(unalias ls >/dev/null 2>&1 || true; \
	command ls -ld . | awk '{print $3}')
e_user=$(id -un)
if [ -d .git ] && command -v git >/dev/null 2>&1; then

if [ -d .got ] && command -v got >/dev/null 2>&1; then
	got tag -l |
	awk '
	/^tag/ {
		sub(/^v/,"",$2)
		print $2
		exit
	}' >version.new
elif [ -d .git ] && command -v git >/dev/null 2>&1; then
	LC_ALL=C
	export LC_ALL
	user=$(unalias ls >/dev/null 2>&1 || true; \
		command ls -ld . | awk '{print $3}')
	e_user=$(id -un)
	if [ "$e_user" = "$user" ]; then
		git describe 2>/dev/null | sed 's/^v//' >version.new
	else