diff options
-rw-r--r-- | README | 19 | ||||
-rw-r--r-- | morph.1.in | 40 | ||||
-rw-r--r-- | morphlib/bins.py | 13 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 24 | ||||
-rw-r--r-- | tests.branching/branch-creates-new-system-branch-not-from-master.stdout | 2 | ||||
-rw-r--r-- | tests.branching/branch-creates-new-system-branch.stdout | 2 | ||||
-rw-r--r-- | tests.branching/branch-works-anywhere.stdout | 20 | ||||
-rw-r--r-- | tests.branching/checkout-existing-branch.stdout | 2 | ||||
-rw-r--r-- | tests.branching/checkout-non-aliased-repos.stdout | 4 | ||||
-rw-r--r-- | tests.branching/checkout-works-anywhere.stdout | 6 | ||||
-rw-r--r-- | tests.branching/edit-works-after-branch-root-was-renamed.stdout | 2 |
11 files changed, 89 insertions, 45 deletions
@@ -161,17 +161,19 @@ Example stratum: "chunks": [ { "name": "fhs-dirs", + "repo": "upstream:fhs-dirs", "ref": "baserock/bootstrap", "build-depends": [], }, { "name": "linux-api-headers", - "repo": "linux", + "repo": "upstream:linux", "ref": "baserock/morph", "build-depends": ["fhs-dirs"] }, { "name": "eglibc", + "repo": "upstream:eglibc", "ref": "baserock/bootstrap", "build-depends": [ "linux-api-headers" @@ -179,6 +181,7 @@ Example stratum: }, { "name": "busybox", + "repo": "upstream:busybox", "ref": "baserock/bootstrap", "build-depends": [ "fhs-dirs", @@ -195,12 +198,20 @@ Example system: "kind": "system", "disk-size": "1G", "strata": [ - "foundation", - "linux-stratum" + { + "morph": "foundation", + "repo": "baserock:morphs", + "ref": "master" + }, + { + "morph": "linux-stratum", + "repo": "baserock:morphs", + "ref": "master" + } ] } -Note that unknown keys in morphologies are silently ignored. +Note that currently, unknown keys in morphologies are silently ignored. Build environment @@ -23,7 +23,37 @@ Baserock is an embedded Linux system. is its workflow tool. It manages building binaries, and branching and merging of the entire system. -See the Baserock home page for more information. +Morph is designed to turn collections of git repositories into system images +using morphology files to define their dependencies. +.PP +A +.B system +image is defined as a group of +.B strata +describing subsystems, +each of which comprises a series of +.BR chunks , +each of which in turn corresponds +to an individual upstream project. For example, there might be a 'generic +developer system' system morphology, containing a stratum for the basic +bootable system and another for developer tools; the latter would then have +individual chunks for make, gcc, binutils and so forth. +.PP +A chunk is a git repository based on an individual upstream project's revision +control system, converted into git if upstream does not already use it. +The build is controlled a +.B something.morph +configuration file +defining how to build the chunk and any other changes required to get the +repository to build with the rest of Baserock. +.PP +Morph is also capable of branching the whole system (that is branching +all constituent git repositories of a system simultaneously) in order +to allow system-wide changes that cross the boundaries of individual +git repositories, and of generating commits to the group of git +repositories that have been modified in such a branch. +.PP +For more details, please see the Baserock wiki at http://wiki.baserock.org. .SH OPTIONS .SH ENVIRONMENT .B morph @@ -87,7 +117,7 @@ sets the environment variable to .TP .B MORPH_PLUGIN_PATH .B morph -looks for plugins additionally in the directories given in this variable. +looks for additional plugins in the directories given in this variable. Syntax is same as for .B PATH (i.e., colon delimited pathnames). @@ -97,10 +127,10 @@ The manual page has some more variables that affect .B morph itself. -.SH BUGS -This manual page is badly incomplete, -but at least it should include all options correctly. .SH "SEE ALSO" .BR cliapp (5). .PP http://wiki.baserock.org/ +.br +http://www.baserock.com/ + diff --git a/morphlib/bins.py b/morphlib/bins.py index ec750db1..00b0c2fc 100644 --- a/morphlib/bins.py +++ b/morphlib/bins.py @@ -116,8 +116,6 @@ def unpack_binary_from_file(f, dirname): # pragma: no cover ''' - tf = tarfile.open(fileobj=f) - # This is evil, but necessary. For some reason Python's system # call wrappers (os.mknod and such) do not (always?) set the # filename attribute of the OSError exception they raise. We @@ -177,16 +175,17 @@ def unpack_binary_from_file(f, dirname): # pragma: no cover def make_something(tarinfo, targetpath): # pragma: no cover prepare_extract(tarinfo, targetpath) try: - return real(tarinfo, targetpath) - except OSError, e: + ret = real(tarinfo, targetpath) + except (IOError, OSError), e: if e.errno != errno.EEXIST: if e.filename is None: e.filename = targetpath - raise e - else: - raise + raise + else: + return ret return make_something + tf = tarfile.open(fileobj=f, errorlevel=2) tf.makedir = monkey_patcher(tf.makedir) tf.makefile = monkey_patcher(tf.makefile) tf.makeunknown = monkey_patcher(tf.makeunknown) diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 2878fbd0..80b38b2a 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -106,12 +106,16 @@ class BranchAndMergePlugin(cliapp.Plugin): with open(filename, 'w') as f: f.write('%s\n' % repo) - @staticmethod - def read_branch_root(branch_dir): - filename = os.path.join(branch_dir, '.morph-system-branch', - 'branch-root') - with open(filename, 'r') as f: - return f.read().strip() + def set_branch_config(self, branch_dir, option, value): + filename = os.path.join(branch_dir, '.morph-system-branch', 'config') + self.app.runcmd(['git', 'config', '-f', filename, + 'branch.%s' % option, '%s' % value]) + + def get_branch_config(self, branch_dir, option): + filename = os.path.join(branch_dir, '.morph-system-branch', 'config') + value = self.app.runcmd(['git', 'config', '-f', filename, + 'branch.%s' % option]) + return value.strip() @staticmethod def clone_to_directory(app, dirname, reponame, ref): @@ -285,7 +289,7 @@ class BranchAndMergePlugin(cliapp.Plugin): os.mkdir(os.path.join(branch_dir, '.morph-system-branch')) # Remember the repository we branched off from. - self.write_branch_root(branch_dir, repo) + self.set_branch_config(branch_dir, 'branch-root', repo) # Clone into system branch directory. repo_dir = os.path.join(branch_dir, self.convert_uri_to_path(repo)) @@ -356,7 +360,7 @@ class BranchAndMergePlugin(cliapp.Plugin): os.mkdir(os.path.join(branch_dir, '.morph-system-branch')) # Remember the repository we branched off from. - self.write_branch_root(branch_dir, repo) + self.set_branch_config(branch_dir, 'branch-root', repo) # Clone into system branch directory. repo_dir = os.path.join(branch_dir, self.convert_uri_to_path(repo)) @@ -373,7 +377,7 @@ class BranchAndMergePlugin(cliapp.Plugin): workspace = self.deduce_workspace() system_branch = self.deduce_system_branch() branch_dir = os.path.join(workspace, system_branch) - branch_root = self.read_branch_root(branch_dir) + branch_root = self.get_branch_config(branch_dir, 'branch-root') self.app.output.write('%s\n' % branch_root) def merge(self, args): @@ -408,7 +412,7 @@ class BranchAndMergePlugin(cliapp.Plugin): # Find out which repository we branched off from. branch_dir = os.path.join(workspace, system_branch) - branch_root = self.read_branch_root(branch_dir) + branch_root = self.get_branch_config(branch_dir, 'branch-root') branch_root_dir = self.find_repository(branch_dir, branch_root) # Find out which repository to edit. diff --git a/tests.branching/branch-creates-new-system-branch-not-from-master.stdout b/tests.branching/branch-creates-new-system-branch-not-from-master.stdout index d68a6342..443f325b 100644 --- a/tests.branching/branch-creates-new-system-branch-not-from-master.stdout +++ b/tests.branching/branch-creates-new-system-branch-not-from-master.stdout @@ -9,7 +9,7 @@ d ./newbranch d ./newbranch/.morph-system-branch d ./newbranch/baserock:morphs d ./newbranch/baserock:morphs/.git -f ./newbranch/.morph-system-branch/branch-root +f ./newbranch/.morph-system-branch/config f ./newbranch/baserock:morphs/hello-stratum.morph f ./newbranch/baserock:morphs/hello-system.morph f ./newbranch/baserock:morphs/this.is.alfred diff --git a/tests.branching/branch-creates-new-system-branch.stdout b/tests.branching/branch-creates-new-system-branch.stdout index 3f2dba1d..e79e8588 100644 --- a/tests.branching/branch-creates-new-system-branch.stdout +++ b/tests.branching/branch-creates-new-system-branch.stdout @@ -9,7 +9,7 @@ d ./newbranch d ./newbranch/.morph-system-branch d ./newbranch/baserock:morphs d ./newbranch/baserock:morphs/.git -f ./newbranch/.morph-system-branch/branch-root +f ./newbranch/.morph-system-branch/config f ./newbranch/baserock:morphs/hello-stratum.morph f ./newbranch/baserock:morphs/hello-system.morph Current branches: diff --git a/tests.branching/branch-works-anywhere.stdout b/tests.branching/branch-works-anywhere.stdout index cddc2d76..ec22698f 100644 --- a/tests.branching/branch-works-anywhere.stdout +++ b/tests.branching/branch-works-anywhere.stdout @@ -9,7 +9,7 @@ d ./branch1 d ./branch1/.morph-system-branch d ./branch1/baserock:morphs d ./branch1/baserock:morphs/.git -f ./branch1/.morph-system-branch/branch-root +f ./branch1/.morph-system-branch/config f ./branch1/baserock:morphs/hello-stratum.morph f ./branch1/baserock:morphs/hello-system.morph Workspace after creating the second branch: @@ -27,10 +27,10 @@ d ./branch2 d ./branch2/.morph-system-branch d ./branch2/baserock:morphs d ./branch2/baserock:morphs/.git -f ./branch1/.morph-system-branch/branch-root +f ./branch1/.morph-system-branch/config f ./branch1/baserock:morphs/hello-stratum.morph f ./branch1/baserock:morphs/hello-system.morph -f ./branch2/.morph-system-branch/branch-root +f ./branch2/.morph-system-branch/config f ./branch2/baserock:morphs/hello-stratum.morph f ./branch2/baserock:morphs/hello-system.morph Workspace after creating the third branch: @@ -52,13 +52,13 @@ d ./branch3 d ./branch3/.morph-system-branch d ./branch3/baserock:morphs d ./branch3/baserock:morphs/.git -f ./branch1/.morph-system-branch/branch-root +f ./branch1/.morph-system-branch/config f ./branch1/baserock:morphs/hello-stratum.morph f ./branch1/baserock:morphs/hello-system.morph -f ./branch2/.morph-system-branch/branch-root +f ./branch2/.morph-system-branch/config f ./branch2/baserock:morphs/hello-stratum.morph f ./branch2/baserock:morphs/hello-system.morph -f ./branch3/.morph-system-branch/branch-root +f ./branch3/.morph-system-branch/config f ./branch3/baserock:morphs/hello-stratum.morph f ./branch3/baserock:morphs/hello-system.morph Workspace after creating the fourth branch: @@ -84,15 +84,15 @@ d ./branch4 d ./branch4/.morph-system-branch d ./branch4/baserock:morphs d ./branch4/baserock:morphs/.git -f ./branch1/.morph-system-branch/branch-root +f ./branch1/.morph-system-branch/config f ./branch1/baserock:morphs/hello-stratum.morph f ./branch1/baserock:morphs/hello-system.morph -f ./branch2/.morph-system-branch/branch-root +f ./branch2/.morph-system-branch/config f ./branch2/baserock:morphs/hello-stratum.morph f ./branch2/baserock:morphs/hello-system.morph -f ./branch3/.morph-system-branch/branch-root +f ./branch3/.morph-system-branch/config f ./branch3/baserock:morphs/hello-stratum.morph f ./branch3/baserock:morphs/hello-system.morph -f ./branch4/.morph-system-branch/branch-root +f ./branch4/.morph-system-branch/config f ./branch4/baserock:morphs/hello-stratum.morph f ./branch4/baserock:morphs/hello-system.morph diff --git a/tests.branching/checkout-existing-branch.stdout b/tests.branching/checkout-existing-branch.stdout index 1af2900c..4a8a614b 100644 --- a/tests.branching/checkout-existing-branch.stdout +++ b/tests.branching/checkout-existing-branch.stdout @@ -9,7 +9,7 @@ d ./master d ./master/.morph-system-branch d ./master/baserock:morphs d ./master/baserock:morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/baserock:morphs/hello-stratum.morph f ./master/baserock:morphs/hello-system.morph Current branches: diff --git a/tests.branching/checkout-non-aliased-repos.stdout b/tests.branching/checkout-non-aliased-repos.stdout index 872d74aa..dbaa3e5c 100644 --- a/tests.branching/checkout-non-aliased-repos.stdout +++ b/tests.branching/checkout-non-aliased-repos.stdout @@ -12,7 +12,7 @@ d ./master/TEMP_DIR d ./master/DATADIR d ./master/DATADIR/morphs d ./master/DATADIR/morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/DATADIR/morphs/hello-stratum.morph f ./master/DATADIR/morphs/hello-system.morph Current branches of repo with suffix: @@ -31,7 +31,7 @@ d ./master/TEMP_DIR d ./master/DATADIR d ./master/DATADIR/morphs d ./master/DATADIR/morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/DATADIR/morphs/hello-stratum.morph f ./master/DATADIR/morphs/hello-system.morph Current branches of repo without suffix: diff --git a/tests.branching/checkout-works-anywhere.stdout b/tests.branching/checkout-works-anywhere.stdout index 0cd18b85..bb4cc1fa 100644 --- a/tests.branching/checkout-works-anywhere.stdout +++ b/tests.branching/checkout-works-anywhere.stdout @@ -9,7 +9,7 @@ d ./master d ./master/.morph-system-branch d ./master/baserock:morphs d ./master/baserock:morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/baserock:morphs/hello-stratum.morph f ./master/baserock:morphs/hello-system.morph Workspace after checking out master from within a new branch: @@ -27,9 +27,9 @@ d ./newbranch d ./newbranch/.morph-system-branch d ./newbranch/baserock:morphs d ./newbranch/baserock:morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/baserock:morphs/hello-stratum.morph f ./master/baserock:morphs/hello-system.morph -f ./newbranch/.morph-system-branch/branch-root +f ./newbranch/.morph-system-branch/config f ./newbranch/baserock:morphs/hello-stratum.morph f ./newbranch/baserock:morphs/hello-system.morph diff --git a/tests.branching/edit-works-after-branch-root-was-renamed.stdout b/tests.branching/edit-works-after-branch-root-was-renamed.stdout index 5554e08b..5cfe475f 100644 --- a/tests.branching/edit-works-after-branch-root-was-renamed.stdout +++ b/tests.branching/edit-works-after-branch-root-was-renamed.stdout @@ -12,7 +12,7 @@ d ./master/baserock:hello d ./master/baserock:hello/.git d ./master/my-renamed-morphs d ./master/my-renamed-morphs/.git -f ./master/.morph-system-branch/branch-root +f ./master/.morph-system-branch/config f ./master/baserock:hello/hello.morph f ./master/my-renamed-morphs/hello-stratum.morph f ./master/my-renamed-morphs/hello-system.morph |