All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls
@ 2021-10-29 12:57 Richard Purdie
  2021-10-29 13:00 ` [bitbake-devel] " Robert P. J. Day
  2021-10-29 18:49 ` Peter Kjellerstedt
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Purdie @ 2021-10-29 12:57 UTC (permalink / raw)
  To: bitbake-devel

There is much uncertainty around what tools and hosting providers will
do about default git branch naming in the future. To help ensure we
can handle the various scenarios, we will make branch names required in
SRC_URI. To start that process, show users a warning if it isn't set.
This may also allow us to change the default at some point in the future.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 51b616bad7..17a7927e52 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -165,7 +165,10 @@ class Git(FetchMethod):
             ud.nocheckout = 1
   
         ud.unresolvedrev = {}
-        branches = ud.parm.get("branch", "master").split(',')
+        branches = ud.parm.get("branch", "").split(',')
+        if branches == [""]:
+            bb.warn("URL: %s does not have any branch set. The uncertainty around the default branch used by tools and repositories means we will soon require this in all git urls so please add it." % ud.url)
+            branches = ["master"]
         if len(branches) != len(ud.names):
             raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
 
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [bitbake-devel] [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls
  2021-10-29 12:57 [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls Richard Purdie
@ 2021-10-29 13:00 ` Robert P. J. Day
  2021-10-29 18:49 ` Peter Kjellerstedt
  1 sibling, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2021-10-29 13:00 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

On Fri, 29 Oct 2021, Richard Purdie wrote:

> There is much uncertainty around what tools and hosting providers will
> do about default git branch naming in the future. To help ensure we
> can handle the various scenarios, we will make branch names required in
> SRC_URI. To start that process, show users a warning if it isn't set.
> This may also allow us to change the default at some point in the future.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/fetch2/git.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 51b616bad7..17a7927e52 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -165,7 +165,10 @@ class Git(FetchMethod):
>              ud.nocheckout = 1
>
>          ud.unresolvedrev = {}
> -        branches = ud.parm.get("branch", "master").split(',')
> +        branches = ud.parm.get("branch", "").split(',')
> +        if branches == [""]:
> +            bb.warn("URL: %s does not have any branch set. The uncertainty around the default branch used by tools and repositories means we will soon require this in all git urls so please add it." % ud.url)
> +            branches = ["master"]
>          if len(branches) != len(ud.names):
>              raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)

  pedantically, i would "git urls" -> "Git URLs".

rday


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [bitbake-devel] [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls
  2021-10-29 12:57 [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls Richard Purdie
  2021-10-29 13:00 ` [bitbake-devel] " Robert P. J. Day
@ 2021-10-29 18:49 ` Peter Kjellerstedt
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Kjellerstedt @ 2021-10-29 18:49 UTC (permalink / raw)
  To: Richard Purdie, bitbake-devel

> -----Original Message-----
> From: bitbake-devel@lists.openembedded.org <bitbake-
> devel@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 29 oktober 2021 14:58
> To: bitbake-devel@lists.openembedded.org
> Subject: [bitbake-devel] [PATCH] fetch2/git: Add a warning asking users to
> set a branch in git urls
> 
> There is much uncertainty around what tools and hosting providers will
> do about default git branch naming in the future. To help ensure we
> can handle the various scenarios, we will make branch names required in
> SRC_URI. To start that process, show users a warning if it isn't set.
> This may also allow us to change the default at some point in the future.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/fetch2/git.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 51b616bad7..17a7927e52 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -165,7 +165,10 @@ class Git(FetchMethod):
>              ud.nocheckout = 1
> 
>          ud.unresolvedrev = {}
> -        branches = ud.parm.get("branch", "master").split(',')
> +        branches = ud.parm.get("branch", "").split(',')
> +        if branches == [""]:
> +            bb.warn("URL: %s does not have any branch set. The
> uncertainty around the default branch used by tools and repositories means
> we will soon require this in all git urls so please add it." % ud.url)
> +            branches = ["master"]
>          if len(branches) != len(ud.names):
>              raise bb.fetch2.ParameterError("The number of name and branch
> parameters is not balanced", ud.url)
> 
> --
> 2.32.0

What about nobranch=1? We use that for all our Git recipes (~1500). I would 
really hate to have to add branch=master to all of them when we really do 
not care about what branch the SRCREV happens to be on (especially as it 
often is a Gerrit review reference).

//Peter



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-29 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 12:57 [PATCH] fetch2/git: Add a warning asking users to set a branch in git urls Richard Purdie
2021-10-29 13:00 ` [bitbake-devel] " Robert P. J. Day
2021-10-29 18:49 ` Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.