Skip to contentSkip to conversation

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

RFC PATCH Superseded Dorinda 2 participants 4 messages Mar 8, 2021 – Mar 13, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dorinda

author
#0 lore raw

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

From: Dorinda Bassey <[email protected]>

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]

---
v2:
-Changed PN to BPN
-Used set() instead of lists
-Changed condition for checking recipes with missing DESCRIPTION

 meta/lib/oeqa/selftest/cases/distrodata.py | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
meta/lib/oeqa/selftest/cases/distrodata.py +36 -0
index e1cfc3b621..633bf25dc7 100644
@@ -40,6 +40,42 @@ 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 = set()
+            no_homepage = set()
+            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.add((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.add((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
Quoted 24 lines · Dorinda

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]

---
v2:

(quoted diff) +0 -3
-Changed PN to BPN
-Used set() instead of lists
-Changed condition for checking recipes with missing DESCRIPTION
 
  meta/lib/oeqa/selftest/cases/distrodata.py | 36 ++++++++++++++++++++++
  1 file changed, 36 insertions(+)
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
index e1cfc3b621..633bf25dc7 100644
@@ -40,6 +40,42 @@ 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):

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

Quoted 10 lines
meta/lib/oeqa/selftest/cases/distrodata.py +10 -0
+        """
+        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 = set()
+            no_homepage = set()

Since the other tests in this file such as:
def test_maintainers(self):
uses lists rather than set()s:

            with_maintainer_list = []
            no_maintainer_list = []

            missing_recipes = []
            recipes = []

Maybe pick one data structure to be consistent.

If you decide that set() is better then make a separate commit to change that. Apparently sets are faster for some operations:
https://stackoverflow.com/questions/2831212/python-sets-vs-lists
it would be nice if you checked and documented what you find in the commit log since these tests do take a few minutes on a lowly laptop.

The rest looks good to me. Drop the RFC if you send a v3.

Thanks!
../Randy

Quoted 33 lines
meta/lib/oeqa/selftest/cases/distrodata.py +25 -0
+            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.add((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.add((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 · 2 lines
# Randy MacLeod
# Wind River Linux
author
#2 lore raw

Alright, I get you.
Will send a v3 RFC.

Thanks,
Dorinda.

Quoted 112 lines · Randy MacLeod
Quoted 1 line · Dorinda

This test is to keep track of recipes that do not have a HOMEPAGE or

DESCRIPTION,

Quoted 1 line

with exceptions to recipes whose SRC_URI are not linked to external

sources.

Review

Quoted 14 lines

[YOCTO #13471]

---
v2:

(quoted diff) +0 -3
-Changed PN to BPN
-Used set() instead of lists
-Changed condition for checking recipes with missing DESCRIPTION
 
  meta/lib/oeqa/selftest/cases/distrodata.py | 36 ++++++++++++++++++++++
  1 file changed, 36 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..633bf25dc7 100644

meta/lib/oeqa/selftest/cases/distrodata.py +0 -0
@@ -40,6 +40,42 @@ 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 53

Quoted 6 lines
meta/lib/oeqa/selftest/cases/distrodata.py +6 -0
+        Product:     oe-core
+        """
+        with bb.tinfoil.Tinfoil() as tinfoil:
+            tinfoil.prepare(config_only=False)
+            no_description = set()
+            no_homepage = set()

Since the other tests in this file such as:
def test_maintainers(self):
uses lists rather than set()s:

             with_maintainer_list = []
             no_maintainer_list = []

             missing_recipes = []
             recipes = []

Maybe pick one data structure to be consistent.

If you decide that set() is better then make a separate commit to change that. Apparently sets are faster for some operations:

    https://stackoverflow.com/questions/2831212/python-sets-vs-lists

it would be nice if you checked and documented what you find in the commit log since these tests do take a few minutes on a lowly laptop.

The rest looks good to me. Drop the RFC if you send a v3.

Thanks!
../Randy

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

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

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

Quoted 1 line
meta/lib/oeqa/selftest/cases/distrodata.py +1 -0
+                if not (rd.getVar('SUMMARY') or

rd.getVar('DESCRIPTION')):

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

Quoted 3 lines
meta/lib/oeqa/selftest/cases/distrodata.py +3 -0
+                    no_description.add((pn, fn))
+                if not rd.getVar('HOMEPAGE'):
+                    if srcfile and srcfile[0].startswith('file') or not

rd.getVar('SRC_URI'):

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

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

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

Quoted 5 lines

--
# Randy MacLeod
# Wind River Linux

#3 lore raw
Quoted 2 lines · dorinda bassey

Alright, I get you.
Will send a v3 RFC.

I think it'll be ready to merge so drop the RFC!
../Randy

Quoted 122 lines

Thanks,
Dorinda.

On Fri, Mar 12, 2021 at 3:11 AM Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

On 2021-03-08 4:12 p.m., Dorinda wrote:
> 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]
>
> Signed-off-by: Dorinda Bassey <[email protected]
<mailto:[email protected]>>
> ---
> v2:
> -Changed PN to BPN
> -Used set() instead of lists
> -Changed condition for checking recipes with missing DESCRIPTION >
>   meta/lib/oeqa/selftest/cases/distrodata.py | 36
++++++++++++++++++++++
>   1 file changed, 36 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py
b/meta/lib/oeqa/selftest/cases/distrodata.py
> index e1cfc3b621..633bf25dc7 100644
> --- a/meta/lib/oeqa/selftest/cases/distrodata.py
> +++ b/meta/lib/oeqa/selftest/cases/distrodata.py
> @@ -40,6 +40,42 @@ 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 = set()
> +            no_homepage = set()

Since the other tests in this file such as:
     def test_maintainers(self):
uses lists rather than set()s:
             with_maintainer_list = []
             no_maintainer_list = []

             missing_recipes = []
             recipes = []

Maybe pick one data structure to be consistent.

If you decide that set() is better then make a separate commit to change that. Apparently sets are faster for some operations:
https://stackoverflow.com/questions/2831212/python-sets-vs-lists
<https://stackoverflow.com/questions/2831212/python-sets-vs-lists>
it would be nice if you checked and documented what you find in the commit log since these tests do take a few minutes on a lowly laptop.

The rest looks good to me. Drop the RFC if you send a v3.

Thanks!
../Randy

> +            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.add((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.add((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
>
>
>
>
>

--
# Randy MacLeod
# Wind River Linux

Signature · 2 lines
# Randy MacLeod
# Wind River Linux