]> code.ossystems Code Review - openembedded-core.git/commitdiff
combo-layer: handle unset dest_dir in sanity_check()
authorPatrick Ohly <patrick.ohly@intel.com>
Wed, 20 May 2015 11:48:20 +0000 (13:48 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 May 2015 09:48:47 +0000 (10:48 +0100)
The previous "clean up dest_dir checking" patch (f8cdbe7497) improved
handling of empty dest_dir but made handling of unset dest_dir worse:
instead showing the "Option dest_dir is not defined for component ..."
error, it fails with a Python exception.

Avoid that by providing a sane fallback for the unset case. With that
change, dest_dir is no longer strictly required, but the check for it
is kept to ensure that a combo-layer.conf also works with older
combo-layer versions.

[Yocto #7773]

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/combo-layer

index b0b7c28beaec11b7e1be1118b4a4c319de31c9bd..698d3e3baac83c7d8279d89aabdfc068ab7f37b1 100755 (executable)
@@ -145,8 +145,10 @@ class Configuration(object):
                     msg = "%s\nOption %s is not defined for component %s" %(msg, option, name)
                     missing_options.append(option)
             # Sanitize dest_dir so that we do not have to deal with edge cases
-            # (empty string, double slashes) in the rest of the code.
-            dest_dir = os.path.normpath(self.repos[name]["dest_dir"])
+            # (unset, empty string, double slashes) in the rest of the code.
+            # It not being set will still be flagged as error because it is
+            # listed as required option above; that could be changed now.
+            dest_dir = os.path.normpath(self.repos[name].get("dest_dir", "."))
             self.repos[name]["dest_dir"] = "." if not dest_dir else dest_dir
         if msg != "":
             logger.error("configuration file %s has the following error: %s" % (self.conffile,msg))