Skip to contentSkip to conversation

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

PATCH Superseded Dorinda 2 participants 2 messages Feb 1, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dorinda

author
#0 lore raw

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

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

[YOCTO #12096]

---
 scripts/oe-pkgdata-util | 5 +++++
 1 file changed, 5 insertions(+)
scripts/oe-pkgdata-util +5 -0
index 93220e3617..169908638d 100755
@@ -513,6 +513,11 @@ def find_path(args):
 
 
 def main():
+
+    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)
+
     parser = argparse_oe.ArgumentParser(description="OpenEmbedded pkgdata tool - queries the pkgdata files written out during do_package",
                                         epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
     parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
Signature · 1 line
2.17.1
#1 lore raw

There's a '-p' option. It should error out only when it cannot determine the pkdata dir.

Regards,
Chen Qi

Quoted 27 lines · Dorinda

[YOCTO #12096]

---
  scripts/oe-pkgdata-util | 5 +++++
  1 file changed, 5 insertions(+)
scripts/oe-pkgdata-util +5 -0
index 93220e3617..169908638d 100755
@@ -513,6 +513,11 @@ def find_path(args):
 
 
  def main():
+
+    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)
+
      parser = argparse_oe.ArgumentParser(description="OpenEmbedded pkgdata tool - queries the pkgdata files written out during do_package",
                                          epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
      parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')