[gnome-continuous-yocto/gnomeostree-3.28-rocko: 7182/8267] externalsrc: Handle .git not being a directory
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 7182/8267] externalsrc: Handle .git not being a directory
- Date: Sun, 17 Dec 2017 05:53:21 +0000 (UTC)
commit 3ca6085729d9a1025156c7a47f433981c2076995
Author: Joshua Watt <jpewhacker gmail com>
Date: Wed Aug 9 21:18:32 2017 -0500
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>
meta/classes/externalsrc.bbclass | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9aabb42..8141f25 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -184,11 +184,19 @@ def srctree_hash_files(d, srcdir=None):
import tempfile
s_dir = srcdir or d.getVar('EXTERNALSRC')
- git_dir = os.path.join(s_dir, '.git')
- oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
+ git_dir = None
+
+ try:
+ # git rev-parse returns the path relative to the current working
+ # directory
+ git_dir = os.path.join(s_dir,
+ subprocess.check_output(['git', 'rev-parse', '--git-dir'], cwd=s_dir).decode("utf-8").rstrip())
+ except subprocess.CalledProcessError:
+ pass
ret = " "
- if os.path.exists(git_dir):
+ if git_dir is not None:
+ oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
# Clone index
shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]