Skip to contentSkip to conversation

distrodata.py: Test to track recipes without HOMEPAGE or DESCRIPTION

RFC Superseded Dorinda 2 participants 3 messages Mar 6, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dorinda

author
#0 lore raw

RFC 1/1 distrodata.py: Test to track recipes without HOMEPAGE or DESCRIPTION

This test is to keep track of recipes that do not have a HOMEPAGE or DESCRIPTION, with exceptions to recipes whose SRC_URI are not linked to external sources.

[YOCTO #13471]

---
 meta/lib/oeqa/selftest/cases/distrodata.py | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
meta/lib/oeqa/selftest/cases/distrodata.py +34 -0
index e1cfc3b621..d8df0b530c 100644
@@ -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')
+                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'):
+                        # 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
Signature · 1 line
2.17.1
#1 lore raw

some nitpick below

Quoted 22 lines · Dorinda

[YOCTO #13471]

---
  meta/lib/oeqa/selftest/cases/distrodata.py | 34 ++++++++++++++++++++++
  1 file changed, 34 insertions(+)
meta/lib/oeqa/selftest/cases/distrodata.py +7 -0
index e1cfc3b621..d8df0b530c 100644
@@ -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
+        """

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re · line 59

Quoted 10 lines
meta/lib/oeqa/selftest/cases/distrodata.py +10 -0
+        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

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re · line 64

Quoted 5 lines
meta/lib/oeqa/selftest/cases/distrodata.py +5 -0
+                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:

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re · line 75

Quoted 11 lines
meta/lib/oeqa/selftest/cases/distrodata.py +11 -0
+                        # 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)

Quoted 9 lines
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
+
      def test_maintainers(self):
          """
          Summary:     Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe
author
#2 lore raw

Alright, Thank you for the feedback.

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)
I now see why I didn't get reports on recipes without DESCRIPTION.

Thanks,
Dorinda.

Quoted 88 lines · On Sat, Mar 6, 2021, 22:10 Konrad Weihmann <[email protected]> wrote:

some nitpick below

Review

Quoted 8 lines · Dorinda

[YOCTO #13471]

---
  meta/lib/oeqa/selftest/cases/distrodata.py | 34 ++++++++++++++++++++++
  1 file changed, 34 insertions(+)
(quoted diff) +0 -0

b/meta/lib/oeqa/selftest/cases/distrodata.py

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting

Quoted 4 lines

index e1cfc3b621..d8df0b530c 100644

meta/lib/oeqa/selftest/cases/distrodata.py +0 -0
@@ -40,6 +40,40 @@ but their recipes claim otherwise by setting

UPSTREAM_VERSION_UNKNOWN. Please re

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting · line 41

Quoted 2 lines
meta/lib/oeqa/selftest/cases/distrodata.py +0 -0
  """ + "\n".join(regressed_successes)
          self.assertTrue(len(regressed_failures) == 0 and

len(regressed_successes) == 0, msg)

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re

Quoted 4 lines
meta/lib/oeqa/selftest/cases/distrodata.py +3 -0
+    def test_missing_homepg(self):
+        """
+        Summary:     Test for oe-core recipes that don't have a

HOMEPAGE or DESCRIPTION

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting · line 46

Quoted 2 lines
meta/lib/oeqa/selftest/cases/distrodata.py +2 -0
+        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.

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re · line 59

Quoted 12 lines
meta/lib/oeqa/selftest/cases/distrodata.py +12 -0
+        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

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re

Quoted 5 lines
meta/lib/oeqa/selftest/cases/distrodata.py +5 -0
+                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:

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting · line 64

Quoted 1 line
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
+                        # We are only interested in recipes SRC_URI

fetched from external sources

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re

Quoted 5 lines
meta/lib/oeqa/selftest/cases/distrodata.py +5 -0
+                        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.

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re

Quoted 4 lines
meta/lib/oeqa/selftest/cases/distrodata.py +4 -0
+""" + "\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.

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re · line 75

Quoted 1 line
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
+""" + "\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)

meta/lib/oeqa/selftest/cases/distrodata.py but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re

Quoted 4 lines
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
+
      def test_maintainers(self):
          """
          Summary:     Test that oe-core recipes have a maintainer and

entries in maintainers list have a recipe

Quoted 5 lines