diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-09-01 04:52:10 +0000 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-09-02 09:19:17 -0700 |
commit | 900cc29b603691eb3a077cb660545ead3715ed54 (patch) | |
tree | 94d9ca9b87e5b9c22e3bbccc8aac551ced5e13c4 /classes/patch.bbclass | |
parent | 490c68ac991239c908ec23a2fc143ef8ce2d9981 (diff) | |
download | openembedded-900cc29b603691eb3a077cb660545ead3715ed54.tar.gz |
do_unpack, do_patch: shift some responsibility around, clean things up
- Consolidate 'is this file a patch' logic
- Move unpack functions from classes into oe.unpack
- Move the unpacking message printing into do_unpack
- Move the destination directory determination into do_unpack
- Use subprocess's ability to pass in PATH and cwd rather than mangling the cmd
- Use shutil.copy2/copytree for ordinary file "unpack"
- Use the existing urldata from bb.fetch.init rather than re-decodeurl'ing the urls
- Make handling of globs in url paths explicit rather than implicit, calling
oe_unpack on each one, so showing an unpacking message to the user for each
globbed file, rather than the entirety
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Tom Rini <tom_rini@mentor.com>
Diffstat (limited to 'classes/patch.bbclass')
-rw-r--r-- | classes/patch.bbclass | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 227d7c9aeb..58b931f966 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -7,6 +7,7 @@ PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_sysroot" python patch_do_patch() { import oe.patch + import oe.unpack src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() if not src_uri: @@ -34,32 +35,24 @@ python patch_do_patch() { classes = {} + src_uri = d.getVar("SRC_URI", True).split() + srcurldata = bb.fetch.init(src_uri, d, True) workdir = bb.data.getVar('WORKDIR', d, 1) - for url in src_uri: - (type, host, path, user, pswd, parm) = bb.decodeurl(url) + for url in d.getVar("SRC_URI", True).split(): + urldata = srcurldata[url] - local = None - base, ext = os.path.splitext(os.path.basename(path)) + local = urldata.localpath + if not local: + raise bb.build.FuncFailed('Unable to locate local file for %s' % url) + + base, ext = os.path.splitext(os.path.basename(local)) if ext in ('.gz', '.bz2', '.Z'): - local = os.path.join(workdir, base) - ext = os.path.splitext(base)[1] - - if "apply" in parm: - apply = parm["apply"] - if apply != "yes": - if 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) - elif ext not in (".diff", ".patch"): + local = oe.path.join(workdir, base) + + if not oe.unpack.is_patch(local, urldata.parm): continue - if not local: - bb.fetch.init([url],d) - url = bb.encodeurl((type, host, path, user, pswd, [])) - local = os.path.join('/', bb.fetch.localpath(url, d)) - local = bb.data.expand(local, d) + parm = urldata.parm if "striplevel" in parm: striplevel = parm["striplevel"] |