summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-05-23 20:23:53 -0700
committerChris Larson <chris_larson@mentor.com>2010-05-25 12:53:41 -0700
commitbf7d0467a0788a7fcc1c96e0dc35a25ae09278a0 (patch)
tree96f28e2f5133d68c3e3dadabaa2339340671454f /classes
parentfab0af3aefee22b21541e403d3c356a6979bfa63 (diff)
Rename url params patch=<ignored>/pnum=<n> to apply={yes,no}/striplevel=<n>
I think this makes the behavior rather more clear. Signed-off-by: Chris Larson <chris_larson@mentor.com> Acked-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/patch.bbclass35
1 files changed, 20 insertions, 15 deletions
diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 1af374b39b..4767a3b7dc 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -39,32 +39,37 @@ python patch_do_patch() {
workdir = bb.data.getVar('WORKDIR', d, 1)
for url in src_uri:
(type, host, path, user, pswd, parm) = bb.decodeurl(url)
- if not "patch" in parm:
+ apply = parm.get("apply")
+ if apply != "yes" and not "patch" in parm:
+ if apply and apply != "no":
+ bb.msg.warn(None, "Unsupported value '%s' for 'apply' url param in '%s', please use 'yes' or 'no'" % (apply, url))
continue
+ elif "patch" in parm:
+ bb.msg.warn(None, "Deprecated usage of 'patch' url param in '%s', please use 'apply={yes,no}'" % url)
bb.fetch.init([url],d)
url = bb.encodeurl((type, host, path, user, pswd, []))
local = os.path.join('/', bb.fetch.localpath(url, d))
- # did it need to be unpacked?
- dots = os.path.basename(local).split(".")
- if dots[-1] in ['gz', 'bz2', 'Z']:
- unpacked = os.path.join(bb.data.getVar('WORKDIR', d),'.'.join(dots[0:-1]))
- else:
- unpacked = local
- unpacked = bb.data.expand(unpacked, d)
+ base, ext = os.path.splitext(os.path.basename(local))
+ if ext in ('.gz', '.bz2', '.Z'):
+ local = os.path.join(workdir, base)
+ local = bb.data.expand(local, d)
- if "pnum" in parm:
- pnum = parm["pnum"]
+ if "striplevel" in parm:
+ striplevel = parm["striplevel"]
+ elif "pnum" in parm:
+ bb.msg.warn(None, "Deprecated usage of 'pnum' url parameter in '%s', please use 'striplevel'" % url)
+ striplevel = parm["pnum"]
else:
- pnum = "1"
+ striplevel = '1'
if "pname" in parm:
pname = parm["pname"]
else:
- pname = os.path.basename(unpacked)
+ pname = os.path.basename(local)
- if "mindate" in parm or "maxdate" in parm:
+ if "mindate" in parm or "maxdate" in parm:
pn = bb.data.getVar('PN', d, 1)
srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
if not srcdate:
@@ -94,9 +99,9 @@ python patch_do_patch() {
bb.note("Patch '%s' applies to earlier revisions" % pname)
continue
- bb.note("Applying patch '%s' (%s)" % (pname, oe.path.format_display(unpacked, d)))
+ bb.note("Applying patch '%s' (%s)" % (pname, oe.path.format_display(local, d)))
try:
- patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
+ patchset.Import({"file":local, "remote":url, "strippath": striplevel}, True)
except Exception:
import sys
raise bb.build.FuncFailed(str(sys.exc_value))