summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-07-07 11:28:33 +0000
committerSam Thursfield <sam@afuera.me.uk>2014-09-05 13:00:20 +0000
commit44ce57f9aab1e20a74cb35e0efa11ba8a7d40d36 (patch)
treed6b01685f9232d4fe690d65d902d0b62f8027a17
parent805cbb2729a2a9f88e8a88df4474ac21d113649f (diff)
downloadmorph-44ce57f9aab1e20a74cb35e0efa11ba8a7d40d36.tar.gz
WHAT
-rw-r--r--morphlib/artifactsplitrule.py9
-rw-r--r--morphlib/plugins/list_system_contents_plugin.py7
2 files changed, 13 insertions, 3 deletions
diff --git a/morphlib/artifactsplitrule.py b/morphlib/artifactsplitrule.py
index 125f5b93..461304f8 100644
--- a/morphlib/artifactsplitrule.py
+++ b/morphlib/artifactsplitrule.py
@@ -48,6 +48,10 @@ class FileMatch(Rule):
# Possible optimisation: compile regexes as one pattern
self._regexes = [re.compile(r) for r in regexes]
+ def __repr__(self):
+ matches = [x.pattern for x in self._regexes]
+ return '<file match: %s>' % ', '.join(matches)
+
def match(self, path):
return any(r.match(path) for r in self._regexes)
@@ -116,6 +120,11 @@ class SplitRules(collections.Iterable):
def __iter__(self):
return iter(self._rules)
+ def pretty_print(self):
+ rules = ['%s: %s' % (artifact, rules) for artifact, rules in
+ self._rules]
+ return 'Split rules:\n\t%s' % '\n\t'.join(rules)
+
def add(self, artifact, rule):
self._rules.append((artifact, rule))
diff --git a/morphlib/plugins/list_system_contents_plugin.py b/morphlib/plugins/list_system_contents_plugin.py
index 187d5c6a..6c98c8a2 100644
--- a/morphlib/plugins/list_system_contents_plugin.py
+++ b/morphlib/plugins/list_system_contents_plugin.py
@@ -69,7 +69,7 @@ class ListSystemContentsPlugin(cliapp.Plugin):
if len(args) != 1:
raise morphlib.Error("Usage: morph-search-file SYSTEM")
- system_name = morphlib.util.strip_morph_extension(args[0])
+ system_filename = morphlib.util.sanitise_morphology_path(args[0])
workspace = morphlib.workspace.open('.')
system_branch = morphlib.sysbranchdir.open_from_within('.')
@@ -81,7 +81,7 @@ class ListSystemContentsPlugin(cliapp.Plugin):
source_pool = build_command.create_source_pool(
build_branch.root_repo_url,
build_branch.root_ref,
- system_name + '.morph')
+ system_filename)
root_artifact = build_command.resolve_artifacts(source_pool)
build_command.build_in_order(root_artifact)
@@ -96,7 +96,8 @@ class ListSystemContentsPlugin(cliapp.Plugin):
for path in contents:
abs_path = '/%s' % path
if abs_path in files:
- print 'WARNING: file %s is in more than one chunk!' % abs_path
+ print 'WARNING: file %s is in more than one ' \
+ 'chunk!' % abs_path
files[abs_path] = artifact
files.update('/%s' % p for p in contents)
except tarfile.ReadError: