Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] wic usability fixes
@ 2013-10-18  4:45 Tom Zanussi
  2013-10-18  4:45 ` [PATCH 1/2] wic: Check for the existence/correctness of build artifacts Tom Zanussi
  2013-10-18  4:45 ` [PATCH 2/2] wic: Initialize return values in find_artifacts() Tom Zanussi
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Zanussi @ 2013-10-18  4:45 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

These fixes point out problems or avoid ugly backtraces when users
supply invalid input values.

The following changes since commit fd09f894b40dadb8bc8b267a26dbf52e22a53d66:

  wic: add pseudo to the populate-extfs step (2013-10-16 14:11:53 -0500)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib.git tzanussi/wic-fixes-2
  http://git.yoctoproject.org/cgit.cgi//log/?h=tzanussi/wic-fixes-2

Tom Zanussi (2):
  wic: Check for the existence/correctness of build artifacts
  wic: Initialize return values in find_artifacts()

 scripts/lib/image/engine.py |  2 ++
 scripts/wic                 | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

-- 
1.7.11.4



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

* [PATCH 1/2] wic: Check for the existence/correctness of build artifacts
  2013-10-18  4:45 [PATCH 0/2] wic usability fixes Tom Zanussi
@ 2013-10-18  4:45 ` Tom Zanussi
  2013-10-18  4:45 ` [PATCH 2/2] wic: Initialize return values in find_artifacts() Tom Zanussi
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Zanussi @ 2013-10-18  4:45 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

If a user uses the -e option and specifies a machine that hasn't been
built or uses the wrong .wks script for the build artifacts pointed to
by the current machine, we should point that out for obvious cases.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/wic | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/scripts/wic b/scripts/wic
index a7221c3..08473d3 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -143,6 +143,26 @@ def wic_create_subcommand(args, usage_str):
         if not os.path.isdir(native_sysroot):
             print "--native-sysroot (-n) not found, exiting\n"
             sys.exit(1)
+    else:
+        not_found = not_found_dir = ""
+        if not os.path.isdir(rootfs_dir):
+            (not_found, not_found_dir) = ("rootfs-dir", rootfs_dir)
+        elif not os.path.isdir(hdddir) and not os.path.isdir(staging_data_dir):
+            (not_found, not_found_dir) = ("bootimg-dir", bootimg_dir)
+        elif not os.path.isdir(kernel_dir):
+            (not_found, not_found_dir) = ("kernel-dir", kernel_dir)
+        elif not os.path.isdir(native_sysroot):
+            (not_found, not_found_dir) = ("native-sysroot", native_sysroot)
+        if not_found:
+            if not not_found_dir:
+                not_found_dir = "Completely missing artifact - wrong image (.wks) used?"
+            print "Build artifacts not found, exiting."
+            print "  (Please check that the build artifacts for the machine"
+            print "   selected in local.conf actually exist and that they"
+            print "   are the correct artifacts for the image (.wks file)).\n"
+            print "The artifact that couldn't be found was %s:\n  %s" % \
+                (not_found, not_found_dir)
+            sys.exit(1)
 
     wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                native_sysroot, hdddir, staging_data_dir, scripts_path,
-- 
1.7.11.4



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

* [PATCH 2/2] wic: Initialize return values in find_artifacts()
  2013-10-18  4:45 [PATCH 0/2] wic usability fixes Tom Zanussi
  2013-10-18  4:45 ` [PATCH 1/2] wic: Check for the existence/correctness of build artifacts Tom Zanussi
@ 2013-10-18  4:45 ` Tom Zanussi
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Zanussi @ 2013-10-18  4:45 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi

If one of these isn't found, it won't be initialized and will throw an
UnboundLocalError.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/image/engine.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index be29222..b3a9c74 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -82,6 +82,8 @@ def find_artifacts(image_name):
         print "Couldn't get '%s' output, exiting." % bitbake_env_cmd
         sys.exit(1)
 
+    rootfs_dir = kernel_dir = hdddir = staging_data_dir = native_sysroot = ""
+
     for line in bitbake_env_lines.split('\n'):
         if (get_line_val(line, "IMAGE_ROOTFS")):
             rootfs_dir = get_line_val(line, "IMAGE_ROOTFS")
-- 
1.7.11.4



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

end of thread, other threads:[~2013-10-18  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18  4:45 [PATCH 0/2] wic usability fixes Tom Zanussi
2013-10-18  4:45 ` [PATCH 1/2] wic: Check for the existence/correctness of build artifacts Tom Zanussi
2013-10-18  4:45 ` [PATCH 2/2] wic: Initialize return values in find_artifacts() Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox