[oe-commits] Laurentiu Palcu : image.py: check file exists before deleting

git at git.openembedded.org git at git.openembedded.org
Fri Mar 28 13:35:25 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 8910d3cc94899ab4d509e681b438ae96218fa777
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=8910d3cc94899ab4d509e681b438ae96218fa777

Author: Laurentiu Palcu <laurentiu.palcu at intel.com>
Date:   Fri Mar 28 15:07:40 2014 +0200

image.py: check file exists before deleting

When RM_OLD_IMAGE = "1", we delete old images but we didn't check they
actually exist...

[YOCTO #6029]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oe/image.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index a03b73e..c9b9033 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -192,7 +192,8 @@ class Image(ImageDepGraph):
                 if img.find(self.d.getVar('IMAGE_LINK_NAME', True)) == 0:
                     img = os.path.join(deploy_dir, img)
                     if os.path.islink(img):
-                        if self.d.getVar('RM_OLD_IMAGE', True) == "1":
+                        if self.d.getVar('RM_OLD_IMAGE', True) == "1" and \
+                                os.path.exists(os.path.realpath(img)):
                             os.remove(os.path.realpath(img))
 
                         os.remove(img)



More information about the Openembedded-commits mailing list