fetch2/git: Add a warning asking users to set a branch in git urls
PATCH 1/1 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.
--- lib/bb/fetch2/git.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/fetch2/git.py +4 -1
@@ -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)
Signature · 1 line
2.32.0
Quoted 16 lines · Richard Purdie
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 <[email protected]>--- lib/bb/fetch2/git.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)lib/bb/fetch2/git.py +0
-0
lib/bb/fetch2/git.py class Git(FetchMethod): · line 173
Quoted 10 lines
lib/bb/fetch2/git.py +4
-1@@ -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
Quoted 38 lines
-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie
Sent: den 29 oktober 2021 14:58
To: [email protected]
Subject: [bitbake-devel] [PATCH] fetch2/git: Add a warning asking users to set a branch in git urlsThere 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 <[email protected]>--- lib/bb/fetch2/git.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)lib/bb/fetch2/git.py +3
-1@@ -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. Theuncertainty 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)
Quoted 2 lines
--
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