Skip to contentSkip to conversation

oe-pkgdata-util: Check if environment script is initialized

PATCH In review Dorinda 2 participants 4 messages Feb 1, 2021 – Feb 9, 2021

lore
Share & tools
lore

Dorinda

author
#0 lore raw

PATCH v2 1/1 oe-pkgdata-util: Check if environment script is initialized

Tinfoil doesn't behave well if environment is not initialized, this check ensures a proper error log if environment is not initialized.

[YOCTO #12096]

---
v2:
-Positioned check under a condition when it cannot determine the pkgdata_dir

 scripts/oe-pkgdata-util | 3 +++
 1 file changed, 3 insertions(+)
scripts/oe-pkgdata-util +3 -0
index 93220e3617..75dd23efa3 100755
@@ -598,6 +598,9 @@ def main():
             logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
             sys.exit(1)
         logger.debug('Found bitbake path: %s' % bitbakepath)
+        if not os.environ.get('BUILDDIR', ''):
+            logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
         tinfoil = tinfoil_init()
         try:
             args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
Signature · 1 line
2.17.1
author
#1 lore raw

Hi Everyone,
Just a friendly reminder to review this patch.

Thanks,
Dorinda.

Quoted 34 lines · dorindabassey

Tinfoil doesn't behave well if environment is not initialized, this check ensures a proper error log if environment is not initialized.

[YOCTO #12096]

---
v2:
-Positioned check under a condition when it cannot determine the pkgdata_dir

 scripts/oe-pkgdata-util | 3 +++
 1 file changed, 3 insertions(+)
scripts/oe-pkgdata-util +3 -0
index 93220e3617..75dd23efa3 100755
@@ -598,6 +598,9 @@ def main():
             logger.error("Unable to find bitbake by searching parent
 directory of this script or PATH")
             sys.exit(1)
         logger.debug('Found bitbake path: %s' % bitbakepath)
+        if not os.environ.get('BUILDDIR', ''):
+            logger.error("This script can only be run after initialising
 the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
         tinfoil = tinfoil_init()

try:
args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
--
2.17.1

#2 lore raw
In reply to Dorinda

Hi Dorinda,

Quoted 24 lines · Dorinda

Tinfoil doesn't behave well if environment is not initialized, this check ensures a proper error log if environment is not initialized.

[YOCTO #12096]

---
v2:
-Positioned check under a condition when it cannot determine the pkgdata_dir

 scripts/oe-pkgdata-util | 3 +++

 1 file changed, 3 insertions(+)
scripts/oe-pkgdata-util +3 -0
index 93220e3617..75dd23efa3 100755
@@ -598,6 +598,9 @@ def main():
              logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
              sys.exit(1)
          logger.debug('Found bitbake path: %s' % bitbakepath)
+        if not os.environ.get('BUILDDIR', ''):
+            logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
          tinfoil = tinfoil_init()
Quoted 2 lines

         try:
             args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')

I'm a little worried about this patch since it fixes the oe-pkgdata- util case but what about devtool, or recipetool or anything else which uses tinfoil.

I'm wondering if there should be a check inside tinfoil itself?

or is this problem really oe-pkgdata-util specific?

Cheers,

Richard

author
#3 lore raw

Hi Richard,

I checked devtool and recipetool, they have checks in place that errors out immediately if executed without initializing oe-init-build-env script.

However, I'm unsure about this:
I'm wondering if there should be a check inside tinfoil itself?

Thanks and Regards,
Dorinda.

On Feb 8, 2021 17:42, "Richard Purdie" <[email protected]> wrote:

Hi Dorinda,

Quoted 1 line · Dorinda

Tinfoil doesn't behave well if environment is not initialized, this check

ensures a proper error log if environment is not initialized.

Quoted 7 lines

[YOCTO #12096]

---
v2:
-Positioned check under a condition when it cannot determine the

pkgdata_dir

scripts/oe-pkgdata-util def main(): · line 598

Quoted 10 lines
 scripts/oe-pkgdata-util | 3 +++
 1 file changed, 3 insertions(+)
scripts/oe-pkgdata-util +0 -0
index 93220e3617..75dd23efa3 100755
@@ -598,6 +598,9 @@ def main():
             logger.error("Unable to find bitbake by searching parent

directory of this script or PATH")

scripts/oe-pkgdata-util def main():

Quoted 4 lines
scripts/oe-pkgdata-util +2 -0
             sys.exit(1)
         logger.debug('Found bitbake path: %s' % bitbakepath)
+        if not os.environ.get('BUILDDIR', ''):
+            logger.error("This script can only be run after initialising

the build environment (e.g. by using oe-init-build-env)")

scripts/oe-pkgdata-util def main(): · line 606

Quoted 4 lines
scripts/oe-pkgdata-util +1 -0
+            sys.exit(1)
         tinfoil = tinfoil_init()
         try:
             args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')

I'm a little worried about this patch since it fixes the oe-pkgdata- util case but what about devtool, or recipetool or anything else which uses tinfoil.

I'm wondering if there should be a check inside tinfoil itself?

or is this problem really oe-pkgdata-util specific?

Cheers,

Richard