[oe-commits] Paul Eggleton : devtool: reset: avoid errors in case file no longer exists

git at git.openembedded.org git at git.openembedded.org
Sun Apr 26 21:58:37 UTC 2015


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

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Thu Apr 23 17:18:31 2015 +0100

devtool: reset: avoid errors in case file no longer exists

If you manually delete files in the workspace layer (which you really
shouldn't) it was possible to get yourself into the situation where you
couldn't reset because we were attempting to check if the file had been
modified and erroring out if it couldn't be opened. If the file's not
there anymore there's not much point checking if it needs to be
preserved, just skip it.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/lib/devtool/standard.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 8932265..d561e40 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -308,7 +308,14 @@ def _check_preserve(config, recipename):
                 splitline = line.rstrip().split('|')
                 if splitline[0] == recipename:
                     removefile = os.path.join(config.workspace_path, splitline[1])
-                    md5 = bb.utils.md5_file(removefile)
+                    try:
+                        md5 = bb.utils.md5_file(removefile)
+                    except IOError as err:
+                        if err.errno == 2:
+                            # File no longer exists, skip it
+                            continue
+                        else:
+                            raise
                     if splitline[2] != md5:
                         bb.utils.mkdirhier(preservepath)
                         preservefile = os.path.basename(removefile)



More information about the Openembedded-commits mailing list