aboutsummaryrefslogtreecommitdiffstats
path: root/target/sdk/Makefile
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-01-20 09:51:38 +0100
committerJo-Philipp Wich <jo@mein.io>2017-01-20 10:10:54 +0100
commitdab6338b47c1a8c9e8d7b34fd7bbaa53672e8894 (patch)
tree39a0700883c37f8b1e7a73f2f9c4ca41a3669c00 /target/sdk/Makefile
parent261415a660c12a5673fe3d48dabaf677e1d5c32c (diff)
downloadupstream-dab6338b47c1a8c9e8d7b34fd7bbaa53672e8894.tar.gz
upstream-dab6338b47c1a8c9e8d7b34fd7bbaa53672e8894.tar.bz2
upstream-dab6338b47c1a8c9e8d7b34fd7bbaa53672e8894.zip
sdk: fix Git URL detection
Instead of relying on complex sed patterns that trip up make syntax rules, use GNU Makes builtin filter function to match desired URLs. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'target/sdk/Makefile')
-rw-r--r--target/sdk/Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index c93e317458..47a7382d24 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -36,10 +36,13 @@ SDK_DIRS = \
$(STAGING_SUBDIR_HOST) \
$(STAGING_SUBDIR_TOOLCHAIN)
-BASE_FEED:=$(shell git config --get remote.origin.url 2>/dev/null | sed -ne '\#\(git\|http\|https\)://#s/^/src-git base /p')
+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))
+
+BASE_FEED:=$(if $(GIT_URL),src-git base $(GIT_URL)$(if $(GIT_BRANCH),;$(GIT_BRANCH)))
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$(filter-out ;master,;$(shell git rev-parse --abbrev-ref HEAD)))
+BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git base https://git.lede-project.org/source.git$(if $(GIT_BRANCH),;$(GIT_BRANCH)))
KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))