Bug 14146

Summary: Post-patch hook fails with submodules and PATCHTOOL=git and PATCH_COMMIT_FUNCTIONS=1
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Unassigned <unassigned>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, pavel, randy.macleod
Version: 3.4   
Target Milestone: 6.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2020-12-08 16:27:34 UTC
If a recipe puts a git repo inside another git repo (submodules) and patches the submodule, the patch postfunc fails when PATCHTOOL=git PATCH_COMMIT_FUNCTIONS=1.

ERROR: devtool-test-multisrc-subdir-1.0-r0 do_patch: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:patch_task_postfunc(d)
     0003:
File: '/home/ross/Yocto/poky/meta/classes/patch.bbclass', lineno: 82, function: patch_task_postfunc
     0078:        stdout, _ = bb.process.run('git status --porcelain .', cwd=srcsubdir)
     0079:        if stdout:
     0080:            useroptions = []
     0081:            oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d)
 *** 0082:            bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(useroptions), func, oe.patch.GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir)
     0083:}
     0084:
     0085:def src_patches(d, all=False, expand=True):
     0086:    import oe.patch
File: '/home/ross/Yocto/poky/bitbake/lib/bb/process.py', lineno: 184, function: run
     0180:        if not stderr is None:
     0181:            stderr = stderr.decode("utf-8")
     0182:
     0183:    if pipe.returncode != 0:
 *** 0184:        raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
     0185:    return stdout, stderr
Exception: bb.process.ExecutionError: Execution of 'git add .; git -c user.name="OpenEmbedded" -c user.email="oe.patch@oe" commit -a -m "Committing changes from do_patch

%% ignore - from do_patch"' failed with exit code 1:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
	modified:   libfakekey (modified content)

no changes added to commit (use "git add" and/or "git commit -a")


ERROR: Logfile of failure stored in: /yocto/ross/build/tmp/work/neoversen1-poky-linux/devtool-test-multisrc-subdir/1.0-r0/temp/log.do_patch.1796167
ERROR: Task (/home/ross/Yocto/poky/meta/recipes-devtools/devtool/devtool-test-multisrc-subdir_1.0.bb:do_patch) failed with exit code '1'
Comment 1 Randy MacLeod 2021-08-19 15:20:04 UTC
Rather than doing the patching with git, could we use quilt ? (Randy typing for Richard)

 PATCHTOOL=git with submodules should just fail with an error.
Comment 2 Randy MacLeod 2023-10-24 14:24:38 UTC
Bulk move from 4.99 or 0.00 to 5.99