From f9c5734d5014ed5a794ddcf54ed2ad03bdf392ad Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 14 Mar 2014 10:54:27 +0000 Subject: Fix copyright date in stagingarea_tests --- morphlib/stagingarea_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py index 1c424ab8..52f495eb 100644 --- a/morphlib/stagingarea_tests.py +++ b/morphlib/stagingarea_tests.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- cgit v1.2.1 From a9e19c96b345106a6bc564271d02d094b67bd10c Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 10 Mar 2014 15:54:43 +0000 Subject: yarns: set deployment name based on system name --- yarns/deployment.yarn | 9 +++++---- yarns/implementations.yarn | 2 +- yarns/regression.yarn | 2 +- yarns/splitting.yarn | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index f98d2751..c8bfc68f 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -15,7 +15,7 @@ Morph Deployment Tests WHEN the user checks out the system branch called master GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options system.location=test.tar + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location=test.tar THEN morph succeeded Some deployment types support upgrades, but some do not and Morph needs to make @@ -27,7 +27,7 @@ this clear. WHEN the user checks out the system branch called master GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master WHEN the user builds the system test-system in branch master - AND the user attempts to upgrade the cluster test-cluster in branch master with options system.location=test.tar + AND the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.tar THEN morph failed The rawdisk write extension supports both initial deployment and subsequent @@ -42,6 +42,7 @@ the same code paths as a real upgrade. WHEN the user checks out the system branch called master GIVEN a cluster called test-cluster for deploying only the test-system system as type rawdisk in system branch master WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options system.location=test.img system.DISK_SIZE=10M system.VERSION_LABEL=test1 - AND the user attempts to upgrade the cluster test-cluster in branch master with options system.location=test.img system.VERSION_LABEL=test2 + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location=test.img test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1 + THEN morph succeeded + WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.img test-system.VERSION_LABEL=test2 THEN morph succeeded diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 3e5b3ab5..71a782f3 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -692,7 +692,7 @@ with only the minimal information. repo: test:morphs ref: $branch deploy: - system: + $system: type: $type EOF diff --git a/yarns/regression.yarn b/yarns/regression.yarn index d8eedea2..17e3ad87 100644 --- a/yarns/regression.yarn +++ b/yarns/regression.yarn @@ -62,7 +62,7 @@ source it depended on. WHEN the user builds the system test-system in branch master GIVEN stratum test-stratum in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}] WHEN the user builds the system test-system in branch master - AND the user deploys the cluster test-cluster in branch master with options system.location="$DATADIR/test.tar" + AND the user deploys the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar" THEN tarball test.tar contains baserock/test-chunk-misc.meta diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn index 3da397f5..a1b5e565 100644 --- a/yarns/splitting.yarn +++ b/yarns/splitting.yarn @@ -49,7 +49,7 @@ its contents. GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options system.location="$DATADIR/test.tar" + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar" The -runtime artifacts include executables and shared libraries. -- cgit v1.2.1 From 0a94204ca8bfd1593aed1bb7c44d9c2cdad608dc Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 7 Mar 2014 14:31:14 +0000 Subject: Remove ugly loading of old b&m plugin --- morphlib/plugins/deploy_plugin.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 61e1b5a4..c1f26e46 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -26,13 +26,6 @@ import uuid import morphlib -# UGLY HACK: We need to re-use some code from the branch and merge -# plugin, so we import and instantiate that plugin. This needs to -# be fixed by refactoring the codebase so the shared code is in -# morphlib, not in a plugin. However, this hack lets us re-use -# code without copying it. -import morphlib.plugins.branch_and_merge_plugin - class ExtensionNotFoundError(morphlib.Error): pass @@ -51,9 +44,6 @@ class DeployPlugin(cliapp.Plugin): self.app.add_subcommand( 'deploy', self.deploy, arg_synopsis='CLUSTER [SYSTEM.KEY=VALUE]') - self.other = \ - morphlib.plugins.branch_and_merge_plugin.BranchAndMergePlugin() - self.other.app = self.app def disable(self): pass -- cgit v1.2.1 From d79ea3978718aba1d4e3585de873b4a661428d07 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 7 Mar 2014 14:31:54 +0000 Subject: Patch buildcommand once, rather that once per system --- morphlib/plugins/deploy_plugin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index c1f26e46..71ca5a2c 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -261,6 +261,11 @@ class DeployPlugin(cliapp.Plugin): ''' + # Nasty hack to allow deploying things of a different architecture + def validate(self, root_artifact): + pass + morphlib.buildcommand.BuildCommand._validate_architecture = validate + if not args: raise cliapp.AppException( 'Too few arguments to deploy command (see help)') @@ -338,9 +343,6 @@ 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) -- cgit v1.2.1 From 678bac5ca44a8b4b7b5f0e3ab17104b5171cda0e Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 7 Mar 2014 15:23:06 +0000 Subject: Move tempdir creation out of the loop We don't need to remove the whole thing every time, and for nested deployments, we want to keep the directories around, since there will be multiple deploys happening in it concurrently. --- morphlib/plugins/deploy_plugin.py | 48 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 71ca5a2c..51f5b247 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -332,13 +332,20 @@ class DeployPlugin(cliapp.Plugin): ref=build_ref, dirname=gd.dirname, remote=remote.get_push_url(), chatty=True) - for system in cluster_morphology['systems']: - self.deploy_system(build_command, root_repo_dir, - bb.root_repo_url, bb.root_ref, - system, env_vars) - - def deploy_system(self, build_command, root_repo_dir, build_repo, ref, - system, env_vars): + # Create a tempdir for this deployment to work in + deploy_tempdir = tempfile.mkdtemp( + dir=os.path.join(self.app.settings['tempdir'], 'deployments')) + try: + for system in cluster_morphology['systems']: + self.deploy_system(build_command, deploy_tempdir, + root_repo_dir, + bb.root_repo_url, bb.root_ref, + system, env_vars) + finally: + shutil.rmtree(deploy_tempdir) + + def deploy_system(self, build_command, deploy_tempdir, + root_repo_dir, build_repo, ref, system, env_vars): # Find the artifact to build morph = system['morph'] srcpool = build_command.create_source_pool(build_repo, ref, @@ -373,11 +380,12 @@ class DeployPlugin(cliapp.Plugin): 'for system "%s"' % system_id) morphlib.util.sanitize_environment(final_env) - self.do_deploy(build_command, root_repo_dir, ref, artifact, + self.do_deploy(build_command, deploy_tempdir, + root_repo_dir, ref, artifact, deployment_type, location, final_env) - def do_deploy(self, build_command, root_repo_dir, ref, artifact, - deployment_type, location, env): + def do_deploy(self, build_command, deploy_tempdir, root_repo_dir, + ref, artifact, deployment_type, location, env): # Run optional write check extension. These are separate from the write # extension because it may be several minutes before the write # extension itself has the chance to raise an error. @@ -388,18 +396,15 @@ class DeployPlugin(cliapp.Plugin): except ExtensionNotFoundError: pass - # Create a tempdir for this deployment to work in - deploy_tempdir = tempfile.mkdtemp( - dir=os.path.join(self.app.settings['tempdir'], 'deployments')) - try: - # Create a tempdir to extract the rootfs in - system_tree = tempfile.mkdtemp(dir=deploy_tempdir) + # Create a tempdir to extract the rootfs in + system_tree = tempfile.mkdtemp(dir=deploy_tempdir) - # Extensions get a private tempdir so we can more easily clean - # up any files an extension left behind - deploy_private_tempdir = tempfile.mkdtemp(dir=deploy_tempdir) - env['TMPDIR'] = deploy_private_tempdir + # Extensions get a private tempdir so we can more easily clean + # up any files an extension left behind + deploy_private_tempdir = tempfile.mkdtemp(dir=deploy_tempdir) + env['TMPDIR'] = deploy_private_tempdir + try: # Unpack the artifact (tarball) to a temporary directory. self.app.status(msg='Unpacking system for configuration') @@ -453,7 +458,8 @@ class DeployPlugin(cliapp.Plugin): finally: # Cleanup. self.app.status(msg='Cleaning up') - shutil.rmtree(deploy_tempdir) + shutil.rmtree(deploy_private_tempdir) + shutil.rmtree(system_tree) self.app.status(msg='Finished deployment') -- cgit v1.2.1 From fc372d58558989603785eddc7ba7d07e77c42b09 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 7 Mar 2014 16:01:04 +0000 Subject: Move deploy logic into multiple methods Check is now separate from setup, which is now separate from running the commands. --- morphlib/plugins/deploy_plugin.py | 42 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 51f5b247..28d0d3a1 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -344,6 +344,8 @@ class DeployPlugin(cliapp.Plugin): finally: shutil.rmtree(deploy_tempdir) + self.app.status(msg='Finished deployment') + def deploy_system(self, build_command, deploy_tempdir, root_repo_dir, build_repo, ref, system, env_vars): # Find the artifact to build @@ -380,12 +382,17 @@ class DeployPlugin(cliapp.Plugin): 'for system "%s"' % system_id) morphlib.util.sanitize_environment(final_env) - self.do_deploy(build_command, deploy_tempdir, - root_repo_dir, ref, artifact, - deployment_type, location, final_env) - - def do_deploy(self, build_command, deploy_tempdir, root_repo_dir, - ref, artifact, deployment_type, location, env): + self.check_deploy(root_repo_dir, ref, deployment_type, location, + final_env) + system_tree = self.setup_deploy(build_command, deploy_tempdir, + root_repo_dir, ref, artifact, + deployment_type, location, + final_env) + self.run_deploy_commands(deploy_tempdir, final_env, artifact, + root_repo_dir, ref, deployment_type, + system_tree, location) + + def check_deploy(self, root_repo_dir, ref, deployment_type, location, env): # Run optional write check extension. These are separate from the write # extension because it may be several minutes before the write # extension itself has the chance to raise an error. @@ -396,14 +403,12 @@ class DeployPlugin(cliapp.Plugin): except ExtensionNotFoundError: pass + def setup_deploy(self, build_command, deploy_tempdir, root_repo_dir, ref, + artifact, deployment_type, location, env): + # Create a tempdir to extract the rootfs in system_tree = tempfile.mkdtemp(dir=deploy_tempdir) - # Extensions get a private tempdir so we can more easily clean - # up any files an extension left behind - deploy_private_tempdir = tempfile.mkdtemp(dir=deploy_tempdir) - env['TMPDIR'] = deploy_private_tempdir - try: # Unpack the artifact (tarball) to a temporary directory. self.app.status(msg='Unpacking system for configuration') @@ -432,7 +437,19 @@ class DeployPlugin(cliapp.Plugin): system_tree, 'baserock', 'deployment.meta') with morphlib.savefile.SaveFile(metadata_path, 'w') as f: f.write(json.dumps(metadata, indent=4, sort_keys=True)) + return system_tree + except Exception: + shutil.rmtree(system_tree) + raise + def run_deploy_commands(self, deploy_tempdir, env, artifact, root_repo_dir, + ref, deployment_type, system_tree, location): + # Extensions get a private tempdir so we can more easily clean + # up any files an extension left behind + deploy_private_tempdir = tempfile.mkdtemp(dir=deploy_tempdir) + env['TMPDIR'] = deploy_private_tempdir + + try: # Run configuration extensions. self.app.status(msg='Configure system') names = artifact.source.morphology['configuration-extensions'] @@ -459,9 +476,6 @@ class DeployPlugin(cliapp.Plugin): # Cleanup. self.app.status(msg='Cleaning up') shutil.rmtree(deploy_private_tempdir) - shutil.rmtree(system_tree) - - self.app.status(msg='Finished deployment') def _run_extension(self, gd, ref, name, kind, args, env): '''Run an extension. -- cgit v1.2.1 From f05e2152c027f63e5ce53dbcec1c892f1262b3b9 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 7 Mar 2014 16:14:40 +0000 Subject: Add the ability to do nested deployments --- morphlib/plugins/deploy_plugin.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 28d0d3a1..9f5891e0 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -338,16 +338,17 @@ class DeployPlugin(cliapp.Plugin): try: for system in cluster_morphology['systems']: self.deploy_system(build_command, deploy_tempdir, - root_repo_dir, - bb.root_repo_url, bb.root_ref, - system, env_vars) + root_repo_dir, bb.root_repo_url, + bb.root_ref, system, env_vars, + parent_location='') finally: shutil.rmtree(deploy_tempdir) self.app.status(msg='Finished deployment') def deploy_system(self, build_command, deploy_tempdir, - root_repo_dir, build_repo, ref, system, env_vars): + root_repo_dir, build_repo, ref, system, env_vars, + parent_location): # Find the artifact to build morph = system['morph'] srcpool = build_command.create_source_pool(build_repo, ref, @@ -355,7 +356,7 @@ class DeployPlugin(cliapp.Plugin): artifact = build_command.resolve_artifacts(srcpool) - deploy_defaults = system['deploy-defaults'] + deploy_defaults = system.get('deploy-defaults', {}) deployments = system['deploy'] for system_id, deploy_params in deployments.iteritems(): user_env = morphlib.util.parse_environment_pairs( @@ -388,9 +389,19 @@ class DeployPlugin(cliapp.Plugin): root_repo_dir, ref, artifact, deployment_type, location, final_env) + for subsystem in system.get('subsystems', []): + self.deploy_system(build_command, deploy_tempdir, + root_repo_dir, build_repo, + ref, subsystem, env_vars, + parent_location=system_tree) + if parent_location: + deploy_location = os.path.join(parent_location, + location.lstrip('/')) + else: + deploy_location = location self.run_deploy_commands(deploy_tempdir, final_env, artifact, root_repo_dir, ref, deployment_type, - system_tree, location) + system_tree, deploy_location) def check_deploy(self, root_repo_dir, ref, deployment_type, location, env): # Run optional write check extension. These are separate from the write @@ -405,6 +416,7 @@ class DeployPlugin(cliapp.Plugin): def setup_deploy(self, build_command, deploy_tempdir, root_repo_dir, ref, artifact, deployment_type, location, env): + # deployment_type, location and env are only used for saving metadata # Create a tempdir to extract the rootfs in system_tree = tempfile.mkdtemp(dir=deploy_tempdir) -- cgit v1.2.1 From 6102336c2db3a84dbf7db2900b2df381bc823f3b Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 10 Mar 2014 15:55:54 +0000 Subject: scripts: Add helper commands for altering cluster morphologies These define a vocabulary for altering a cluster morphology's fields, since defining an implementation that is only used by one scenario for setup is cumbersome. --- scripts/edit-morph | 108 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 11 deletions(-) diff --git a/scripts/edit-morph b/scripts/edit-morph index 2970cc6e..465a3ea3 100755 --- a/scripts/edit-morph +++ b/scripts/edit-morph @@ -16,6 +16,7 @@ import cliapp +import contextlib import os import re import yaml @@ -201,6 +202,15 @@ class EditMorph(cliapp.Application): return result + @staticmethod + @contextlib.contextmanager + def _open_yaml(path): + with open(path, 'r') as f: + d = yaml.load(f) + yield d + with open(path, 'w') as f: + yaml.dump(d, f) + def cmd_set_system_artifact_depends(self, args): '''Change the artifacts used by a System. @@ -219,13 +229,10 @@ class EditMorph(cliapp.Application): file_path = args[0] stratum_name = args[1] artifacts = re.split(r"\s+and\s+|,?\s*", args[2]) - with open(file_path, "r") as f: - d = yaml.load(f) - for spec in d["strata"]: - if spec.get("alias", spec["name"]) == stratum_name: - spec["artifacts"] = artifacts - with open(file_path, "w") as f: - yaml.dump(d, f) + with self._open_yaml(file_path) as d: + for spec in d["strata"]: + if spec.get("alias", spec["name"]) == stratum_name: + spec["artifacts"] = artifacts def cmd_set_stratum_match_rules(self, (file_path, match_rules)): '''Set a stratum's match rules. @@ -239,10 +246,89 @@ class EditMorph(cliapp.Application): The match rules must be a string that yaml can parse. ''' - with open(file_path, "r") as f: - d = yaml.load(f) - d['products'] = yaml.load(match_rules) - with open(file_path, "w") as f: + with self._open_yaml(file_path) as d: + d['products'] = yaml.load(match_rules) + + @classmethod + def _splice_cluster_system(cls, syslist, syspath): + sysname = syspath[0] + syspath = syspath[1:] + for system in syslist: + if sysname in system['deploy']: + break + else: + system = { + 'morph': None, + 'deploy': { + sysname: { + 'type': None, + 'location': None, + }, + }, + } + syslist.append(system) + if syspath: + cls._splice_cluster_system( + system.setdefault('subsystems', []), syspath) + + @classmethod + def _find_cluster_system(cls, syslist, syspath): + sysname = syspath[0] + syspath = syspath[1:] + for system in syslist: + if sysname in system['deploy']: + break + if syspath: + return cls._find_cluster_system(system['subsystems'], syspath) + return system + + def cmd_cluster_init(self, (cluster_file,)): + suffix = '.morph' + if not cluster_file.endswith(suffix): + raise cliapp.AppException( + "Morphology file path must end with .morph") + with open(cluster_file, 'w') as f: + d = { + 'name': os.path.basename(cluster_file)[:-len(suffix)], + 'kind': 'cluster', + } yaml.dump(d, f) + def cmd_cluster_system_init(self, (cluster_file, system_path)): + syspath = system_path.split('.') + with self._open_yaml(cluster_file) as d: + self._splice_cluster_system(d.setdefault('systems', []), syspath) + + def cmd_cluster_system_set_morphology(self, + (cluster_file, system_path, morphology)): + + syspath = system_path.split('.') + with self._open_yaml(cluster_file) as d: + system = self._find_cluster_system(d['systems'], syspath) + system['morph'] = morphology + + def cmd_cluster_system_set_deploy_type(self, + (cluster_file, system_path, deploy_type)): + + syspath = system_path.split('.') + with self._open_yaml(cluster_file) as d: + system = self._find_cluster_system(d['systems'], syspath) + system['deploy'][syspath[-1]]['type'] = deploy_type + + def cmd_cluster_system_set_deploy_location(self, + (cluster_file, system_path, deploy_location)): + + syspath = system_path.split('.') + with self._open_yaml(cluster_file) as d: + system = self._find_cluster_system(d['systems'], syspath) + system['deploy'][syspath[-1]]['location'] = deploy_location + + def cmd_cluster_system_set_deploy_variable(self, + (cluster_file, system_path, key, val)): + + syspath = system_path.split('.') + with self._open_yaml(cluster_file) as d: + system = self._find_cluster_system(d['systems'], syspath) + system['deploy'][syspath[-1]][key] = val + EditMorph().run() -- cgit v1.2.1 From 8fd1da1a64fc48ccb070bcc52766a547c85cbecc Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 10 Mar 2014 16:59:07 +0000 Subject: Add sysroot write extension This moves the deployed system to somewhere on the host. Any existing contents of the directory is deleted, so don't try to be clever and deploy a new system on top of / in place of a proper upgrade. It can be used to deploy a chroot, sysroot or container, but its current use is to allow for nested deployments to include another system in itself, since the parent deployment's "$1" is prepended to the sub-deployment's "$2". --- morphlib/exts/sysroot.write | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 morphlib/exts/sysroot.write diff --git a/morphlib/exts/sysroot.write b/morphlib/exts/sysroot.write new file mode 100755 index 00000000..1ae4864f --- /dev/null +++ b/morphlib/exts/sysroot.write @@ -0,0 +1,29 @@ +#!/bin/sh +# Copyright (C) 2014 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# A Morph write extension to deploy to another directory + +set -eu + +# Ensure the target is an empty directory +mkdir -p "$2" +find "$2" -mindepth 1 -delete + +# Move the contents of our source directory to our target +# Previously we would (cd "$1" && find -print0 | cpio -0pumd "$absolute_path") +# to do this, but the source directory is disposable anyway, so we can move +# its contents to save time +find "$1" -maxdepth 1 -mindepth 1 -exec mv {} "$2/." + -- cgit v1.2.1 From 439f278b2048ef20f7b0f953ed45feed50d73120 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 10 Mar 2014 16:06:29 +0000 Subject: Test nested deployments --- yarns/deployment.yarn | 70 ++++++++++++++++++++++++++++++++++++++----- yarns/implementations.yarn | 75 +++++++++++++++++++++++++++++++++------------- yarns/regression.yarn | 5 +++- yarns/splitting.yarn | 5 +++- 4 files changed, 125 insertions(+), 30 deletions(-) diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index c8bfc68f..a5da8ee5 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -13,9 +13,13 @@ Morph Deployment Tests GIVEN a workspace AND a git server WHEN the user checks out the system branch called master - GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: tar + AND system test-system in cluster test-cluster in branch master has deployment location: test.tar WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location=test.tar + AND the user attempts to deploy the cluster test-cluster in branch master THEN morph succeeded Some deployment types support upgrades, but some do not and Morph needs to make @@ -25,9 +29,13 @@ this clear. GIVEN a workspace AND a git server WHEN the user checks out the system branch called master - GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: tar + AND system test-system in cluster test-cluster in branch master has deployment location: test.tar WHEN the user builds the system test-system in branch master - AND the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.tar + AND the user attempts to upgrade the cluster test-cluster in branch master THEN morph failed The rawdisk write extension supports both initial deployment and subsequent @@ -40,9 +48,57 @@ the same code paths as a real upgrade. GIVEN a workspace AND a git server WHEN the user checks out the system branch called master - GIVEN a cluster called test-cluster for deploying only the test-system system as type rawdisk in system branch master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk + AND system test-system in cluster test-cluster in branch master has deployment location: test.tar WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location=test.img test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1 + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1 THEN morph succeeded - WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.img test-system.VERSION_LABEL=test2 + WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.VERSION_LABEL=test2 THEN morph succeeded + +Nested deployments +================== + +For the use-cases of: + +1. Installer CD/USB +2. NFS/VM host +3. System with multiple containerised applications +4. System with a toolchain targetting the sysroot of another target +5. Any nested combination of the above + +It is convenient to be able to deploy one system inside another. + + SCENARIO deploying a cluster morphology with nested systems + GIVEN a workspace + AND a git server + WHEN the user checks out the system branch called master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: tar + +After the usual setup, we also add a subsystem to the cluster. + + GIVEN a subsystem in cluster test-cluster in branch master called test-system.sysroot + AND subsystem test-system.sysroot in cluster test-cluster in branch master builds test-system + AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment type: sysroot + +We specify the location as a file path, this is relative to the parent +system's extracted rootfs, before it is configured. + + AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment location: var/lib/sysroots/test-system + WHEN the user builds the system test-system in branch master + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar" + THEN morph succeeded + +Morph succeeding alone is not sufficient to check whether it actually +worked, since if it ignored the subsystems field, or got the location +wrong for the subsystem. To actually test it, we have to check that our +deployed system contains the other. Since the baserock directory is in +every system, we can check for that. + + AND tarball test.tar contains var/lib/sysroots/test-system/baserock diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 71a782f3..e4f36399 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -675,27 +675,6 @@ them, so they can be added to the end of the implements section. if [ $MATCH_1 == "upgrades" ]; then run_morph "$@" else attempt_morph "$@"; fi -To successfully deploy systems, we need a cluster morphology. Since the -common case is to just have one system, we generate a stub morphology -with only the minimal information. - - IMPLEMENTS GIVEN a cluster called (\S+) for deploying only the (\S+) system as type (\S+) in system branch (\S+) - name="$MATCH_1" - system="$MATCH_2" - type="$MATCH_3" - branch="$MATCH_4" - cat << EOF > "$DATADIR/workspace/$branch/test/morphs/$name.morph" - name: $name - kind: cluster - systems: - - morph: $system - repo: test:morphs - ref: $branch - deploy: - $system: - type: $type - EOF - Implementations sections for reading error messages =================================================== @@ -817,7 +796,61 @@ Altering morphologies in their source repositories Altering morphologies in the workspace -------------------------------------- +### Altering strata ### + IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*) cd "$DATADIR/workspace/$MATCH_2/test/morphs" "$SRCDIR/scripts/edit-morph" set-stratum-match-rules \ "$MATCH_1.morph" "$MATCH_3" + +### Altering clusters ### + + IMPLEMENTS GIVEN a cluster called (\S+) in system branch (\S+) + name="$MATCH_1" + branch="$MATCH_2" + "$SRCDIR/scripts/edit-morph" cluster-init \ + "$DATADIR/workspace/$branch/test/morphs/$name.morph" + + IMPLEMENTS GIVEN a (sub)?system in cluster (\S+) in branch (\S+) called (\S+) + cluster="$MATCH_2" + branch="$MATCH_3" + name="$MATCH_4" + "$SRCDIR/scripts/edit-morph" cluster-system-init \ + "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" + + IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) builds (\S+) + name="$MATCH_2" + cluster="$MATCH_3" + branch="$MATCH_4" + morphology="$MATCH_5" + "$SRCDIR/scripts/edit-morph" cluster-system-set-morphology \ + "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \ + "$morphology" + + IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment type: (\S+) + name="$MATCH_2" + cluster="$MATCH_3" + branch="$MATCH_4" + type="$MATCH_5" + "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-type \ + "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \ + "$type" + + IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment location: (\S+) + name="$MATCH_2" + cluster="$MATCH_3" + branch="$MATCH_4" + location="$MATCH_5" + "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-location \ + "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \ + "$location" + + IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment variable: ([^=]+)=(.*) + name="$MATCH_2" + cluster="$MATCH_3" + branch="$MATCH_4" + key="$MATCH_5" + val="$MATCH_6" + "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-variable \ + "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \ + "$key" "$val" diff --git a/yarns/regression.yarn b/yarns/regression.yarn index 17e3ad87..b0f4d112 100644 --- a/yarns/regression.yarn +++ b/yarns/regression.yarn @@ -58,7 +58,10 @@ source it depended on. AND system test-system uses test-stratum-runtime from test-stratum AND stratum test-stratum has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|locale)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|misc)]}] WHEN the user checks out the system branch called master - GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: tar WHEN the user builds the system test-system in branch master GIVEN stratum test-stratum in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}] WHEN the user builds the system test-system in branch master diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn index a1b5e565..ee587e11 100644 --- a/yarns/splitting.yarn +++ b/yarns/splitting.yarn @@ -47,7 +47,10 @@ The best way to test that only using some stratum artifacts works is to check which files the output has, so we deploy a tarball and inspect its contents. - GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + GIVEN a cluster called test-cluster in system branch master + AND a system in cluster test-cluster in branch master called test-system + AND system test-system in cluster test-cluster in branch master builds test-system + AND system test-system in cluster test-cluster in branch master has deployment type: tar WHEN the user builds the system test-system in branch master AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar" -- cgit v1.2.1 From 4171217354a01c6492ce6160bbf4aaaf7326bdf1 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 11 Mar 2014 17:49:06 +0000 Subject: deploy: Make extension output display which it is This also makes it obey status prefix --- morphlib/plugins/deploy_plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 9f5891e0..41eb817f 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -526,7 +526,8 @@ class DeployPlugin(cliapp.Plugin): name=name, kind=kind) self.app.runcmd( [ext_filename] + args, - ['sh', '-c', 'while read l; do echo `date "+%F %T"` $l; done'], + ['sh', '-c', 'while read l; do echo `date "+%F %T"` "$1$l"; done', + '-', '%s[%s]' % (self.app.status_prefix, name + kind)], cwd=gd.dirname, env=env, stdout=None, stderr=None) if delete_ext: -- cgit v1.2.1 From 8592fe5681fb131f05434d208133bbc82f8109e1 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 11 Mar 2014 17:49:43 +0000 Subject: deploy: Set status prefix to show which deployment the status is for --- morphlib/plugins/deploy_plugin.py | 122 +++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 53 deletions(-) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 41eb817f..cc2076cd 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -349,59 +349,75 @@ class DeployPlugin(cliapp.Plugin): def deploy_system(self, build_command, deploy_tempdir, root_repo_dir, build_repo, ref, system, env_vars, parent_location): - # Find the artifact to build - morph = system['morph'] - srcpool = build_command.create_source_pool(build_repo, ref, - morph + '.morph') - - artifact = build_command.resolve_artifacts(srcpool) - - deploy_defaults = system.get('deploy-defaults', {}) - deployments = system['deploy'] - for system_id, deploy_params in deployments.iteritems(): - user_env = morphlib.util.parse_environment_pairs( - os.environ, - [pair[len(system_id)+1:] - for pair in env_vars - if pair.startswith(system_id)]) - - final_env = dict(deploy_defaults.items() + - deploy_params.items() + - user_env.items()) - - is_upgrade = 'yes' if self.app.settings['upgrade'] else 'no' - final_env['UPGRADE'] = is_upgrade - - deployment_type = final_env.pop('type', None) - if not deployment_type: - raise morphlib.Error('"type" is undefined ' - 'for system "%s"' % system_id) - - location = final_env.pop('location', None) - if not location: - raise morphlib.Error('"location" is undefined ' - 'for system "%s"' % system_id) - - morphlib.util.sanitize_environment(final_env) - self.check_deploy(root_repo_dir, ref, deployment_type, location, - final_env) - system_tree = self.setup_deploy(build_command, deploy_tempdir, - root_repo_dir, ref, artifact, - deployment_type, location, - final_env) - for subsystem in system.get('subsystems', []): - self.deploy_system(build_command, deploy_tempdir, - root_repo_dir, build_repo, - ref, subsystem, env_vars, - parent_location=system_tree) - if parent_location: - deploy_location = os.path.join(parent_location, - location.lstrip('/')) - else: - deploy_location = location - self.run_deploy_commands(deploy_tempdir, final_env, artifact, - root_repo_dir, ref, deployment_type, - system_tree, deploy_location) + old_status_prefix = self.app.status_prefix + system_status_prefix = '%s[%s]' % (old_status_prefix, system['morph']) + self.app.status_prefix = system_status_prefix + try: + # Find the artifact to build + morph = system['morph'] + srcpool = build_command.create_source_pool(build_repo, ref, + morph + '.morph') + + artifact = build_command.resolve_artifacts(srcpool) + + deploy_defaults = system.get('deploy-defaults', {}) + deployments = system['deploy'] + for system_id, deploy_params in deployments.iteritems(): + deployment_status_prefix = '%s[%s]' % ( + system_status_prefix, system_id) + self.app.status_prefix = deployment_status_prefix + try: + user_env = morphlib.util.parse_environment_pairs( + os.environ, + [pair[len(system_id)+1:] + for pair in env_vars + if pair.startswith(system_id)]) + + final_env = dict(deploy_defaults.items() + + deploy_params.items() + + user_env.items()) + + is_upgrade = ('yes' if self.app.settings['upgrade'] + else 'no') + final_env['UPGRADE'] = is_upgrade + + deployment_type = final_env.pop('type', None) + if not deployment_type: + raise morphlib.Error('"type" is undefined ' + 'for system "%s"' % system_id) + + location = final_env.pop('location', None) + if not location: + raise morphlib.Error('"location" is undefined ' + 'for system "%s"' % system_id) + + morphlib.util.sanitize_environment(final_env) + self.check_deploy(root_repo_dir, ref, deployment_type, + location, final_env) + system_tree = self.setup_deploy(build_command, + deploy_tempdir, + root_repo_dir, + ref, artifact, + deployment_type, + location, final_env) + for subsystem in system.get('subsystems', []): + self.deploy_system(build_command, deploy_tempdir, + root_repo_dir, build_repo, + ref, subsystem, env_vars, + parent_location=system_tree) + if parent_location: + deploy_location = os.path.join(parent_location, + location.lstrip('/')) + else: + deploy_location = location + self.run_deploy_commands(deploy_tempdir, final_env, + artifact, root_repo_dir, + ref, deployment_type, + system_tree, deploy_location) + finally: + self.app.status_prefix = system_status_prefix + finally: + self.app.status_prefix = old_status_prefix def check_deploy(self, root_repo_dir, ref, deployment_type, location, env): # Run optional write check extension. These are separate from the write -- cgit v1.2.1 From f366960273b026322f7e7cc3c1eb0cd632ebc73e Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 10 Mar 2014 10:25:03 +0000 Subject: tests: Allow running ./check on 32-bit x86 uname will return the same string morph expects as an architecture on x86_64, but the canonical x86_32 architecture names match i?86 instead. To make it work on 32-bit, we replace calls to uname with morph print-architecture, which does the translation for us. --- tests.as-root/metadata-includes-morph-version.setup | 2 +- tests.as-root/metadata-includes-repo-alias.setup | 2 +- tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script | 4 ++-- tests.as-root/run-in-artifact-with-different-artifacts.stderr | 2 +- tests.as-root/setup | 4 ++-- tests.as-root/system-overlap.script | 2 +- tests.as-root/tarball-image-is-sensible.setup | 2 +- tests.branching/setup | 2 +- tests.branching/tag-creates-commit-and-tag.stdout | 6 +++--- tests.branching/tag-tag-works-as-expected.stdout | 6 +++--- tests.build/bootstrap-mode.stdout | 6 +++--- tests.build/setup | 2 +- tests.deploy/setup | 4 ++-- tests.merging/setup | 4 ++-- tests/show-dependencies.setup | 2 +- yarns/deployment.yarn | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests.as-root/metadata-includes-morph-version.setup b/tests.as-root/metadata-includes-morph-version.setup index 31829b01..d7fc96e3 100755 --- a/tests.as-root/metadata-includes-morph-version.setup +++ b/tests.as-root/metadata-includes-morph-version.setup @@ -27,7 +27,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.as-root/metadata-includes-repo-alias.setup b/tests.as-root/metadata-includes-repo-alias.setup index 31829b01..d7fc96e3 100755 --- a/tests.as-root/metadata-includes-repo-alias.setup +++ b/tests.as-root/metadata-includes-repo-alias.setup @@ -27,7 +27,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script index 93cd135f..e0829968 100755 --- a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script +++ b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2011, 2012, 2013 Codethink Limited +# Copyright (C) 2011, 2012, 2013, 2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ set -eu cache="$DATADIR/cache/artifacts" -arch=$(uname -m) +arch=$("$SRCDIR/scripts/test-morph" print-architecture) cd "$DATADIR/kernel-repo" cat <linux.morph diff --git a/tests.as-root/run-in-artifact-with-different-artifacts.stderr b/tests.as-root/run-in-artifact-with-different-artifacts.stderr index 9241fbb5..3995cc42 100644 --- a/tests.as-root/run-in-artifact-with-different-artifacts.stderr +++ b/tests.as-root/run-in-artifact-with-different-artifacts.stderr @@ -1 +1 @@ -ERROR: Artifact TMP/cache/artifacts/e8e771e742c8f2199bd9f1e29cbeca07dbd51dd8880136d6521093711d37d8bf.stratum.linux-stratum-runtime cannot be extracted or mounted +ERROR: Artifact TMP/cache/artifacts/b6c123860d8b1b84a39490b5ded7b792219be89bae3e09201bd10795ac509a21.stratum.linux-stratum-runtime cannot be extracted or mounted diff --git a/tests.as-root/setup b/tests.as-root/setup index b865f42d..1cf9dd04 100755 --- a/tests.as-root/setup +++ b/tests.as-root/setup @@ -132,7 +132,7 @@ git add tools-stratum.morph cat < hello-system.morph name: hello-system kind: system -arch: `uname -m` +arch: `"$SRCDIR/scripts/test-morph" print-architecture` strata: - morph: hello-stratum EOF @@ -155,7 +155,7 @@ git add linux-stratum.morph cat < linux-system.morph name: linux-system kind: system -arch: `uname -m` +arch: `"$SRCDIR/scripts/test-morph" print-architecture` strata: - morph: hello-stratum - morph: linux-stratum diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script index c6154e0e..1ce8379d 100755 --- a/tests.as-root/system-overlap.script +++ b/tests.as-root/system-overlap.script @@ -31,7 +31,7 @@ cat <overlap-system.morph { "name": "overlap-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "foo-baz-stratum", diff --git a/tests.as-root/tarball-image-is-sensible.setup b/tests.as-root/tarball-image-is-sensible.setup index 505707b3..c47a5336 100755 --- a/tests.as-root/tarball-image-is-sensible.setup +++ b/tests.as-root/tarball-image-is-sensible.setup @@ -46,7 +46,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "link-stratum", diff --git a/tests.branching/setup b/tests.branching/setup index 06a05e90..22c51c24 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -50,7 +50,7 @@ ln -s "$DATADIR/morphs" "$DATADIR/morphs.git" cat < "$DATADIR/morphs/hello-system.morph" name: hello-system kind: system -arch: $(uname -m) +arch: $("$SRCDIR/scripts/test-morph" print-architecture) strata: - morph: hello-stratum EOF diff --git a/tests.branching/tag-creates-commit-and-tag.stdout b/tests.branching/tag-creates-commit-and-tag.stdout index 335e6a31..0e885652 100644 --- a/tests.branching/tag-creates-commit-and-tag.stdout +++ b/tests.branching/tag-creates-commit-and-tag.stdout @@ -5,7 +5,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000 Message -commit 74b7fcdd21ac4756e473eb8a577caaabeab208b0 +commit eb4ad9eb2e04ef131c774c79dd4391aea57b7b4d Author: developer Date: Tue Jul 31 16:51:54 2012 +0000 @@ -26,7 +26,7 @@ index e012b5f..50da61b 100644 build-mode: test test:morphs -commit 74b7fcdd21ac4756e473eb8a577caaabeab208b0 +commit eb4ad9eb2e04ef131c774c79dd4391aea57b7b4d Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer @@ -34,7 +34,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000 Message -commit dc323150575be26e3df0d2dab678560c04281b9f +commit 2a240d0170183a94869bd30a9112d11715627e4c Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer diff --git a/tests.branching/tag-tag-works-as-expected.stdout b/tests.branching/tag-tag-works-as-expected.stdout index c3d723d7..d2eec589 100644 --- a/tests.branching/tag-tag-works-as-expected.stdout +++ b/tests.branching/tag-tag-works-as-expected.stdout @@ -9,7 +9,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000 Second -commit ed4fa3a98076e92d61983202ed44455b3689bc16 +commit 589936e1097412e612ca3843be5f0a9f77a08077 Author: developer Date: Tue Jul 31 16:51:54 2012 +0000 @@ -30,7 +30,7 @@ index e012b5f..50da61b 100644 build-mode: test test:morphs -commit ed4fa3a98076e92d61983202ed44455b3689bc16 +commit 589936e1097412e612ca3843be5f0a9f77a08077 Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer @@ -38,7 +38,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000 Second -commit dc323150575be26e3df0d2dab678560c04281b9f +commit 2a240d0170183a94869bd30a9112d11715627e4c Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer diff --git a/tests.build/bootstrap-mode.stdout b/tests.build/bootstrap-mode.stdout index 26544a75..083dd09d 100644 --- a/tests.build/bootstrap-mode.stdout +++ b/tests.build/bootstrap-mode.stdout @@ -1,8 +1,8 @@ build-essential strata: -./2271bef9cb222b1fd49bd2bcf3da435e02b4e0ce9fdddbcdf9358f608f51b547.stratum.build-essential-devel -["xxxx.chunk.cc-devel", "xxxx.chunk.cc-doc"] -./2a908a170acf10b4e9e131a007c8f3f0fa4961a7227c60793b3550c107f4c312.stratum.build-essential-runtime +./b75013d0859b014c0315da32d8b678efe7f781af458ea40e6d16854f2dbcd23e.stratum.build-essential-runtime ["xxxx.chunk.cc-bins", "xxxx.chunk.cc-libs", "xxxx.chunk.cc-locale", "xxxx.chunk.cc-misc"] +./c63086da61edde5bb6141a7100862e24bbcb47be7692bc1176883fa5e18d5503.stratum.build-essential-devel +["xxxx.chunk.cc-devel", "xxxx.chunk.cc-doc"] hello-system: ./ diff --git a/tests.build/setup b/tests.build/setup index 8b1dfd0e..559825b1 100755 --- a/tests.build/setup +++ b/tests.build/setup @@ -107,7 +107,7 @@ cat < hello-system.morph { "name": "hello-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.deploy/setup b/tests.deploy/setup index 5fbe0262..ece8819a 100755 --- a/tests.deploy/setup +++ b/tests.deploy/setup @@ -112,7 +112,7 @@ cat < hello-system.morph { "name": "hello-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", @@ -148,7 +148,7 @@ cat < linux-system.morph { "name": "linux-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.merging/setup b/tests.merging/setup index 2fdf9db0..77b8bebc 100755 --- a/tests.merging/setup +++ b/tests.merging/setup @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ cat < "$DATADIR/morphs/hello-system.morph" { "name": "hello-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "morph": "hello-stratum", diff --git a/tests/show-dependencies.setup b/tests/show-dependencies.setup index e1cc71ae..510656e6 100755 --- a/tests/show-dependencies.setup +++ b/tests/show-dependencies.setup @@ -347,7 +347,7 @@ cat < xfce-system.morph { "name": "xfce-system", "kind": "system", - "arch": "$(uname -m)", + "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", "strata": [ { "build-mode": "test", diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index a5da8ee5..88fd47a9 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -54,7 +54,7 @@ the same code paths as a real upgrade. AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk AND system test-system in cluster test-cluster in branch master has deployment location: test.tar WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1 + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=100M test-system.VERSION_LABEL=test1 THEN morph succeeded WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.VERSION_LABEL=test2 THEN morph succeeded -- cgit v1.2.1 From 95df3b251b455843683b6e24aa4c76ed80beb724 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 14 Mar 2014 11:05:17 +0000 Subject: Revert "tests: Allow running ./check on 32-bit x86" This reverts commit f366960273b026322f7e7cc3c1eb0cd632ebc73e. These changes break building on x86_64, which is our main development platform. Better patches will be forthcoming later. --- tests.as-root/metadata-includes-morph-version.setup | 2 +- tests.as-root/metadata-includes-repo-alias.setup | 2 +- tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script | 2 +- tests.as-root/run-in-artifact-with-different-artifacts.stderr | 2 +- tests.as-root/setup | 4 ++-- tests.as-root/system-overlap.script | 2 +- tests.as-root/tarball-image-is-sensible.setup | 2 +- tests.branching/setup | 2 +- tests.branching/tag-creates-commit-and-tag.stdout | 6 +++--- tests.branching/tag-tag-works-as-expected.stdout | 6 +++--- tests.build/bootstrap-mode.stdout | 6 +++--- tests.build/setup | 2 +- tests.deploy/setup | 4 ++-- tests.merging/setup | 2 +- tests/show-dependencies.setup | 2 +- yarns/deployment.yarn | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests.as-root/metadata-includes-morph-version.setup b/tests.as-root/metadata-includes-morph-version.setup index d7fc96e3..31829b01 100755 --- a/tests.as-root/metadata-includes-morph-version.setup +++ b/tests.as-root/metadata-includes-morph-version.setup @@ -27,7 +27,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.as-root/metadata-includes-repo-alias.setup b/tests.as-root/metadata-includes-repo-alias.setup index d7fc96e3..31829b01 100755 --- a/tests.as-root/metadata-includes-repo-alias.setup +++ b/tests.as-root/metadata-includes-repo-alias.setup @@ -27,7 +27,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script index e0829968..20b61507 100755 --- a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script +++ b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script @@ -23,7 +23,7 @@ set -eu cache="$DATADIR/cache/artifacts" -arch=$("$SRCDIR/scripts/test-morph" print-architecture) +arch=$(uname -m) cd "$DATADIR/kernel-repo" cat <linux.morph diff --git a/tests.as-root/run-in-artifact-with-different-artifacts.stderr b/tests.as-root/run-in-artifact-with-different-artifacts.stderr index 3995cc42..9241fbb5 100644 --- a/tests.as-root/run-in-artifact-with-different-artifacts.stderr +++ b/tests.as-root/run-in-artifact-with-different-artifacts.stderr @@ -1 +1 @@ -ERROR: Artifact TMP/cache/artifacts/b6c123860d8b1b84a39490b5ded7b792219be89bae3e09201bd10795ac509a21.stratum.linux-stratum-runtime cannot be extracted or mounted +ERROR: Artifact TMP/cache/artifacts/e8e771e742c8f2199bd9f1e29cbeca07dbd51dd8880136d6521093711d37d8bf.stratum.linux-stratum-runtime cannot be extracted or mounted diff --git a/tests.as-root/setup b/tests.as-root/setup index 1cf9dd04..b865f42d 100755 --- a/tests.as-root/setup +++ b/tests.as-root/setup @@ -132,7 +132,7 @@ git add tools-stratum.morph cat < hello-system.morph name: hello-system kind: system -arch: `"$SRCDIR/scripts/test-morph" print-architecture` +arch: `uname -m` strata: - morph: hello-stratum EOF @@ -155,7 +155,7 @@ git add linux-stratum.morph cat < linux-system.morph name: linux-system kind: system -arch: `"$SRCDIR/scripts/test-morph" print-architecture` +arch: `uname -m` strata: - morph: hello-stratum - morph: linux-stratum diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script index 1ce8379d..c6154e0e 100755 --- a/tests.as-root/system-overlap.script +++ b/tests.as-root/system-overlap.script @@ -31,7 +31,7 @@ cat <overlap-system.morph { "name": "overlap-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "foo-baz-stratum", diff --git a/tests.as-root/tarball-image-is-sensible.setup b/tests.as-root/tarball-image-is-sensible.setup index c47a5336..505707b3 100755 --- a/tests.as-root/tarball-image-is-sensible.setup +++ b/tests.as-root/tarball-image-is-sensible.setup @@ -46,7 +46,7 @@ cat < hello-tarball.morph { "name": "hello-tarball", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "link-stratum", diff --git a/tests.branching/setup b/tests.branching/setup index 22c51c24..06a05e90 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -50,7 +50,7 @@ ln -s "$DATADIR/morphs" "$DATADIR/morphs.git" cat < "$DATADIR/morphs/hello-system.morph" name: hello-system kind: system -arch: $("$SRCDIR/scripts/test-morph" print-architecture) +arch: $(uname -m) strata: - morph: hello-stratum EOF diff --git a/tests.branching/tag-creates-commit-and-tag.stdout b/tests.branching/tag-creates-commit-and-tag.stdout index 0e885652..335e6a31 100644 --- a/tests.branching/tag-creates-commit-and-tag.stdout +++ b/tests.branching/tag-creates-commit-and-tag.stdout @@ -5,7 +5,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000 Message -commit eb4ad9eb2e04ef131c774c79dd4391aea57b7b4d +commit 74b7fcdd21ac4756e473eb8a577caaabeab208b0 Author: developer Date: Tue Jul 31 16:51:54 2012 +0000 @@ -26,7 +26,7 @@ index e012b5f..50da61b 100644 build-mode: test test:morphs -commit eb4ad9eb2e04ef131c774c79dd4391aea57b7b4d +commit 74b7fcdd21ac4756e473eb8a577caaabeab208b0 Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer @@ -34,7 +34,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000 Message -commit 2a240d0170183a94869bd30a9112d11715627e4c +commit dc323150575be26e3df0d2dab678560c04281b9f Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer diff --git a/tests.branching/tag-tag-works-as-expected.stdout b/tests.branching/tag-tag-works-as-expected.stdout index d2eec589..c3d723d7 100644 --- a/tests.branching/tag-tag-works-as-expected.stdout +++ b/tests.branching/tag-tag-works-as-expected.stdout @@ -9,7 +9,7 @@ Date: Tue Jul 31 16:51:54 2012 +0000 Second -commit 589936e1097412e612ca3843be5f0a9f77a08077 +commit ed4fa3a98076e92d61983202ed44455b3689bc16 Author: developer Date: Tue Jul 31 16:51:54 2012 +0000 @@ -30,7 +30,7 @@ index e012b5f..50da61b 100644 build-mode: test test:morphs -commit 589936e1097412e612ca3843be5f0a9f77a08077 +commit ed4fa3a98076e92d61983202ed44455b3689bc16 Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer @@ -38,7 +38,7 @@ CommitDate: Tue Jul 31 16:51:54 2012 +0000 Second -commit 2a240d0170183a94869bd30a9112d11715627e4c +commit dc323150575be26e3df0d2dab678560c04281b9f Author: developer AuthorDate: Tue Jul 31 16:51:54 2012 +0000 Commit: developer diff --git a/tests.build/bootstrap-mode.stdout b/tests.build/bootstrap-mode.stdout index 083dd09d..26544a75 100644 --- a/tests.build/bootstrap-mode.stdout +++ b/tests.build/bootstrap-mode.stdout @@ -1,8 +1,8 @@ build-essential strata: -./b75013d0859b014c0315da32d8b678efe7f781af458ea40e6d16854f2dbcd23e.stratum.build-essential-runtime -["xxxx.chunk.cc-bins", "xxxx.chunk.cc-libs", "xxxx.chunk.cc-locale", "xxxx.chunk.cc-misc"] -./c63086da61edde5bb6141a7100862e24bbcb47be7692bc1176883fa5e18d5503.stratum.build-essential-devel +./2271bef9cb222b1fd49bd2bcf3da435e02b4e0ce9fdddbcdf9358f608f51b547.stratum.build-essential-devel ["xxxx.chunk.cc-devel", "xxxx.chunk.cc-doc"] +./2a908a170acf10b4e9e131a007c8f3f0fa4961a7227c60793b3550c107f4c312.stratum.build-essential-runtime +["xxxx.chunk.cc-bins", "xxxx.chunk.cc-libs", "xxxx.chunk.cc-locale", "xxxx.chunk.cc-misc"] hello-system: ./ diff --git a/tests.build/setup b/tests.build/setup index 559825b1..8b1dfd0e 100755 --- a/tests.build/setup +++ b/tests.build/setup @@ -107,7 +107,7 @@ cat < hello-system.morph { "name": "hello-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.deploy/setup b/tests.deploy/setup index ece8819a..5fbe0262 100755 --- a/tests.deploy/setup +++ b/tests.deploy/setup @@ -112,7 +112,7 @@ cat < hello-system.morph { "name": "hello-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", @@ -148,7 +148,7 @@ cat < linux-system.morph { "name": "linux-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", diff --git a/tests.merging/setup b/tests.merging/setup index 77b8bebc..411fc45d 100755 --- a/tests.merging/setup +++ b/tests.merging/setup @@ -51,7 +51,7 @@ cat < "$DATADIR/morphs/hello-system.morph" { "name": "hello-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "morph": "hello-stratum", diff --git a/tests/show-dependencies.setup b/tests/show-dependencies.setup index 510656e6..e1cc71ae 100755 --- a/tests/show-dependencies.setup +++ b/tests/show-dependencies.setup @@ -347,7 +347,7 @@ cat < xfce-system.morph { "name": "xfce-system", "kind": "system", - "arch": "$("$SRCDIR/scripts/test-morph" print-architecture)", + "arch": "$(uname -m)", "strata": [ { "build-mode": "test", diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index 88fd47a9..a5da8ee5 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -54,7 +54,7 @@ the same code paths as a real upgrade. AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk AND system test-system in cluster test-cluster in branch master has deployment location: test.tar WHEN the user builds the system test-system in branch master - AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=100M test-system.VERSION_LABEL=test1 + AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1 THEN morph succeeded WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.VERSION_LABEL=test2 THEN morph succeeded -- cgit v1.2.1