summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool/__init__.py')
-rw-r--r--scripts/lib/devtool/__init__.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index e9e88a5533..b4f998a5bc 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -233,6 +233,27 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None):
233 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) 233 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir)
234 bb.process.run('git tag -f %s' % basetag, cwd=repodir) 234 bb.process.run('git tag -f %s' % basetag, cwd=repodir)
235 235
236 # if recipe unpacks another git repo inside S, we need to declare it as a regular git submodule now,
237 # so we will be able to tag branches on it and extract patches when doing finish/update on the recipe
238 stdout, _ = bb.process.run("git status --porcelain", cwd=repodir)
239 found = False
240 for line in stdout.splitlines():
241 if line.endswith("/"):
242 new_dir = line.split()[1]
243 for root, dirs, files in os.walk(os.path.join(repodir, new_dir)):
244 if ".git" in dirs + files:
245 (stdout, _) = bb.process.run('git remote', cwd=root)
246 remote = stdout.splitlines()[0]
247 (stdout, _) = bb.process.run('git remote get-url %s' % remote, cwd=root)
248 remote_url = stdout.splitlines()[0]
249 logger.error(os.path.relpath(os.path.join(root, ".."), root))
250 bb.process.run('git submodule add %s %s' % (remote_url, os.path.relpath(root, os.path.join(root, ".."))), cwd=os.path.join(root, ".."))
251 found = True
252 if found:
253 useroptions = []
254 oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d)
255 bb.process.run('git %s commit -m "Adding additionnal submodule from SRC_URI\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=os.path.join(root, ".."))
256 found = False
236 if os.path.exists(os.path.join(repodir, '.gitmodules')): 257 if os.path.exists(os.path.join(repodir, '.gitmodules')):
237 bb.process.run('git submodule foreach --recursive "git tag -f %s"' % basetag, cwd=repodir) 258 bb.process.run('git submodule foreach --recursive "git tag -f %s"' % basetag, cwd=repodir)
238 259