From 2d2774a3b84ce9dba9b4445e842801c2768cdaa3 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 30 Apr 2015 02:43:08 +0000 Subject: yarns: Add the ability to tag chunks and commit updates to definitions Change-Id: Ia644ddfaa5138f0ad459099cf26f51b545a9f9ca --- scripts/edit-morph | 12 ++++++++++++ yarns/implementations.yarn | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/scripts/edit-morph b/scripts/edit-morph index 8c0863c3..a3f857df 100755 --- a/scripts/edit-morph +++ b/scripts/edit-morph @@ -22,6 +22,7 @@ import yaml import morphlib + class EditMorph(cliapp.Application): '''Tools for performing set operations on large morphologies''' @@ -204,6 +205,17 @@ class EditMorph(cliapp.Application): with self._open_yaml(file_path) as d: d['products'] = yaml.load(match_rules) + def cmd_update_stratum_chunk_ref(self, (file_path, chunk_name, chunk_ref)): + '''Update a chunk in a stratum's ref + + Usage: FILE_PATH CHUNK_NAME CHUNK_REF + + ''' + with self._open_yaml(file_path) as d: + for spec in d['chunks']: + if spec.get('alias', spec['name']) == chunk_name: + spec['ref'] = chunk_ref + @classmethod def _splice_cluster_system(cls, syslist, syspath): sysname = syspath[0] diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index befd503e..d11f8752 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -39,6 +39,9 @@ we can test it later in a THEN step. ;; esac + IMPLEMENTS THEN morph output (.*) + grep -q "$MATCH_1" "$DATADIR/out-latest" + We need to check that a workspace creation worked. This requires the directory to exist, and its `.morph` subdirectory to exist, and nothing else. @@ -723,6 +726,10 @@ Generating a manifest. die "Output isn't what we expect" fi + IMPLEMENTS WHEN the user commits all changes in system branch (\S+) + cd "$DATADIR/workspace/$MATCH_1/test/morphs" + git commit -a --allow-empty -m 'Commit all changes' + Implementations for temporary build branch handling --------------------------------------------------- @@ -1052,6 +1059,11 @@ Altering morphologies in their source repositories git add "$MATCH_1" git commit -m "Make $MATCH_1 match $MATCH_2" + IMPLEMENTS WHEN chunk repository (\S+) is re-tagged as (\S+) + cd "$DATADIR/gits/$MATCH_1" + git commit --allow-empty -m "Prepare for $MATCH_2" + git tag -af -m "Release $MATCH_2" "$MATCH_2" + Altering morphologies in the workspace -------------------------------------- @@ -1062,6 +1074,12 @@ Altering morphologies in the workspace "$SRCDIR/scripts/edit-morph" set-stratum-match-rules \ "$MATCH_1" "$MATCH_3" + IMPLEMENTS WHEN chunk (\S+) in stratum (\S+) in system branch (\S+) is updated to use (\S+) from chunk repository (\S+) + cd "$DATADIR/workspace/$MATCH_3/test/morphs" + sha1=$(cd "$DATADIR/gits/$MATCH_5" && git rev-parse "$MATCH_4") + "$SRCDIR/scripts/edit-morph" update-stratum-chunk-ref \ + "$MATCH_2" "$MATCH_1" "$sha1" + ### Altering clusters ### IMPLEMENTS GIVEN a cluster called (\S+) in system branch (\S+) -- cgit v1.2.1