diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-07-27 14:51:04 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-07-27 14:51:04 +0000 |
commit | 9fc92c1403e374d78712db852fb4342f770162fb (patch) | |
tree | c63be27eb73b01d5899c56e6bfbdfbe958bda4a0 | |
parent | 1a9c76a2fe30346fc0ed782eb2757c06699ba448 (diff) | |
download | morph-9fc92c1403e374d78712db852fb4342f770162fb.tar.gz |
Add '--repo' and '--ref' options to cross-bootstrap command
Change-Id: I5d8c2f0979f086f6abeec4421dded440b5948706
-rw-r--r-- | morphlib/plugins/cross-bootstrap_plugin.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py index 112e9133..4a87d798 100644 --- a/morphlib/plugins/cross-bootstrap_plugin.py +++ b/morphlib/plugins/cross-bootstrap_plugin.py @@ -216,7 +216,8 @@ class CrossBootstrapPlugin(cliapp.Plugin): pass def cross_bootstrap(self, args): - '''Cross-bootstrap a system from a different architecture.''' + '''Cross-bootstrap a system from a different architecture. + ''' MINARGS = 2 @@ -225,16 +226,31 @@ class CrossBootstrapPlugin(cliapp.Plugin): 'cross-bootstrap requires 2 arguments: target archicture, and ' 'filename of the system morphology') - definitions_repo = morphlib.definitions_repo.open( - '.', search_for_root=True, app=self.app) arch = args[0] filename = args[1] + repo = self.app.settings['repo'] + ref = self.app.settings['ref'] + + if bool(repo) ^ bool(ref): + raise cliapp.AppException( + '--repo and --ref work toghether, use both please.') if arch not in morphlib.valid_archs: raise morphlib.Error('Unsupported architecture "%s"' % arch) filename = morphlib.util.sanitise_morphology_path(filename) + + if repo and ref: + build_command = morphlib.buildcommand.BuildCommand(self.app) + source_pool = build_command.create_source_pool(repo, ref, + [filename]) + self._cross_bootstrap(arch, source_pool) + return + + definitions_repo = morphlib.definitions_repo.open( + '.', search_for_root=True, app=self.app) + filename = definitions_repo.relative_path(filename, cwd='.') source_pool_context = definitions_repo.source_pool( |