<div dir="ltr"><div>What a blasphemy to recommend it, but so many people did, that I'll probably try it as well soon.</div><div><br></div><div>BTW: I wanted to improve the warning message, because if you grep for ^WARNING: in fairly large build, warnings like:</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">WARNING: nettle-2.7.1-r0 do_patch:</span><br></div><div>doesn't say much (e.g. you cannot immediately grep for the patch filename to discover which layer introduced it).</div><div><br></div><div>I've checked where this warning is added in meta/lib/oe/patch.py:<wbr>runcmd(args, dir = None) and my naive 1st attempt was to just include the args (expecting to see the .patch file as well), but for default quilt it's quite useless:</div><div>WARNING: nettle-2.7.1-r0 do_patch: Patch cannot be applied cleanly with: ['quilt', '--quiltrc', '/OE/build/oe-core/tmp-glibc/<wbr>work/core2-64-oe-linux/nettle/<wbr>2.7.1-r0/recipe-sysroot-<wbr>native/etc/quiltrc', 'push']<br></div><div><br></div><div>So I've tried to use</div><div>PATCHTOOL = "patch"</div><div>and it fails completely:</div><div><br></div><div><div>ERROR: nettle-2.7.1-r0 do_patch: Error executing a python function in exec_python_func() autogenerated:</div><div><br></div><div>The stack trace of python calls that resulted in this exception/failure was:</div><div>File: 'exec_python_func() autogenerated', lineno: 2, function: <module></div><div> 0001:</div><div> *** 0002:patch_do_patch(d)</div><div> 0003:</div><div>File: '/OE/build/oe-core/<wbr>openembedded-core/meta/<wbr>classes/patch.bbclass', lineno: 134, function: patch_do_patch</div><div> 0130: if not patchdir in classes:</div><div> 0131: patchset = cls(patchdir, d)</div><div> 0132: resolver = rcls(patchset, oe_terminal)</div><div> 0133: classes[patchdir] = (patchset, resolver)</div><div> *** 0134: patchset.Clean()</div><div> 0135: else:</div><div> 0136: patchset, resolver = classes[patchdir]</div><div> 0137:</div><div> 0138: bb.note("Applying patch '%s' (%s)" % (parm['patchname'], oe.path.format_display(local, d)))</div><div>File: '/OE/build/oe-core/<wbr>openembedded-core/meta/lib/oe/<wbr>patch.py', lineno: 293, function: Clean</div><div> 0289: self._current = self._current - 1</div><div> 0290:</div><div> 0291: def Clean(self):</div><div> 0292: """"""</div><div> *** 0293: self.Pop(all=True)</div><div> 0294:</div><div> 0295:class GitApplyTree(PatchTree):</div><div> 0296: patch_line_prefix = '%% original patch'</div><div> 0297: ignore_commit_prefix = '%% ignore'</div><div>File: '/OE/build/oe-core/<wbr>openembedded-core/meta/lib/oe/<wbr>patch.py', lineno: 280, function: Pop</div><div> 0276: return ret</div><div> 0277:</div><div> 0278: def Pop(self, force = None, all = None):</div><div> 0279: if all:</div><div> *** 0280: self._removePatchFile(True)</div><div> 0281: self._current = None</div><div> 0282: else:</div><div> 0283: self._removePatchFile(False)</div><div> 0284:</div><div>File: '/OE/build/oe-core/<wbr>openembedded-core/meta/lib/oe/<wbr>patch.py', lineno: 211, function: _removePatchFile</div><div> 0207: with open(self.seriespath, 'r+') as f:</div><div> 0208: patches = f.readlines()</div><div> 0209: if all:</div><div> 0210: for p in reversed(patches):</div><div> *** 0211: self._removePatch(os.path.<wbr>join(self.patchdir, p.strip()))</div><div> 0212: patches = []</div></div><div><div> 0213: else:</div><div> 0214: self._removePatch(os.path.<wbr>join(self.patchdir, patches[-1].strip()))</div><div> 0215: patches.pop()</div><div>File: '/OE/build/oe-core/<wbr>openembedded-core/meta/lib/oe/<wbr>patch.py', lineno: 201, function: _removePatch</div><div> 0197:</div><div> 0198: def _removePatch(self, p):</div><div> 0199: patch = {}</div><div> 0200: patch['file'] = p.split(",")[0]</div><div> *** 0201: patch['strippath'] = p.split(",")[1]</div><div> 0202: self._applypatch(patch, False, True)</div><div> 0203:</div><div> 0204: def _removePatchFile(self, all = False):</div><div> 0205: if not os.path.exists(self.<wbr>seriespath):</div><div>Exception: IndexError: list index out of range</div><div><br></div><div>ERROR: nettle-2.7.1-r0 do_patch: Function failed: patch_do_patch</div><div>ERROR: Logfile of failure stored in: /OE/build/oe-core/tmp-glibc/<wbr>work/core2-64-oe-linux/nettle/<wbr>2.7.1-r0/temp/log.do_patch.<wbr>2168</div><div>ERROR: Task (/OE/build/oe-core/meta-gplv2/<wbr>recipes-support/nettle/nettle_<wbr>2.7.1.bb:do_patch) failed with exit code '1'</div></div><div><br></div><div>PATCHTOOL = "git" fails the same.</div><div><br></div><div>The questions are:</div><div><br></div><div>Is patch and git as a PATCHTOOL broken for everybody?</div><div>Is it worth parsing the fuzz in the patch output somewhere outside runcmd and try _harder_ to show the patch name on the first line of the warning? Maybe using the last line from quilt output (hopefully the "Now at patch Add-target-to-only-build-<wbr>tests-not-run-them.patch" line) for warning and leaving the long explanation only as a bb.note? Not sure how this is meant to work with various PATCHTOOLs.</div><div><br></div><div>FYI: I had one .patch which was always being applied with small fuzz, it was caused by some strange character (might be some Korean letter) in comment above the modified lines, so the quilt was somehow counting the lines incorrectly and always showed:</div><div>Hunk #1 succeeded at 69 with fuzz 2.<br></div><div>I've tried to refresh the patch with devtool, then manually and it was always failing like this, until I've tried to remove the strange characters in the same patch and now it applies cleanly.</div><div><br></div><div>Regards,</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 16, 2018 at 11:37 AM, Alexander Kanavin <span dir="ltr"><<a href="mailto:alexander.kanavin@linux.intel.com" target="_blank">alexander.kanavin@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 03/16/2018 12:50 AM, Martin Jansa wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
* --no-signature saves unnecessary .patch modifications when executed on<br>
host with different git version<br>
* --no-numbered saves unnecessary .patch modifications when number of the<br>
applied patches is changed (the number is still in the filename so the<br>
order how they should be applied is still preserved)<br>
* both options exist for very long time, I've tested them with git 1.9.1<br>
from Ubuntu 14.04 and I'm quite sure they were available even in much<br>
older releases, so there shouldn't be any issue on relatively new sanity<br>
tested distros<br>
</blockquote>
<br></span>
Thanks, this should reduce the churn. By the way, when reviewing a change to a patch, it is *far* easier to look at it with a side by side diff tool than the usual +- format. I use vscode with gitlens extension (can't believe I am recommending a Microsoft product, but here we are).<br>
<br>
Alex<br>
</blockquote></div><br></div></div>