diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-12 10:12:12 +0000 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-12 14:04:37 +0100 |
commit | da5a4968789e45d90f4b855874835d35c2614e58 (patch) | |
tree | 0fb71bb33b47dfe56c5b24e900e5410f617e9db6 /morphlib/app.py | |
parent | 1c89026bc70003b302167248c0d2ed229cd27223 (diff) | |
download | morph-da5a4968789e45d90f4b855874835d35c2614e58.tar.gz |
Add support for Trove hosted content to morph configuration.
Trove has a fixed structure for repositories and prefixes. By taking advantage
of this, we can simplify the repo-alias configuration in morph somewhat and
thus make it easier for others to add their own aliases and prefixes later,
without worrying that they'll miss out on default ones created by the Baserock
team.
We override process_args in the application class to achieve this because
cliapp's setup() hook is not quite right for our purposes.
Diffstat (limited to 'morphlib/app.py')
-rwxr-xr-x | morphlib/app.py | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 508e0975..7d7ddeb5 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -25,13 +25,9 @@ import morphlib defaults = { + 'trove-host': 'git.baserock.org', + 'trove-prefix': [ ], 'repo-alias': [ - ('upstream=' - 'git://git.baserock.org/delta/#' - 'ssh://gitano@git.baserock.org/delta/'), - ('baserock=' - 'git://git.baserock.org/baserock/#' - 'ssh://gitano@git.baserock.org/baserock/'), ('freedesktop=' 'git://anongit.freedesktop.org/#' 'ssh://git.freedesktop.org/'), @@ -59,6 +55,22 @@ class Morph(cliapp.Application): 'show what is happening in much detail') self.settings.boolean(['quiet', 'q'], 'show no output unless there is an error') + self.settings.string(['trove-host'], + 'hostname of Trove instance', + metavar='HOST', + default=defaults['trove-host']) + self.settings.string_list(['trove-prefix'], + 'define URL prefix aliases stored ' + 'directly on the Trove host. Uses ' + 'the form ' + 'alias=pathprefix#pullmethod#pushmethod ' + 'for example, foocorp=fooprojects#git#ssh ' + 'will be expanded into a repo-alias of ' + 'foocorp=git://trove-host/fooprojects/%s#...' + ' with the push side set to the ssh url to ' + 'the trove.',\ + metavar='ALIAS=PREFIX#PULL#PUSH', + default=defaults['trove-prefix']) self.settings.string_list(['repo-alias'], 'define URL prefix aliases to allow ' 'repository addresses to be shortened; ' @@ -151,6 +163,14 @@ class Morph(cliapp.Application): metavar='PREFIX', default=defaults['build-ref-prefix']) + def process_args(self, args): + # Combine the aliases into repo-alias before passing on to normal + # command processing. This means everything from here on down can + # treat settings['repo-alias'] as the sole source of prefixes for git + # URL expansion. + self.settings['repo-alias'] = morphlib.util.combine_aliases(self) + cliapp.Application.process_args(self, args) + def setup_plugin_manager(self): cliapp.Application.setup_plugin_manager(self) |