diff options
-rw-r--r-- | morphlib/app.py | 8 | ||||
-rw-r--r-- | morphlib/artifactresolver.py | 6 | ||||
-rw-r--r-- | morphlib/buildcommand.py | 2 | ||||
-rw-r--r-- | morphlib/morphset.py | 8 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 32 | ||||
-rw-r--r-- | morphlib/plugins/build_plugin.py | 15 | ||||
-rw-r--r-- | morphlib/plugins/deploy_plugin.py | 14 | ||||
-rw-r--r-- | morphlib/source.py | 2 |
8 files changed, 42 insertions, 45 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 91647a32..74707998 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -279,7 +279,7 @@ class Morph(cliapp.Application): while args: assert len(args) >= 2, args - yield args[0], args[1], args[2] + ".morph" + yield args[0], args[1], args[2] args = args[3:] def create_source_pool(self, lrc, rrc, triplet): @@ -367,15 +367,15 @@ class Morph(cliapp.Application): elif morphology['kind'] == 'system': queue.extend((s.get('repo') or reponame, s.get('ref') or ref, - '%s.morph' % s['morph']) + s['morph']) for s in morphology['strata']) elif morphology['kind'] == 'stratum': if morphology['build-depends']: queue.extend((s.get('repo') or reponame, s.get('ref') or ref, - '%s.morph' % s['morph']) + s['morph']) for s in morphology['build-depends']) - queue.extend((c['repo'], c['ref'], '%s.morph' % c['morph']) + queue.extend((c['repo'], c['ref'], c['morph']) for c in morphology['chunks']) def cache_repo_and_submodules(self, cache, url, ref, done): diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py index 00976eb7..aab65506 100644 --- a/morphlib/artifactresolver.py +++ b/morphlib/artifactresolver.py @@ -142,7 +142,7 @@ class ArtifactResolver(object): stratum_source = self._source_pool.lookup( info.get('repo') or source.repo_name, info.get('ref') or source.original_ref, - '%s.morph' % info['morph']) + info['morph']) stratum_name = stratum_source.morphology['name'] matches, overlaps, unmatched = source.split_rules.partition( @@ -167,7 +167,7 @@ class ArtifactResolver(object): other_source = self._source_pool.lookup( stratum_info.get('repo') or source.repo_name, stratum_info.get('ref') or source.original_ref, - '%s.morph' % stratum_info['morph']) + stratum_info['morph']) # Make every stratum artifact this stratum source produces # depend on every stratum artifact the other stratum source @@ -194,7 +194,7 @@ class ArtifactResolver(object): chunk_source = self._source_pool.lookup( info['repo'], info['ref'], - '%s.morph' % info['morph']) + info['morph']) chunk_name = chunk_source.morphology['name'] diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 7ad7909d..d15061d6 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -231,7 +231,7 @@ class BuildCommand(object): for spec in specs: repo_name = spec.get('repo') or src.repo_name ref = spec.get('ref') or src.original_ref - filename = '%s.morph' % spec['morph'] + filename = spec['morph'] logging.debug( 'Validating cross ref to %s:%s:%s' % (repo_name, ref, filename)) diff --git a/morphlib/morphset.py b/morphlib/morphset.py index dedbabd5..6e60c880 100644 --- a/morphlib/morphset.py +++ b/morphlib/morphset.py @@ -99,7 +99,7 @@ class MorphologySet(object): raise StratumNotInSystemError(system_morph['name'], stratum_name) m = self._get_morphology(repo_url or system_morph.repo_url, ref or system_morph.ref, - '%s.morph' % morph) + morph) if m is None: raise StratumNotInSetError(stratum_name) return m @@ -175,13 +175,13 @@ class MorphologySet(object): process_spec_list(m, 'chunks') for m in self.morphologies: - tup = (m.repo_url, m.ref, m.filename[:-len('.morph')]) + tup = (m.repo_url, m.ref, m.filename) if tup in altered_references: spec = altered_references[tup] if m.ref != spec.get('ref'): m.ref = spec.get('ref') m.dirty = True - assert (m.filename == spec['morph'] + '.morph' + assert (m.filename == spec['morph'] or m.repo_url == spec.get('repo')), \ 'Moving morphologies is not supported.' @@ -196,7 +196,7 @@ class MorphologySet(object): def wanted_spec(m, kind, spec): return (spec.get('repo') == repo_url and spec.get('ref') == orig_ref and - spec['morph'] + '.morph' == morph_filename) + spec['morph'] == morph_filename) def process_spec(m, kind, spec): spec['unpetrify-ref'] = spec.get('ref') diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 51cba401..0650ce85 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -293,7 +293,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): return [ (spec.get('repo') or morph.repo_url, spec.get('ref') or morph.ref, - '%s.morph' % spec['morph']) + spec['morph']) for spec in specs ] @@ -376,7 +376,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): For example: - morph edit devel-system-x86-64-generic devel + morph edit systems/devel-system-x86-64-generic.morph strata/devel.morph The above command will mark the `devel` stratum as being modified in the current system branch. In this case, the stratum's @@ -387,13 +387,13 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): In other words, where the system morphology used to say this: - morph: devel + morph: strata/devel.morph repo: baserock:baserock/morphs ref: master The updated system morphology will now say this instead: - morph: devel + morph: strata/devel.morph repo: baserock:baserock/morphs ref: jrandom/new-feature @@ -401,7 +401,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): Another example: - morph edit devel-system-x86_64-generic devel gcc + morph edit systems/devel-system-x86_64-generic.morph strata/devel.morph chunks/gcc.morph The above command will mark the `gcc` chunk as being edited in the current system branch. Morph will clone the `gcc` repository @@ -424,11 +424,11 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): ' a stratum and optionally a chunk' ' as parameters') - system_name = morphlib.util.strip_morph_extension(args[0]) - stratum_name = morphlib.util.strip_morph_extension(args[1]) + system_filename = args[0] + stratum_filename = args[1] chunk_name = None if len(args) == 3: - chunk_name = morphlib.util.strip_morph_extension(args[2]) + chunk_filename = args[2] ws = morphlib.workspace.open('.') sb = morphlib.sysbranchdir.open_from_within('.') @@ -439,12 +439,12 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): logging.debug('Loading system morphology') system_morph = loader.load_from_file( - sb.get_filename(sb.root_repository_url, system_name + '.morph')) + sb.get_filename(sb.root_repository_url, system_filename)) if system_morph['kind'] != 'system': - raise cliapp.AppException("%s is not a system" % system_name) + raise cliapp.AppException("%s is not a system" % system_filename) system_morph.repo_url = sb.root_repository_url system_morph.ref = sb.system_branch_name - system_morph.filename = system_name + '.morph' + system_morph.filename = system_filename logging.debug('Loading stratum morphologies') morphs = self._load_stratum_morphologies(loader, sb, system_morph) @@ -454,9 +454,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): # Change refs to the stratum to be to the system branch. # Note: this currently only supports strata in root repository. - logging.debug('Changing refs to stratum %s' % stratum_name) + logging.debug('Changing refs to stratum %s' % stratum_filename) stratum_morph = morphs.get_stratum_in_system( - system_morph, stratum_name) + system_morph, stratum_filename) morphs.change_ref( stratum_morph.repo_url, stratum_morph.ref, stratum_morph.filename, sb.system_branch_name) @@ -467,10 +467,10 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): # name. if chunk_name: - logging.debug('Editing chunk %s' % chunk_name) + logging.debug('Editing chunk %s' % chunk_filename) chunk_url, chunk_ref, chunk_morph = morphs.get_chunk_triplet( - stratum_morph, chunk_name) + stratum_morph, chunk_filename) chunk_dirname = sb.get_git_directory_name(chunk_url) if not os.path.exists(chunk_dirname): @@ -494,7 +494,7 @@ class SimpleBranchAndMergePlugin(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) # Save any modified strata. diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py index 62009bcd..a82fa0fe 100644 --- a/morphlib/plugins/build_plugin.py +++ b/morphlib/plugins/build_plugin.py @@ -53,7 +53,7 @@ class BuildPlugin(cliapp.Plugin): Example: - morph distbuild devel-system-x86_64-generic + morph distbuild systems/devel-system-x86_64-generic.morph ''' @@ -80,8 +80,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 systems/devel-system-x86_64-generic.morph ''' @@ -118,7 +118,7 @@ class BuildPlugin(cliapp.Plugin): Example: - morph build devel-system-x86_64-generic + morph build systems/devel-system-x86_64-generic.morph ''' @@ -133,7 +133,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 = args[0] ws = morphlib.workspace.open('.') sb = morphlib.sysbranchdir.open_from_within('.') @@ -158,7 +158,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) @@ -187,4 +188,4 @@ class BuildPlugin(cliapp.Plugin): build_command.build([bb.root_repo_url, bb.root_ref, - system_name]) + system_filename]) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 1d582949..2f9d81fc 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -96,7 +96,7 @@ class DeployPlugin(cliapp.Plugin): name: cluster-foo kind: cluster systems: - - morph: devel-system-x86_64-generic + - morph: systems/devel-system-x86_64-generic.morph deploy: cluster-foo-x86_64-1: type: kvm @@ -274,7 +274,7 @@ class DeployPlugin(cliapp.Plugin): self.app.settings['tempdir-min-space'], '/', 0) - cluster_name = morphlib.util.strip_morph_extension(args[0]) + cluster_filename = args[0] env_vars = args[1:] ws = morphlib.workspace.open('.') @@ -289,13 +289,10 @@ class DeployPlugin(cliapp.Plugin): name = morphlib.git.get_user_name(self.app.runcmd) email = morphlib.git.get_user_email(self.app.runcmd) build_ref_prefix = self.app.settings['build-ref-prefix'] - root_repo_dir = morphlib.gitdir.GitDirectory( sb.get_git_directory_name(sb.root_repository_url)) - mf = morphlib.morphologyfinder.MorphologyFinder(root_repo_dir) - cluster_text, cluster_filename = mf.read_morphology(cluster_name) - cluster_morphology = loader.load_from_string(cluster_text, - filename=cluster_filename) + + cluster_morphology = loader.load_from_file(cluster_filename) if cluster_morphology['kind'] != 'cluster': raise cliapp.AppException( @@ -350,8 +347,7 @@ class DeployPlugin(cliapp.Plugin): try: # Find the artifact to build morph = system['morph'] - srcpool = build_command.create_source_pool(build_repo, ref, - morph + '.morph') + srcpool = build_command.create_source_pool(build_repo, ref, morph) artifact = build_command.resolve_artifacts(srcpool) diff --git a/morphlib/source.py b/morphlib/source.py index 75a2e4de..2dbabad1 100644 --- a/morphlib/source.py +++ b/morphlib/source.py @@ -55,4 +55,4 @@ class Source(object): def __str__(self): # pragma: no cover return '%s|%s|%s' % (self.repo_name, self.original_ref, - self.filename[:-len('.morph')]) + self.filename) |