some nitpick below

On 06.03.21 21:53, Dorinda wrote:
[YOCTO #13471]

Signed-off-by: Dorinda Bassey <[email protected]>
---
  meta/lib/oeqa/selftest/cases/distrodata.py | 34 ++++++++++++++++++++++
  1 file changed, 34 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py 
b/meta/lib/oeqa/selftest/cases/distrodata.py
index e1cfc3b621..d8df0b530c 100644
--- a/meta/lib/oeqa/selftest/cases/distrodata.py
+++ b/meta/lib/oeqa/selftest/cases/distrodata.py
@@ -40,6 +40,40 @@ 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('PN')

shouldn't it be BPN, otherwise we would get the same warning for native/cross/nativesdk and target configuration. Also I would advise to used set() instead of lists for `no_description` and `no_homepage`, just to rule out any double postings

+                srcfile = rd.getVar('SRC_URI').split()
+                if not rd.getVar('DESCRIPTION'):
+                    no_description.append((pn, fn))
+                if not rd.getVar('HOMEPAGE'):
+                    if len(srcfile) > 0 and srcfile[0].startswith('file') or 
not rd.getVar('SRC_URI'):

`if len(x) > 0` is a bad pattern - a pythonic way would be `if x:`

+                        # 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]))

the currently valid edition (https://www.openembedded.org/wiki/Styleguide) of the the style guide claims that DESCRIPTION defaults to SUMMARY. So I personally would rather check that SUMMARY != DESCRIPTION in case DESCRIPTION is set - by default DESCRIPTION isn't mandatory IMO (or the styleguide needs to be updated)

+
      def test_maintainers(self):
          """
          Summary:     Test that oe-core recipes have a maintainer and entries 
in maintainers list have a recipe





-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149077): 
https://lists.openembedded.org/g/openembedded-core/message/149077
Mute This Topic: https://lists.openembedded.org/mt/81136066/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to