diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-06 16:31:10 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-08 10:56:35 +0000 |
commit | d90fb73db5b07a1f407d59e698c5114d342e2322 (patch) | |
tree | ad5941189e93feeccf244ce99cb36c41f46a11c5 /meta/classes-global | |
parent | 3d35d09ff2a9bb79f99ee45923fbe74c8fd6d0d7 (diff) | |
download | poky-d90fb73db5b07a1f407d59e698c5114d342e2322.tar.gz |
insane: Move unpack tests to do_recipe_qa
The SRC_URI tests are a better fit for the new do_recipe_qa task, move them
there.
(From OE-Core rev: 5afde8e24e74c7b73c1da312cca65b3277a6c355)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-global')
-rw-r--r-- | meta/classes-global/insane.bbclass | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index ecc868a4e0..b78bb6f445 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
@@ -1502,35 +1502,18 @@ Rerun configure task after fixing this.""" | |||
1502 | oe.qa.exit_if_errors(d) | 1502 | oe.qa.exit_if_errors(d) |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | def unpack_check_src_uri(pn, d): | ||
1506 | import re | ||
1507 | |||
1508 | skip = (d.getVar('INSANE_SKIP') or "").split() | ||
1509 | if 'src-uri-bad' in skip: | ||
1510 | bb.note("Recipe %s skipping qa checking: src-uri-bad" % d.getVar('PN')) | ||
1511 | return | ||
1512 | |||
1513 | if "${PN}" in d.getVar("SRC_URI", False): | ||
1514 | oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d) | ||
1515 | |||
1516 | for url in d.getVar("SRC_URI").split(): | ||
1517 | # Search for github and gitlab URLs that pull unstable archives (comment for future greppers) | ||
1518 | if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url) or "//codeload.github.com/" in url: | ||
1519 | oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d) | ||
1520 | |||
1521 | python do_qa_unpack() { | 1505 | python do_qa_unpack() { |
1522 | src_uri = d.getVar('SRC_URI') | 1506 | src_uri = d.getVar('SRC_URI') |
1523 | s_dir = d.getVar('S') | 1507 | s_dir = d.getVar('S') |
1524 | if src_uri and not os.path.exists(s_dir): | 1508 | if src_uri and not os.path.exists(s_dir): |
1525 | 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)) | 1509 | 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)) |
1526 | |||
1527 | unpack_check_src_uri(d.getVar('PN'), d) | ||
1528 | } | 1510 | } |
1529 | 1511 | ||
1530 | python do_recipe_qa() { | 1512 | python do_recipe_qa() { |
1531 | def test_missing_metadata(d): | 1513 | import re |
1514 | |||
1515 | def test_missing_metadata(pn, d): | ||
1532 | fn = d.getVar("FILE") | 1516 | fn = d.getVar("FILE") |
1533 | pn = d.getVar('BPN') | ||
1534 | srcfile = d.getVar('SRC_URI').split() | 1517 | srcfile = d.getVar('SRC_URI').split() |
1535 | # Check that SUMMARY is not the same as the default from bitbake.conf | 1518 | # Check that SUMMARY is not the same as the default from bitbake.conf |
1536 | if d.getVar('SUMMARY') == d.expand("${PN} version ${PV}-${PR}"): | 1519 | if d.getVar('SUMMARY') == d.expand("${PN} version ${PV}-${PR}"): |
@@ -1542,16 +1525,31 @@ python do_recipe_qa() { | |||
1542 | else: | 1525 | else: |
1543 | oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d) | 1526 | oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d) |
1544 | 1527 | ||
1545 | def test_missing_maintainer(d): | 1528 | def test_missing_maintainer(pn, d): |
1546 | fn = d.getVar("FILE") | 1529 | fn = d.getVar("FILE") |
1547 | pn = d.getVar("PN") | ||
1548 | if pn.endswith("-native") or pn.startswith("nativesdk-") or "packagegroup-" in pn or "core-image-ptest-" in pn: | 1530 | if pn.endswith("-native") or pn.startswith("nativesdk-") or "packagegroup-" in pn or "core-image-ptest-" in pn: |
1549 | return | 1531 | return |
1550 | if not d.getVar('RECIPE_MAINTAINER'): | 1532 | if not d.getVar('RECIPE_MAINTAINER'): |
1551 | oe.qa.handle_error("missing-maintainer", "Recipe {} in {} does not have an assigned maintainer. Please add an entry into meta/conf/distro/include/maintainers.inc.".format(pn, fn), d) | 1533 | oe.qa.handle_error("missing-maintainer", "Recipe {} in {} does not have an assigned maintainer. Please add an entry into meta/conf/distro/include/maintainers.inc.".format(pn, fn), d) |
1552 | 1534 | ||
1553 | test_missing_metadata(d) | 1535 | def test_srcuri(pn, d): |
1554 | test_missing_maintainer(d) | 1536 | skip = (d.getVar('INSANE_SKIP') or "").split() |
1537 | if 'src-uri-bad' in skip: | ||
1538 | bb.note("Recipe %s skipping qa checking: src-uri-bad" % pn) | ||
1539 | return | ||
1540 | |||
1541 | if "${PN}" in d.getVar("SRC_URI", False): | ||
1542 | oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses PN not BPN" % pn, d) | ||
1543 | |||
1544 | for url in d.getVar("SRC_URI").split(): | ||
1545 | # Search for github and gitlab URLs that pull unstable archives (comment for future greppers) | ||
1546 | if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url) or "//codeload.github.com/" in url: | ||
1547 | oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d) | ||
1548 | |||
1549 | pn = d.getVar('PN') | ||
1550 | test_missing_metadata(pn, d) | ||
1551 | test_missing_maintainer(pn, d) | ||
1552 | test_srcuri(pn, d) | ||
1555 | oe.qa.exit_if_errors(d) | 1553 | oe.qa.exit_if_errors(d) |
1556 | } | 1554 | } |
1557 | 1555 | ||