summaryrefslogtreecommitdiff
path: root/meta/classes/patch.bbclass
diff options
context:
space:
mode:
authorTom Rini <tom_rini@mentor.com>2011-03-31 10:45:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-04 13:57:14 +0100
commit01e4609ee8441c8212725fd062782313caae0708 (patch)
treeb0abf40874539b9270f0a8969d3f9ca598072b5b /meta/classes/patch.bbclass
parent21f2fc95890d00eb4c1cc88b50332444fc371f56 (diff)
downloadopenembedded-core-01e4609ee8441c8212725fd062782313caae0708.tar.gz
openembedded-core-01e4609ee8441c8212725fd062782313caae0708.tar.bz2
openembedded-core-01e4609ee8441c8212725fd062782313caae0708.tar.xz
openembedded-core-01e4609ee8441c8212725fd062782313caae0708.zip
patch.bbclass: allow importing patches into other dirs
This is taken from openembedded.master: commit 9d0d70da60ca8ef278916f442125d41161846f38 Author: Chris Larson <chris_larson@mentor.com> Date: Mon Aug 23 13:03:55 2010 -0400 patch: allow importing patches into other dirs Use the 'patchdir' flag. If relative, it's assumed to be relative to ${S}. It creates a patchset class per patch directory, so for quilt this results i multiple .pc/patches directories to manage each of the patchsets. Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Tom Rini <tom_rini@mentor.com>
Diffstat (limited to 'meta/classes/patch.bbclass')
-rw-r--r--meta/classes/patch.bbclass19
1 files changed, 16 insertions, 3 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 80fd45f0e..762216345 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -31,10 +31,8 @@ python patch_do_patch() {
path = os.getenv('PATH')
os.putenv('PATH', bb.data.getVar('PATH', d, 1))
- patchset = cls(s, d)
- patchset.Clean()
- resolver = rcls(patchset)
+ classes = {}
workdir = bb.data.getVar('WORKDIR', d, 1)
for url in src_uri:
@@ -117,6 +115,21 @@ python patch_do_patch() {
bb.note("Patch '%s' doesn't apply to revision" % pname)
continue
+ if "patchdir" in parm:
+ patchdir = parm["patchdir"]
+ if not os.path.isabs(patchdir):
+ patchdir = os.path.join(s, patchdir)
+ else:
+ patchdir = s
+
+ if not patchdir in classes:
+ patchset = cls(patchdir, d)
+ resolver = rcls(patchset)
+ classes[patchdir] = (patchset, resolver)
+ patchset.Clean()
+ else:
+ patchset, resolver = classes[patchdir]
+
bb.note("Applying patch '%s' (%s)" % (pname, oe.path.format_display(local, d)))
try:
patchset.Import({"file":local, "remote":url, "strippath": striplevel}, True)