summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass17
1 files changed, 9 insertions, 8 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index dff61842f2..da7eb4781c 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -130,21 +130,22 @@ python externalsrc_compile_prefunc() {
130def srctree_hash_files(d): 130def srctree_hash_files(d):
131 import shutil 131 import shutil
132 import subprocess 132 import subprocess
133 import tempfile
133 134
134 s_dir = d.getVar('EXTERNALSRC', True) 135 s_dir = d.getVar('EXTERNALSRC', True)
135 git_dir = os.path.join(s_dir, '.git') 136 git_dir = os.path.join(s_dir, '.git')
136 oe_index_file = os.path.join(git_dir, 'oe-devtool-index')
137 oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1') 137 oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
138 138
139 ret = " " 139 ret = " "
140 if os.path.exists(git_dir): 140 if os.path.exists(git_dir):
141 # Clone index 141 with tempfile.NamedTemporaryFile(dir=git_dir, prefix='oe-devtool-index') as tmp_index:
142 shutil.copy2(os.path.join(git_dir, 'index'), oe_index_file) 142 # Clone index
143 # Update our custom index 143 shutil.copy2(os.path.join(git_dir, 'index'), tmp_index.name)
144 env = os.environ.copy() 144 # Update our custom index
145 env['GIT_INDEX_FILE'] = oe_index_file 145 env = os.environ.copy()
146 subprocess.check_output(['git', 'add', '.'], cwd=s_dir, env=env) 146 env['GIT_INDEX_FILE'] = tmp_index.name
147 sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env) 147 subprocess.check_output(['git', 'add', '.'], cwd=s_dir, env=env)
148 sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env)
148 with open(oe_hash_file, 'w') as fobj: 149 with open(oe_hash_file, 'w') as fobj:
149 fobj.write(sha1) 150 fobj.write(sha1)
150 ret = oe_hash_file + ':True' 151 ret = oe_hash_file + ':True'