summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
authorTomasz Dziendzielski <tomasz.dziendzielski@gmail.com>2021-01-20 15:55:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-05 23:35:18 +0000
commitc35cb3135e9bf8e93010fa49cdabf6a26f6c54ce (patch)
tree3220cc7b588fdf1afe146b3df31ec99d2c53ddd0 /meta/classes/externalsrc.bbclass
parent18ca369a5dddc7de7d762003c526acaebe1bf3ef (diff)
downloadpoky-c35cb3135e9bf8e93010fa49cdabf6a26f6c54ce.tar.gz
externalsrc: Fix parsing error with devtool non-git sources
If srcdir is under poky directory (e.g. devtool poky/build/workspace/sources) and is not a git repository then ${@srctree_hash_files(d)} will run "git rev-parse --git-dir" and detect poky directory as git-dir and run "'git', 'add', '-A', '.'], cwd=s_dir" trying to add srcdir but build dir is in .gitignore and latest git will fail with "The following paths are ignored by one of your .gitignore files: build" which will end with "ExpansionError during parsing". In this commit I added a check if git_dir is the same as git-dir from TOPDIR (which will detect poky directory) and if yes, then treat srcdir as non-git sources. (From OE-Core rev: 95fbac8dcad6c93f4c9737e9fe13e92ab6befa09) (From OE-Core rev: 1da57e92812a1025d975204797b761a3be3998aa) Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 28bdfe0066cb3c41d6471af75dabcc573e319688) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass4
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index dd09395788..7a7d31e311 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -197,6 +197,10 @@ def srctree_hash_files(d, srcdir=None):
197 try: 197 try:
198 git_dir = os.path.join(s_dir, 198 git_dir = os.path.join(s_dir,
199 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) 199 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
200 top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'],
201 stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
202 if git_dir == top_git_dir:
203 git_dir = None
200 except subprocess.CalledProcessError: 204 except subprocess.CalledProcessError:
201 pass 205 pass
202 206