]> code.ossystems Code Review - openembedded-core.git/commitdiff
rootfs-postcommands: handle broken links when writing manifest
authorRoss Burton <ross.burton@intel.com>
Wed, 13 Apr 2016 11:14:23 +0000 (12:14 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Apr 2016 09:58:27 +0000 (10:58 +0100)
If the manifest link is broken then os.path.exists() returns False so the link
isn't removed, resulting in the os.symlink() call failing as the file already
exists.  Prevent this by using os.path.lexists to check that the symlink itself
exists, not the target.

Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/rootfs-postcommands.bbclass

index 56e810fd6f271d75c14241b64bc1b1237617c89b..95d28afa30b62516d63c50805428188e12f6b36e 100644 (file)
@@ -225,7 +225,7 @@ python write_image_manifest () {
 
     if os.path.exists(manifest_name):
         manifest_link = deploy_dir + "/" + link_name + ".manifest"
-        if os.path.exists(manifest_link):
+        if os.path.lexists(manifest_link):
             if d.getVar('RM_OLD_IMAGE', True) == "1" and \
                     os.path.exists(os.path.realpath(manifest_link)):
                 os.remove(os.path.realpath(manifest_link))
@@ -275,5 +275,3 @@ rootfs_check_host_user_contaminated () {
 rootfs_sysroot_relativelinks () {
        sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
 }
-
-