From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v3] externalsrc: Handle .git not being a directory
Date: Mon, 7 Aug 2017 20:46:24 -0500 [thread overview]
Message-ID: <20170808014624.9506-1-JPEWhacker@gmail.com> (raw)
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.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
meta/classes/externalsrc.bbclass | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9aabb426d9e..ea0faaf4193 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -184,11 +184,16 @@ 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_dir = subprocess.check_output(['git', 'rev-parse', '--absolute-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)
--
2.13.3
next reply other threads:[~2017-08-08 1:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 1:46 Joshua Watt [this message]
2017-08-08 19:32 ` [PATCH v3] externalsrc: Handle .git not being a directory Burton, Ross
2017-08-08 19:46 ` Leonardo Sandoval
2017-08-08 20:57 ` Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170808014624.9506-1-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox