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__.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 702db669de..c9d7ade9ff 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -78,12 +78,15 @@ def exec_fakeroot(d, cmd, **kwargs):
78 """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" 78 """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions"""
79 # Grab the command and check it actually exists 79 # Grab the command and check it actually exists
80 fakerootcmd = d.getVar('FAKEROOTCMD') 80 fakerootcmd = d.getVar('FAKEROOTCMD')
81 fakerootenv = d.getVar('FAKEROOTENV')
82 exec_fakeroot_no_d(fakerootcmd, fakerootenv, cmd, kwargs)
83
84def exec_fakeroot_no_d(fakerootcmd, fakerootenv, cmd, **kwargs):
81 if not os.path.exists(fakerootcmd): 85 if not os.path.exists(fakerootcmd):
82 logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built') 86 logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built')
83 return 2 87 return 2
84 # Set up the appropriate environment 88 # Set up the appropriate environment
85 newenv = dict(os.environ) 89 newenv = dict(os.environ)
86 fakerootenv = d.getVar('FAKEROOTENV')
87 for varvalue in fakerootenv.split(): 90 for varvalue in fakerootenv.split():
88 if '=' in varvalue: 91 if '=' in varvalue:
89 splitval = varvalue.split('=', 1) 92 splitval = varvalue.split('=', 1)
@@ -144,6 +147,8 @@ def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False):
144 Check that a recipe is in the workspace and (optionally) that source 147 Check that a recipe is in the workspace and (optionally) that source
145 is present. 148 is present.
146 """ 149 """
150 import bb.runqueue
151 _, pn = bb.runqueue.split_mc(pn)
147 152
148 workspacepn = pn 153 workspacepn = pn
149 154
@@ -231,7 +236,29 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base', d=None):
231 f.write(line) 236 f.write(line)
232 237
233 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) 238 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir)
234 bb.process.run('git tag -f %s' % basetag, cwd=repodir) 239 bb.process.run('git tag -f --no-sign %s' % basetag, cwd=repodir)
240
241 # if recipe unpacks another git repo inside S, we need to declare it as a regular git submodule now,
242 # so we will be able to tag branches on it and extract patches when doing finish/update on the recipe
243 stdout, _ = bb.process.run("git status --porcelain", cwd=repodir)
244 found = False
245 for line in stdout.splitlines():
246 if line.endswith("/"):
247 new_dir = line.split()[1]
248 for root, dirs, files in os.walk(os.path.join(repodir, new_dir)):
249 if ".git" in dirs + files:
250 (stdout, _) = bb.process.run('git remote', cwd=root)
251 remote = stdout.splitlines()[0]
252 (stdout, _) = bb.process.run('git remote get-url %s' % remote, cwd=root)
253 remote_url = stdout.splitlines()[0]
254 logger.error(os.path.relpath(os.path.join(root, ".."), root))
255 bb.process.run('git submodule add %s %s' % (remote_url, os.path.relpath(root, os.path.join(root, ".."))), cwd=os.path.join(root, ".."))
256 found = True
257 if found:
258 oe.patch.GitApplyTree.commitIgnored("Add additional submodule from SRC_URI", dir=os.path.join(root, ".."), d=d)
259 found = False
260 if os.path.exists(os.path.join(repodir, '.gitmodules')):
261 bb.process.run('git submodule foreach --recursive "git tag -f --no-sign %s"' % basetag, cwd=repodir)
235 262
236def recipe_to_append(recipefile, config, wildcard=False): 263def recipe_to_append(recipefile, config, wildcard=False):
237 """ 264 """