summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-21 14:48:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 13:57:04 +0000
commit04c27888d05e16791cfb5ebc3b51f9f02923775b (patch)
treea7e732b52f22cd44bfb9332e908ce6a6d71c30e9 /bitbake/lib/bb/fetch2/__init__.py
parent2b8761e5fc0cbef8e43a2246450098e9b48413c0 (diff)
downloadpoky-04c27888d05e16791cfb5ebc3b51f9f02923775b.tar.gz
bitbake: fetch2: Add autorev warning when it is set too late
Bitbake expects a consistent metadata environment when it parses. There are plenty of ways you can set a recipe to autorev at a point where parts of the fetcher have already been triggered leading to obsure bugs which I struggled to debug, let alone anyone not familar with the code. If anyone is running into the message from the commit, the issue is likely one of timing. Keep in mind that the anonymous python code in base.bbclass will expand variables like FILESPATH, WORKDIR and others which contain PV. The recipe needs to be set to AUTOREV before that anonymous python runs. In particular, that means you can't set SRCREV = "${AUTOREV}" in other anonymous python, it needs to happen earlier. (Bitbake rev: 4d9ec332d5bfc8b60b54f8ec2a17d34e35aa903a) 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__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 3b96849a25..718b9f2958 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -749,10 +749,13 @@ def subprocess_setup():
749 # SIGPIPE errors are known issues with gzip/bash 749 # SIGPIPE errors are known issues with gzip/bash
750 signal.signal(signal.SIGPIPE, signal.SIG_DFL) 750 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
751 751
752def get_autorev(d): 752def mark_recipe_nocache(d):
753 # only not cache src rev in autorev case
754 if d.getVar('BB_SRCREV_POLICY') != "cache": 753 if d.getVar('BB_SRCREV_POLICY') != "cache":
755 d.setVar('BB_DONT_CACHE', '1') 754 d.setVar('BB_DONT_CACHE', '1')
755
756def get_autorev(d):
757 mark_recipe_nocache(d)
758 d.setVar("__BBAUTOREV_SEEN", True)
756 return "AUTOINC" 759 return "AUTOINC"
757 760
758def get_srcrev(d, method_name='sortable_revision'): 761def get_srcrev(d, method_name='sortable_revision'):
@@ -1219,6 +1222,7 @@ def srcrev_internal_helper(ud, d, name):
1219 if srcrev == "INVALID" or not srcrev: 1222 if srcrev == "INVALID" or not srcrev:
1220 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) 1223 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)
1221 if srcrev == "AUTOINC": 1224 if srcrev == "AUTOINC":
1225 d.setVar("__BBAUTOREV_ACTED_UPON", True)
1222 srcrev = ud.method.latest_revision(ud, d, name) 1226 srcrev = ud.method.latest_revision(ud, d, name)
1223 1227
1224 return srcrev 1228 return srcrev