From 52e27d9b00fd18cde2ec27dbfda94eba3b0571bd Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Tue, 15 Oct 2013 10:55:14 +0000 Subject: Building with references to tags will now instead use the underlying commit --- morphlib/plugins/branch_and_merge_plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 9961fcf3..260c0e48 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -1718,8 +1718,9 @@ class BranchAndMergePlugin(cliapp.Plugin): # Obtain parent SHA1 for the temporary ref tree to be committed. # This will either be the current commit of the temporary ref or # HEAD in case the temporary ref does not exist yet. - system_branch_sha1 = self.resolve_ref(repo_dir, system_branch) - parent_sha1 = self.resolve_ref(repo_dir, build_ref) + system_branch_sha1 = self.resolve_ref( + repo_dir, '%s^{commit}' % system_branch) + parent_sha1 = self.resolve_ref(repo_dir, '%s^{commit}' % build_ref) if not parent_sha1: parent_sha1 = system_branch_sha1 -- cgit v1.2.1 From e5ae2aba5c0eed9562e34e9398af9989f9a12de7 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 24 Oct 2013 15:05:12 +0000 Subject: Adding test --- yarns/implementations.yarn | 23 ++++++++++++++++++++++- yarns/regression.yarn | 14 ++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 yarns/regression.yarn diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 3d403f30..d03e7ae0 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -76,6 +76,13 @@ another to hold a chunk. morph: test-stratum EOF + cat << EOF > "$DATADIR/gits/morphs/simple-system.morph" + name: simple-system + kind: system + arch: $arch + strata: [] + EOF + cat << EOF > "$DATADIR/gits/morphs/test-stratum.morph" name: test-stratum kind: stratum @@ -91,6 +98,7 @@ another to hold a chunk. run_in "$DATADIR/gits/morphs" git init . run_in "$DATADIR/gits/morphs" git add . run_in "$DATADIR/gits/morphs" git commit -m Initial. + run_in "$DATADIR/gits/morphs" git tag -a "test-tag" -m "Tagging test-tag" # Create the chunk repository. @@ -112,8 +120,14 @@ another to hold a chunk. cat << EOF > "$DATADIR/morph.conf" [config] repo-alias = test=file://$DATADIR/gits/%s#file://$DATADIR/gits/%s + cachedir = $DATADIR/cache + tempdir = $DATADIR/tmp + trove-host= [] EOF + mkdir "$DATADIR/cache" + mkdir "$DATADIR/tmp" + Morphologies need to support having a null ref, which means look for the stratum in the same repository and ref. Testing this requires different morphologies. @@ -132,7 +146,7 @@ Implementation sections for system branch operations Checkout out an existing system branch. We parameterise this so the same phrase can be used to check out any system branch. - IMPLEMENTS WHEN checking out the (\S+) system branch + IMPLEMENTS WHEN checking out the (\S+) system (branch|tag) cd "$DATADIR/workspace" run_morph checkout test:morphs "$MATCH_1" @@ -496,3 +510,10 @@ variables in `$DATADIR/env`. We treat the value as a format string for IMPLEMENTS GIVEN an environment variable (\S+) containing "(.*)" printf "export $MATCH_1=$MATCH_2" >> "$DATADIR/env" + +Implementations for building systems +------------------------------------ + + IMPLEMENTS THEN morph build the system (\S+) of the (branch|tag) (\S+) of the repo (\S+) + cd "$DATADIR/workspace/$MATCH_3/$MATCH_4" + run_morph build "$MATCH_1" diff --git a/yarns/regression.yarn b/yarns/regression.yarn new file mode 100644 index 00000000..d1cc8e79 --- /dev/null +++ b/yarns/regression.yarn @@ -0,0 +1,14 @@ +"regression" tests +================== + +Tests for check we don't introduce some bugs again. + + +Testing if we can build after checking out from a tag. + + SCENARIO morph build works after checkout from a tag + GIVEN a workspace + AND a git server + WHEN checking out the test-tag system tag + THEN morph build the system simple-system of the tag test-tag of the repo test:morphs + -- cgit v1.2.1