insane: move src-uri-bad checks to unpack stage

previously used package_qa_check_src_uri was triggered during
package_qa stage, which implies having packages.
This isn't the case for native-only recipes or recipe that inherit
nopackages.

Still the checks performed (src-uri-bad) apply to those as well.
Therefore move the check from package_qa stage to unpack stage.

(From OE-Core rev: 8fe68a0516df25a9f336c9f5156a6895d65c0820)

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Konrad Weihmann
2021-12-14 17:39:20 +01:00
committed by Richard Purdie
parent 35ca84e101
commit 53a41cb39c

View File

@@ -968,17 +968,6 @@ def package_qa_check_host_user(path, name, d, elf, messages):
return False
return True
QARECIPETEST[src-uri-bad] = "package_qa_check_src_uri"
def package_qa_check_src_uri(pn, d, messages):
import re
if "${PN}" in d.getVar("SRC_URI", False):
oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d)
for url in d.getVar("SRC_URI").split():
if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url):
oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d)
QARECIPETEST[unhandled-features-check] = "package_qa_check_unhandled_features_check"
def package_qa_check_unhandled_features_check(pn, d, messages):
if not bb.data.inherits_class('features_check', d):
@@ -1285,11 +1274,28 @@ Rerun configure task after fixing this."""
oe.qa.exit_if_errors(d)
}
def unpack_check_src_uri(pn, d):
import re
skip = (d.getVar('INSANE_SKIP') or "").split()
if 'src-uri-bad' in skip:
bb.note("Recipe %s skipping qa checking: src-uri-bad" % d.getVar('PN'))
return
if "${PN}" in d.getVar("SRC_URI", False):
oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d)
for url in d.getVar("SRC_URI").split():
if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url):
oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d)
python do_qa_unpack() {
src_uri = d.getVar('SRC_URI')
s_dir = d.getVar('S')
if src_uri and not os.path.exists(s_dir):
bb.warn('%s: the directory %s (%s) pointed to by the S variable doesn\'t exist - please set S within the recipe to point to where the source has been unpacked to' % (d.getVar('PN'), d.getVar('S', False), s_dir))
unpack_check_src_uri(d.getVar('PN'), d)
}
# The Staging Func, to check all staging