diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2013-12-20 15:37:40 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2013-12-20 15:37:40 +0000 |
commit | 7593ccef93eed631ea712c716f4e31e9be3a2bf6 (patch) | |
tree | 8fc1fc0900dd29bf28c67d504533a148ac42e1b1 | |
parent | ae0bb5ac1245fe124560fa7dc1f53656da190ac2 (diff) | |
parent | 28b186e83095495aa9829bb1b75de28fd7d3d41b (diff) | |
download | morph-7593ccef93eed631ea712c716f4e31e9be3a2bf6.tar.gz |
Merge branch 'baserock/pedroalvarez/fix-cross-bootstrap6'
Reviewed-by: Richard Maw
-rw-r--r-- | morphlib/plugins/cross-bootstrap_plugin.py | 13 | ||||
-rw-r--r-- | morphlib/plugins/deploy_plugin.py | 4 | ||||
-rwxr-xr-x | tests.build/cross-bootstrap.script | 3 | ||||
-rw-r--r-- | yarns/architecture.yarn | 11 | ||||
-rw-r--r-- | yarns/implementations.yarn | 61 |
5 files changed, 88 insertions, 4 deletions
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py index 72c7924f..ec0cfbcb 100644 --- a/morphlib/plugins/cross-bootstrap_plugin.py +++ b/morphlib/plugins/cross-bootstrap_plugin.py @@ -267,6 +267,19 @@ class CrossBootstrapPlugin(cliapp.Plugin): system_source = srcpool.lookup(root_repo, ref, morph_name) system_source.morphology.builds_artifacts = builds_artifacts + # FIXME: this is a quick fix in order to get it working for + # Baserock 13 release, it is not a reasonable fix + def validate(self, root_artifact): + root_arch = root_artifact.source.morphology['arch'] + target_arch = arch + if root_arch != target_arch: + raise morphlib.Error( + 'Target architecture is %s ' + 'but the system architecture is %s' + % (target_arch, root_arch)) + + morphlib.buildcommand.BuildCommand._validate_architecture = validate + system_artifact = build_command.resolve_artifacts(srcpool) # Calculate build order diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 1e86d44c..47cd00c1 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -329,6 +329,10 @@ class DeployPlugin(cliapp.Plugin): morph = system['morph'] srcpool = build_command.create_source_pool(build_repo, ref, morph + '.morph') + def validate(self, root_artifact): + pass + morphlib.buildcommand.BuildCommand._validate_architecture = validate + artifact = build_command.resolve_artifacts(srcpool) deploy_defaults = system['deploy-defaults'] diff --git a/tests.build/cross-bootstrap.script b/tests.build/cross-bootstrap.script index 4de0f1ae..51d9ef1e 100755 --- a/tests.build/cross-bootstrap.script +++ b/tests.build/cross-bootstrap.script @@ -24,4 +24,5 @@ set -eu "$SRCDIR/tests.build/setup-build-essential" "$SRCDIR/scripts/test-morph" cross-bootstrap \ - x86_32 test:morphs-repo master hello-system + $("$SRCDIR/scripts/test-morph" print-architecture) \ + test:morphs-repo master hello-system diff --git a/yarns/architecture.yarn b/yarns/architecture.yarn index 521575a3..679c804b 100644 --- a/yarns/architecture.yarn +++ b/yarns/architecture.yarn @@ -9,3 +9,14 @@ Morph Cross-Building Tests AND the user attempts to build the system base-system-testarch in branch master THEN morph failed AND the build error message includes the string "Are you trying to cross-build?" + + +Morph Cross-Bootstrap Tests +=========================== + + SCENARIO cross-bootstraping a system for a different architecture + GIVEN a workspace + AND a git server + AND a system called base-system-testarch for the test architecture in the git server + WHEN the user checks out the system branch called master + THEN the user cross-bootstraps the system base-system-testarch in branch master of repo test:morphs to the arch testarch diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 132ce9b3..0fad95be 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -124,6 +124,46 @@ We need a consistent value for the architecture in some tests, so we have a morphology using the test architecture. IMPLEMENTS GIVEN a system called (\S+) for the test architecture in the git server + + cat << EOF > "$DATADIR/gits/test-chunk/stage1-chunk.morph" + name: stage1-chunk + kind: chunk + build-system: dummy + EOF + + run_in "$DATADIR/gits/test-chunk" git init . + run_in "$DATADIR/gits/test-chunk" git add . + run_in "$DATADIR/gits/test-chunk" git commit -m Initial. + + + cat << EOF > "$DATADIR/gits/morphs/build-essential.morph" + name: build-essential + kind: stratum + chunks: + - name: stage1-chunk + repo: test:test-chunk + ref: master + morph: stage1-chunk + build-mode: bootstrap + build-depends: [] + EOF + + cat << EOF > "$DATADIR/gits/morphs/core.morph" + name: core + kind: stratum + build-depends: + - morph: build-essential + ref: master + repo: test:morphs + chunks: + - name: test-chunk + repo: test:test-chunk + ref: master + morph: test-chunk + build-mode: test + build-depends: [] + EOF + cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph" arch: testarch configuration-extensions: [] @@ -131,13 +171,20 @@ have a morphology using the test architecture. kind: system name: $MATCH_1 strata: - - name: test-stratum + - name: build-essential repo: test:morphs ref: master - morph: test-stratum + morph: build-essential + - name: core + repo: test:morphs + ref: master + morph: core EOF + + run_in "$DATADIR/gits/morphs" git add "build-essential.morph" + run_in "$DATADIR/gits/morphs" git add "core.morph" run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph" - run_in "$DATADIR/gits/morphs" git commit -m "Added $MATCH_1 morphology." + run_in "$DATADIR/gits/morphs" git commit -m "Added $MATCH_1 and strata morphologies." Morphologies need to support having a null ref, which means look for the stratum in the same repository and ref. Testing this requires different @@ -466,6 +513,14 @@ Implementation sections for building if [ $MATCH_1 == "builds" ]; then run_morph "$@" else attempt_morph "$@"; fi +Implementation sections for cross-bootstraping +============================================== + + IMPLEMENTS THEN the user cross-bootstraps the system (\S+) in branch (\S+) of repo (\S+) to the arch (\S+) + cd "$DATADIR/workspace/$MATCH_2" + set -- cross-bootstrap "$MATCH_4" "$MATCH_3" "$MATCH_2" "$MATCH_1" + run_morph "$@" + Implementation sections for deployment ====================================== |