[LEDE-DEV] [PATCH] sdk: Fix src-git URL for the base feed when on a detached commit (FS#501)

Baptiste Jonglez baptiste at bitsofnetworks.org
Sun Feb 12 13:11:13 PST 2017


From: Baptiste Jonglez <git at bitsofnetworks.org>

When the source repository is on a detached commit (such as when building
a release tag), the git URL for the "base" feed is incorrect in the SDK.

Before this commit:

  On branch "master":      src-git base git://git.lede-project.org/source
  On branch "lede-17.01":  src-git base git://git.lede-project.org/source;lede-17.01
  On tag "v17.01.0-rc2":   src-git base git://git.lede-project.org/source;HEAD  <-- incorrect

After this commit:

  On branch "master":      src-git base git://git.lede-project.org/source;master
  On branch "lede-17.01":  src-git base git://git.lede-project.org/source;lede-17.01
  On tag "v17.01.0-rc2":   src-git base git://git.lede-project.org/source^28b7d7f1dac725157c19236b8899e1c97f19cee9

Notice that the "master" branch is now explicitly expanded: this is just
to simplify the new code.

Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
---
 target/sdk/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 719b659d25..34755b2096 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -38,9 +38,10 @@ 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_BRANCH:=$(filter-out HEAD,$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null))
+GIT_DETACHED_COMMIT:=$(shell git rev-parse HEAD 2>/dev/null)
 
-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),^$(GIT_DETACHED_COMMIT)))
 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)))
-- 
2.11.1




More information about the Lede-dev mailing list