Bug 2043

Summary: modifying patch.bbclass functions breaks quilt-native
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Bruce Ashfield <bruce.ashfield>
Component: meta-yoctoAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: poky.bs.watcher, poky.watcher
Version: 1.2   
Target Milestone: 1.2   
Hardware: x86   
OS: Multiple   
Whiteboard: Two patches submitted to resolve the problems discussed here
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Bruce Ashfield 2012-03-01 02:07:44 UTC
If patch.bbclass is modified, it results in the following error:

NOTE: package quilt-native-0.51-r0: task do_patch: Started
ERROR: Error executing a python function in /home/bruce/poky/meta/recipes-devtools/quilt/quilt-native_0.51.bb:
IndexError: list index out of range

ERROR: The stack trace of python calls that resulted in this exception/failure was:
ERROR:   File "patch_do_patch", line 57, in <module>
ERROR: 
ERROR:   File "patch_do_patch", line 52, in patch_do_patch
ERROR: 
ERROR:   File "/home/bruce/poky/meta/lib/oe/patch.py", line 358, in Resolve
ERROR:     patchcmd = self.patchset.Push(True, False, False)
ERROR: 
ERROR:   File "/home/bruce/poky/meta/lib/oe/patch.py", line 148, in Push
ERROR:     bb.note("applying patch %s" % self.patches[self._current])
ERROR: 
ERROR: The code that was being executed was:
ERROR:      0053:               except bb.BBHandledException as e:
ERROR:      0054:                       bb.fatal(str(e))
ERROR:      0055:
ERROR:      0056:
ERROR:  *** 0057:patch_do_patch(d)
ERROR:      0058:
ERROR: (file: 'patch_do_patch', lineno: 57, function: <module>)
ERROR:      0048:                       patchset.Import({"file":local, "strippath": parm['striplevel']}, True)
ERROR:      0049:               except Exception as exc:
ERROR:      0050:                       bb.fatal(str(exc))
ERROR:      0051:               try:
ERROR:  *** 0052:                       resolver.Resolve()
ERROR:      0053:               except bb.BBHandledException as e:
ERROR:      0054:                       bb.fatal(str(e))
ERROR:      0055:
ERROR:      0056:
ERROR: (file: 'patch_do_patch', lineno: 52, function: patch_do_patch)
ERROR: Function failed: patch_do_patch

------------------------------

Richard's email analysis is below:


Hi Bruce,

I had a look at your do_patch problems. First, some observations:

a) Most recipes are patched using quilt
b) If patches are already applied, quilt will remove and reapply them
c) You can't use quilt to patch quilt-native. It uses patch instead
d) patch does not remove existing patches
e) We recently added hashes of the tasks to the stamp files. This means
  if a hash changes for a task, the task gets rerun.

If you change any code or variable in patch.bbclass that do_patch
depends upon, it is very likely to alter the do_patch task hashes. This
means in particular the do_patch hash of quilt-native is invalidated and
it will rerun.

Due to d) above, it will fail. It will not fail for any other recipes
due to a)+b).

So its expected that it would rerun do_patch and we need to fix
quilt-native so that task is re-entrant safe and checks if the patch is
already applied. Please file a bug.

Cheers,

Richard
Comment 1 Richard Purdie 2012-03-01 23:25:41 UTC
Note to get this backtrace PATCHRESOLVE = "user" is also required. A failure of the do_patch task itself is found if you have PATCHRESOLVE = "noop".
Comment 2 Richard Purdie 2012-03-02 16:30:01 UTC
Patches http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=93b3692ac810f7129f6561b446847800aecaf352 and the previous commit added to address the issues reported here.