summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-18 11:04:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-19 11:46:30 +0000
commit18a533bfe6d4d5020c0252f9aecf6fc4abda672e (patch)
treef59f92b430d1f39fcdb250927314e11d9e715051 /bitbake/lib/bb/fetch2/__init__.py
parente8e34a04ce283bd41591dcc6ae8d6e8094d489e0 (diff)
downloadpoky-18a533bfe6d4d5020c0252f9aecf6fc4abda672e.tar.gz
bitbake: fetch/git: Rework tag parameter handling
Currently bitbake disallows tag parameters along with revision parameters. This isn't great since quite often, we'd like to verify that a given revision does match some tag. At the same time we don't want to or need to access the network to verify this, which normally a tag would require. Rework the code so that tag and revisions can both be specified together. Verify that any tag specified matches the revision in use at unpack time. This means we can start requiring people to put tags in git SRC_URIs when revisions are used, making review a little easier that it isn't some random revision. The test that is dropped looks like a different test but the comment is a copy and paste error. The SRCREV/rev mismatch test remains, this removes the rev and tag set test. (Bitbake rev: d591d7633fe8d739ec00395920e44910b0b77e27) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 5aa67accc3..cfbbce5288 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1248,20 +1248,17 @@ def srcrev_internal_helper(ud, d, name):
1248 if srcrev and srcrev != "INVALID": 1248 if srcrev and srcrev != "INVALID":
1249 break 1249 break
1250 1250
1251 if 'rev' in ud.parm and 'tag' in ud.parm: 1251 if 'rev' in ud.parm:
1252 raise FetchError("Please specify a ;rev= parameter or a ;tag= parameter in the url %s but not both." % (ud.url)) 1252 parmrev = ud.parm['rev']
1253
1254 if 'rev' in ud.parm or 'tag' in ud.parm:
1255 if 'rev' in ud.parm:
1256 parmrev = ud.parm['rev']
1257 else:
1258 parmrev = ud.parm['tag']
1259 if srcrev == "INVALID" or not srcrev: 1253 if srcrev == "INVALID" or not srcrev:
1260 return parmrev 1254 return parmrev
1261 if srcrev != parmrev: 1255 if srcrev != parmrev:
1262 raise FetchError("Conflicting revisions (%s from SRCREV and %s from the url) found, please specify one valid value" % (srcrev, parmrev)) 1256 raise FetchError("Conflicting revisions (%s from SRCREV and %s from the url) found, please specify one valid value" % (srcrev, parmrev))
1263 return parmrev 1257 return parmrev
1264 1258
1259 if 'tag' in ud.parm and (srcrev == "INVALID" or not srcrev):
1260 return ud.parm['tag']
1261
1265 if srcrev == "INVALID" or not srcrev: 1262 if srcrev == "INVALID" or not srcrev:
1266 raise FetchError("Please set a valid SRCREV for url %s (possible key names are %s, or use a ;rev=X URL parameter)" % (str(attempts), ud.url), ud.url) 1263 raise FetchError("Please set a valid SRCREV for url %s (possible key names are %s, or use a ;rev=X URL parameter)" % (str(attempts), ud.url), ud.url)
1267 if srcrev == "AUTOINC": 1264 if srcrev == "AUTOINC":