summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/deploy_plugin.py10
-rw-r--r--morphlib/plugins/update_gits_plugin.py83
2 files changed, 5 insertions, 88 deletions
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index 30e356e8..38c17bc2 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -308,7 +308,7 @@ class DeployPlugin(cliapp.Plugin):
all_deployments = set()
deployments = set()
for system in cluster_morphology['systems']:
- all_deployments.update([sys_id for sys_id in system['deploy']])
+ all_deployments.update(system['deploy'].iterkeys())
if 'subsystems' in system:
all_subsystems.update(loader._get_subsystem_names(system))
for item in args[1:]:
@@ -367,9 +367,9 @@ class DeployPlugin(cliapp.Plugin):
'Cannot directly deploy subsystems. Create a top '
'level deployment for the subsystem %s instead.' %
subsystem)
- if not any(deployment in var
- for deployment in all_deployments) \
- and not subsystem in var:
+ if (not any(deployment in var
+ for deployment in all_deployments)
+ and not subsystem in var):
raise cliapp.AppException(
'Variable referenced a non-existent deployment '
'name: %s' % var)
@@ -377,7 +377,7 @@ class DeployPlugin(cliapp.Plugin):
def deploy_system(self, build_command, deploy_tempdir,
root_repo_dir, build_repo, ref, system, env_vars,
deployment_filter, parent_location):
- sys_ids = set(sys_id for sys_id, _ in system['deploy'].iteritems())
+ sys_ids = set(system['deploy'].iterkeys())
if deployment_filter and not \
any(sys_id in deployment_filter for sys_id in sys_ids):
return
diff --git a/morphlib/plugins/update_gits_plugin.py b/morphlib/plugins/update_gits_plugin.py
deleted file mode 100644
index 46686391..00000000
--- a/morphlib/plugins/update_gits_plugin.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (C) 2012-2013 Codethink Limited
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-import cliapp
-import os
-
-import morphlib
-
-
-class UpdateGitsPlugin(cliapp.Plugin):
-
- def enable(self):
- self.app.add_subcommand('update-gits',
- self.update_gits,
- arg_synopsis='(REPO REF MORPHOLOGY)...')
-
- def disable(self):
- pass
-
- def update_gits(self, args):
- '''Manually update cached git repositories for the given morphology
-
- Command line arguments:
-
- * `REPO` is a git repository URL.
- * `REF` is a git commit ref (sha1, branch, tag).
- * `MORPHOLOGY` is a morphology filename.
-
- This updates the local cached copy of a git repository, and any
- git repositories of components in the morphology (for system
- and stratum morphologies).
-
- You do not normally need to do this. Morph updates the cached
- repositories automatically anyway.
-
- '''
-
- app = self.app
- if not os.path.exists(app.settings['cachedir']):
- os.mkdir(app.settings['cachedir'])
- cachedir = os.path.join(app.settings['cachedir'], 'gits')
- repo_resolver = morphlib.repoaliasresolver.RepoAliasResolver(
- app.settings['repo-alias'])
- tarball_base_url = app.settings['tarball-server']
- cache = morphlib.localrepocache.LocalRepoCache(
- app, cachedir, repo_resolver, tarball_base_url)
-
- subs_to_process = set()
-
- def visit(reponame, ref, filename, absref, tree, morphology):
- app.status(msg='Updating %(repo_name)s %(ref)s %(filename)s',
- repo_name=reponame, ref=ref, filename=filename)
- assert cache.has_repo(reponame)
- cached_repo = cache.get_repo(reponame)
- try:
- submodules = morphlib.git.Submodules(app, cached_repo.path,
- absref)
- submodules.load()
- except morphlib.git.NoModulesFileError:
- pass
- else:
- for submod in submodules:
- subs_to_process.add((submod.url, submod.commit))
-
- app.traverse_morphs(app.itertriplets(args), cache, None,
- update=True, visit=visit)
-
- done = set()
- for url, ref in subs_to_process:
- app.cache_repo_and_submodules(cache, url, ref, done)