[OE-core] [poky][PATCH] Jail patch_task_patch_prefunc in classes/patch into the workdir

Pablo Saavedra psaavedra at igalia.com
Fri Jul 6 09:50:23 UTC 2018


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 at 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.
---
 meta/classes/patch.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
-- 
2.11.0




More information about the Openembedded-core mailing list