build: Backport "generate strictly increasing git revisions"

Enhance luci-0.12's build/mkrevision.sh by backporting
the code to generate strictly increasing git revisions:
0856030c79

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
Hannu Nyman 2014-11-15 12:11:46 +02:00
parent 54c869aa00
commit 177bd6edf1

View file

@ -14,7 +14,10 @@ TOPDIR="${0%mkrevision.sh}"
elif git log -1 >/dev/null 2>/dev/null; then
revision="svn-r$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"
if [ "$revision" = "svn-r" ]; then
revision="git-$(LC_ALL=C git log -1 --pretty=%h)"
set -- $(git log -1 --format="%ct %h")
secs="$(($1 % 86400))"
yday="$(date --utc --date="@$1" "+%y.%j")"
revision="$(printf 'git-%s.%05d-%s' "$yday" "$secs" "$2")"
fi
else
revision="unknown"