summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/patch.bbclass15
1 files changed, 15 insertions, 0 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 930ee33d54..2fc6925e49 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -28,6 +28,21 @@ python patch_task_patch_prefunc() {
28 # Prefunc for do_patch 28 # Prefunc for do_patch
29 srcsubdir = d.getVar('S') 29 srcsubdir = d.getVar('S')
30 30
31 workdir = os.path.abspath(d.getVar('WORKDIR'))
32 testsrcdir = os.path.abspath(srcsubdir)
33 if (testsrcdir + os.sep).startswith(workdir + os.sep):
34 # Double-check that either workdir or S or some directory in-between is a git repository
35 found = False
36 while testsrcdir != '/':
37 if os.path.exists(os.path.join(testsrcdir, '.git')):
38 found = True
39 break
40 if testsrcdir == workdir:
41 break
42 testsrcdir = os.path.dirname(testsrcdir)
43 if not found:
44 bb.fatal('PATCHTOOL = "git" set for source tree that is not a git repository. Refusing to continue as that may result in commits being made in your metadata repository.')
45
31 patchdir = os.path.join(srcsubdir, 'patches') 46 patchdir = os.path.join(srcsubdir, 'patches')
32 if os.path.exists(patchdir): 47 if os.path.exists(patchdir):
33 if os.listdir(patchdir): 48 if os.listdir(patchdir):