diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-07-04 14:55:37 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-07-05 08:12:59 +0000 |
commit | 16533b10d26a203d6a2d3bcd83223c64f7b68a5b (patch) | |
tree | ea941c10fa35e766a875747c2d48ed83ce054c38 /morphlib/plugins/artifact_inspection_plugin.py | |
parent | 4a73748a4f9e11e915388068557c30529a536178 (diff) | |
download | morph-16533b10d26a203d6a2d3bcd83223c64f7b68a5b.tar.gz |
Improve the GENIVI manifest generation
- Stop prefixing every field with the column name. Add a top row with
the names of the columns.
- Remove the morphology column.
- Append the version to the artifact name instead of keeping it in a
separate column
- Use 7-char SHA1s for commit ids
- Use 7-char SHA1s for build references (baserock/build/...)
- Use 7-char for the cache key
Diffstat (limited to 'morphlib/plugins/artifact_inspection_plugin.py')
-rw-r--r-- | morphlib/plugins/artifact_inspection_plugin.py | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/morphlib/plugins/artifact_inspection_plugin.py b/morphlib/plugins/artifact_inspection_plugin.py index 569fbb8a..f3417058 100644 --- a/morphlib/plugins/artifact_inspection_plugin.py +++ b/morphlib/plugins/artifact_inspection_plugin.py @@ -191,22 +191,35 @@ class ManifestGenerator(object): # Try to guess the version of this artifact version = self.version_guesser.guess_version( - metadata['repo'], metadata['sha1']) or '-' - + metadata['repo'], metadata['sha1']) + if version is None: + version = '' + else: + version = '-%s' % version + + fst_col = '%s.%s.%s%s' % (metadata['cache-key'][:7], + metadata['kind'], + metadata['artifact-name'], + version) + + original_ref = metadata['original_ref'] + if metadata['kind'] in ('system', 'stratum'): + original_ref = original_ref[: len('baserock/builds/') + 7] + artifacts.append({ - 'cache-key': metadata['cache-key'], - 'name': metadata['artifact-name'], 'kind': metadata['kind'], - 'sha1': metadata['sha1'], - 'original_ref': metadata['original_ref'], + 'name': metadata['artifact-name'], + 'fst_col': fst_col, 'repo': metadata['repo'], - 'morphology': metadata['morphology'], - 'version': version, + 'original_ref': original_ref, + 'sha1': metadata['sha1'][:7] }) # Generate a format string for dumping the information. fmt = self._generate_output_format(artifacts) - + self.app.output.write(fmt % ('ARTIFACT', 'REPOSITORY', + 'REF', 'COMMIT')) + # Print information about system, strata and chunks. self._print_artifacts(fmt, artifacts, 'system') self._print_artifacts(fmt, artifacts, 'stratum') @@ -218,35 +231,22 @@ class ManifestGenerator(object): for key, value in artifact.iteritems(): colwidths[key] = max(colwidths.get(key, 0), len(value)) - colwidths['first'] = sum([colwidths['cache-key'], - colwidths['kind'], - colwidths['name']]) + 1 - - return 'artifact=%%-%is\t' \ - 'version=%%-%is\t' \ - 'commit=%%-%is\t' \ - 'repository=%%-%is\t' \ - 'ref=%%-%is\t' \ - 'morphology=%%-%is\n' % ( - len('artifact=') + colwidths['first'], - len('version=') + colwidths['version'], - len('commit=') + colwidths['sha1'], - len('repository=') + colwidths['repo'], - len('ref=') + colwidths['original_ref'], - len('morphology=') + colwidths['morphology']) + return '%%-%is\t' \ + '%%-%is\t' \ + '%%-%is\t' \ + '%%-%is\n' % ( + colwidths['fst_col'], + colwidths['repo'], + colwidths['original_ref'], + colwidths['sha1']) def _print_artifacts(self, fmt, artifacts, kind): for artifact in sorted(artifacts, key=lambda x: x['name']): if artifact['kind'] == kind: - self.app.output.write(fmt % ( - '%s.%s.%s' % (artifact['cache-key'], - artifact['kind'], - artifact['name']), - artifact['version'], - artifact['sha1'], - artifact['repo'], - artifact['original_ref'], - artifact['morphology'])) + self.app.output.write(fmt % (artifact['fst_col'], + artifact['repo'], + artifact['original_ref'], + artifact['sha1'])) class ArtifactInspectionPlugin(cliapp.Plugin): |