conditional patch-tool dep
PATCH 1/1 conditional patch-tool dep
Hi,
If a recipe doesn't reference any patch then patching doesn't make sense and neither does depending on patch-tool.
I didn't look yet if i can say
addtask patch after do_unpack if needs_patching_at_all(d) (or something like that).
So, for a start, don't depend do_patch on the patch tool if there is no patch in the SRC_URI.
untested.
PS: There should be some oe.is_compressed(uri) shorthand that is used to decide if an uri is in a compressed format, imho.
Bernhard Reutner-Fischer (1):
patch.bbclass: conditional patch-tool dependency
classes/patch.bbclass | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.2.3
PATCH 1/1 patch.bbclass: conditional patch-tool dependency
only depend do_patch on patch-tool if recipe references any patch
--- classes/patch.bbclass | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
classes/patch.bbclass +19 -2
@@ -38,7 +38,7 @@ python patch_do_patch() { 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 d.getVar("SRC_URI", True).split(): + for url in src_uri: urldata = srcurldata[url] local = urldata.localpath
@@ -120,8 +120,25 @@ python patch_do_patch() { bb.fatal(str(exc)) } +def patch_deps(d): + import oe.unpack + + src_uri = d.getVar("SRC_URI", True).split() + srcurldata = bb.fetch.init(src_uri, d, True) + for url in src_uri: + urldata = srcurldata[url] + local = urldata.localpath + if local: + base, ext = os.path.splitext(os.path.basename(local)) + if ext in ('.gz', '.bz2', '.Z', '.xz'): + local = base + if oe.unpack.is_patch(local, urldata.parm): + return "${PATCHDEPENDENCY}" + return "" + + addtask patch after do_unpack do_patch[dirs] = "${WORKDIR}" -do_patch[depends] = "${PATCHDEPENDENCY}" +do_patch[depends] = "${@patch_deps(d)}" EXPORT_FUNCTIONS do_patch
Signature · 1 line
1.7.2.3
Re: [PATCH] patch.bbclass: conditional patch-tool dependency
Quoted 1 line · Bernhard Reutner-Fischer
only depend
do_patchon patch-tool if recipe references any patch
ping?
Quoted 49 lines
Signed-off-by Bernhard Reutner-Fischer <[email protected]>---
classes/patch.bbclass | 21 +++++++++++++++++++--1 files changed, 19 insertions(+), 2 deletions(-)classes/patch.bbclass +18
-1@@ -38,7 +38,7 @@ python patch_do_patch() { 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 d.getVar("SRC_URI", True).split(): + for url in src_uri: urldata = srcurldata[url] local = urldata.localpath@@ -120,8 +120,25 @@ python patch_do_patch() { bb.fatal(str(exc)) } +def patch_deps(d): + import oe.unpack + + src_uri = d.getVar("SRC_URI", True).split() + srcurldata = bb.fetch.init(src_uri, d, True) + for url in src_uri: + urldata = srcurldata[url] + local = urldata.localpath + if local: + base, ext = os.path.splitext(os.path.basename(local)) + if ext in ('.gz', '.bz2', '.Z', '.xz'): + local = base + if oe.unpack.is_patch(local, urldata.parm): + return "${PATCHDEPENDENCY}" + return "" + +addtask patch after
do_unpack
do_patch[dirs] = "${WORKDIR}"classes/patch.bbclass +1
-1-do_patch[depends] = "${PATCHDEPENDENCY}" +do_patch[depends] = "${@patch_deps(d)}"
EXPORT_FUNCTIONSdo_patchSignature · 1 line
1.7.2.3
Re: [PATCH] patch.bbclass: conditional patch-tool dependency
In reply to Bernhard Reutner-FischerHello,
Quoted 4 lines · Bernhard Reutner-Fischer
only depend
do_patchon patch-tool if recipe references any patchSigned-off-by Bernhard Reutner-Fischer <[email protected]>---
Untested but I like it.
Signature · 1 line
Leon