summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2017-08-09 21:18:32 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-16 00:03:14 +0100
commit3ca6085729d9a1025156c7a47f433981c2076995 (patch)
treebf561ac2231ded1b012d321152fb67983e67ee19 /meta
parent9dcc9f116e84fb33fbcd6b9892a3ad792fca5364 (diff)
downloadpoky-3ca6085729d9a1025156c7a47f433981c2076995.tar.gz
externalsrc: Handle .git not being a directory
Use git rev-parse to determine the location of the .git directory, in case it is not an immediate child of EXTERNALSRC (e.g. when using submodules). In the event git can't resolve the .git directory, fall back to the non-git method for hashing. (From OE-Core rev: 95e1341b49f7184d280a03f64f131a4468a06867) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/externalsrc.bbclass14
1 files changed, 11 insertions, 3 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9aabb426d9..8141f25e04 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -184,11 +184,19 @@ def srctree_hash_files(d, srcdir=None):
184 import tempfile 184 import tempfile
185 185
186 s_dir = srcdir or d.getVar('EXTERNALSRC') 186 s_dir = srcdir or d.getVar('EXTERNALSRC')
187 git_dir = os.path.join(s_dir, '.git') 187 git_dir = None
188 oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1') 188
189 try:
190 # git rev-parse returns the path relative to the current working
191 # directory
192 git_dir = os.path.join(s_dir,
193 subprocess.check_output(['git', 'rev-parse', '--git-dir'], cwd=s_dir).decode("utf-8").rstrip())
194 except subprocess.CalledProcessError:
195 pass
189 196
190 ret = " " 197 ret = " "
191 if os.path.exists(git_dir): 198 if git_dir is not None:
199 oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
192 with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index: 200 with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
193 # Clone index 201 # Clone index
194 shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name) 202 shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)