summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py5
-rw-r--r--morphlib/plugins/build_plugin.py15
-rw-r--r--morphlib/plugins/cross-bootstrap_plugin.py2
-rw-r--r--morphlib/plugins/deploy_plugin.py10
-rw-r--r--morphlib/plugins/list_artifacts_plugin.py23
5 files changed, 28 insertions, 27 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 75e2bfe8..a66098b8 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -325,12 +325,13 @@ class BranchAndMergePlugin(cliapp.Plugin):
# Change the refs to the chunk.
if chunk_ref != sb.system_branch_name:
morphs.change_ref(
- chunk_url, chunk_ref, chunk_morph + '.morph',
+ chunk_url, chunk_ref,
+ chunk_morph,
sb.system_branch_name)
return chunk_dirname
- chunk_name = morphlib.util.strip_morph_extension(args[0])
+ chunk_name = args[0]
dirs = set()
found = 0
diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py
index fb7efa5b..1a4fb573 100644
--- a/morphlib/plugins/build_plugin.py
+++ b/morphlib/plugins/build_plugin.py
@@ -76,7 +76,7 @@ class BuildPlugin(cliapp.Plugin):
Example:
- morph distbuild devel-system-x86_64-generic
+ morph distbuild devel-system-x86_64-generic.morph
'''
@@ -103,8 +103,8 @@ class BuildPlugin(cliapp.Plugin):
Example:
- morph build-morphology baserock:baserock/morphs \
- master devel-system-x86_64-generic
+ morph build-morphology baserock:baserock/definitions \
+ master devel-system-x86_64-generic.morph
'''
@@ -141,7 +141,7 @@ class BuildPlugin(cliapp.Plugin):
Example:
- morph build devel-system-x86_64-generic
+ morph build devel-system-x86_64-generic.morph
'''
@@ -156,7 +156,7 @@ class BuildPlugin(cliapp.Plugin):
self.app.settings['cachedir'],
self.app.settings['cachedir-min-space'])
- system_name = morphlib.util.strip_morph_extension(args[0])
+ system_filename = morphlib.util.sanitise_morphology_path(args[0])
ws = morphlib.workspace.open('.')
sb = morphlib.sysbranchdir.open_from_within('.')
@@ -181,7 +181,8 @@ class BuildPlugin(cliapp.Plugin):
self.app.status(msg='Starting build %(uuid)s', uuid=build_uuid)
self.app.status(msg='Collecting morphologies involved in '
'building %(system)s from %(branch)s',
- system=system_name, branch=sb.system_branch_name)
+ system=system_filename,
+ branch=sb.system_branch_name)
bb = morphlib.buildbranch.BuildBranch(sb, build_ref_prefix,
push_temporary=push)
@@ -210,4 +211,4 @@ class BuildPlugin(cliapp.Plugin):
build_command.build([bb.root_repo_url,
bb.root_ref,
- system_name])
+ system_filename])
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py
index bfd0d047..cd8e355e 100644
--- a/morphlib/plugins/cross-bootstrap_plugin.py
+++ b/morphlib/plugins/cross-bootstrap_plugin.py
@@ -260,7 +260,7 @@ class CrossBootstrapPlugin(cliapp.Plugin):
self.app.settings, arch)
build_command = morphlib.buildcommand.BuildCommand(self.app, build_env)
- morph_name = system_name + '.morph'
+ morph_name = morphlib.util.sanitise_morphology_path(system_name)
builds_artifacts = [system_name + '-bootstrap-rootfs']
srcpool = build_command.create_source_pool(root_repo, ref, morph_name)
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index 7c009071..9384c422 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -99,7 +99,7 @@ class DeployPlugin(cliapp.Plugin):
name: cluster-foo
kind: cluster
systems:
- - morph: devel-system-x86_64-generic
+ - morph: devel-system-x86_64-generic.morph
deploy:
cluster-foo-x86_64-1:
type: kvm
@@ -278,7 +278,7 @@ class DeployPlugin(cliapp.Plugin):
'/', 0)
self.app.settings['no-git-update'] = True
- cluster_name = morphlib.util.strip_morph_extension(args[0])
+ cluster_filename = morphlib.util.sanitise_morphology_path(args[0])
ws = morphlib.workspace.open('.')
sb = morphlib.sysbranchdir.open_from_within('.')
@@ -294,7 +294,6 @@ class DeployPlugin(cliapp.Plugin):
build_ref_prefix = self.app.settings['build-ref-prefix']
root_repo_dir = morphlib.gitdir.GitDirectory(
sb.get_git_directory_name(sb.root_repository_url))
- cluster_filename = cluster_name + '.morph'
cluster_text = root_repo_dir.read_file(cluster_filename)
cluster_morphology = loader.load_from_string(cluster_text,
filename=cluster_filename)
@@ -387,9 +386,8 @@ class DeployPlugin(cliapp.Plugin):
self.app.status_prefix = system_status_prefix
try:
# Find the artifact to build
- morph = system['morph']
- srcpool = build_command.create_source_pool(build_repo, ref,
- morph + '.morph')
+ morph = morphlib.util.sanitise_morphology_path(system['morph'])
+ srcpool = build_command.create_source_pool(build_repo, ref, morph)
artifact = build_command.resolve_artifacts(srcpool)
diff --git a/morphlib/plugins/list_artifacts_plugin.py b/morphlib/plugins/list_artifacts_plugin.py
index 5e64f708..ad6bc772 100644
--- a/morphlib/plugins/list_artifacts_plugin.py
+++ b/morphlib/plugins/list_artifacts_plugin.py
@@ -55,21 +55,22 @@ class ListArtifactsPlugin(cliapp.Plugin):
'(see help)')
repo, ref = args[0], args[1]
- system_names = map(morphlib.util.strip_morph_extension, args[2:])
+ system_filenames = map(morphlib.util.sanitise_morphology_path,
+ args[2:])
self.lrc, self.rrc = morphlib.util.new_repo_caches(self.app)
self.resolver = morphlib.artifactresolver.ArtifactResolver()
artifact_files = set()
- for system_name in system_names:
+ for system_filename in system_filenames:
system_artifact_files = self.list_artifacts_for_system(
- repo, ref, system_name)
+ repo, ref, system_filename)
artifact_files.update(system_artifact_files)
for artifact_file in sorted(artifact_files):
print artifact_file
- def list_artifacts_for_system(self, repo, ref, system_name):
+ def list_artifacts_for_system(self, repo, ref, system_filename):
'''List all artifact files in the build graph of a single system.'''
# Sadly, we must use a fresh source pool and a fresh list of artifacts
@@ -82,24 +83,24 @@ class ListArtifactsPlugin(cliapp.Plugin):
# different architectures right now.
self.app.status(
- msg='Creating source pool for %s' % system_name, chatty=True)
+ msg='Creating source pool for %s' % system_filename, chatty=True)
source_pool = self.app.create_source_pool(
- self.lrc, self.rrc, (repo, ref, system_name + '.morph'))
+ self.lrc, self.rrc, (repo, ref, system_filename))
self.app.status(
- msg='Resolving artifacts for %s' % system_name, chatty=True)
+ msg='Resolving artifacts for %s' % system_filename, chatty=True)
artifacts = self.resolver.resolve_artifacts(source_pool)
- def find_artifact_by_name(artifacts_list, name):
+ def find_artifact_by_name(artifacts_list, filename):
for a in artifacts_list:
- if a.source.filename == name + '.morph':
+ if a.source.filename == name:
return a
raise ValueError
- system_artifact = find_artifact_by_name(artifacts, system_name)
+ system_artifact = find_artifact_by_name(artifacts, system_filename)
self.app.status(
- msg='Computing cache keys for %s' % system_name, chatty=True)
+ msg='Computing cache keys for %s' % system_filename, chatty=True)
build_env = morphlib.buildenvironment.BuildEnvironment(
self.app.settings, system_artifact.source.morphology['arch'])
ckc = morphlib.cachekeycomputer.CacheKeyComputer(build_env)