All of lore.kernel.org
 help / color / mirror / Atom feed
* [[AUH] 0/6] Integration error handling and enhacements
@ 2015-12-01 22:03 Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 1/6] recipe/git.py: Add missing import of re module Aníbal Limón
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

This changes can be also reviewed at,

http://git.yoctoproject.org/cgit/cgit.cgi/auto-upgrade-helper/log/?h=boot_images_v3

Aníbal Limón (6):
  recipe/git.py: Add missing import of re module.
  upgradehelper.py: Add support for preserve logs in workdir.
  upgradehelper.py: Add support for specify what image test.
  testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES.
  testimage: Add handling of IntegrationError
  upgradehelper: Remove deprecated setting drop_previous_commits.

 README                |   7 ++-
 modules/errors.py     |   9 ++++
 modules/recipe/git.py |   1 +
 modules/testimage.py  |  80 ++++++++++++++++++++++--------
 upgradehelper.py      | 135 +++++++++++++++++++++++++++++++-------------------
 5 files changed, 156 insertions(+), 76 deletions(-)

-- 
2.1.4



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

* [[AUH] 1/6] recipe/git.py: Add missing import of re module.
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 2/6] upgradehelper.py: Add support for preserve logs in workdir Aníbal Limón
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 modules/recipe/git.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/recipe/git.py b/modules/recipe/git.py
index 7526a67..b1a6201 100644
--- a/modules/recipe/git.py
+++ b/modules/recipe/git.py
@@ -23,6 +23,7 @@
 #
 
 from recipe.base import Recipe
+import re
 
 class GitRecipe(Recipe):
     def _extract_tag_from_ver(self, ver):
-- 
2.1.4



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

* [[AUH] 2/6] upgradehelper.py: Add support for preserve logs in workdir.
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 1/6] recipe/git.py: Add missing import of re module Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 3/6] upgradehelper.py: Add support for specify what image test Aníbal Limón
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

Add FileHandler log to store the log into workdir, this needs
to move up the work directory creation.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 upgradehelper.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/upgradehelper.py b/upgradehelper.py
index 0d3f8b2..7dbfbeb 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -134,6 +134,10 @@ class Updater(object):
     def __init__(self, auto_mode=False, send_email=False, skip_compilation=False):
         build_dir = get_build_dir()
 
+        self._make_dirs(build_dir)
+
+        self._add_file_logger()
+
         self.bb = Bitbake(build_dir)
 
         try:
@@ -160,6 +164,7 @@ class Updater(object):
         self.opts['buildhistory'] = self._buildhistory_is_enabled()
         self.opts['testimage'] = self._testimage_is_enabled()
 
+    def _make_dirs(self, build_dir):
         self.uh_dir = os.path.join(build_dir, "upgrade-helper")
         if not os.path.exists(self.uh_dir):
             os.mkdir(self.uh_dir)
@@ -176,6 +181,11 @@ class Updater(object):
         self.uh_recipes_failed_dir = os.path.join(self.uh_work_dir, "failed")
         os.mkdir(self.uh_recipes_failed_dir)
 
+    def _add_file_logger(self):
+        fh = log.FileHandler(os.path.join(self.uh_work_dir, "upgrade-helper.log"))
+        logger = log.getLogger()
+        logger.addHandler(fh)
+
     def _get_status_msg(self, err):
         if err:
             return str(err)
-- 
2.1.4



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

* [[AUH] 3/6] upgradehelper.py: Add support for specify what image test.
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 1/6] recipe/git.py: Add missing import of re module Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 2/6] upgradehelper.py: Add support for preserve logs in workdir Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES Aníbal Limón
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

Before this commit core-image-sato was hardcoded for image
to test with this commit image name can be specified in
the upgrade-helper.conf.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 README               |  1 +
 modules/testimage.py | 10 +++++-----
 upgradehelper.py     | 13 ++++++++-----
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/README b/README
index 0756fdc..1c8eba1 100644
--- a/README
+++ b/README
@@ -68,6 +68,7 @@ machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
 # optional features
 buildhistory=no
 testimage=no
+testimage_name=image-custom # defaults to core-image-sato
 
 --------------- snip ---------------
 
diff --git a/modules/testimage.py b/modules/testimage.py
index 3fbbc19..e410111 100644
--- a/modules/testimage.py
+++ b/modules/testimage.py
@@ -153,18 +153,18 @@ class TestImage():
                         f.write(line)
                     f.write("END: PTEST for %s\n" % machine)
 
-    def sato(self, machine):
+    def testimage(self, machine, image):
         os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
             self._get_pkgs_to_install(self.pkgs_ctx)
 
         if 'TEST_SUITES' in os.environ:
             del os.environ['TEST_SUITES']
 
-        I( "   building core-image-sato for %s ..." % machine)
-        self.bb.complete("core-image-sato", machine)
+        I( "   building %s for %s ..." % (image, machine))
+        self.bb.complete(image, machine)
 
-        I( "   running core-image-sato/testimage for %s ..." % machine)
-        self.bb.complete("core-image-sato -c testimage", machine)
+        I( "   running %s/testimage for %s ..." % (image, machine))
+        self.bb.complete("%s -c testimage" % image, machine)
 
         log_file = self._find_log("log.do_testimage", machine)
         shutil.copyfile(log_file,
diff --git a/upgradehelper.py b/upgradehelper.py
index 7dbfbeb..db39601 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -68,6 +68,7 @@ help_text = """Usage examples:
     $ upgrade-helper.py all
 """
 
+DEFAULT_TESTIMAGE = 'core-image-sato'
 
 def parse_cmdline():
     parser = argparse.ArgumentParser(description='Package Upgrade Helper',
@@ -314,8 +315,8 @@ class Updater(object):
             "The recipe has ptest enabled and has been tested with core-image-minimal/ptest \n" \
             "with the next machines %s. Attached is the log file.\n\n"
 
-        testimage_sato_info = \
-            "The recipe has been tested using core-image-sato testimage and succeeded with \n" \
+        testimage_info = \
+            "The recipe has been tested using %s testimage and succeeded with \n" \
             "the next machines %s. Attached is the log file.\n\n" \
 
         mail_footer = \
@@ -353,7 +354,8 @@ class Updater(object):
                 msg_body += testimage_ptest_info % machines
             if 'testimage' in pkg_ctx:
                 machines = pkg_ctx['testimage'].keys()
-                msg_body += testimage_sato_info % machines
+                msg_body += testimage_info % (settings.get('testimage_name', \
+                    DEFAULT_TESTIMAGE), machines)
 
         msg_body += mail_footer
 
@@ -602,10 +604,11 @@ class Updater(object):
                             import traceback
                             traceback.print_exc(file=sys.stdout)
 
+                    image = settings.get('testimage_name', DEFAULT_TESTIMAGE)
                     try:
-                        tim.sato(machine)
+                        tim.testimage(machine, image)
                     except Exception as e:
-                        E(" core-image-sato/testimage on machine %s failed" % machine)
+                        E(" %s/testimage on machine %s failed" % (image, machine))
                         if isinstance(e, Error):
                             E(" %s" % e.stdout)
                         else:
-- 
2.1.4



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

* [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES.
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
                   ` (2 preceding siblings ...)
  2015-12-01 22:03 ` [[AUH] 3/6] upgradehelper.py: Add support for specify what image test Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  2015-12-11  1:31   ` Paul Eggleton
  2015-12-01 22:03 ` [[AUH] 5/6] testimage: Add handling of IntegrationError Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 6/6] upgradehelper: Remove deprecated setting drop_previous_commits Aníbal Limón
  5 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

Instead of add manually the ptest packages use IMAGE_FEATURE to
install ptest packages this save time validating if ptest pkg
exist.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 README               | 3 ++-
 modules/testimage.py | 5 ++---
 upgradehelper.py     | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/README b/README
index 1c8eba1..63c3b39 100644
--- a/README
+++ b/README
@@ -108,7 +108,8 @@ file:
 --------------- snip ---------------
 INHERIT += "testimage"
 
-EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
+DISTRO_FEATURES_append = " ptest"
+EXTRA_IMAGE_FEATURES = "debug-tweaks package-management ptest-pkgs"
 # testimage/ptest only work with rpm
 PACKAGE_CLASSES = "package_rpm"
 --------------- snip ---------------
diff --git a/modules/testimage.py b/modules/testimage.py
index e410111..52e2592 100644
--- a/modules/testimage.py
+++ b/modules/testimage.py
@@ -60,11 +60,10 @@ class TestImage():
         # for provide access to the target
         if ptest:
             pkgs_out.append("dropbear")
+            pkgs_out.append("ptest-runner")
 
         for c in pkgs:
             pkgs_out.append(c['PN'])
-            if ptest:
-                pkgs_out.append("%s-ptest" % c['PN'])
 
         return ' '.join(pkgs_out)
 
@@ -122,7 +121,7 @@ class TestImage():
         ptest_pkgs = self._get_ptest_pkgs()
 
         os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
-            self._get_pkgs_to_install(ptest_pkgs, True)
+            self._get_pkgs_to_install(ptest_pkgs, ptest=True)
         I( "   building core-image-minimal for %s ..." % machine)
         self.bb.complete("core-image-minimal", machine)
 
diff --git a/upgradehelper.py b/upgradehelper.py
index db39601..5a2b844 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -242,6 +242,11 @@ class Updater(object):
                       " please add to conf/local.conf.")
                     exit(1)
 
+                if not "ptest-pkgs" in self.base_env['EXTRA_IMAGE_FEATURES']:
+                    E(" testimage/ptest requires ptest-pkgs in EXTRA_IMAGE_FEATURES"\
+                      " please add to conf/local.conf.")
+                    exit(1)
+
                 if not "package_rpm" == self.base_env["PACKAGE_CLASSES"]:
                     E(" testimage/ptest requires PACKAGE_CLASSES set to package_rpm"\
                       " please add to conf/local.conf.")
-- 
2.1.4



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

* [[AUH] 5/6] testimage: Add handling of IntegrationError
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
                   ` (3 preceding siblings ...)
  2015-12-01 22:03 ` [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  2015-12-01 22:03 ` [[AUH] 6/6] upgradehelper: Remove deprecated setting drop_previous_commits Aníbal Limón
  5 siblings, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

A recipe can compile alone when the upgrade proccess is made
but when integrate it can fail due to dependencies of another
recipes.

If build image fail then analyze logs to find what recipe failed
if recipe is found directly on the set of recipe upgrades remove it,
if not recipe found directly then search within dependencies of
failed recipe.

Since IntegrationError can happen now, move the statistics update and
directory symlink creation after testimage.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 modules/errors.py    |  9 ++++++
 modules/testimage.py | 69 +++++++++++++++++++++++++++++++---------
 upgradehelper.py     | 89 +++++++++++++++++++++++++++++++++++-----------------
 3 files changed, 125 insertions(+), 42 deletions(-)

diff --git a/modules/errors.py b/modules/errors.py
index 1504fa5..9f8f37f 100644
--- a/modules/errors.py
+++ b/modules/errors.py
@@ -91,3 +91,12 @@ class EmptyEnvError(Error):
 
     def __str__(self):
         return "Failed(get_env)"
+
+class IntegrationError(Error):
+    def __init__(self, stdout, pkg_ctx):
+        super(IntegrationError, self).__init__("Failed to build %s in testimage branch"
+                % pkg_ctx['PN'], stdout)
+        self.pkg_ctx = pkg_ctx
+
+        def __str__(self):
+            return "Failed(integrate)"
diff --git a/modules/testimage.py b/modules/testimage.py
index 52e2592..4a254af 100644
--- a/modules/testimage.py
+++ b/modules/testimage.py
@@ -35,20 +35,25 @@ from logging import critical as C
 from errors import *
 from utils.bitbake import *
 
+def _pn_in_pkgs_ctx(pn, pkgs_ctx):
+    for c in pkgs_ctx:
+        if pn == c['PN']:
+            return c
+    return None
+
 class TestImage():
-    def __init__(self, bb, git, uh_work_dir, pkgs_ctx):
+    def __init__(self, bb, git, uh_work_dir):
         self.bb = bb
         self.git = git
         self.uh_work_dir = uh_work_dir
-        self.pkgs_ctx = pkgs_ctx
 
         os.environ['BB_ENV_EXTRAWHITE'] = os.environ['BB_ENV_EXTRAWHITE'] + \
             " TEST_SUITES CORE_IMAGE_EXTRA_INSTALL"
 
-    def _get_ptest_pkgs(self):
+    def _get_ptest_pkgs(self, pkgs_ctx):
         pkgs = []
 
-        for c in self.pkgs_ctx:
+        for c in pkgs_ctx:
             if "ptest" in c['recipe'].get_inherits():
                 pkgs.append(c)
 
@@ -67,7 +72,7 @@ class TestImage():
 
         return ' '.join(pkgs_out)
 
-    def prepare_branch(self):
+    def prepare_branch(self, pkgs_ctx):
         self.git.checkout_branch("master")
         try:
             self.git.delete_branch("testimage")
@@ -77,7 +82,7 @@ class TestImage():
         self.git.reset_hard()
 
         self.git.create_branch("testimage")
-        for c in self.pkgs_ctx:
+        for c in pkgs_ctx:
             patch_file = os.path.join(c['workdir'], c['patch_file'])
             self.git.apply_patch(patch_file)
 
@@ -117,13 +122,46 @@ class TestImage():
             if machine in ptest_log:
                 return ptest_log
 
-    def ptest(self, machine):
-        ptest_pkgs = self._get_ptest_pkgs()
+    def _get_failed_recipe(self, log):
+        pn = None
+
+        for line in log.splitlines():
+            m = re.match("ERROR: Logfile of failure stored in: " \
+                "(.*/([^/]*)/[^/]*/temp/log\.(.*)\.[0-9]*)", line)
+            if m:
+                pn = m.group(2)
+
+        return pn
+
+    def _handle_image_build_error(self, pkgs_ctx, e):
+        pn = self._get_failed_recipe(e.stdout)
+        if pn:
+            pkg_ctx = _pn_in_pkgs_ctx(pn, pkgs_ctx)
+            if pkg_ctx:
+                raise IntegrationError(e.stdout, pkg_ctx)
+            else:
+                pn_env = self.bb.env(pn)
+
+                depends = pn_env['DEPENDS'].split()
+                rdepends = pn_env['RDEPENDS'].split()
+                deps = depends + rdepends
+
+                for d in deps:
+                    pkg_ctx = _pn_in_pkgs_ctx(d, pkgs_ctx)
+                    if pkg_ctx:
+                        raise IntegrationError(e.stdout, pkg_ctx)
+        raise e
+
+    def ptest(self, pkgs_ctx, machine):
+        ptest_pkgs = self._get_ptest_pkgs(pkgs_ctx)
 
         os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
             self._get_pkgs_to_install(ptest_pkgs, ptest=True)
         I( "   building core-image-minimal for %s ..." % machine)
-        self.bb.complete("core-image-minimal", machine)
+        try:
+            self.bb.complete("core-image-minimal", machine)
+        except Error as e:
+            self._handle_image_build_error(pkgs_ctx, e)
 
         os.environ['TEST_SUITES'] = "ping ssh _ptest"
         I( "   running core-image-minimal/ptest for %s ..." % machine)
@@ -135,7 +173,7 @@ class TestImage():
 
         ptest_result = self._parse_ptest_log(ptest_log_file)
         for pn in ptest_result:
-            for pkg_ctx in self.pkgs_ctx:
+            for pkg_ctx in pkgs_ctx:
                 if not pn == pkg_ctx['PN']:
                     continue 
 
@@ -152,15 +190,18 @@ class TestImage():
                         f.write(line)
                     f.write("END: PTEST for %s\n" % machine)
 
-    def testimage(self, machine, image):
+    def testimage(self, pkgs_ctx, machine, image):
         os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
-            self._get_pkgs_to_install(self.pkgs_ctx)
+            self._get_pkgs_to_install(pkgs_ctx)
 
         if 'TEST_SUITES' in os.environ:
             del os.environ['TEST_SUITES']
 
         I( "   building %s for %s ..." % (image, machine))
-        self.bb.complete(image, machine)
+        try:
+            self.bb.complete(image, machine)
+        except Error as e:
+            self._handle_image_build_error(pkgs_ctx, e)
 
         I( "   running %s/testimage for %s ..." % (image, machine))
         self.bb.complete("%s -c testimage" % image, machine)
@@ -168,7 +209,7 @@ class TestImage():
         log_file = self._find_log("log.do_testimage", machine)
         shutil.copyfile(log_file,
                 os.path.join(self.uh_work_dir, "log_%s.do_testimage" % machine))
-        for pkg_ctx in self.pkgs_ctx:
+        for pkg_ctx in pkgs_ctx:
             if not 'testimage' in pkg_ctx:
                 pkg_ctx['testimage'] = {}
             if not 'testimage_log' in pkg_ctx:
diff --git a/upgradehelper.py b/upgradehelper.py
index 5a2b844..19327c8 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -550,10 +550,7 @@ class Updater(object):
                     if msg is not None:
                         I(" %s: %s" % (pkg_ctx['PN'], msg))
                     step(self.bb, self.git, self.opts, pkg_ctx)
-
                 succeeded_pkgs_ctx.append(pkg_ctx)
-                os.symlink(pkg_ctx['workdir'], os.path.join( \
-                    self.uh_recipes_succeed_dir, pkg_ctx['PN']))
 
                 I(" %s: Upgrade SUCCESSFUL! Please test!" % pkg_ctx['PN'])
             except Exception as e:
@@ -575,21 +572,16 @@ class Updater(object):
                             % (pkg_ctx['PN'], pkg_ctx['workdir']))
 
                 pkg_ctx['error'] = e
-
                 failed_pkgs_ctx.append(pkg_ctx)
-                os.symlink(pkg_ctx['workdir'], os.path.join( \
-                    self.uh_recipes_failed_dir, pkg_ctx['PN']))
 
             self.commit_changes(pkg_ctx)
-            self.statistics.update(pkg_ctx['PN'], pkg_ctx['NPV'],
-                    pkg_ctx['MAINTAINER'], pkg_ctx['error'])
 
         if self.opts['testimage']:
             if len(succeeded_pkgs_ctx) > 0:
-                tim = TestImage(self.bb, self.git, self.uh_work_dir, succeeded_pkgs_ctx)
+                tim = TestImage(self.bb, self.git, self.uh_work_dir)
 
                 try:
-                    tim.prepare_branch()
+                    tim.prepare_branch(succeeded_pkgs_ctx)
                 except Exception as e:
                     E(" testimage: Failed to prepare branch.")
                     if isinstance(e, Error):
@@ -599,31 +591,72 @@ class Updater(object):
                 I(" Images will test for %s." % ', '.join(self.opts['machines']))
                 for machine in self.opts['machines']:
                     I("  Testing images for %s ..." % machine)
-                    try:
-                        tim.ptest(machine)
-                    except Exception as e:
-                        E(" core-image-minimal/ptest on machine %s failed" % machine)
-                        if isinstance(e, Error):
-                            E(" %s" % e.stdout)
-                        else:
-                            import traceback
-                            traceback.print_exc(file=sys.stdout)
+                    while True:
+                        try:
+                            tim.ptest(succeeded_pkgs_ctx, machine)
+                            break
+                        except IntegrationError as e:
+                            E("   %s on machine %s failed in integration, removing..." 
+                                % (pkg_ctx['PN'], machine))
+
+                            with open(os.path.join(pkg_ctx['workdir'],
+                                'integration_error.log'), 'w+') as f:
+                                f.write(e.stdout)
+
+                            pkg_ctx['error'] = e
+                            failed_pkgs_ctx.append(pkg_ctx)
+                            succeeded_pkgs_ctx.remove(pkg_ctx)
+                            tim.prepare_branch(succeeded_pkgs_ctx)
+                        except Exception as e:
+                            E(" core-image-minimal/ptest on machine %s failed" % machine)
+                            if isinstance(e, Error):
+                                E(" %s" % e.stdout)
+                            else:
+                                import traceback
+                                traceback.print_exc(file=sys.stdout)
+
+                            break
 
                     image = settings.get('testimage_name', DEFAULT_TESTIMAGE)
-                    try:
-                        tim.testimage(machine, image)
-                    except Exception as e:
-                        E(" %s/testimage on machine %s failed" % (image, machine))
-                        if isinstance(e, Error):
-                            E(" %s" % e.stdout)
-                        else:
-                            import traceback
-                            traceback.print_exc(file=sys.stdout)
+                    while True:
+                        try:
+                            tim.testimage(succeeded_pkgs_ctx, machine, image)
+                            break
+                        except IntegrationError as e:
+                            E("    %s on machine %s failed in integration, removing..." 
+                                % (pkg_ctx['PN'], machine))
+
+                            with open(os.path.join(pkg_ctx['workdir'],
+                                'integration_error.log'), 'w+') as f:
+                                f.write(e.stdout)
+
+                            pkg_ctx['error'] = e
+                            failed_pkgs_ctx.append(pkg_ctx)
+                            succeeded_pkgs_ctx.remove(pkg_ctx)
+                            tim.prepare_branch(succeeded_pkgs_ctx)
+                        except Exception as e:
+                            E(" %s/testimage on machine %s failed" % (image, machine))
+                            if isinstance(e, Error):
+                                E(" %s" % e.stdout)
+                            else:
+                                import traceback
+                                traceback.print_exc(file=sys.stdout)
+                            break
             else:
                 I(" Testimage was enabled but any upgrade was successful.")
 
         for pn in pkgs_ctx.keys():
             pkg_ctx = pkgs_ctx[pn]
+
+            if pkg_ctx in succeeded_pkgs_ctx:
+                os.symlink(pkg_ctx['workdir'], os.path.join( \
+                    self.uh_recipes_succeed_dir, pkg_ctx['PN']))
+            else:
+                os.symlink(pkg_ctx['workdir'], os.path.join( \
+                    self.uh_recipes_failed_dir, pkg_ctx['PN']))
+
+            self.statistics.update(pkg_ctx['PN'], pkg_ctx['NPV'],
+                    pkg_ctx['MAINTAINER'], pkg_ctx['error'])
             self.pkg_upgrade_handler(pkg_ctx)
 
         if attempted_pkgs > 0:
-- 
2.1.4



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

* [[AUH] 6/6] upgradehelper: Remove deprecated setting drop_previous_commits.
  2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
                   ` (4 preceding siblings ...)
  2015-12-01 22:03 ` [[AUH] 5/6] testimage: Add handling of IntegrationError Aníbal Limón
@ 2015-12-01 22:03 ` Aníbal Limón
  5 siblings, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2015-12-01 22:03 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton

Since recipe upgrades are done in isolate manner cleaning the repo
for every recipe [1] the drop_previous_commits becomes deprecated.

Also now we have Testimage integration phase that handles/reports
this kind of errors.

[1] http://git.yoctoproject.org/cgit/cgit.cgi/auto-upgrade-helper/commit/?h=boot_images_v2&id=8769030a02753f09ed6b5e7c98ed1c442a51a466

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 README           |  3 ---
 upgradehelper.py | 20 --------------------
 2 files changed, 23 deletions(-)

diff --git a/README b/README
index 63c3b39..1b73034 100644
--- a/README
+++ b/README
@@ -59,9 +59,6 @@ clean_sstate=yes
 # clean tmp directory before upgrading
 clean_tmp=yes
 
-# keep previous commits or not
-drop_previous_commits=yes
-
 # machines to test build with
 machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
 
diff --git a/upgradehelper.py b/upgradehelper.py
index 19327c8..d9fa48a 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -276,26 +276,6 @@ class Updater(object):
 
     # this function will be called at the end of each recipe upgrade
     def pkg_upgrade_handler(self, pkg_ctx):
-        if self.opts['interactive'] and pkg_ctx['error'] and pkg_ctx['patch_file']:
-            answer = "N"
-            I(" %s: Do you want to keep the changes? (y/N)" % pkg_ctx['PN'])
-            answer = sys.stdin.readline().strip().upper()
-
-            if answer == '' or answer == 'N':
-                I(" %s: Dropping changes from git ..." % pkg_ctx['PN'])
-                self.git.reset_hard(1)
-                self.git.clean_untracked()
-                return
-
-        # drop last upgrade from git. It's safer this way if the upgrade has
-        # problems and other recipes depend on it. Give the other recipes a
-        # chance...
-        if (settings.get("drop_previous_commits", "no") == "yes" and
-                not pkg_ctx['error']) or (pkg_ctx['error'] and pkg_ctx['patch_file']):
-            I(" %s: Dropping changes from git ..." % pkg_ctx['PN'])
-            self.git.reset_hard(1)
-            self.git.clean_untracked()
-
         mail_header = \
             "Hello,\n\nYou are receiving this email because you are the maintainer\n" \
             "of *%s* recipe and this is to let you know that the automatic attempt\n" \
-- 
2.1.4



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

* Re: [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES.
  2015-12-01 22:03 ` [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES Aníbal Limón
@ 2015-12-11  1:31   ` Paul Eggleton
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Eggleton @ 2015-12-11  1:31 UTC (permalink / raw)
  To: Aníbal Limón; +Cc: yocto

On Tue, 01 Dec 2015 16:03:39 Aníbal Limón wrote:
> Instead of add manually the ptest packages use IMAGE_FEATURE to
> install ptest packages this save time validating if ptest pkg
> exist.
> 
> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
> ---
>  README               | 3 ++-
>  modules/testimage.py | 5 ++---
>  upgradehelper.py     | 5 +++++
>  3 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/README b/README
> index 1c8eba1..63c3b39 100644
> --- a/README
> +++ b/README
> @@ -108,7 +108,8 @@ file:
>  --------------- snip ---------------
>  INHERIT += "testimage"
> 
> -EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
> +DISTRO_FEATURES_append = " ptest"
> +EXTRA_IMAGE_FEATURES = "debug-tweaks package-management ptest-pkgs"
>  # testimage/ptest only work with rpm
>  PACKAGE_CLASSES = "package_rpm"
>  --------------- snip ---------------
> diff --git a/modules/testimage.py b/modules/testimage.py
> index e410111..52e2592 100644
> --- a/modules/testimage.py
> +++ b/modules/testimage.py
> @@ -60,11 +60,10 @@ class TestImage():
>          # for provide access to the target
>          if ptest:
>              pkgs_out.append("dropbear")
> +            pkgs_out.append("ptest-runner")
> 
>          for c in pkgs:
>              pkgs_out.append(c['PN'])
> -            if ptest:
> -                pkgs_out.append("%s-ptest" % c['PN'])
> 
>          return ' '.join(pkgs_out)
> 
> @@ -122,7 +121,7 @@ class TestImage():
>          ptest_pkgs = self._get_ptest_pkgs()
> 
>          os.environ['CORE_IMAGE_EXTRA_INSTALL'] = \
> -            self._get_pkgs_to_install(ptest_pkgs, True)
> +            self._get_pkgs_to_install(ptest_pkgs, ptest=True)
>          I( "   building core-image-minimal for %s ..." % machine)
>          self.bb.complete("core-image-minimal", machine)
> 
> diff --git a/upgradehelper.py b/upgradehelper.py
> index db39601..5a2b844 100755
> --- a/upgradehelper.py
> +++ b/upgradehelper.py
> @@ -242,6 +242,11 @@ class Updater(object):
>                        " please add to conf/local.conf.")
>                      exit(1)
> 
> +                if not "ptest-pkgs" in
> self.base_env['EXTRA_IMAGE_FEATURES']: 
> +                    E("
> testimage/ptest requires ptest-pkgs in EXTRA_IMAGE_FEATURES"\ 
> +            
>          " please add to conf/local.conf.")
> +                    exit(1)
> +

Strictly speaking this isn't really the proper test - the proper test is that 
ptest-pkgs is in IMAGE_FEATURES *for the image being built and tested* (not 
necessarily the global configuration). We can deal with this at some point in 
the future though.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

end of thread, other threads:[~2015-12-11  1:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 22:03 [[AUH] 0/6] Integration error handling and enhacements Aníbal Limón
2015-12-01 22:03 ` [[AUH] 1/6] recipe/git.py: Add missing import of re module Aníbal Limón
2015-12-01 22:03 ` [[AUH] 2/6] upgradehelper.py: Add support for preserve logs in workdir Aníbal Limón
2015-12-01 22:03 ` [[AUH] 3/6] upgradehelper.py: Add support for specify what image test Aníbal Limón
2015-12-01 22:03 ` [[AUH] 4/6] testimage/ptest: Add require of ptest-pkgs in EXTRA_IMAGE_FEATURES Aníbal Limón
2015-12-11  1:31   ` Paul Eggleton
2015-12-01 22:03 ` [[AUH] 5/6] testimage: Add handling of IntegrationError Aníbal Limón
2015-12-01 22:03 ` [[AUH] 6/6] upgradehelper: Remove deprecated setting drop_previous_commits Aníbal Limón

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.