All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] tinfoil.py: Check if BUILDDIR exists
  2018-01-18 23:45 [PATCH 0/1] " Amanda Brindle
@ 2018-01-18 23:45 ` Amanda Brindle
  0 siblings, 0 replies; 5+ messages in thread
From: Amanda Brindle @ 2018-01-18 23:45 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton, Amanda Brindle

Check if BUILDDIR exists in order to deterimine if a tinfoil using
script is running without having called oe-init-build-env (or similar).
If not, instruct user to initialise the build environment, and then
error out immediately. Before, tinfoil would hang for 30s before
erroring out.

Fixes [YOCTO #12096]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
 bitbake/lib/bb/tinfoil.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 368264f..e156b47 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -372,6 +372,11 @@ class Tinfoil:
         """
         self.quiet = quiet
 
+        basepath = os.environ.get('BUILDDIR')
+        if not basepath:
+            print("Tinfoil can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
+
         if self.tracking:
             extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
         else:
-- 
2.7.4



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

* [PATCH 0/1] tinfoil.py: Check if BUILDDIR exists
@ 2018-01-19 20:52 Amanda Brindle
  2018-01-19 20:53 ` [PATCH 1/1] " Amanda Brindle
  0 siblings, 1 reply; 5+ messages in thread
From: Amanda Brindle @ 2018-01-19 20:52 UTC (permalink / raw)
  To: bitbake-devel; +Cc: paul.eggleton

The following changes since commit e153efde9754a650e555f46cba09680baabd7d7e:

  multilib.bbclass: deltask populate_sdk and populate_sdk_ext (2018-01-19 12:37:14 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib abrindle/tinfoil
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=abrindle/tinfoil

Amanda Brindle (1):
  tinfoil.py: Check if BUILDDIR exists

 bitbake/lib/bb/tinfoil.py | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.7.4



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

* [PATCH 1/1] tinfoil.py: Check if BUILDDIR exists
  2018-01-19 20:52 [PATCH 0/1] tinfoil.py: Check if BUILDDIR exists Amanda Brindle
@ 2018-01-19 20:53 ` Amanda Brindle
  2018-01-22 20:02   ` Paul Eggleton
  0 siblings, 1 reply; 5+ messages in thread
From: Amanda Brindle @ 2018-01-19 20:53 UTC (permalink / raw)
  To: bitbake-devel; +Cc: paul.eggleton

Check if BUILDDIR exists in order to deterimine if a tinfoil using
script is running without having called oe-init-build-env (or similar).
If not, instruct user to initialise the build environment, and then
error out immediately. Before, tinfoil would hang for 30s before
erroring out.

Fixes [YOCTO #12096]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
 bitbake/lib/bb/tinfoil.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 368264f..e156b47 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -372,6 +372,11 @@ class Tinfoil:
         """
         self.quiet = quiet
 
+        basepath = os.environ.get('BUILDDIR')
+        if not basepath:
+            print("Tinfoil can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
+
         if self.tracking:
             extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
         else:
-- 
2.7.4



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

* Re: [PATCH 1/1] tinfoil.py: Check if BUILDDIR exists
  2018-01-19 20:53 ` [PATCH 1/1] " Amanda Brindle
@ 2018-01-22 20:02   ` Paul Eggleton
  2018-01-22 22:08     ` Richard Purdie
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggleton @ 2018-01-22 20:02 UTC (permalink / raw)
  To: Amanda Brindle; +Cc: bitbake-devel

Hi Amanda,

On Saturday, 20 January 2018 9:53:13 AM NZDT Amanda Brindle wrote:
> +        basepath = os.environ.get('BUILDDIR')
> +        if not basepath:
> +            print("Tinfoil can only be run after initialising the build
> environment (e.g. by using oe-init-build-env)")
> +            sys.exit(1)
> +

We should be raising an exception here - tinfoil is utility code, it shouldn't 
be calling sys.exit(). Additionally, bitbake shouldn't be referring to 
oe-init-build-env, that's something from OpenEmbedded; even mentioning Tinfoil 
isn't going to be much use to the user. I would simply raise a custom 
exception class with the message "Build environment not initialised" or 
similar, and if tinfoil-using want to catch that exception and produce a more 
friendly message they can fairly easily do so.

Cheers,
Paul


-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: [PATCH 1/1] tinfoil.py: Check if BUILDDIR exists
  2018-01-22 20:02   ` Paul Eggleton
@ 2018-01-22 22:08     ` Richard Purdie
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2018-01-22 22:08 UTC (permalink / raw)
  To: Paul Eggleton, Amanda Brindle; +Cc: bitbake-devel

On Tue, 2018-01-23 at 09:02 +1300, Paul Eggleton wrote:
> Hi Amanda,
> 
> On Saturday, 20 January 2018 9:53:13 AM NZDT Amanda Brindle wrote:
> > 
> > +        basepath = os.environ.get('BUILDDIR')
> > +        if not basepath:
> > +            print("Tinfoil can only be run after initialising the
> > build
> > environment (e.g. by using oe-init-build-env)")
> > +            sys.exit(1)
> > +
> We should be raising an exception here - tinfoil is utility code, it
> shouldn't 
> be calling sys.exit(). Additionally, bitbake shouldn't be referring
> to 
> oe-init-build-env, that's something from OpenEmbedded; even
> mentioning Tinfoil 
> isn't going to be much use to the user. I would simply raise a
> custom 
> exception class with the message "Build environment not initialised"
> or 
> similar, and if tinfoil-using want to catch that exception and
> produce a more 
> friendly message they can fairly easily do so.

This was also triggering on the autobuilder tests so something isn't
quite right here:

https://autobuilder.yocto.io/builders/nightly-x86-64/builds/744/steps/Running%20ESDK%20Sanity%20Tests/logs/stdio

Cheers,

Richard


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

end of thread, other threads:[~2018-01-22 22:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19 20:52 [PATCH 0/1] tinfoil.py: Check if BUILDDIR exists Amanda Brindle
2018-01-19 20:53 ` [PATCH 1/1] " Amanda Brindle
2018-01-22 20:02   ` Paul Eggleton
2018-01-22 22:08     ` Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2018-01-18 23:45 [PATCH 0/1] " Amanda Brindle
2018-01-18 23:45 ` [PATCH 1/1] " Amanda Brindle

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.