summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-02-19 20:45:11 +0100
committerJo-Philipp Wich <jo@mein.io>2017-02-19 20:47:49 +0100
commit7c9f5c7e6b43650315603db1fe03c1c2fb857135 (patch)
tree70f4c7ed60a1864aa30f7b84ae309927916c6754 /target
parentb65dc04712dfb8cc7bb9036c7c73b0cead6dd7c9 (diff)
downloadmtk-20170518-7c9f5c7e6b43650315603db1fe03c1c2fb857135.zip
mtk-20170518-7c9f5c7e6b43650315603db1fe03c1c2fb857135.tar.gz
mtk-20170518-7c9f5c7e6b43650315603db1fe03c1c2fb857135.tar.bz2
sdk: emit proper tag references for base URLs
Properly resolve symbolic tag names when constructing the base feed Git url and avoid emitting "HEAD" references when building from detached commits. Fixes #495, #501. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'target')
-rw-r--r--target/sdk/Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index ecaa015..a1b6415 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -38,12 +38,14 @@ SDK_DIRS = \
$(STAGING_SUBDIR_TOOLCHAIN)
GIT_URL:=$(filter git://% http://% https://%,$(shell git config --get remote.origin.url 2>/dev/null))
-GIT_BRANCH:=$(filter-out master,$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null))
+GIT_COMMIT:=$(shell git rev-parse HEAD 2>/dev/null)
+GIT_BRANCH:=$(filter-out master HEAD,$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null))
+GIT_TAGNAME:=$(shell git show-ref --tags --dereference 2>/dev/null | sed -ne '/^$(GIT_COMMIT) / { s|^.*/||; s|\^.*||; p }')
-BASE_FEED:=$(if $(GIT_URL),src-git base $(GIT_URL)$(if $(GIT_BRANCH),;$(GIT_BRANCH)))
+BASE_FEED:=$(if $(GIT_URL),src-git base $(GIT_URL)$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME))))
BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C git svn info 2>/dev/null | sed -ne 's/^URL: /src-gitsvn base /p'))
BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C svn info 2>/dev/null | sed -ne 's/^URL: /src-svn base /p'))
-BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git base https://git.lede-project.org/source.git$(if $(GIT_BRANCH),;$(GIT_BRANCH)))
+BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git base https://git.lede-project.org/source.git$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME))))
KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))