From 654e8e3a00cb12fcae63346319943751e3442aa2 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Thu, 19 Dec 2013 17:59:20 +0000 Subject: Deploy and cross-bootstrap commands no longer validate host architecture --- morphlib/plugins/cross-bootstrap_plugin.py | 13 +++++++++++++ morphlib/plugins/deploy_plugin.py | 4 ++++ 2 files changed, 17 insertions(+) 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'] -- cgit v1.2.1 From 077c14440cc52b918367a48793304d3e9d5296d7 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 20 Dec 2013 11:15:29 +0000 Subject: Fix old cross-bootstrap test --- tests.build/cross-bootstrap.script | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1 From 28b186e83095495aa9829bb1b75de28fd7d3d41b Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 20 Dec 2013 11:19:42 +0000 Subject: Add yarn test for cross-bootstrap --- yarns/architecture.yarn | 11 +++++++++ yarns/implementations.yarn | 61 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 3 deletions(-) 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 ====================================== -- cgit v1.2.1