[LEDE-DEV] [PATCH] scripts: getver.sh: include branch name in a revision string

Rafał Miłecki zajec5 at gmail.com
Thu Jun 22 01:50:28 PDT 2017


From: Rafał Miłecki <rafal at milecki.pl>

The purpose of revision (r* number) is to provide a rough info about
build next to the (very) specific SHA-1. Unfortunately without a branch
name specified it's a bit misleading and what's more two commits may get
the same revision, e.g.:

For master branch:
./scripts/getver.sh bb9d2aa868
r3438-bb9d2aa868

For lede-17.01 branch:
./scripts/getver.sh 2e206c79cc
r3438-2e206c79cc

This can be solved by prepending a branch name so above example would
look like this:

./scripts/getver.sh 2e206c79cc
master-r2993+445-b9a408c2b4

Another option is to simply use "git describe" but it doesn't provide
info on amount of local commits so let's stick to own method for now.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 scripts/getver.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/getver.sh b/scripts/getver.sh
index 9175f411db..479cf25b7d 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -40,7 +40,7 @@ try_git() {
 			REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
 		fi
 
-		REV="${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
+		REV="${BRANCH}-${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
 
 		;;
 	esac
-- 
2.11.0




More information about the Lede-dev mailing list