All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] lib/oe/recipeutils: Add a new function to mimic do_checkpkg
@ 2018-12-14 18:15 Richard Purdie
  2018-12-14 18:15 ` [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function Richard Purdie
  2018-12-14 18:35 ` ✗ patchtest: failure for "lib/oe/recipeutils: Add a new ..." and 1 more Patchwork
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Purdie @ 2018-12-14 18:15 UTC (permalink / raw)
  To: openembedded-core

The code in distrodata.bbclass related to the do_checkpkg task is rather
dated, has holes in it (ignoring some recipes) and has horrible locking
and csv related issues.

We should use modern APIs such as tinfoil to make the calls we need directly
against bitbake, cutting out the middleman and clarifing the code.

This change imports the bits of distrodata.bbclass that are needed by the
automated upgrade helper (AUH) into a standalone function which uses the
tinfoil API. This can then be used by AUH and by the tests in
oeqa/selftest/distrodata as well as by any other standalone script that needs
this functionality. Its likely it can be further improved from here but this is a
good start and appears to function as before, with slightly wider recipe
coverage as some things skipped by distrodata are not skipped here (images,
pieces of gcc, nativesdk only recipes).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oe/recipeutils.py | 53 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 9c99164d248..39d3de4bb1f 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -16,8 +16,10 @@ import shutil
 import re
 import fnmatch
 import glob
-from collections import OrderedDict, defaultdict
+import bb.tinfoil
 
+from collections import OrderedDict, defaultdict
+from bb.utils import vercmp_string
 
 # Help us to find places to insert values
 recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()']
@@ -1017,3 +1019,52 @@ def get_recipe_upstream_version(rd):
         ru['datetime'] = datetime.now()
 
     return ru
+
+def get_recipe_upgrade_status(recipes=None):
+    pkgs_list = []
+    with bb.tinfoil.Tinfoil() as tinfoil:
+        tinfoil.prepare(config_only=False)
+
+        if not recipes:
+            recipes = tinfoil.all_recipe_files(variants=False)
+
+        for fn in recipes:
+            try:
+                if fn.startswith("/"):
+                    data = tinfoil.parse_recipe_file(fn)
+                else:
+                    data = tinfoil.parse_recipe(fn)
+            except bb.providers.NoProvider:
+                bb.note(" No provider for %s" % fn)
+                continue
+
+            unreliable = data.getVar('UPSTREAM_CHECK_UNRELIABLE')
+            if unreliable == "1":
+                bb.note(" Skip package %s as upstream check unreliable" % pn)
+                continue
+
+            uv = get_recipe_upstream_version(data)
+
+            pn = data.getVar('PN')
+            cur_ver = uv['current_version']
+
+            upstream_version_unknown = data.getVar('UPSTREAM_VERSION_UNKNOWN')
+            if not uv['version']:
+                status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
+            else:
+                cmp = vercmp_string(uv['current_version'], uv['version'])
+                if cmp == -1:
+                    status = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN"
+                elif cmp == 0:
+                    status = "MATCH" if not upstream_version_unknown else "KNOWN_BROKEN"
+                else:
+                    status = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN"
+
+            next_ver = uv['version'] if uv['version'] else "N/A"
+            revision = uv['revision'] if uv['revision'] else "N/A"
+            maintainer = data.getVar('RECIPE_MAINTAINER')
+            no_upgrade_reason = data.getVar('RECIPE_NO_UPDATE_REASON')
+
+            pkgs_list.append((pn, status, cur_ver, next_ver, maintainer, revision, no_upgrade_reason))
+
+    return pkgs_list
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function
  2018-12-14 18:15 [PATCH 1/2] lib/oe/recipeutils: Add a new function to mimic do_checkpkg Richard Purdie
@ 2018-12-14 18:15 ` Richard Purdie
  2018-12-14 18:28   ` Alexander Kanavin
  2018-12-14 18:35 ` ✗ patchtest: failure for "lib/oe/recipeutils: Add a new ..." and 1 more Patchwork
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2018-12-14 18:15 UTC (permalink / raw)
  To: openembedded-core

Rather than use the obsolete do_checkpkg function, use the new recipeutils
function which uses tinfoil to get the data rather than needing csv file
manipulation.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/distrodata.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py
index a862d30b10e..824e29e01b5 100644
--- a/meta/lib/oeqa/selftest/cases/distrodata.py
+++ b/meta/lib/oeqa/selftest/cases/distrodata.py
@@ -4,6 +4,8 @@ from oeqa.utils.decorators import testcase
 from oeqa.utils.ftools import write_file
 from oeqa.core.decorator.oeid import OETestID
 
+import oe.recipeutils
+
 class Distrodata(OESelftestTestCase):
 
     @OETestID(1902)
@@ -17,11 +19,11 @@ class Distrodata(OESelftestTestCase):
         feature = 'INHERIT += "distrodata"\n'
         feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n'
         self.write_config(feature)
-        bitbake('-c checkpkg world')
 
-        checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:]
-        regressed_failures = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'UNKNOWN_BROKEN']
-        regressed_successes = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'KNOWN_BROKEN']
+        pkgs = oe.recipeutils.get_recipe_upgrade_status()
+
+        regressed_failures = [pkg[0] for pkg in pkgs if pkg[1] == 'UNKNOWN_BROKEN']
+        regressed_successes = [pkg[0] for pkg in pkgs if pkg[1] == 'KNOWN_BROKEN']
         msg = ""
         if len(regressed_failures) > 0:
             msg = msg + """
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function
  2018-12-14 18:15 ` [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function Richard Purdie
@ 2018-12-14 18:28   ` Alexander Kanavin
  2018-12-14 22:54     ` Richard Purdie
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2018-12-14 18:28 UTC (permalink / raw)
  To: Richard Purdie; +Cc: OE-core

On Fri, 14 Dec 2018 at 19:16, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> @@ -17,11 +19,11 @@ class Distrodata(OESelftestTestCase):
>          feature = 'INHERIT += "distrodata"\n'
>          feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n'

^^^^ These are no longer needed? Otherwise, looks fantastic!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✗ patchtest: failure for "lib/oe/recipeutils: Add a new ..." and 1 more
  2018-12-14 18:15 [PATCH 1/2] lib/oe/recipeutils: Add a new function to mimic do_checkpkg Richard Purdie
  2018-12-14 18:15 ` [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function Richard Purdie
@ 2018-12-14 18:35 ` Patchwork
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-12-14 18:35 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

== Series Details ==

Series: "lib/oe/recipeutils: Add a new ..." and 1 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/15355/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Patch            [2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function
 Issue             Commit shortlog is too long [test_shortlog_length] 
  Suggested fix    Edit shortlog so that it is 90 characters or less (currently 94 characters)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function
  2018-12-14 18:28   ` Alexander Kanavin
@ 2018-12-14 22:54     ` Richard Purdie
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2018-12-14 22:54 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On Fri, 2018-12-14 at 19:28 +0100, Alexander Kanavin wrote:
> On Fri, 14 Dec 2018 at 19:16, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > @@ -17,11 +19,11 @@ class Distrodata(OESelftestTestCase):
> >          feature = 'INHERIT += "distrodata"\n'
> >          feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n'
> 
> ^^^^ These are no longer needed? Otherwise, looks fantastic!

The license flags may not be, the distrodata is still needed right now
to inherit the maintainers include file.

I will add a patch to do that by default, then we can drop the class
and the inherit. The license flags variable needs investigation so can
also be a followup...

Cheers,

Richard



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-14 22:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 18:15 [PATCH 1/2] lib/oe/recipeutils: Add a new function to mimic do_checkpkg Richard Purdie
2018-12-14 18:15 ` [PATCH 2/2] oeqa/selftest/distrodata: Port to use the new recipeutils.get_recipe_upgrade_status() function Richard Purdie
2018-12-14 18:28   ` Alexander Kanavin
2018-12-14 22:54     ` Richard Purdie
2018-12-14 18:35 ` ✗ patchtest: failure for "lib/oe/recipeutils: Add a new ..." and 1 more Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.