* [PATCH] externalsrc: Handle .git not being a directory
@ 2017-08-05 22:07 Joshua Watt
2017-08-05 23:37 ` Christopher Larson
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Watt @ 2017-08-05 22:07 UTC (permalink / raw)
To: openembedded-core
If EXTERNALSRC points to a git submodule, the .git entry will not be a
directory, but rather a file that points to the actual .git location (in
the parent repository). If this still can't be resolved to a directory,
ignore it and fall back to the non-git method for hashing.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
meta/classes/externalsrc.bbclass | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9aabb426d9e..ab5cd636051 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -182,13 +182,25 @@ def srctree_hash_files(d, srcdir=None):
import shutil
import subprocess
import tempfile
+ import re
s_dir = srcdir or d.getVar('EXTERNALSRC')
git_dir = os.path.join(s_dir, '.git')
+
+ if os.path.exists(git_dir) and os.path.isfile(git_dir):
+ with open(git_dir, 'r') as f:
+ m = re.match(r'gitdir: (.*)$', f.read())
+ if m is not None:
+ path = m.group(1)
+ if os.path.isabs(path):
+ git_dir = path
+ else:
+ git_dir = os.path.join(git_dir, path)
+
oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
ret = " "
- if os.path.exists(git_dir):
+ if os.path.exists(git_dir) and os.path.isdir(git_dir):
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] externalsrc: Handle .git not being a directory
2017-08-05 22:07 [PATCH] externalsrc: Handle .git not being a directory Joshua Watt
@ 2017-08-05 23:37 ` Christopher Larson
2017-08-07 2:15 ` Joshua Watt
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Larson @ 2017-08-05 23:37 UTC (permalink / raw)
To: Joshua Watt; +Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Sat, Aug 5, 2017 at 3:07 PM, Joshua Watt <jpewhacker@gmail.com> wrote:
> If EXTERNALSRC points to a git submodule, the .git entry will not be a
> directory, but rather a file that points to the actual .git location (in
> the parent repository). If this still can't be resolved to a directory,
> ignore it and fall back to the non-git method for hashing.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>
We shouldn’t be assuming knowledge of how .git works, IMO we should call
out to git rev-parse to query the info we need.
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 1186 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] externalsrc: Handle .git not being a directory
2017-08-05 23:37 ` Christopher Larson
@ 2017-08-07 2:15 ` Joshua Watt
0 siblings, 0 replies; 3+ messages in thread
From: Joshua Watt @ 2017-08-07 2:15 UTC (permalink / raw)
To: Christopher Larson; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 803 bytes --]
On Aug 5, 2017 18:37, "Christopher Larson" <kergoth@gmail.com> wrote:
On Sat, Aug 5, 2017 at 3:07 PM, Joshua Watt <jpewhacker@gmail.com> wrote:
> If EXTERNALSRC points to a git submodule, the .git entry will not be a
> directory, but rather a file that points to the actual .git location (in
> the parent repository). If this still can't be resolved to a directory,
> ignore it and fall back to the non-git method for hashing.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>
We shouldn’t be assuming knowledge of how .git works, IMO we should call
out to git rev-parse to query the info we need.
Ya that makes sense. I'll fix it.
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 2009 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-07 2:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-05 22:07 [PATCH] externalsrc: Handle .git not being a directory Joshua Watt
2017-08-05 23:37 ` Christopher Larson
2017-08-07 2:15 ` Joshua Watt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.