From: Hannu Nyman Date: Sun, 30 Apr 2017 08:48:05 +0000 (+0300) Subject: luci.mk: fix length of abbreviated hash in version X-Git-Url: https://git.archive.openwrt.org/?a=commitdiff_plain;h=e3bd7b5ee02a51518752846b8ae66fbabba51734;p=project%2Fluci.git luci.mk: fix length of abbreviated hash in version Fix the length of the abbreviated commit hash used in the LuCI version string used in the package names. Use the old standard of seven characters in hash. New git versions vary the length of the abbreviated commit hash based on the number of objects in repo. That may lead into different hash lengths with e.g. having full/shallow git history, having all/single branch or having different git versions in different build hosts. Different hash lengths in package name may lead to sneaky opkg install errors, as opkg apparently preserves info for removed packages and may prefer that. Signed-off-by: Hannu Nyman (cherry picked from commit b9159c53472d1788284d363dc6ffff8c2542e4be) --- diff --git a/luci.mk b/luci.mk index 137886f1b..7674825b4 100644 --- a/luci.mk +++ b/luci.mk @@ -56,7 +56,7 @@ PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ 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 \ - set -- $$(git log -1 --format="%ct %h"); \ + set -- $$(git log -1 --format="%ct %h" --abbrev=7); \ secs="$$(($$1 % 86400))"; \ yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ revision="$$(printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2")"; \