diff mbox

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

Message ID 20170212211113.9495-1-baptiste@bitsofnetworks.org
State Superseded
Headers show

Commit Message

Baptiste Jonglez Feb. 12, 2017, 9:11 p.m. UTC
From: Baptiste Jonglez <git@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@bitsofnetworks.org>
---
 target/sdk/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Karl Palsson Feb. 13, 2017, 10:06 a.m. UTC | #1
Baptiste Jonglez <baptiste@bitsofnetworks.org> wrote:
> From: Baptiste Jonglez <git@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

I'd prefer if you could make it...

On tag "v17.01.0-rc2": src-git base
git://git.lede-project.org/source;v17.01.0-rc2

rather than the hash. Tags work just fine there, I've been using
that locally for my own tags, and it's much "nicer" than just the
hash.

Cheers,
Karl P


> 
> Notice that the "master" branch is now explicitly expanded:
> this is just to simplify the new code.
> 
> Signed-off-by: Baptiste Jonglez <git@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
> 
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
diff mbox

Patch

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)))