From patchwork Tue May 9 17:23:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 23717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06649C77B7C for ; Tue, 9 May 2023 17:23:54 +0000 (UTC) Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by mx.groups.io with SMTP id smtpd.web10.39152.1683653030460337529 for ; Tue, 09 May 2023 10:23:50 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=hB5iOiNp; spf=pass (domain: gmail.com, ip: 209.85.208.48, mailfrom: alex.kanavin@gmail.com) Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-50bc0117683so11197077a12.1 for ; Tue, 09 May 2023 10:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683653028; x=1686245028; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wWnnk3/OWk0V3vA0y5OwGq4MFU8RiuL21WE4zwNx/Os=; b=hB5iOiNpA32NTs7KH+N7pw9PGzBMhqbIWvS5M9se7LDnMbThU6AcGZnqnNLSdY2Lr1 Zcecd+sUQTnZZDx/a0oQwOe8M15SSHw9p1Cc1oVm4+xCw/1E78NAR3lhNxgAcuQwiRgQ BXtHtVsx7hw6VTePysBU4Tgeb27Q9IGpJjN3zflwsT2V7AGXThEJ+JQ4YFrhkbC4Jjvf yQCWDaAtVo7j8mg9z3zCTV86MnR5ewGHnmLDPZPW0j2jA5LtZ/1QP1nF9cZl39l5werG d3Uzot37ycB3czFJMv5D2TK7/LyAFqB9mjhsTVWbgFOzZMCgJgcDHZBEb+TO0KbVWvZ/ di9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683653028; x=1686245028; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wWnnk3/OWk0V3vA0y5OwGq4MFU8RiuL21WE4zwNx/Os=; b=Bn7AyhKBJnm01zLmmDSy1L8S+3V4vJ98JmpBYloagE6XAabI0WCgtpS6Q//31WJZpy W3dBqjL8rXHZSo75T2GOhawapnCZeClPOZkabFS36jO+4fY7GfK1F7YrDNJUG24lJ6// vgHeN45Ibu/EzhbCMAiEMenGy4/6CK5Z9MNOMyl+HfHXMwHYjXapFNYhxjPfDw5qTUpd 9KvOt3klM73Tl425jXc/RQ5VMhNgQc1TCHVSydnBOZzcbMj6oDWDSClQ51cYSqn+lY1Q eNWWUtgxlHnKGKkuBozjg+FIrXzg+3cQZTh0RlvkxjegbtBGnUshy2Hm9Fim/6ZSeZXz 4NeA== X-Gm-Message-State: AC+VfDx1SUzUzWJgjCEonqRlZ8/huMBcsWRusbysxIN7a+vLL5ALL8If sxPrHwB9/nvasBkGycdbadQ82mKyZSY= X-Google-Smtp-Source: ACHHUZ6r2LvxQrg+I6vAgy9DcJsQVCxAMmqPzSvRWWVMIfYGONXMsGQ31l0ebyPVNrBI+L2Ajkjxsg== X-Received: by 2002:a17:906:eeca:b0:965:d17b:292 with SMTP id wu10-20020a170906eeca00b00965d17b0292mr11700498ejb.60.1683653028214; Tue, 09 May 2023 10:23:48 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id jz24-20020a17090775f800b0096347ef816dsm1578252ejc.64.2023.05.09.10.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 10:23:47 -0700 (PDT) From: Alexander Kanavin X-Google-Original-From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 01/27] insane.bbclass: add a SUMMARY/HOMEPAGE check (oe-core recipes only) Date: Tue, 9 May 2023 19:23:18 +0200 Message-Id: <20230509172344.1516743-1-alex@linutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 09 May 2023 17:23:54 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/181056 This was done in a selftest, but that is too late and creates friction in integration as errors are not seen until autobuilder fails. Bonus fix: SUMMARY check wasn't even working, as in the absence of one set in the recipe there is a default value set from bitbake.conf. I left DESCRIPTION check out for now, as many recipes don't actually have it, and it's set from SUMMARY (plus a dot) if absent. Signed-off-by: Alexander Kanavin --- meta/classes-global/insane.bbclass | 26 ++++++++++++++++ meta/lib/oeqa/selftest/cases/distrodata.py | 36 ---------------------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 8788f58fc5b..632f738c86d 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -34,6 +34,7 @@ WARN_QA ?= " libdir xorg-driver-abi buildpaths \ missing-update-alternatives native-last missing-ptest \ license-exists license-no-generic license-syntax license-format \ license-incompatible license-file-missing obsolete-license \ + missing-metadata \ " ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ @@ -1473,6 +1474,28 @@ python do_qa_unpack() { unpack_check_src_uri(d.getVar('PN'), d) } +python do_qa_fetch() { + def test_missing_metadata(d): + fn = d.getVar("FILE") + if not '/meta/recipes-' in fn: + # We are only interested in OE-Core + return + pn = d.getVar('BPN') + srcfile = d.getVar('SRC_URI').split() + # Check that SUMMARY is not the same as the default from bitbake.conf + if d.getVar('SUMMARY') == d.expand("${PN} version ${PV}-${PR}"): + oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a SUMMARY. Please add an entry.".format(pn, fn), d) + if not d.getVar('HOMEPAGE'): + if srcfile and srcfile[0].startswith('file') or not d.getVar('SRC_URI'): + # We are only interested in recipes SRC_URI fetched from external sources + pass + else: + oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d) + + test_missing_metadata(d) + oe.qa.exit_if_errors(d) +} + # Check for patch fuzz do_patch[postfuncs] += "do_qa_patch " @@ -1484,6 +1507,9 @@ do_configure[postfuncs] += "do_qa_configure " # Check does S exist. do_unpack[postfuncs] += "do_qa_unpack" +# Check basic recipe metadata (e.g. SUMMARY/HOMEPAGE/RECIPE_MAINTAINER) +do_fetch[postfuncs] += "do_qa_fetch" + python () { import re diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py index c83a3a7bd67..fd262fe3c9e 100644 --- a/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/meta/lib/oeqa/selftest/cases/distrodata.py @@ -39,42 +39,6 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re """ + "\n".join(regressed_successes) self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg) - def test_missing_homepg(self): - """ - Summary: Test for oe-core recipes that don't have a HOMEPAGE or DESCRIPTION - Expected: All oe-core recipes should have a DESCRIPTION entry - Expected: All oe-core recipes should have a HOMEPAGE entry except for recipes that are not fetched from external sources. - Product: oe-core - """ - with bb.tinfoil.Tinfoil() as tinfoil: - tinfoil.prepare(config_only=False) - no_description = [] - no_homepage = [] - for fn in tinfoil.all_recipe_files(variants=False): - if not '/meta/recipes-' in fn: - # We are only interested in OE-Core - continue - rd = tinfoil.parse_recipe_file(fn, appends=False) - pn = rd.getVar('BPN') - srcfile = rd.getVar('SRC_URI').split() - #Since DESCRIPTION defaults to SUMMARY if not set, we are only interested in recipes without DESCRIPTION or SUMMARY - if not (rd.getVar('SUMMARY') or rd.getVar('DESCRIPTION')): - no_description.append((pn, fn)) - if not rd.getVar('HOMEPAGE'): - if srcfile and srcfile[0].startswith('file') or not rd.getVar('SRC_URI'): - # We are only interested in recipes SRC_URI fetched from external sources - continue - no_homepage.append((pn, fn)) - if no_homepage: - self.fail(""" -The following recipes do not have a HOMEPAGE. Please add an entry for HOMEPAGE in the recipe. -""" + "\n".join(['%s (%s)' % i for i in no_homepage])) - - if no_description: - self.fail(""" -The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIPTION in the recipe. -""" + "\n".join(['%s (%s)' % i for i in no_description])) - def test_maintainers(self): """ Summary: Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe