diff options
author | Joshua Lock <josh@linux.intel.com> | 2010-08-03 18:18:03 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-04 11:43:12 +0100 |
commit | 1fbcd2ca178db28747046b5bd943c81176db9f65 (patch) | |
tree | 18b476a4260e5970da74cc4d60ee51a010ee870c /meta | |
parent | 7b743641209492476329b88dcb213fbbd1780a9f (diff) | |
download | poky-1fbcd2ca178db28747046b5bd943c81176db9f65.tar.gz |
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 <josh@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/patch.py | 15 | ||||
-rw-r--r-- | meta/lib/oe/path.py | 22 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 11 |
3 files changed, 39 insertions, 9 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 94c56bc101..f203d683da 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -1,3 +1,5 @@ | |||
1 | import oe.path | ||
2 | |||
1 | class NotFoundError(Exception): | 3 | class NotFoundError(Exception): |
2 | def __init__(self, path): | 4 | def __init__(self, path): |
3 | self.path = path | 5 | self.path = path |
@@ -234,15 +236,10 @@ class QuiltTree(PatchSet): | |||
234 | if not self.initialized: | 236 | if not self.initialized: |
235 | self.InitFromDir() | 237 | self.InitFromDir() |
236 | PatchSet.Import(self, patch, force) | 238 | PatchSet.Import(self, patch, force) |
237 | 239 | oe.path.symlink(patch["file"], self._quiltpatchpath(patch["file"])) | |
238 | args = ["import", "-p", patch["strippath"]] | 240 | f = open(os.path.join(self.dir, "patches","series"), "a"); |
239 | if force: | 241 | f.write(os.path.basename(patch["file"]) + " -p" + patch["strippath"]+"\n") |
240 | args.append("-f") | 242 | f.close() |
241 | args.append("-dn") | ||
242 | args.append(patch["file"]) | ||
243 | |||
244 | self._runcmd(args) | ||
245 | |||
246 | patch["quiltfile"] = self._quiltpatchpath(patch["file"]) | 243 | patch["quiltfile"] = self._quiltpatchpath(patch["file"]) |
247 | patch["quiltfilemd5"] = bb.utils.md5_file(patch["quiltfile"]) | 244 | patch["quiltfilemd5"] = bb.utils.md5_file(patch["quiltfile"]) |
248 | 245 | ||
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): | |||
42 | return path | 42 | return path |
43 | else: | 43 | else: |
44 | return rel | 44 | return rel |
45 | |||
46 | def remove(path): | ||
47 | """Equivalent to rm -f or rm -rf""" | ||
48 | import os, errno, shutil | ||
49 | try: | ||
50 | os.unlink(path) | ||
51 | except OSError, exc: | ||
52 | if exc.errno == errno.EISDIR: | ||
53 | shutil.rmtree(path) | ||
54 | elif exc.errno != errno.ENOENT: | ||
55 | raise | ||
56 | |||
57 | def symlink(source, destination, force=False): | ||
58 | """Create a symbolic link""" | ||
59 | import os, errno | ||
60 | try: | ||
61 | if force: | ||
62 | remove(destination) | ||
63 | os.symlink(source, destination) | ||
64 | except OSError, e: | ||
65 | if e.errno != errno.EEXIST or os.readlink(destination) != source: | ||
66 | raise | ||
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index e61d663a50..3469700726 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -67,3 +67,14 @@ def str_filter(f, str, d): | |||
67 | def str_filter_out(f, str, d): | 67 | def str_filter_out(f, str, d): |
68 | from re import match | 68 | from re import match |
69 | return " ".join(filter(lambda x: not match(f, x, 0), str.split())) | 69 | return " ".join(filter(lambda x: not match(f, x, 0), str.split())) |
70 | |||
71 | def param_bool(cfg, field, dflt = None): | ||
72 | """Lookup <field> in <cfg> map and convert it to a boolean; take | ||
73 | <dflt> when this <field> does not exist""" | ||
74 | value = cfg.get(field, dflt) | ||
75 | strvalue = str(value).lower() | ||
76 | if strvalue in ('yes', 'y', 'true', 't', '1'): | ||
77 | return True | ||
78 | elif strvalue in ('no', 'n', 'false', 'f', '0'): | ||
79 | return False | ||
80 | raise ValueError("invalid value for boolean parameter '%s': '%s'" % (field, value)) | ||