All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: yocto@yoctoproject.org
Cc: paul.eggleton@linux.intel.com
Subject: [[AUH] 05/17] buildhistory: Add option for enable in upgrade-helper.conf
Date: Wed, 25 Nov 2015 18:00:34 -0600	[thread overview]
Message-ID: <1448496046-13186-6-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1448496046-13186-1-git-send-email-anibal.limon@linux.intel.com>

Make consistent the enablement for this feature it need to be
explicit enable into upgrade-helper.conf and also needs configuration
in local.conf.

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

diff --git a/README b/README
index 44c3bf1..ee1bd1f 100644
--- a/README
+++ b/README
@@ -58,6 +58,10 @@ drop_previous_commits=yes
 
 # machines to test build with
 machines=qemux86 qemux86-64 qemuarm qemumips qemuppc
+
+# optional features
+buildhistory=no
+
 --------------- snip ---------------
 
 3. Enable distrodata and supply appropriate additional metadata. For
@@ -75,8 +79,9 @@ WARNING: if you are using the default maintainers.inc file supplied
          emails to the default maintainers. Please be careful not to
          do this :)
 
-4. Enable buildhistory by adding the following lines to your
-conf/local.conf file:
+4. If you want to enable buildhistory (optional) you need to enable in
+upgrade-helper.conf also add the following lines to your conf/local.conf
+file:
 
 --------------- snip ---------------
 INHERIT =+ "buildhistory"
diff --git a/modules/steps.py b/modules/steps.py
index b85a0dc..4a2eee3 100644
--- a/modules/steps.py
+++ b/modules/steps.py
@@ -85,7 +85,7 @@ def detect_recipe_type(bb, git, opts, pkg_ctx):
             pkg_ctx['recipe_dir'], bb, git)
 
 def buildhistory_init(bb, git, opts, pkg_ctx):
-    if not opts['buildhistory_enabled']:
+    if not opts['buildhistory']:
         return
 
     pkg_ctx['buildhistory'] = BuildHistory(bb, pkg_ctx['PN'],
@@ -118,11 +118,11 @@ def compile(bb, git, opts, pkg_ctx):
     for machine in opts['machines']:
         I(" %s: compiling for %s ..." % (pkg_ctx['PN'], machine))
         pkg_ctx['recipe'].compile(machine)
-        if opts['buildhistory_enabled']:
+        if opts['buildhistory']:
             pkg_ctx['buildhistory'].add()
 
 def buildhistory_diff(bb, git, opts, pkg_ctx):
-    if not opts['buildhistory_enabled']:
+    if not opts['buildhistory']:
         return
 
     I(" %s: Checking buildhistory ..." % pkg_ctx['PN'])
diff --git a/upgradehelper.py b/upgradehelper.py
index e526597..c841c2a 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -156,7 +156,7 @@ class Updater(object):
         self.opts['machines'] = settings.get('machines',
                 'qemux86 qemux86-64 qemuarm qemumips qemuppc').split()
         self.opts['skip_compilation'] = skip_compilation
-        self.opts['buildhistory_enabled'] = self._buildhistory_is_enabled()
+        self.opts['buildhistory'] = self._buildhistory_is_enabled()
 
         self.uh_dir = os.path.join(build_dir, "upgrade-helper")
         if not os.path.exists(self.uh_dir):
@@ -180,22 +180,34 @@ class Updater(object):
     def _buildhistory_is_enabled(self):
         enabled = False
 
-        if 'buildhistory' in self.base_env['INHERIT']:
-            if not 'BUILDHISTORY_COMMIT' in self.base_env:
-                E(" Buildhistory was enabled but need"\
-                        " BUILDHISTORY_COMMIT=1 please set.")
-                exit(1)
+        if settings.get("buildhistory", "no") == "yes":
+            if 'buildhistory' in self.base_env['INHERIT']:
+                if not 'BUILDHISTORY_COMMIT' in self.base_env:
+                    E(" Buildhistory was INHERIT in conf/local.conf"\
+                      " but need BUILDHISTORY_COMMIT=1 please set.")
+                    exit(1)
 
-            if not self.base_env['BUILDHISTORY_COMMIT'] == '1':
-                E(" Buildhistory was enabled but need"\
-                        " BUILDHISTORY_COMMIT=1 please set.")
-                exit(1)
+                if not self.base_env['BUILDHISTORY_COMMIT'] == '1':
+                    E(" Buildhistory was INHERIT in conf/local.conf"\
+                      " but need BUILDHISTORY_COMMIT=1 please set.")
+                    exit(1)
 
-            if self.opts['skip_compilation']:
-                W(" Buildhistory disabled because user" \
-                        " skip compilation!")
+                if self.opts['skip_compilation']:
+                    W(" Buildhistory disabled because user" \
+                            " skip compilation!")
+                else:
+                    enabled = True
             else:
-                enabled = True
+                E(" Buildhistory was enabled in upgrade-helper.conf"\
+                  " but isn't INHERIT in conf/local.conf, if you want"\
+                  " to enable please set.")
+                exit(1)
+        else:
+            if 'buildhistory' in self.base_env['INHERIT']:
+                E(" Buildhistory was INHERIT in conf/local.conf"\
+                  " but buildhistory=yes isn't in upgrade-helper.conf,"\
+                  " if you want to enable please set.")
+                exit(1)
 
         return enabled
 
-- 
2.1.4



  parent reply	other threads:[~2015-11-26  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  0:00 [[AUH] 00/17] AUH code refactor and support test image Aníbal Limón
2015-11-26  0:00 ` [[AUH] 01/17] {upgradehelper, bitbake}.py: Move _get_env function to bitbake Aníbal Limón
2015-11-26  0:00 ` [[AUH] 02/17] upgradehelper.py: Merge options into a dictionary Aníbal Limón
2015-11-26  0:00 ` [[AUH] 03/17] upgradehelper.py: Adds own module for steps Aníbal Limón
2015-11-26  0:00 ` [[AUH] 04/17] upgradehelper: Reorder files into directories Aníbal Limón
2015-11-26  0:00 ` Aníbal Limón [this message]
2015-11-26  0:00 ` [[AUH] 06/17] recipe/base.py: Add is_recipe_or_include_file func Aníbal Limón
2015-11-26  0:00 ` [[AUH] 07/17] recipe/base.py: Add modify_recipe_files function decorator Aníbal Limón
2015-11-26  0:00 ` [[AUH] 08/17] recipe/base.py: Add support for get recipe inherits Aníbal Limón
2015-11-26 20:25   ` Paul Eggleton
2015-11-27 16:50     ` Aníbal Limón
2015-11-26  0:00 ` [[AUH] 09/17] steps.py: Merge load_dirs step into load_env Aníbal Limón
2015-11-26  0:00 ` [[AUH] 10/17] steps.py: Move clean_repo to first step Aníbal Limón
2015-11-26  0:00 ` [[AUH] 11/17] utils/git.py: Add method for apply patches into a branch Aníbal Limón
2015-11-26 20:28   ` Paul Eggleton
2015-11-27 16:51     ` Aníbal Limón
2015-11-26  0:00 ` [[AUH] 12/17] upgradehelper.py: Add settings for enable testimage Aníbal Limón
2015-11-26  0:00 ` [[AUH] 13/17] upgradehelper: Add testimage feature Aníbal Limón
2015-11-26 20:29   ` Paul Eggleton
2015-11-27 16:51     ` Aníbal Limón
2015-11-26  0:00 ` [[AUH] 14/17] upgradehelper.py: Changed retry failure build to 30 days Aníbal Limón
2015-11-26  0:00 ` [[AUH] 15/17] upgradehelper: Add workdir setting Aníbal Limón
2015-11-26  0:00 ` [[AUH] 16/17] statistics: Improve email format and get_summary method Aníbal Limón
2015-11-26  0:00 ` [[AUH] 17/17] statistics: Add support for publish_work_url setting Aníbal Limón

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448496046-13186-6-git-send-email-anibal.limon@linux.intel.com \
    --to=anibal.limon@linux.intel.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.