From 52e2b4aa1463e0247b6d1ef1653bbacc5dc0e02c Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 22 Jan 2014 13:39:34 +0000 Subject: yarns: Move system artifact inclusion implementation This moves the GIVEN system $system uses $artifacts from $source to the generic implements section, and the Python implementation into the edit-morph helper script. --- scripts/edit-morph | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/edit-morph b/scripts/edit-morph index 967bbc13..acb33b7e 100755 --- a/scripts/edit-morph +++ b/scripts/edit-morph @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2013 Codethink Limited +# Copyright (C) 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 @@ -18,6 +18,7 @@ import cliapp import os import re +import yaml import morphlib @@ -200,4 +201,30 @@ class EditMorph(cliapp.Application): return result + def cmd_set_system_artifact_depends(self, args): + '''Change the artifacts used by a System. + + Usage: MORPHOLOGY_FILE STRATUM_NAME ARTIFACTS + + ARTIFACTS is an English language string describing which artifacts + to include, since the primary use of this command is to assist + yarn tests. + + Example: edit-morph set-system-artifact-depends system.morph \ + build-essential "build-essential-minimal, + build-essential-runtime and build-essential-devel" + + ''' + + 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) + EditMorph().run() -- cgit v1.2.1