summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Saavedra <psaavedra@igalia.com>2018-07-06 11:50:23 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-06 22:54:56 +0100
commitdb6ce9d8838b1f9064604654ab579da3e237f361 (patch)
tree53aa0df2cbd133c9a056753913b97d6c967d99c2
parentd942ec4ff649782d22afe49fd48839dbbfedc871 (diff)
downloadopenembedded-core-contrib-db6ce9d8838b1f9064604654ab579da3e237f361.tar.gz
openembedded-core-contrib-db6ce9d8838b1f9064604654ab579da3e237f361.tar.bz2
openembedded-core-contrib-db6ce9d8838b1f9064604654ab579da3e237f361.zip
patch: Jail patch_task_patch_prefunc in classes/patch into the workdir
With PATCHTOOL=git patches the changes in the patch_task_postfunc of the classes/patch. This works OK when the S dir is a Git repo but doesn't if the source is a tarball. The while condition in the patch_task_patch_prefunc must be jailed into the WORKDIR. In the opposite, when you are executing the recipe out of a Git subtree the function simply fails but when your recipes are into a Git repo the patch_task_postfunc execute a commit over your BSP local Git repo adding the changes in an arbitrary Git repo found in the path from the SOURCE directory to the '/'. This situation is highly probable in cases like ~home directories under the control of a .git repo or Yocto BSP which manage the meta layers as git submodules. This patch fix the changes introduced in classes/patch: when PATCHTOOL = "git" double-check the repository commit: 86ab56b55164393924b5e688b20e8f3f3f8fc578 Author: Paul Eggleton <paul.eggleton@linux.intel.com> Date: Tue Dec 5 14:36:58 2017 +1300 classes/patch: when PATCHTOOL = "git" double-check the repository If a bug is present or the user has set PATCHTOOL = "git" on a source tree that isn't git, if we try to perform git operations (such as committing or changing branches) when extracting source, then we might in fact be running those operations on the metadata repository if the build directory is underneath, say, poky or OE-Core, and that could make a mess. Check if the source tree is a git repository and refuse to continue if it isn't. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/patch.bbclass2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 2fc6925e49..3e0a181821 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -33,7 +33,7 @@ python patch_task_patch_prefunc() {
if (testsrcdir + os.sep).startswith(workdir + os.sep):
# Double-check that either workdir or S or some directory in-between is a git repository
found = False
- while testsrcdir != '/':
+ while testsrcdir != workdir:
if os.path.exists(os.path.join(testsrcdir, '.git')):
found = True
break