From 1fbcd2ca178db28747046b5bd943c81176db9f65 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Tue, 3 Aug 2010 18:18:03 +0100 Subject: lib/oe: sync with OE.dev Most notable change is the move to creating symlinks to patches in the metadata tree rather than copying them. Signed-off-by: Joshua Lock --- meta/lib/oe/path.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'meta/lib/oe/path.py') diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index 8902951581..f58c0138bb 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py @@ -42,3 +42,25 @@ def format_display(path, metadata): return path else: return rel + +def remove(path): + """Equivalent to rm -f or rm -rf""" + import os, errno, shutil + try: + os.unlink(path) + except OSError, exc: + if exc.errno == errno.EISDIR: + shutil.rmtree(path) + elif exc.errno != errno.ENOENT: + raise + +def symlink(source, destination, force=False): + """Create a symbolic link""" + import os, errno + try: + if force: + remove(destination) + os.symlink(source, destination) + except OSError, e: + if e.errno != errno.EEXIST or os.readlink(destination) != source: + raise -- cgit 1.2.3-korg