<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5625827309301120857</id><updated>2012-01-24T15:24:36.489Z</updated><category term='IR widget; USB'/><category term='kbus'/><title type='text'>kynesim</title><subtitle type='html'>A corporate blog for Kynesim Ltd - a technology development company in Cambridge UK specialising in IPTV/OTT and embedded systems development.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>52</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4555328843302757819</id><published>2012-01-24T15:21:00.002Z</published><updated>2012-01-24T15:24:36.498Z</updated><title type='text'>...and muddle continues to evolve</title><content type='html'>muddle v2.3.1 fixes a couple of bugs, and beyond that, head-of-tree adds "&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle --version&lt;/span&gt;", which uses git to report a sensible version string, and also the directory that muddle is being run from. For instance:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;$ muddle --version&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle v2.3.1-3-g34519ca in /home/tibs/sw/muddle&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;(That's the last tag (v2.3.1), the number of commits since then (3) and the start of the SHA1 string for this commit (34519ca))&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4555328843302757819?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4555328843302757819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2012/01/and-muddle-continues-to-evolve.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4555328843302757819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4555328843302757819'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2012/01/and-muddle-continues-to-evolve.html' title='...and muddle continues to evolve'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-5469010791495125885</id><published>2012-01-19T13:57:00.003Z</published><updated>2012-01-19T13:57:47.930Z</updated><title type='text'>KBUS on Google Code now using Git</title><content type='html'>The KBUS repositories on&amp;nbsp;&lt;a href="http://code.google.com/p/kbus/"&gt;http://code.google.com/p/kbus/&lt;/a&gt; have now been moved from Mercurial to Git.&lt;br /&gt;
&lt;br /&gt;
The "default" (userspace) and&lt;b&gt; kernel&lt;/b&gt; repositories are now recombined. The changes from the kernel submission work on github have also been folded in.&lt;br /&gt;
&lt;br /&gt;
See&amp;nbsp;&lt;a href="http://code.google.com/p/kbus/wiki/DevelopmentHistory"&gt;http://code.google.com/p/kbus/wiki/DevelopmentHistory&lt;/a&gt; for more information.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-5469010791495125885?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/5469010791495125885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2012/01/kbus-on-google-code-now-using-git.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5469010791495125885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5469010791495125885'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2012/01/kbus-on-google-code-now-using-git.html' title='KBUS on Google Code now using Git'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-300997354979293666</id><published>2012-01-12T21:52:00.003Z</published><updated>2012-01-12T22:01:46.037Z</updated><title type='text'>Version 2.3 of muddle is released</title><content type='html'>I took a branch of muddle out in September 2011 to write tests for domain support, which had "bit rotted" through disuse. As it turned out, my need for domain support went away again, and instead I started to use the branch for rewriting the help texts for each command. Of course, in order to do that, I had to understand exactly what each command did, which led to rewriting the main command structure so that this was &lt;i&gt;consistent&lt;/i&gt;, and hopefully also &lt;i&gt;predictable&lt;/i&gt;, and thus easier to document. So it all took rather longer than planned.&lt;br /&gt;
Meanwhile, another project recently necessitated adding support for git repositories on Google Code, which in turn required rewriting the internal repository and checkout support. So that also got folded in.&lt;br /&gt;
This version of muddle is now stable enough to merge back into the mainline. I've been using it for real development work throughout its development, and there are more tests than there used to be (although still not enough subdomain tests!). However, clearly, if you come across a bug or infelicity that I've introduced, do let me know (preferably by raising an issue at &lt;a class="reference external" href="http://code.google.com/p/muddle/issues/list"&gt;http://code.google.com/p/muddle/issues/list&lt;/a&gt;, but otherwise by email to &lt;a class="reference external" href="mailto:tibs@kynesim.co.uk"&gt;tibs@kynesim.co.uk&lt;/a&gt;).&lt;br /&gt;
Since there's a large amount of sudden change, much of it to significant internal structure, I'm giving this new version of muddle a version tag, and calling it version 2.3 (SVN revision 638 (back when muddle was stored in subversion) had tag 2_2).&lt;br /&gt;
&lt;blockquote&gt;(The tag "end_of_v2.2" marks the end of version 2.2, and there is also a branch "v2.2-legacy" from the same location, which can be conveniently used to checkout the end of the 2.2 sequence, and also provides a place for any maintenance changes if such prove necessary.)&lt;/blockquote&gt;The main changes are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;div class="first"&gt;Much of the the internals of the command line processing has been rewritten, and this should give more robust command handling. It also means that commands of a common "category" (see 'muddle help categories') share much more common code, and thus have better consistency.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Much of the help text has been reworked, and there are new topics:&lt;/div&gt;&lt;ul class="simple"&gt;&lt;li&gt;'muddle help categories'&lt;/li&gt;
&lt;li&gt;'muddle help labels'&lt;/li&gt;
&lt;li&gt;'muddle help subdomains'&lt;/li&gt;
&lt;/ul&gt;Also, help text is now paged (much as is done by git), using the pager specified by $PAGER, or else 'more'. There is a command line switch, '--nopager', to rever to the old behaviour.&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;An attempt has been made to make the "bare" muddle command (i.e., 'muddle' with no arguments) follow the DWIM (Do What I Mean) principles described in the documentation. See 'muddle help labels' for more information on how this works.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Similarly, muddle checkout/package/dependency commands with no label arguments (e.g., 'muddle build') now try to decide consistently what to do. Again, see 'muddle help labels'.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;All checkout/package/dependency commands now know how to cope with any type of label. See 'muddle help labels' for details.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Most commands that take labels as arguments can now take partial labels (label fragments) instead, which is a lot simpler for a human being. This includes the 'visdep' script in the sandbox. See 'muddle help labels' for more information.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;'muddle -n' now works for all commands that do something (it used to be very unpredictable about this). It is now a reliable tool, and may be used as such. Also, note that it reports a single label per line, which makes it much easier to read.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;As well as the special '_all' argument, there are now also '_default_deployments' and '_default_roles', which expand to all the default deployment labels and all the package labels in the default roles, respectively. Thus the top-level "bare" 'muddle' command is identical to 'muddle buildlabel _default_deployments _default_roles'.&lt;/div&gt;However, note that '_all' is now treated as a special value for use on the commandline, and not as a "pseudo-wildcard" label name. Thus it is no longer meaningful to ask for &lt;tt class="docutils literal"&gt;package:_all{x86}&lt;/tt&gt; when one meant &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:*{x86}&lt;/span&gt;&lt;/tt&gt; (the former will report that there is no package called &lt;tt class="docutils literal"&gt;_all{x86}&lt;/tt&gt;).&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;What 'muddle where' says has changed in detail, and there is now 'muddle where -detail' for use in scripts.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;When building things, or "killing" things, muddle is significantly less verbose - it doesn't normally report ALL the labels it will affect.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;More and hopefully more useful error messages have been introduced. In particular, I've tried to catch occasions where muddle unexpectedly does nothing, and suggest why this might be (liking trying to do 'muddle build' in a checkout directory when the only role for the corresponding package is not one of the default roles - this one has taken me too long to work out in the past). Some of these error reports are more verbose, or not as easy to understand, as they should be, but this is hoped to be an important improvement.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;When a syntax or other error is found in a build description, it is no longer buried in a traceback concerned with how the build description was being imported.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;muddle commands now try harder to catch cases where the user has specified a role for a checkout or deployment label, and grumble.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Various command aliases have been removed:&lt;/div&gt;&lt;ul class="simple"&gt;&lt;li&gt;'muddle query deps' - use 'needed-by'&lt;/li&gt;
&lt;li&gt;'muddle query instructions' - use 'inst-files'&lt;/li&gt;
&lt;li&gt;'muddle query makeenv' - use 'make-env'&lt;/li&gt;
&lt;li&gt;'muddle query preciseenv' - use 'precise-env'&lt;/li&gt;
&lt;li&gt;'muddle query results' - use 'needs'&lt;/li&gt;
&lt;/ul&gt;Note that 'muddle query envs' is still an alias for 'muddle query all-envs', and this is still different than 'muddle query env'.&lt;br /&gt;
Also, as it turned out, 'muddle uncheckout' and 'muddle removed' did exactly the same thing. 'muddle removed' has thus been removed.&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Some commands have been changed:&lt;/div&gt;&lt;ul class="simple"&gt;&lt;li&gt;'muddle dependencies' is replaced by 'muddle query dependencies'&lt;/li&gt;
&lt;li&gt;'muddle depends' is replaced by 'muddle query depends' (this is actually the same as the previous item)&lt;/li&gt;
&lt;li&gt;'muddle vcs' is replaced by 'muddle query vcs'&lt;/li&gt;
&lt;li&gt;'muddle root' has gone. Instead use 'muddle query root', which already existed. 'muddle query root' now just reports the root (of the build tree), and not the "default domain", since this concept has essentially gone away.&lt;/li&gt;
&lt;li&gt;'muddle query default-labels' is now the more accurate 'muddle query default-deployments'&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;'muddle query package-roles' will also include domains in the reported names, if appropriate.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;'muddle pull' is once again preferred over 'muddle fetch' or 'muddle update', but the other variants are still there.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;The 'utils.Directory' classes now set $PWD (as top-level muddle itself does, and for the same reason). They also now have a useful 'join' method (see the classes for its use). A version of these classes has been pulled out to a separate repository on github - see &lt;a class="reference external" href="https://github.com/tibs/withdir"&gt;https://github.com/tibs/withdir&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;There is now more testing! (particularly of the 'muddle -n' commands, and of subdomain handling - necessary because the latter had "bit rotted").&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Various obscure bugs have been found and fixed by the new tests. Some of them were really &lt;i&gt;quite&lt;/i&gt; obscure.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Various things that were to be deprecated have now been removed. Hopefully no-one will notice.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;'NullPackage' and 'null_package()' have been added to muddled/pkg.py. Their docstrings explain why they might be useful.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;'Rule' classes now have an 'action' member, instead of an 'obj' member. I believe this to be much clearer, but it is an unannounced incompatible change.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Repository handling has been rewritten, separating out the concerns of naming a (remote) repository and naming (the location of) a checkout.&lt;/div&gt;In particular, and importantly, it now understands how to use git repositories at google code, where the repository name is appended to the "main" URL with a dot, rather than a "/".&lt;br /&gt;
The old commands for setting things up (checkouts.twolevel and so on) are still there, but one can now do:&lt;br /&gt;
&lt;pre class="literal-block"&gt;from muddled.repository import Repository
from muddled.version_control import checkout_from_repo

repo = Repository('git', 'https://example.com', 'useful-stuff',
                  branch='very-useful')
checkout_from_repo(builder, 'useful-stuff', repo)
&lt;/pre&gt;althogh there's actually more to it than that - in particular, one can specify a different &amp;lt;co_dir&amp;gt; and &amp;lt;co_leaf&amp;gt; to checkout_from_repo, giving one full control over where the repository is actually checked out:&lt;br /&gt;
&lt;pre class="literal-block"&gt;checkout_from_repo(builder, 'useful-stuff', repo, co_dir='jim',
                   co_leaf='fred')
&lt;/pre&gt;checks the repository out into 'src/jim/fred', but still using the label 'checkout:useful-stuff/checked_out'. I'd claim this is significantly easier to understand than the twoleve/multilevel functions.&lt;br /&gt;
See the documentation for Repository via "muddle doc repository.Repository", or in its source file.&lt;br /&gt;
There is now thus a new command "muddle query checkout-repos" to report on the repositories. See its help for details.&lt;br /&gt;
This new mechanism is believed to understand muddle stamp files generated by previous versions of muddle, and to be able to produce muddle stamp files that previous versions of muddle should understand.&lt;/li&gt;
&lt;li&gt;&lt;div class="first"&gt;Internal changes that may be of interest:&lt;/div&gt;&lt;ul class="simple"&gt;&lt;li&gt;'builder.invocation.default_labels' is now 'builder.invocation.default_deployment_labels'.&lt;/li&gt;
&lt;li&gt;Similarly, the method 'add_default_label()' becomes 'add_default_deployment_label()'. It also now checks that the label &lt;i&gt;is&lt;/i&gt; a deployment label.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;Also, of course, many minor code tidies have been made.&lt;br /&gt;
&lt;div class="section" id="particular-issues-fixed"&gt;&lt;h1&gt;Particular issues fixed&lt;/h1&gt;&lt;ul class="simple"&gt;&lt;li&gt;Fixes issue 4. Bugs in description files are not handled elegantly&lt;/li&gt;
&lt;li&gt;Fixes issue 67. Checkout and package inference should know about domains&lt;/li&gt;
&lt;li&gt;Fixes issue 104. No feedback on undefined label name&lt;/li&gt;
&lt;li&gt;Fixes issue 112. Python 2.7 (I'm now using that for testing as well)&lt;/li&gt;
&lt;li&gt;Fixes issue 126. Provide coherent branch support in the VCS plugins&lt;/li&gt;
&lt;li&gt;Fixes issue 166. test_checkouts.py broken by fix for issue 161&lt;/li&gt;
&lt;li&gt;Fixes issue 175. Repository name should be independent of local checkout name&lt;/li&gt;
&lt;li&gt;Fixes issue 177. 'muddle checkout package:xxx' should checkout what is needed for package xxx&lt;/li&gt;
&lt;li&gt;Fixes issue 179. revisit the implementation of the simple/twolevel/multilevel checkout code&lt;/li&gt;
&lt;li&gt;Fixes issue 184. All the muddle commands that take labels should support domains&lt;/li&gt;
&lt;li&gt;Fixes issue 185. Muddle unstamp should check its build against domain/checkout name, not just checkouts name&lt;/li&gt;
&lt;li&gt;Fixes issue 186. Deprecate use of 'all_packages', use 'all_package_labels' instead&lt;/li&gt;
&lt;li&gt;Fixes issue 189. Make sure all commands do something vaguely sensible for '-n'&lt;/li&gt;
&lt;li&gt;Fixes issue 194. 'muddle pull' of a toplevel checkout in a subdomain attempts to clone&lt;/li&gt;
&lt;li&gt;Fixes issue 195. If there's nothing to do, say so&lt;/li&gt;
&lt;li&gt;Fixes issue 198. Muddle should actually honour the DWIM section from the README&lt;/li&gt;
&lt;li&gt;Fixes issue 199. Helpful error behaviour of fetch/pull unexpected (well, ok, this is in master as well)&lt;/li&gt;
&lt;li&gt;Fixes issue 200. Find all targets for deployments&lt;/li&gt;
&lt;li&gt;Fixes issue 207. Muddle assumes too much about how RootRepository and Description are joined&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;ul class="simple"&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="section" id="updating-to-the-new-version"&gt;&lt;h1&gt;Updating to the new version&lt;/h1&gt;...is simple, just &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;"&gt;cd&lt;/span&gt; into your muddle source directory and &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;"&gt;git pull&lt;/span&gt; in the normal manner.&lt;br /&gt;
&lt;br /&gt;
If you find some serious bug and need to go back to version 2.2, then &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;"&gt;cd&lt;/span&gt; into the muddle source directory and do &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;"&gt;git checkout v2.2-legacy&lt;/span&gt;&lt;span style="font-family: inherit;"&gt; (and, obviously, report the problem).&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-300997354979293666?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/300997354979293666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2012/01/version-23-of-muddle-is-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/300997354979293666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/300997354979293666'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2012/01/version-23-of-muddle-is-released.html' title='Version 2.3 of muddle is released'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-2559443006566767678</id><published>2011-09-26T16:59:00.001+01:00</published><updated>2011-10-31T17:20:01.546Z</updated><title type='text'>How to discuss our open source projects?</title><content type='html'>So we now have a collection of Kynesim open source projects:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;muddle&lt;/li&gt;
&lt;li&gt;KBUS&lt;/li&gt;
&lt;li&gt;cdatecalc&lt;/li&gt;
&lt;li&gt;tstools&lt;/li&gt;
&lt;li&gt;grump&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;and another one to be added soon. What we don't have is any way of making announcements about them (other than this blog - not really ideal) or holding discussion on them (issue tracking I reckon is OK, as I quite like the Google Code issue mechanisms).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Mailing lists are a pain, and none of them make using their archives particularly nice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Google groups are a possibility, although they're not perfect either.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Google+ won't work because I won't use it (so that discussion is moot).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Any good ideas?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-2559443006566767678?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/2559443006566767678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/09/how-to-discuss-our-open-source-projects.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2559443006566767678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2559443006566767678'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/09/how-to-discuss-our-open-source-projects.html' title='How to discuss our open source projects?'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7813739662603290845</id><published>2011-09-26T16:16:00.000+01:00</published><updated>2011-09-26T16:16:59.516+01:00</updated><title type='text'>Still improooving muddle - some commands slightly changed.</title><content type='html'>I'm still trying to fix various problems in how muddle handles subdomains, and also to add some more testing. However, I've just pushed a somewhat incompatible change to the way that some of the command line tools work.&lt;br /&gt;
&lt;br /&gt;
In the past, if you did something like &lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle fetch&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; at th&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;e&lt;/span&gt;&amp;nbsp;top level of the build tree, it didn't actually do anything, and you had to do &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle fetch _all&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;. This was, in fact, a bug, and those commands which take checkout arguments will now, in general, always default to the checkouts "below" them, including at the top level (where all checkouts are "below").&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Of course, it's also an incompatible change. On the other hand, I don't know how many other people still had the habit of typing &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle fetch&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;(etc.) with the vague feeling that they should be doing something that they weren't...&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;As normal, please raise any issues on the Google Code issues page (and I get an email at home when you do so).&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7813739662603290845?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7813739662603290845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/09/still-improooving-muddle-some-commands.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7813739662603290845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7813739662603290845'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/09/still-improooving-muddle-some-commands.html' title='Still improooving muddle - some commands slightly changed.'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3935988041190519512</id><published>2011-09-09T11:22:00.000+01:00</published><updated>2011-09-09T11:22:48.511+01:00</updated><title type='text'>Finally, muddle has a (VCS) status command</title><content type='html'>It's been a long wait, but Richard and I both really needed it...&lt;br /&gt;
&lt;br /&gt;
You can now say &lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle status&lt;/span&gt; and get a report on the subversion/bazaar/git status of checkouts (i.e., the version control systems we currently support). It tries not to say anything for checkouts with no interesting status. See &lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle help status&lt;/span&gt; for details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3935988041190519512?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3935988041190519512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/09/finally-muddle-has-vcs-status-command.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3935988041190519512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3935988041190519512'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/09/finally-muddle-has-vcs-status-command.html' title='Finally, muddle has a (VCS) status command'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3772814090260150274</id><published>2011-08-30T21:03:00.000+01:00</published><updated>2011-08-30T21:03:53.556+01:00</updated><title type='text'>KBUS and muddle documentation now on ReadTheDocs</title><content type='html'>The HTML documentation for both KBUS and muddle is now being hosted on&amp;nbsp;&lt;a href="http://readthedocs.org/"&gt;Read the Docs&lt;/a&gt;, who are providing a wonderful service to those of us using Sphinx for our documentation.&lt;br /&gt;
&lt;br /&gt;
See&amp;nbsp;&lt;a href="http://kbus.readthedocs.org/"&gt;http://kbus.readthedocs.org/&lt;/a&gt; and&amp;nbsp;&lt;a href="http://muddle.readthedocs.org/"&gt;http://muddle.readthedocs.org/&lt;/a&gt; respectively.&lt;br /&gt;
&lt;br /&gt;
The documentation should be rebuilt &amp;nbsp;each time a push is made to the appropriate repository. Including, of course, a change to the documentation. So I've no excuse, then...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3772814090260150274?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3772814090260150274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/08/kbus-and-muddle-documentation-now-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3772814090260150274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3772814090260150274'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/08/kbus-and-muddle-documentation-now-on.html' title='KBUS and muddle documentation now on ReadTheDocs'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4984336385985205907</id><published>2011-08-29T18:21:00.000+01:00</published><updated>2011-08-29T18:21:30.229+01:00</updated><title type='text'>muddle is now stored in git</title><content type='html'>As of just now, the muddle Google Code repository has been converted to git.&lt;br /&gt;
&lt;br /&gt;
If you're still accessing muddle via subversion, then you are using a "frozen" version, which will not be developed further. The last subversion revision is revision 638. Also note that due to difficulties in converting our subversion repository to git (strange stuff, honestly), only trunk has been converted, and at that only since revision 78 (around when something strange seems to have happened, probably to do with trying to merge stuff in subversion).&lt;br /&gt;
&lt;br /&gt;
Cloning muddle is done as one might expect:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif;"&gt;git clone https://code.google.com/p/muddle/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Why do this? Well, it makes it easier to development locally (distributed version control systems, yeah), and &lt;em&gt;much&lt;/em&gt; easier to branch (last time I tried that in subversion was a nightmare).&lt;br /&gt;
&lt;br /&gt;
Any problems, please contact me and ask.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4984336385985205907?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4984336385985205907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/08/muddle-is-now-stored-in-git.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4984336385985205907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4984336385985205907'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/08/muddle-is-now-stored-in-git.html' title='muddle is now stored in git'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4067275199605762154</id><published>2011-06-17T15:42:00.003+01:00</published><updated>2011-06-17T16:17:26.766+01:00</updated><title type='text'>Muddle dependency visualisation</title><content type='html'>For about as long as I've been working with muddle, I've felt that it was lacking the ability to get a big-picture view of how a build tree fits together. This led to &lt;a href="http://code.google.com/p/muddle/issues/detail?id=48"&gt;issue 48&lt;/a&gt;. It's not that I have anything against build descriptions being declarative-type programming; just that I sometimes find them hard to follow from scratch and prefer to get an overview.

&lt;p&gt;Over time I hatched a plan to actually do something about this. Well, muddle knows everything it is possible to know about the dependencies; couldn't I put that knowledge to use?

&lt;p&gt;Betraying myself as more of a perl hacker, I initially wrote a perl script which invoked &lt;tt&gt;muddle depend user-short&lt;/tt&gt;, scraped the output and output in &lt;em&gt;dot&lt;/em&gt; format. It was grotty and inelegant in a number of ways, but it served as a valid - if slow - proof of concept. Later, I rewrote it properly in python, directly examining the build description. So I had given myself the ability to create &lt;em&gt;dot&lt;/em&gt; graphs of a build tree, but it still wasn't all that useful: every label was a separate node, and there were far too many of them, making the output cluttered and hard to understand.

&lt;p&gt;The key insight in reducing the output was that while a muddle &lt;em&gt;package&lt;/em&gt; usually gave rise to five labels - preconfig, configured, build, installed, postinstalled - these always appear in strict order. So why not conflate the nodes on the graph? It wasn't quite as simple as unconditionally merging them, as (for example) sometimes one package's &lt;em&gt;built&lt;/em&gt; step depends on another package's &lt;em&gt;configured&lt;/em&gt;, so I had it search for such dependencies and only reduce the graph as far as it could without throwing away information.

&lt;p&gt;The script was duly committed to the sandbox directory, and languished there for a while. Just recently, Tibs has picked it up again. The graphs output by the script now sport colour-coding to differentially highlight checkouts, packages and deployments - and all of a sudden it's much more legible!

&lt;p&gt;Alongside &lt;tt&gt;visualise-dependencies.py&lt;/tt&gt; there is now a &lt;tt&gt;visdep.py&lt;/tt&gt; wrapper which feeds the output into &lt;a href="http://code.google.com/p/jrfonseca/wiki/XDot"&gt;José Fonseca's &lt;tt&gt;xdot&lt;/tt&gt; viewer script&lt;/a&gt;. The wrapper adds the options to choose amongst the various alternative layout filter algorithms (we find &lt;tt&gt;fdp&lt;/tt&gt; often works well), and to pass the graph through &lt;tt&gt;tred&lt;/tt&gt; (transitive reduction of vertices, e.g. if A depends on B, B on C, and A directly on C, you can drop the A-C dependency as it is implicit from the other two).

&lt;p&gt;For example, a build tree I've been working on recently has a &lt;tt&gt;beagle-boot&lt;/tt&gt; deployment, so here is the output from &lt;tt&gt;~/muddle/sandbox/visdep.py deployment:beagle-boot/deployed&lt;/tt&gt; :

&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-XqZ440L61DI/Tftoxmhog2I/AAAAAAAAACA/H6FpUOlMpiU/s1600/beagle-boot.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 103px;" src="http://4.bp.blogspot.com/-XqZ440L61DI/Tftoxmhog2I/AAAAAAAAACA/H6FpUOlMpiU/s320/beagle-boot.png" alt="" id="BLOGGER_PHOTO_ID_5619200161439318882" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;If you want to have a play, you'll find it in the &lt;tt&gt;sandbox&lt;/tt&gt; directory. For the time being you will need to install &lt;tt&gt;xdot.py&lt;/tt&gt; somewhere on your PATH (see the comment at the top of &lt;tt&gt;visdep.py&lt;/tt&gt;). Then invoke &lt;tt&gt;visdep.py&lt;/tt&gt;, telling it the label(s) you are interested in.

&lt;p&gt;The script is not perfect, being a bit hamstrung by how well dot and friends cope (or fail to cope) with complex graphs: particularly in nontrivial build trees, the output is frequently too cluttered or too sparse. Nevertheless, as you can see from the example above, it's capable of doing a very smart job! We dream of creating a more interactive viewer, perhaps one which allows the user to zoom around a three-dimensional rendering of the graph, but that will have to wait for now...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4067275199605762154?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4067275199605762154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/06/muddle-dependency-visualisation.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4067275199605762154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4067275199605762154'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/06/muddle-dependency-visualisation.html' title='Muddle dependency visualisation'/><author><name>Ross</name><uri>http://www.blogger.com/profile/07411033559279865493</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_EGoUTpMFP1M/TLbkbyGfMqI/AAAAAAAAABI/BkuQkndMCbE/S220/userpic.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-XqZ440L61DI/Tftoxmhog2I/AAAAAAAAACA/H6FpUOlMpiU/s72-c/beagle-boot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3634933332837408608</id><published>2011-06-17T15:00:00.004+01:00</published><updated>2011-06-17T15:03:07.622+01:00</updated><title type='text'>Muddle logo</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-pyizHenV4UI/TfteS4Rp0wI/AAAAAAAAAB4/F8GlMEiaavo/s1600/muddle%2Blogo%2Bv1.png"&gt;&lt;img style="float: right; margin: 0pt 0pt 10px 10px; cursor: pointer; width: 264px; height: 268px;" src="http://2.bp.blogspot.com/-pyizHenV4UI/TfteS4Rp0wI/AAAAAAAAAB4/F8GlMEiaavo/s320/muddle%2Blogo%2Bv1.png" alt="" id="BLOGGER_PHOTO_ID_5619188638511911682" border="0" /&gt;&lt;/a&gt;Muddle has a new logo!

&lt;p&gt;It came about when I was scrawling notes during a discussion. I found myself instinctively writing an M in a circle as a shorthand for muddle. I showed it around and it was well received.

&lt;p&gt;So a few minutes work in Inkscape cobbling things together, and hey presto! A logo is born. It's a derivative of the FreeSans font ('@' + 'm') so is covered by the &lt;a href="http://www.gnu.org/software/freefont/license.html"&gt;FreeFont license&lt;/a&gt;, which is GPLv3 with an exception which does not cause documents using it to become bound by the GPL.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3634933332837408608?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3634933332837408608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/06/muddle-logo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3634933332837408608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3634933332837408608'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/06/muddle-logo.html' title='Muddle logo'/><author><name>Ross</name><uri>http://www.blogger.com/profile/07411033559279865493</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_EGoUTpMFP1M/TLbkbyGfMqI/AAAAAAAAABI/BkuQkndMCbE/S220/userpic.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-pyizHenV4UI/TfteS4Rp0wI/AAAAAAAAAB4/F8GlMEiaavo/s72-c/muddle%2Blogo%2Bv1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-1486640949916563536</id><published>2011-01-12T17:35:00.007Z</published><updated>2011-01-12T17:53:41.397Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='kbus'/><title type='text'>KBUS surgery in progress</title><content type='html'>If you've browsed the kbus source on googlecode recently, you may have noticed that it has grown a few more repositories - kernel, cppkbus, jkbus and web. These are in flux at the moment; the eventual goal is to split them and their history out of the 'default' repository. In the meantime, we're going to leave the default repository untouched until we're ready to throw the Big Switch - do not adjust your set!

&lt;p&gt;Mercurial's subrepository support is rather neat. At the moment the plan is to have the kbus 'default' repository check out everything you need to  use it (kernel module, libkbus, tools, jkbus and cppkbus) along with the docs source; the built HTML docs, talks and slides will be hived off to their own repository so you don't have to download them if you don't want to.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-1486640949916563536?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/1486640949916563536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/01/kbus-surgery-in-progress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1486640949916563536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1486640949916563536'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/01/kbus-surgery-in-progress.html' title='KBUS surgery in progress'/><author><name>Ross</name><uri>http://www.blogger.com/profile/07411033559279865493</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_EGoUTpMFP1M/TLbkbyGfMqI/AAAAAAAAABI/BkuQkndMCbE/S220/userpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-8804737785246744463</id><published>2011-01-03T17:39:00.000Z</published><updated>2011-01-03T17:39:38.630Z</updated><title type='text'>KBUS Updates</title><content type='html'>There are now C++ and Java bindings for KBUS. Also, the repository has been moved to Mercurial.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;The C++ API was sketched out by Richard Watts, fleshed out by myself, and then bugfixed and used for an actual project by Richard. It provides a complete interface to the KBUS functionality. However, it does not use exceptions at all (or RTTI) since it is known that some users will need to be able to compile it on embedded systems where such cannot be used. This leads to a slightly different API than might otherwise be expected. Richard also introduced two innovations which may be backported to the other APIs at some point - a specific Device class to represent a KBUS device, which makes a lot of sense when doing non-Ksock specific operations, and the ability to make a message a Reply or Request at "send".&lt;br /&gt;
&lt;br /&gt;
The Java interface was originally implemented by Gareth Bailey (who did the native methods which interface to the KBUS C library). I then expanded it somewhat, and Richard has added the functionality he needed. This is not a complete KBUS API, but provides all the normal functions for day-to-day use.&lt;br /&gt;
&lt;br /&gt;
Both are present in the repository&amp;nbsp;as an initial commit and then a "lump" commit of the results of the development off-line for the project concerned. Apologies for that, but it was easier to just work with the internal repositories during development. The disadvantage, of course, is loss of detailed VCS history.&lt;br /&gt;
&lt;br /&gt;
That commit was then the last commit to KBUS as an SVN repository. The project has now been converted to Mercurial. As normal with Google-hosted projects, the SVN repository will continue to be available "read-only" in its final state. I'm hoping use of Mercurial should aid development in various ways (I'd actually have gone for git if I could).&lt;br /&gt;
&lt;br /&gt;
The next change to the project is likely to be moving the documentation (certainly the generated files and the various PDF and Keynote files) &amp;nbsp;to a separate repository - this should bring down the size of the KBUS source download considerably.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-8804737785246744463?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/8804737785246744463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/01/kbus-updates.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8804737785246744463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8804737785246744463'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/01/kbus-updates.html' title='KBUS Updates'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3882826726019350736</id><published>2011-01-02T01:33:00.005Z</published><updated>2011-01-02T01:39:46.606Z</updated><title type='text'>Gingerbread branch appears to be open..</title><content type='html'>&lt;p&gt;Those of you who watch the android open-source tree will have noticed a couple of interesting additions lately; specifically, the &lt;a href="http://android.git.kernel.org/?p=platform/manifest.git;a=commit;h=42de25a5bdfc418b058676939a0cd5a3524c3acb"&gt;gingerbread manifest branch&lt;/a&gt; and &lt;a href="http://android.git.kernel.org/?p=platform/external/chromium.git;a=summary"&gt;platform/external/chromium.git&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I also notice that someone has been paying attention to the OOM killer and KVM in the android common kernel tree. Sadly, I think KVM is probably a bit heavyweight for this generation of devices, but containers could be a bit of a contender for allowing you to run multiple virtual STBs at the same time - might be a nice way to store your STB (and PVR) in the cloud and have it virtualised onto whatever hardware you happened to be watching at the moment.&lt;/p&gt;

&lt;p&gt;For what it's worth, head seems to be building fine for me and the changes thus far seem quite easy to live with. Certainly much nicer to random undocumented API users like me than Linux was at the corresponding stage in its development ..&lt;/p&gt;

&lt;p&gt;Also, Happy New Year!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3882826726019350736?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3882826726019350736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2011/01/gingerbread-branch-appears-to-be-open.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3882826726019350736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3882826726019350736'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2011/01/gingerbread-branch-appears-to-be-open.html' title='Gingerbread branch appears to be open..'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-2538108821136234994</id><published>2010-12-31T17:21:00.008Z</published><updated>2010-12-31T19:33:11.439Z</updated><title type='text'>Interesting facts about USB, number 2312 in an occasional series.</title><content type='html'>&lt;p&gt;Ah, USB 2.0. How I don't love thee in any way at all.&lt;/p&gt;

&lt;p&gt;I've recently been hacking the USB drivers on an SoC we have here. The initial problem was that a USB mouse connected via a high-speed hub was acting erratically.&lt;/p&gt;

[Update: for what it's worth, it turns out that none of the below actually works. But I do now have some nice clean traces showing a high-speed USB hub apparently blatantly failing to report transaction results back to the host. Hey ho. Work continues.. ]


&lt;a name='more'&gt;&lt;/a&gt;

&lt;p&gt;It turns out that this behaviour is common to all mice and all the high-speed hubs we had about, and to our USB-IR widgets, which would occasionally send key-down without key-up, leading to fun with Android deciding that key-repeat was clearly what you meant and spinning your keypresses repeatedly.&lt;/p&gt;

&lt;p&gt;We asked the manufacturer for support and they reckoned it worked fine at their end with one of &lt;a href="http://www.amazon.co.uk/gp/product/B002YXGTXI/ref=oss_product"&gt;these&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;So: next things to do were to bug a couple of the hubs that seemed to work, get ourselves a hub we knew wasn't broken, pull out the USB analysers and see what we could see.&lt;/p&gt;

&lt;p&gt;Fact #0: A Totalphase Beagle 480 analyser will mysteriously claim 'Host Disconnected' at the slightest provocation. This includes when your hub power supply is 4.97V - nothing else will care, but the Beagle 480 will look as though you've broken it. So that took me two days to work out .. (amusingly, a Beagle 12 seems fine)&lt;/p&gt;
&lt;p&gt;Fact #1: The Slim 4 port USB2.0 hubs that worked are full-speed.&lt;/p&gt;
&lt;p&gt;Fact #2: The problem still exists on a self-built board using SMSC9514 (we wanted ethernet too) - my go-to 'it really does work' high-speed hub chip, as used on the Beagle xM.&lt;/p&gt;
&lt;p&gt;Fact #3: The problem goes away if you connect the hub to a PC rather than our embedded board.&lt;/p&gt;
&lt;p&gt;Fact #4: Our SoC uses the &lt;a href="http://www.synopsys.com/IP/InterfaceIP/USB/Pages/default.aspx"&gt;Designware USB 2.0 OTG host controller IP&lt;/a&gt;. This is an out-of-tree driver from our vendor, though it's been submitted for inclusion in the mainline kernel - &lt;a href="http://kerneltrap.org/mailarchive/linux-usb/2010/6/29/6262451/thread"&gt;here&lt;/a&gt;, but the DENX people have made a &lt;a href=""&gt;few fixes&lt;/a&gt; which we'd merged into the vendor-supplied driver. So the host side USB driver is even more of a mess than the stock Designware drivers, which are in themselves grotty in the extreme.&lt;/p&gt;

&lt;p&gt;Fact #5: If you attach a &lt;a href="http://www.totalphase.com/products/beagle_usb480/"&gt;Beagle 480&lt;/a&gt; to the host side of the hub, you get:&lt;/p&gt;

&lt;tt&gt;
IN txn (SPLIT) [ 1117 POLL ] 00 02 00 28 00 00 00 00
..
&lt;/tt&gt;

&lt;p&gt; whereas if you attach the same analyser to the device side, you find that our USB-IR widget (for it is he) sends:&lt;/p&gt;

&lt;tt&gt;
IN txn [ 105 POLL ]  00 02 00 28 00 00 00 00
[4 SOF]
IN txn  00 01 00 00 00 00 00 00
&lt;/tt&gt;

&lt;p&gt;So: the USB-IR widget is sending key-up, but it's never being received on the high-speed bus. &lt;/p&gt;

&lt;p&gt;At this point, a little background. DANGER WILL ROBINSON! This is highly simplified and almost certainly contains mistakes - the USB 2.0 standard has a good (if long-winded) explanation of transaction translation which it is highly recommended that you read if you ever have to seriously care about these things.&lt;/p&gt;

&lt;p&gt;USB 2.0 runs much faster than USB 1.x. USB 1.x timing is divided into 1ms frames whose timing is broadcast by SOF tokens. In USB 2.x we further subdivide frames into 125uS subframes.&lt;/p&gt;

&lt;p&gt;USB is a host-controlled token-based bus; the host issues tokens (IN, OUT .. ) and devices respond.&lt;/p&gt;

&lt;p&gt;Now, obviously, if you have a high-speed and a full-speed device attached to a high-speed hub you don't want to be waiting around for the full-speed device to respond to your token before servicing the high-speed device. So there is a token called SPLIT, further subdivided into SSPLIT (Start SPLIT) and CSPLIT (Complete SPLIT).&lt;/p&gt;

&lt;p&gt;When a host wants to issue a full-speed transaction to a downstream device, it issues SSPLIT to the (high-speed) hub port in some given micro-frame. This instructs a bit of mechanism in the hub called the transaction translator to initiate a full-speed transaction on a given port, send the packet (IN/OUT) that came with the ssplit, collect the answer and wait for the host to issue a CSPLIT to retrieve it.&lt;/p&gt;

&lt;p&gt;Now, there are some caveats about split transactions:&lt;/p&gt;

&lt;li&gt;There is a limited amount of buffer space per TT. Old transactions will be thrown away when the limit is reached.&lt;/li&gt;
&lt;li&gt; Replies will be discarded when 4 or more microframes have passed since the SSPLIT that issued them.&lt;/li&gt;
&lt;li&gt; CSPLITs for which the hub can find no replies will get NYET (forever if the hub will never get a reply or has discarded it).&lt;/li&gt;
&lt;li&gt; You must not issue an SSPLIT in subframe 6.&lt;/li&gt;
&lt;li&gt; You can have one TT per hub or one TT per port (the hub descriptor tells you which).&lt;/li&gt;
&lt;li&gt; You may have multiple concurrent SPLITs , but you must issue CSPLITs in the order in which you issued SSPLITS or the hub will assume it has lost your CSPLIT and discard transaction results.&lt;/li&gt;
&lt;li&gt; The hub takes some number of FS bit times (8 for the 9514) to issue an FS transaction after a CSPLIT - this is signalled in the hub descriptor.&lt;/li&gt;

&lt;p&gt;To make life even more fun, HID devices like keyboards and mice are periodically polled, so there is something in the host called the periodic scheduler which attempts to make sure that each device is polled at least as often as its descriptor would like it to be. Luckily this is a best-effort polling mechanism.&lt;/p&gt;

&lt;p&gt;.. oh, and for added amusement, you can also have multiple transactions per subframe though you can ignore this for the purposes of this article. There are also things called isochronous transfers which do need to be real-time, and I have probably broken what little support there was for them in the synopsys drivers.&lt;/p&gt;

&lt;p&gt;The upshot of all this is that you need to be extremely careful when issuing splits - particularly periodic splits. Ideally you want to do it in hardware. Less ideally, you need to make sure your periodic scheduler knows about splits and respects the in-order and 'not in microframe 6' constraints.&lt;/p&gt;

&lt;p&gt;So. Our next bet was to tie a Beagle 480 to the hub side of the system under test and a Beagle 12 to the device side; this doesn't give you as much information as you might like because a Beagle 12 is only capable of aggregate (rather than sequential) captures and so presents its results out of order, but it's good enough for now.&lt;/p&gt;

&lt;p&gt;Monitoring both sides of the bus simultaneously we discover that the synopsys drivers are guilty of several sins:&lt;/p&gt;

&lt;ol&gt;1. Issuing SSPLITs in frame 6 (believe it or not, the 9514 actually cares about this and will NYET not the frame 6 SSPLIT but any SSPLIT in frame 7. It's allowed to, but this seems odd)&lt;/ol&gt;

&lt;ol&gt;2. Issuing CSPLITs out of order from the SSPLITs that created them, causing the results of previous SSPLITs to be discarded.&lt;/ol&gt;
&lt;ol&gt;3. There is some logic in the synopsys drivers intended to avoid runaway CSPLITs such that if you are about to issue a CSPLIT in a different full-speed frame from the SSPLIT that created it, you abort the transaction. This causes SSPLITs issued in subframe 7 to never get a corresponding CSPLIT (and a similar slight problem for those in subframe 5, though the chances are that if you're going to get an answer you will have got it by subframe 7)&lt;/ol&gt;
&lt;ol&gt;4. Skipping two subframes between SSPLIT and CSPLIT - so you get SSPLIT:0, CSPLIT:3 ..; it's unclear why that CSPLIT gets NYETed - the 9514 ought to keep your results for you until the start of subframe 4 - but nevertheless, not issuing a CSPLIT in subframes 1 and 2 is a standards violation.&lt;/ol&gt;

&lt;p&gt;These all (indirectly) arise from the fact that the designware IP attempts to handle SPLIT/CSPLIT transfers using the same mechanism it uses for other transfers - the drivers schedule a transaction (if periodic), then they queue it on a hardware channel for transmission, then if it is a split, once you get the reply token (NYET, ACK, etc.) you decide whether to immediately reschedule for transmission.&lt;/p&gt;

&lt;p&gt;So: now we (think we) know what's wrong:&lt;/p&gt;

&lt;p&gt;The designware IP tries to handle case 1 by pushing an SSPLIT into subframe 0. I'm not really sure why this doesn't work.&lt;/p&gt;

&lt;p&gt;It can't avoid 2, because the periodic scheduler doesn't know about splits - if a periodic transaction is ready, it'll be scheduled, in whatever order the list (for it is held in a kernel list) happens to be. If that list is somehow jumbled during scheduling - e.g. because you have two periodic transfers and they keep getting scheduled in the opposite order to each other, so a periodic transfer gets accepted half-way through your split - that's what happens.&lt;/p&gt;

&lt;p&gt;3 is a simple bug, and probably shouldn't arise given our ostensible policy of only ever scheduling a split in subframe 0. However, easily fixed by allowing a frame's grace - this sacrifices bandwidth, but it's good enough for now.&lt;/p&gt;

&lt;p&gt;4 is a pig; the host is simply too slow to run all that code and always get back in time for its CSPLIT.&lt;/p&gt;

&lt;p&gt;So: now we think we know what's going wrong -&lt;/p&gt;

&lt;p&gt;Problem 2 is solved by adding logic to allow only one CSPLIT at a time. This also, obscurely, solves problem 1 (perhaps some kind of hardware channel tx conflict? hard to tell without knowing what the hardware channels are actually supposed to do). &lt;/p&gt;

&lt;p&gt;Problem 3 is easy&lt;/p&gt;

&lt;p&gt;Problem 4 is a pig. I've tried to get around it by adding a fast path to the driver which spots a split in progress and immediately reschedules the transfer on the same host channel without going through the scheduling mechanism. However, the interrupt handling in that driver is a mess so I'm not sure if this is stable, and I'm certainly not sure it solves the problem. &lt;/p&gt;

&lt;p&gt;All seems promising so far, though more testing is needed with various peripherals and I have done nothing yet with non-periodic splits, which probably suffer from many of the same problems.&lt;/p&gt;

&lt;p&gt;As a side-note, I did have a quick look to see if ftrace would help me work out whether someone else was running for long periods with interrupts disabled, but all it did was crash my kernel. Maybe next time ..&lt;/p&gt;

&lt;p&gt;So: there you go. A whirlwind tour of how to get seriously confused about high-speed hubs; hope someone finds it useful. Questions, comments, etc. welcome - do let me know if you'd like the patches - they're to a vendor-only version so I shall have to get permission to release them until there's a formal source release for the product.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-2538108821136234994?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/2538108821136234994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/12/interesting-facts-about-usb-number-2312.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2538108821136234994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2538108821136234994'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/12/interesting-facts-about-usb-number-2312.html' title='Interesting facts about USB, number 2312 in an occasional series.'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3343921760676520572</id><published>2010-12-16T13:43:00.001Z</published><updated>2010-12-16T14:10:51.050Z</updated><title type='text'>Muddle version 2.2 now available</title><content type='html'>I have just merged my "new_vcs" branch of muddle into trunk. This is tagged as "2_2", and thus is muddle version 2.2. Changes include:&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;VCS changes&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;The version control support has been rewritten. The actual code to write for a new version control system is now smaller, and does not rely on any particular knowledge of muddle. This should make it much easier to add a new version control system, and also simpler to maintain/extend the existing support.&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Changed commands: Pull/Update replaced by Fetch/Merge&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;'&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;pull&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' and '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle update&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' &lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="white-space: normal;"&gt;are now deprecated (partly because no-one could remember what the difference between them was, and partly because different version control systems use those terms very differently). Instead we now have&lt;/span&gt;&lt;/span&gt; '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle fetch&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' and '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle merge&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="white-space: normal;"&gt;'.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="white-space: normal;"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle fetch&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' will pull changes from a remote repository, but will only merge those changes if it can be done with no interaction. '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle merge&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' will go ahead and do any merges, even if interaction is  required. See the the help for these commands for more information.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
(It is assumed that, in practice, most people will use '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle fetch&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;',&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;and that if more complex merging is required, people are likely to use&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt; the specific version control system commands to do this. However, it is &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;conceivable that 'muddle merge' may be enough, so it is still, for the moment at least, provided.)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
Note that both '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle fetch _all&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' and '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle merge _all&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' now default to processing all checkouts, and then (re)reporting any problems at the end. The old behaviour (of stopping at the first problem) is available with the '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;-s&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' or '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;-stop&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' switch.&lt;br /&gt;
&lt;br /&gt;
For the moment, 'muddle pull' and 'muddle update' are both still available, but they are just aliases for 'muddle fetch'.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Changed commands: 'package' support in 'checkout' commands&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Those muddle commands that expect checkout names can now also be given arguments of the form '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;package:&lt;name&gt;&lt;/name&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' or '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;package:&lt;name&gt;{role}&lt;/name&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' (and so on). Such arguments will be interpreted as "all checkouts required by the named package(s)". This means that the "&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;dep&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;-&lt;/span&gt;" and "&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;pkg-&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;" variants of some commands have gone away, as they are no longer needed.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Changed commands: Help&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The help infrastructure has been rewritten. The main user-visible change is that help for subcommands is now available per subcommand - for instance:&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle help query&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;br /&gt;
now reports on what subcommands are available for '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;query&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;', and:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;muddle help query rules&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
&lt;br /&gt;
gives help for the single subcommand. See '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle help&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' for more details on how the help command works.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Changed commands: Query subcommands&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Various of the query subcommands now have aliases, and in some cases what is the alias and what is the main command has been changed. See 'muddle help query' for more information.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;
There are some new queries: '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;deployments&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;', '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;default-labels&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;', '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;default-roles&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;' and '&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;package-roles&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;'.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Internal changes&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Apart from the above, the following:&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;ul&gt;&lt;li&gt;'Dependable' has become 'Action' throughout (and similarly for all classes  with Dependable in their names). All things called "dependable" have also  been renamed as "action". For the moment, all the old names have been retained as aliases, in case of other code relying on them.&lt;/li&gt;
&lt;li&gt;The checkout tag names in utils.py have been changed, and code using them modified.&lt;/li&gt;
&lt;li&gt;The pkg.py::add_checkout_rules() function has been changed to fit the new command names. Things that should be transient have been made so. Various things have been simplified. In particular, 'Push' and 'Commit' no longer depend on 'CheckedOut'. This means that "&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle push&lt;/span&gt;" on a checkout that has not yet been checked out will no longer check it out (which sounds like a good idea).&lt;/li&gt;
&lt;li&gt;Since I can never remember the difference between utils.Error and utils.Failure (indeed, I tend to guess that they are the other way round than intended), they have been replaced with utils.MuddleBug and utils.GiveUp (although Error and Failure are retained as aliases for the moment, just in case other code is relying on them).&lt;/li&gt;
&lt;li&gt;'pylint' and 'pyflakes' have been run over the code, and many changes (mostly minor, but a few clear bugs) have been made.&lt;/li&gt;
&lt;li&gt;When starting up, only the specific command that has been requested is instantiated from its class - this may give a small speedup, especially as subcommands are now split out as separate classes.&lt;/li&gt;
&lt;li&gt;utils.DirType is now a named tuple, and the output of '&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;muddle whereami&lt;/span&gt;' is slightly prettier.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3343921760676520572?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3343921760676520572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/12/muddle-version-22-now-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3343921760676520572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3343921760676520572'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/12/muddle-version-22-now-available.html' title='Muddle version 2.2 now available'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4253397741793284576</id><published>2010-10-24T23:50:00.007+01:00</published><updated>2010-10-25T00:10:47.242+01:00</updated><title type='text'>So: this Android thing...</title><content type='html'>&lt;p&gt;Y'know, one day I'm going to post regularly. When that happens, watch out for snowballs from the sun.&lt;/p&gt;

&lt;p&gt;Anyway, I've been quietly porting Android 2.2 to one of the dev boards we have lying around recently &lt;a name='more'&gt;&lt;/a&gt; and it's surprisingly nice; quite apart from all the hype, Froyo is a neat little embedded Linux which requires fairly minimal porting.&lt;/p&gt;

Things that particularly caught my eye:

&lt;ul&gt;
 &lt;li&gt; It provides a sensible(ish) RPC system - if you haven't investigated Binder, I suggest it - it's a good complement to kbus.
 &lt;li&gt; A libc lighter than the leviathan that is GNU libc - and hacking bionic to reflect a new kernel is easier than you think, though you do have to play guess-the-header-file a bit.
 &lt;li&gt; A libstdc++ which is all you should ever want from an embedded Linux
 &lt;li&gt; Decent Java and Javascript implementations
 &lt;li&gt; A WebKit port
 &lt;li&gt; A decent screen manager (seriously: replace com.android.internal.policy.* and watch your windows go where you asked).
 &lt;li&gt; The build system is actually quite nice once you've got used to its oddities - likewise the ANT helper tasks. Admittedly, you do need to go hacking in the SDK and NDK before you even vaguely understand how they do what they do..
 &lt;li&gt; .. and a sensible and lightweight init. 
&lt;/ul&gt;

&lt;p&gt;Oh, and an SDK with eclipse support. There's little not to like - even the kernel patches are pretty sane and easy to apply once you've got your head around what they're doing.&lt;/p&gt;

&lt;p&gt;Networking is, slightly unexpectedly, tricky - the device is pretty convinced it's a mobile phone so trying to persuade it that it has ethernet, DHCP and nothing else causes the odd argument. Also, multi-screen support is only semi-there in Froyo - I can see how to do it, but not how to do it nicely. Hopefully Gingerbread will go some way to solving this one.&lt;/p&gt;

&lt;p&gt;The launcher seems unhappy about being made to run at 720p, but then it probably wasn't expecting that big of a display, so I'll forgive it.&lt;/p&gt;

&lt;p&gt;Resource use seems reasonable - 88Mbyte for my 'doing nothing' Android. A bit high for a stripped embedded Linux, but not high enough to cause me pain. I'm thinking this is a good candidate for my favourite embedded Linux du jour&lt;/p&gt;

&lt;p&gt;So: upward and onward.. hope people have fun at ELC this week - I made the decision to come along just after they'd sold out. D'oh.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4253397741793284576?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4253397741793284576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/so-this-android-thing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4253397741793284576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4253397741793284576'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/so-this-android-thing.html' title='So: this Android thing...'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-927124529176989301</id><published>2010-10-22T17:07:00.000+01:00</published><updated>2010-10-22T17:07:24.766+01:00</updated><title type='text'>CELF Embedded Linux Conference Europe</title><content type='html'>I shall be at the&amp;nbsp;&lt;a href="http://embeddedlinuxconference.com/elc_europe10/index.html"&gt;Embedded Linux Conference&lt;/a&gt;&amp;nbsp;in Cambridge next week, on Wednesday and Thursday. On Thursday I shall be sitting at a desk in the&amp;nbsp;&lt;a href="http://elinux.org/ELCE_2010_Technical_Showcase"&gt;Technical Showcase&lt;/a&gt;&amp;nbsp;session between&amp;nbsp;12:35 and 14:30 (hmm, I assume there's some time for lunch in there as well), available to talk about&amp;nbsp;&lt;a href="http://code.google.com/p/kbus/"&gt;KBUS&lt;/a&gt;,&amp;nbsp;&lt;a href="http://code.google.com/p/muddle/"&gt;muddle&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="http://code.google.com/p/tstools/"&gt;tstools&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I'm assuming my badge will say "Tony Ibbs" rather than "Tibs"...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-927124529176989301?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/927124529176989301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/celf-embedded-linux-conference-europe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/927124529176989301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/927124529176989301'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/celf-embedded-linux-conference-europe.html' title='CELF Embedded Linux Conference Europe'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4571547507744966126</id><published>2010-10-14T13:17:00.005+01:00</published><updated>2010-10-22T11:36:05.289+01:00</updated><title type='text'>Muddle FAQ: Efficient minimal rebuilds</title><content type='html'>&lt;span style="font-style: italic;"&gt;"I've made a change deep within some package. How do I perform an efficient minimal rebuild?"&lt;/span&gt;

&lt;p&gt;Coming to muddle from a mostly make-driven world, I really wanted to be able to stand at the top of a tree, type &lt;tt&gt;make&lt;/tt&gt; and have it rebuild only what has changed. Unfortunately, life isn't as simple as that: it only works properly if package dependencies are correctly defined. This sometimes seems to be beyond individual package developers with their own software, let alone complicated inter-package dependencies, so clearly we need a different plan. &lt;a name='more'&gt;&lt;/a&gt;

&lt;/p&gt;&lt;p&gt;The missing link is provided by muddle &lt;em&gt;labels&lt;/em&gt;. These are a bit like the build-stamps I'm familiar with from working with make: if a label is &lt;em&gt;asserted&lt;/em&gt;, a certain task been completed for a particular component of your tree. For example, a &lt;em&gt;checkout&lt;/em&gt; may be &lt;em&gt;checked_out&lt;/em&gt; and a &lt;em&gt;package&lt;/em&gt; may be &lt;em&gt;configured&lt;/em&gt;, &lt;em&gt;built&lt;/em&gt; and &lt;em&gt;installed&lt;/em&gt;, and as you might imagine these terms imply a natural dependency ordering. Whenever you invoke &lt;tt&gt;muddle&lt;/tt&gt; at the top level it figures out what needs to be done based on the state of those labels.

&lt;/p&gt;&lt;p&gt;However, labels are not wired into the build system of any checkout: in other words, you don't get those make-like semantics. This would be difficult to implement in the general case; muddle would have to get down and extremely dirty with the build system of every checkout - and don't forget that they might be built with make, ant, jam or some build system you've never heard of.

&lt;/p&gt;&lt;p&gt;Now, labels may be manually &lt;em&gt;retracted&lt;/em&gt; and &lt;em&gt;asserted&lt;/em&gt; if necessary. Therefore, one might at first think that it would be reasonable to simply retract the &lt;em&gt;built&lt;/em&gt; label for the package in question. However, that is not a safe course of action: in the general case a single &lt;em&gt;checkout&lt;/em&gt; might be built into multiple &lt;em&gt;packages&lt;/em&gt;, so your change might have multiple effects without you realising it. The better plan is to retract the &lt;em&gt;checked_out&lt;/em&gt; tag for the checkout you have changed, &lt;em&gt;and then immediately reassert it&lt;/em&gt;. Retracting a label has the obvious semantics on labels depending on it, so this would cause all packages depending on that checkout to be rebuilt - what you actually wanted!
&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Figuring out the label&lt;/span&gt;
&lt;/p&gt;&lt;p&gt;So, how do you determine the label to retract and reassert? You might have read the &lt;a href="http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html"&gt;documentation&lt;/a&gt; and know that it looks like &lt;tt&gt;checkout:YOUR-CHECKOUT/checked_out&lt;/tt&gt; - but what is the checkout actually called?

&lt;/p&gt;&lt;p&gt;At the moment you have to invoke &lt;tt&gt;muddle query checkout_dirs&lt;/tt&gt; and look down the list of directories for one which matches your working directory. (Side note: There is no requirement that a checkout label bears any resemblance to the directory path, though by convention they usually do; I imagine that somebody who named their checkout "vaeGhoo3ohRoh3Qu" would find likely themselves on the receiving end of violence - or, at least, extreme sarcasm - from their colleagues.)

&lt;/p&gt;&lt;p&gt;So, in this case, having found out that you were working in the &lt;tt&gt;frobozz&lt;/tt&gt; checkout, you would then run:
&lt;/p&gt;&lt;p&gt;&lt;tt&gt;muddle retract checkout:frobozz/checked_out&lt;/tt&gt;&lt;tt&gt; &lt;br/&gt; muddle assert checkout:frobozz/checked_out&lt;/tt&gt;

&lt;/p&gt;&lt;p&gt;You can then &lt;tt&gt;rebuild&lt;/tt&gt; and &lt;tt&gt;redeploy&lt;/tt&gt; in the usual way.

&lt;/p&gt;&lt;p&gt;More generally, if you want to examine the complete list of dependency labels, start with &lt;tt&gt;muddle depend user-short&lt;/tt&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4571547507744966126?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4571547507744966126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/muddle-faq-efficient-minimal-rebuilds.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4571547507744966126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4571547507744966126'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/muddle-faq-efficient-minimal-rebuilds.html' title='Muddle FAQ: Efficient minimal rebuilds'/><author><name>Ross</name><uri>http://www.blogger.com/profile/07411033559279865493</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_EGoUTpMFP1M/TLbkbyGfMqI/AAAAAAAAABI/BkuQkndMCbE/S220/userpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-5591126039675355414</id><published>2010-10-14T12:46:00.001+01:00</published><updated>2010-10-14T12:49:43.808+01:00</updated><title type='text'>Pretty pictures</title><content type='html'>I keep meaning to write the "introduction to muddle labels" article, and I keep not having time.&lt;br /&gt;
&lt;br /&gt;
I &lt;i&gt;did&lt;/i&gt;, however, get round to drawing some diagrams (using OmniGraffle, which is really good). So it is probably worth putting them somewhere that other people can see them.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
First off, we have a simple Label:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_TVhZ4iJwUyk/TLbrLoFMQoI/AAAAAAAAAC0/ZPbt28TaXFk/s1600/Label.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="87" src="http://3.bp.blogspot.com/_TVhZ4iJwUyk/TLbrLoFMQoI/AAAAAAAAAC0/ZPbt28TaXFk/s320/Label.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;If you need to know about domains, this becomes:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_TVhZ4iJwUyk/TLbrUtznaZI/AAAAAAAAAC4/abj3L6pTzAc/s1600/Label-with-domain.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="65" src="http://4.bp.blogspot.com/_TVhZ4iJwUyk/TLbrUtznaZI/AAAAAAAAAC4/abj3L6pTzAc/s320/Label-with-domain.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;If we have a simple build where each package is built from a single checkout, and some of the packages are then deployed, then we can represent that as:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbr031m_tI/AAAAAAAAAC8/QdW5XOayQFI/s1600/Type-Name-Tag-graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="236" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbr031m_tI/AAAAAAAAAC8/QdW5XOayQFI/s320/Type-Name-Tag-graph.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;This does not show the roles of the packages (checkouts and deployments don't have roles, but for this purpose I'm ignoring that). We can add roles to the diagram as follows:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbsF_Bt39I/AAAAAAAAADA/g1sZhmSgDRA/s1600/Everything-graph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="295" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbsF_Bt39I/AAAAAAAAADA/g1sZhmSgDRA/s320/Everything-graph.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;The association of the parts of a label with the different axes is perhaps more obvious with the final diagram, which is otherwise the same as the one we've just shown:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbsWkntXDI/AAAAAAAAADE/TkbW57IUqiU/s1600/Everything-graph2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="272" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/TLbsWkntXDI/AAAAAAAAADE/TkbW57IUqiU/s320/Everything-graph2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Of course, those last three images are subtly misleading about how deployments (in particular) actually work, but that's one of the reasons the real article is needed.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-5591126039675355414?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/5591126039675355414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/pretty-pictures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5591126039675355414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5591126039675355414'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/pretty-pictures.html' title='Pretty pictures'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_TVhZ4iJwUyk/TLbrLoFMQoI/AAAAAAAAAC0/ZPbt28TaXFk/s72-c/Label.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-617487124200331303</id><published>2010-10-14T10:12:00.002+01:00</published><updated>2010-10-14T10:13:35.017+01:00</updated><title type='text'>"with Directory" makes testing easier</title><content type='html'>One of the problems with writing tests for muddle was finding a clean way to write them in Python.&lt;br /&gt;
Testing muddle involves a lot of directory creation and moving between directories. Using &lt;tt class="docutils literal"&gt;os.chdir()&lt;/tt&gt; and friends doesn't lead to easily readable code, and there is always the problem of forgetting to move back out of a particular directory.&lt;br /&gt;
My first attempt to make this easier was to write simple &lt;tt class="docutils literal"&gt;pushd()&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;popd()&lt;/tt&gt; functions, which maintained a stack of directories. This was a little better, but still didn't solve the "forgetting" problem.&lt;br /&gt;
Of course, the solution is obvious -- use &lt;tt class="docutils literal"&gt;with&lt;/tt&gt;.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;Thus we have:&lt;br /&gt;
&lt;div class="highlight" style="background: #f8f8f8;"&gt;&lt;pre style="line-height: 125%;"&gt;&lt;span style="color: green; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: blue; font-weight: bold;"&gt;Directory&lt;/span&gt;(&lt;span style="color: green;"&gt;object&lt;/span&gt;):
    &lt;span style="color: #ba2121; font-style: italic;"&gt;"""A class to facilitate pushd/popd behaviour&lt;/span&gt;

&lt;span style="color: #ba2121; font-style: italic;"&gt;    It is intended for use with 'with', as in::&lt;/span&gt;

&lt;span style="color: #ba2121; font-style: italic;"&gt;        with Directory('~'):&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;            print 'My home directory contains'&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;            print ' ',' '.join(os.listdir('.'))&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;    """&lt;/span&gt;
    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__init__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, where, verbose&lt;span style="color: #666666;"&gt;=&lt;/span&gt;&lt;span style="color: green;"&gt;True&lt;/span&gt;):
        &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;start &lt;span style="color: #666666;"&gt;=&lt;/span&gt; normalise(os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;getcwd())
        &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;where &lt;span style="color: #666666;"&gt;=&lt;/span&gt; normalise(where)
        &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose &lt;span style="color: #666666;"&gt;=&lt;/span&gt; verbose
        os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;chdir(&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;where)
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; verbose:
            &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'++ pushd to &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;where

    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;close&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;):
        os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;chdir(&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;start)
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
            &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'++ popd to &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;start

    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__enter__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;):
        &lt;span style="color: green; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;

    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__exit__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, etype, value, tb):
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; tb &lt;span style="color: #aa22ff; font-weight: bold;"&gt;is&lt;/span&gt; &lt;span style="color: green;"&gt;None&lt;/span&gt;:
            &lt;span style="color: #408080; font-style: italic;"&gt;# No exception, so just finish normally&lt;/span&gt;
            &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;close()
        &lt;span style="color: green; font-weight: bold;"&gt;else&lt;/span&gt;:
            &lt;span style="color: #408080; font-style: italic;"&gt;# An exception occurred, so do any tidying up necessary&lt;/span&gt;
            &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
                &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'** Oops, an exception occurred - &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt; tidying up'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__class__&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__name__
            &lt;span style="color: #408080; font-style: italic;"&gt;# well, there isn't anything special to do, really&lt;/span&gt;
            &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;close()
            &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
                &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'** ----------------------------------------------------------------------'&lt;/span&gt;
            &lt;span style="color: #408080; font-style: italic;"&gt;# And allow the exception to be re-raised&lt;/span&gt;
            &lt;span style="color: green; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: green;"&gt;False&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;and its obvious friends:&lt;br /&gt;
&lt;div class="highlight" style="background: #f8f8f8;"&gt;&lt;pre style="line-height: 125%;"&gt;&lt;span style="color: green; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: blue; font-weight: bold;"&gt;NewDirectory&lt;/span&gt;(Directory):
    &lt;span style="color: #ba2121; font-style: italic;"&gt;"""A pushd/popd directory that gets created first.&lt;/span&gt;

&lt;span style="color: #ba2121; font-style: italic;"&gt;    It is an Error if the directory already exists.&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;    """&lt;/span&gt;
    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__init__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, where, verbose&lt;span style="color: #666666;"&gt;=&lt;/span&gt;&lt;span style="color: green;"&gt;True&lt;/span&gt;):
        where &lt;span style="color: #666666;"&gt;=&lt;/span&gt; normalise(where)
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;path&lt;span style="color: #666666;"&gt;.&lt;/span&gt;exists(where):
            &lt;span style="color: green; font-weight: bold;"&gt;raise&lt;/span&gt; Error(&lt;span style="color: #ba2121;"&gt;'Directory &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt; already exists'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;where)
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; verbose:
            &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'++ mkdir &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;where
        os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;makedirs(where)
        &lt;span style="color: green;"&gt;super&lt;/span&gt;(NewDirectory, &lt;span style="color: green;"&gt;self&lt;/span&gt;)&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__init__(where, verbose)

&lt;span style="color: green; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: blue; font-weight: bold;"&gt;TransientDirectory&lt;/span&gt;(NewDirectory):
    &lt;span style="color: #ba2121; font-style: italic;"&gt;"""A pushd/popd directory that gets created first and deleted afterwards&lt;/span&gt;

&lt;span style="color: #ba2121; font-style: italic;"&gt;    If 'keep_on_error' is True, then the directory will not be deleted&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;    if an exception occurs in its 'with' clause.&lt;/span&gt;

&lt;span style="color: #ba2121; font-style: italic;"&gt;    It is an Error if the directory already exists.&lt;/span&gt;
&lt;span style="color: #ba2121; font-style: italic;"&gt;    """&lt;/span&gt;
    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__init__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, where, keep_on_error&lt;span style="color: #666666;"&gt;=&lt;/span&gt;&lt;span style="color: green;"&gt;False&lt;/span&gt;, verbose&lt;span style="color: #666666;"&gt;=&lt;/span&gt;&lt;span style="color: green;"&gt;True&lt;/span&gt;):
        &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;rmtree_on_error &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #aa22ff; font-weight: bold;"&gt;not&lt;/span&gt; keep_on_error
        &lt;span style="color: green;"&gt;super&lt;/span&gt;(TransientDirectory, &lt;span style="color: green;"&gt;self&lt;/span&gt;)&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__init__(where, verbose)

    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;close&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, delete_tree):
        &lt;span style="color: green;"&gt;super&lt;/span&gt;(NewDirectory, &lt;span style="color: green;"&gt;self&lt;/span&gt;)&lt;span style="color: #666666;"&gt;.&lt;/span&gt;close()
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; delete_tree:
            &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
                &lt;span style="color: #408080; font-style: italic;"&gt;# The extra space after 'rmtree' is so the directory name&lt;/span&gt;
                &lt;span style="color: #408080; font-style: italic;"&gt;# left aligns with a previous 'popd to' message&lt;/span&gt;
                &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'++ rmtree  &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;where
            shutil&lt;span style="color: #666666;"&gt;.&lt;/span&gt;rmtree(&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;where)

    &lt;span style="color: green; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue;"&gt;__exit__&lt;/span&gt;(&lt;span style="color: green;"&gt;self&lt;/span&gt;, etype, value, tb):
        &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; tb &lt;span style="color: #aa22ff; font-weight: bold;"&gt;is&lt;/span&gt; &lt;span style="color: green;"&gt;None&lt;/span&gt;:
            &lt;span style="color: #408080; font-style: italic;"&gt;# No exception, so just finish normally&lt;/span&gt;
            &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;close(&lt;span style="color: green;"&gt;True&lt;/span&gt;)
        &lt;span style="color: green; font-weight: bold;"&gt;else&lt;/span&gt;:
            &lt;span style="color: #408080; font-style: italic;"&gt;# An exception occurred, so do any tidying up necessary&lt;/span&gt;
            &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
                &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'** Oops, an exception occurred - &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt; tidying up'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__class__&lt;span style="color: #666666;"&gt;.&lt;/span&gt;__name__
            &lt;span style="color: #408080; font-style: italic;"&gt;# but don't delete the tree if we've been asked not to&lt;/span&gt;
            &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;close(&lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;rmtree_on_error)
            &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: green;"&gt;self&lt;/span&gt;&lt;span style="color: #666666;"&gt;.&lt;/span&gt;verbose:
                &lt;span style="color: green; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'** ----------------------------------------------------------------------'&lt;/span&gt;
            &lt;span style="color: #408080; font-style: italic;"&gt;# And allow the exception to be re-raised&lt;/span&gt;
            &lt;span style="color: green; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: green;"&gt;False&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;and I can now write code like:&lt;br /&gt;
&lt;div class="highlight" style="background: #f8f8f8;"&gt;&lt;pre style="line-height: 125%;"&gt;root_repo &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'file://'&lt;/span&gt; &lt;span style="color: #666666;"&gt;+&lt;/span&gt; os&lt;span style="color: #666666;"&gt;.&lt;/span&gt;path&lt;span style="color: #666666;"&gt;.&lt;/span&gt;join(root_dir, &lt;span style="color: #ba2121;"&gt;'repo'&lt;/span&gt;)
&lt;span style="color: green; font-weight: bold;"&gt;with&lt;/span&gt; NewDirectory(&lt;span style="color: #ba2121;"&gt;'test_build1'&lt;/span&gt;):
    banner(&lt;span style="color: #ba2121;"&gt;'Bootstrapping checkout build'&lt;/span&gt;)
    muddle([&lt;span style="color: #ba2121;"&gt;'bootstrap'&lt;/span&gt;, &lt;span style="color: #ba2121;"&gt;'git+&lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;root_repo, &lt;span style="color: #ba2121;"&gt;'test_build'&lt;/span&gt;])
    cat(&lt;span style="color: #ba2121;"&gt;'src/builds/01.py'&lt;/span&gt;)

    banner(&lt;span style="color: #ba2121;"&gt;'Setting up src/'&lt;/span&gt;)
    &lt;span style="color: green; font-weight: bold;"&gt;with&lt;/span&gt; Directory(&lt;span style="color: #ba2121;"&gt;'src'&lt;/span&gt;):
        &lt;span style="color: green; font-weight: bold;"&gt;with&lt;/span&gt; Directory(&lt;span style="color: #ba2121;"&gt;'builds'&lt;/span&gt;):
            touch(&lt;span style="color: #ba2121;"&gt;'01.py'&lt;/span&gt;, CHECKOUT_BUILD)
            git(&lt;span style="color: #ba2121;"&gt;'add 01.py'&lt;/span&gt;)
            git(&lt;span style="color: #ba2121;"&gt;'commit -m "New build"'&lt;/span&gt;)
            git(&lt;span style="color: #ba2121;"&gt;'push &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;/builds HEAD'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;root_repo)

        &lt;span style="color: green; font-weight: bold;"&gt;with&lt;/span&gt; NewDirectory(&lt;span style="color: #ba2121;"&gt;'checkout1'&lt;/span&gt;):
            touch(&lt;span style="color: #ba2121;"&gt;'Makefile.muddle'&lt;/span&gt;, MUDDLE_MAKEFILE)
            git(&lt;span style="color: #ba2121;"&gt;'init'&lt;/span&gt;)
            git(&lt;span style="color: #ba2121;"&gt;'add Makefile.muddle'&lt;/span&gt;)
            git(&lt;span style="color: #ba2121;"&gt;'commit -m "Add muddle makefile"'&lt;/span&gt;)
            git(&lt;span style="color: #ba2121;"&gt;'push &lt;/span&gt;&lt;span style="color: #bb6688; font-weight: bold;"&gt;%s&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;/checkout1 HEAD'&lt;/span&gt;&lt;span style="color: #666666;"&gt;%&lt;/span&gt;root_repo)
            muddle([&lt;span style="color: #ba2121;"&gt;'assert'&lt;/span&gt;, &lt;span style="color: #ba2121;"&gt;'checkout:checkout1/checked_out'&lt;/span&gt;])
&lt;/pre&gt;&lt;/div&gt;which seems to fit with how I want to think about the tests.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-617487124200331303?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/617487124200331303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/class-literal-directory-makes-testing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/617487124200331303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/617487124200331303'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/class-literal-directory-makes-testing.html' title='&quot;with Directory&quot; makes testing easier'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-2565482139087870612</id><published>2010-10-13T21:12:00.001+01:00</published><updated>2010-10-13T21:14:52.716+01:00</updated><title type='text'>New verson of muddle</title><content type='html'>Today I have merged my development branch of muddle back into the trunk. This is the same version of muddle that I was using as "m3" in previous posts. There are a few new commands, but on the whole this is a change for maintainability, and progress towards muddle3, rather than user features.&lt;br /&gt;
&lt;br /&gt;
See the main muddle page (&lt;a href="http://code.google.com/p/muddle/"&gt;http://code.google.com/p/muddle/&lt;/a&gt;) for information on new tags and branches.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-2565482139087870612?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/2565482139087870612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/10/new-verson-of-muddle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2565482139087870612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2565482139087870612'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/10/new-verson-of-muddle.html' title='New verson of muddle'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7519142060423923405</id><published>2010-09-29T20:47:00.001+01:00</published><updated>2010-09-29T20:47:46.965+01:00</updated><title type='text'>muddle and its directories - part 7 - end</title><content type='html'>&lt;p&gt;If you've read all of that, and it made some degree of sense, then I really
do recommend you also go and read &amp;quot;Welcome to Muddle&amp;quot;, online at:&lt;/p&gt;
&lt;blockquote&gt;
&lt;a class="reference external" href="http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html"&gt;http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;If you've read it before, it should now make a different sort of sense, and
if you haven't, you really should. Really.&lt;/p&gt;
&lt;p&gt;It also mentions several topics that have not been addressed in these posts.&lt;/p&gt;
&lt;p&gt;muddle's help is meant to be useful (&lt;tt class="docutils literal"&gt;muddle help&lt;/tt&gt;), although it sometimes
lags behind reality. If you find problems or inaccuracies in the help, please
do raise an issue on the &lt;a class="reference external" href="http://code.google.com/p/muddle/issues/list"&gt;muddle issues page&lt;/a&gt; describing the shortcomings -
these do get attended to.&lt;/p&gt;
&lt;p&gt;Also, I am contactable by email, and will try to help with specific problems.&lt;/p&gt;
&lt;p&gt;Finally, if all else fails, we will develop muddle for money!&lt;/p&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7519142060423923405?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7519142060423923405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-7-end.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7519142060423923405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7519142060423923405'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-7-end.html' title='muddle and its directories - part 7 - end'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-2001594413127322048</id><published>2010-09-29T20:46:00.003+01:00</published><updated>2010-09-29T20:46:59.689+01:00</updated><title type='text'>muddle and its directories - part 6 - domains</title><content type='html'>&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#domains" id="id1"&gt;Domains&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="reference internal" href="#what-domains-are-for" id="id2"&gt;What domains are for&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#how-domains-work" id="id3"&gt;How domains work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-worked-example-of-using-domains" id="id4"&gt;A worked example of using domains&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#version-stamps-and-domains" id="id5"&gt;Version stamps and domains&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="domains"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;Domains&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Domains are part of advanced muddle use, and are probably not relevant to most
builds. Regardless, it is probably worth reading at least &lt;a class="reference internal" href="#what-domains-are-for"&gt;What domains are
for&lt;/a&gt; from this section, as useful background, and so that you can recognise
when they might be applicable.&lt;/p&gt;
&lt;blockquote&gt;
The way domains work follows naturally from the rest of muddle,
but the implementation is still being tidied up - hence the
&lt;tt class="docutils literal"&gt;muddle3_label&lt;/tt&gt; branch.&lt;/blockquote&gt;
&lt;div class="section" id="what-domains-are-for"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id2"&gt;What domains are for&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Domains allow one to include one build description inside another, in much the
same way as a Python module can import another.&lt;/p&gt;
&lt;p&gt;A simple example might be when building a system with WebKit and X11 support.
We might have two builds, constructed as follows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;UI_Build&lt;/span&gt;:
   &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;WebKit_build&lt;/span&gt;
       &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;X11_build&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;Login_build&lt;/span&gt;:
    &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;X11_build&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Alternatively, we might have some high-level software for handling internet
television, and want to build two systems on different architectures. In this
case, our contrasting builds might be:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;IPTV_stack&lt;/span&gt;:
    &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;ARM_based_stack&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;IPTV_stack&lt;/span&gt;:
    &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;MIPS_based_stack&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="how-domains-work"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id3"&gt;How domains work&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A build includes another build (a &lt;em&gt;subdomain&lt;/em&gt;) using the &lt;tt class="docutils literal"&gt;include_domain()&lt;/tt&gt;
function. This takes the same arguments as the muddle &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command (that
is, a repository specification and a build description therein), plus a name
for the domain.&lt;/p&gt;
&lt;p&gt;The following sequence of actions is then performed:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;Create a directory called &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;domains/&amp;lt;name&amp;gt;/&lt;/span&gt;&lt;/tt&gt;, where &lt;tt class="docutils literal"&gt;&amp;lt;name&amp;gt;&lt;/tt&gt; is the name
of the new domain.&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;cd&lt;/tt&gt; into that new directory, and perform (the equivalent of) a muddle
&lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command therein, using the repository specification and build
description given.&lt;/li&gt;
&lt;li&gt;Read in this new build, giving a stand-alone build tree datastructure.&lt;/li&gt;
&lt;li&gt;Find all of the labels in the new build tree datastructures, and &lt;em&gt;change&lt;/em&gt;
them to add the domain name. So, for instance,
&lt;tt class="docutils literal"&gt;checkout:fred/checked_out&lt;/tt&gt; would become
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;checkout:(&amp;lt;name&amp;gt;)fred/checked_out&lt;/span&gt;&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;Incorporate this amended build tree datastructure into the original (&amp;quot;top
level&amp;quot;) build.&lt;/li&gt;
&lt;li&gt;Create a &lt;tt class="docutils literal"&gt;.muddle/am_subdomain&lt;/tt&gt; file in the domain. This allows muddle to
distinguish the &lt;em&gt;actual&lt;/em&gt; (final) top-level build from any subdomains within
it, which is a useful optimisation.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Note that the build description for a domain does not itself know that it is
not the top-level of a muddle build. Indeed, this is an important property of
domains - it means that any build description can potentially be included in
any other.&lt;/p&gt;
&lt;p&gt;For most purposes, the subdomain works just as if it were a &amp;quot;normal&amp;quot; top-level
build. In particular, it uses its own &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory to record its
build state, and writes things to its own &lt;tt class="docutils literal"&gt;obj/&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;install/&lt;/tt&gt;
directories.&lt;/p&gt;
&lt;p&gt;Also note that, as a consequence of the way domains work (and this is a good
thing), it is only possible for a build to refer to labels in subdomains, not
to those in sibling or parent build trees.&lt;/p&gt;
&lt;p&gt;To allow for more flexibility in how domains are used, there are tools in the
&lt;tt class="docutils literal"&gt;muddled&lt;/tt&gt; package for manipulating the merged label-space. For instance, if one
is using subdomains that originated as two different set-top-box builds, both
might provide a linux kernel, and the top-level build probably wants to amend
the labels such that both subdomains use &lt;em&gt;one&lt;/em&gt; of the kernel packages
(broadly, saying &amp;quot;this label should be used instead of that label&amp;quot;).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-worked-example-of-using-domains"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id4"&gt;A worked example of using domains&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, we shall start in a new empty directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; &lt;span style="color: #008000"&gt;cd&lt;/span&gt; ..
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; mkdir example2
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; &lt;span style="color: #008000"&gt;cd &lt;/span&gt;example2
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and start with the same build that we used before:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 init svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio builds/01.py
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example2/.muddle
&lt;span style="color: #808080"&gt;Initialised build tree in /home/tibs/sw/m3/example2&lt;/span&gt;
&lt;span style="color: #808080"&gt;Repository: svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;span style="color: #808080"&gt;Build description: builds/01.py&lt;/span&gt;


&lt;span style="color: #808080"&gt;Checking out build description ..&lt;/span&gt;

&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example2/src
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/builds builds
&lt;span style="color: #808080"&gt;A    builds/01.py&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 459.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example2/.muddle/tags/checkout/builds
&lt;span style="color: #808080"&gt;Done.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, just as before, we now have the following directory structure:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.
|-- .muddle/
|   |-- Description
|   |-- RootRepository
|   `-- tags/
|       `-- checkout/
|           `-- builds/
|               `-- checked_out
`-- src/
    `-- builds/
        |-- 01.py
        `-- 01.pyc
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We can now edit the &lt;tt class="docutils literal"&gt;src/builds/01.py&lt;/tt&gt; file to include a subdomain as part of
the build. As described above, we need to specify how to retrieve the domain,
giving the same information as for the &amp;quot;muddle init&amp;quot; command. We shall call
our domain &lt;tt class="docutils literal"&gt;b&lt;/tt&gt; (after the example we're taking it from):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;from&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.mechanics&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; include_domain
include_domain(builder,
               domain_name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;b&amp;quot;&lt;/span&gt;,
               domain_repo &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&amp;quot;&lt;/span&gt;,
               domain_desc &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builds/01.py&amp;quot;&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We also have to say how to include the result into our deployment - a simple
way to do this is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.deployments.collect&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;collect&lt;/span&gt;
collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;deploy(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;)
collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;copy_from_role_install(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;,
                               role &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;,
                               rel &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, dest &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;,
                               domain &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;copy_from_role_install(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;,
                               role &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;,
                               rel &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, dest &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;usr&amp;quot;&lt;/span&gt;,
                               domain &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;b&amp;quot;&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and then deploy the new deployment &amp;quot;everything&amp;quot;, instead of the old
&amp;quot;cpio_dep&amp;quot;. Note that we're not deploying to a CPIO archive this time, but
just as normal files.&lt;/p&gt;
&lt;p&gt;We should probably also change the introductory comment to:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #408080; font-style: italic"&gt;# An example of building with a subdomain&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So the &amp;quot;top level&amp;quot; build description is now:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #408080; font-style: italic"&gt;#!  /usr/bin/env python&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# An example of building with a subdomain&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.pkgs.make&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.deployments.cpio&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.checkouts.simple&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.deployments.collect&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;collect&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;from&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.mechanics&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; include_domain

&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;describe_to&lt;/span&gt;(builder):
    &lt;span style="color: #408080; font-style: italic"&gt;# Checkout ..&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;relative(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;cpio_co&amp;quot;&lt;/span&gt;)
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkgs&lt;span style="color: #666666"&gt;.&lt;/span&gt;make&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;pkg_cpio&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;cpio_co&amp;quot;&lt;/span&gt;)

    include_domain(builder,
                   domain_name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;b&amp;quot;&lt;/span&gt;,
                   domain_repo &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&amp;quot;&lt;/span&gt;,
                   domain_desc &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builds/01.py&amp;quot;&lt;/span&gt;)

    collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;deploy(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;)
    collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;copy_from_role_install(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;,
                                   role &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;,
                                   rel &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, dest &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;,
                                   domain &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
    collect&lt;span style="color: #666666"&gt;.&lt;/span&gt;copy_from_role_install(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;,
                                   role &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;,
                                   rel &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, dest &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;usr&amp;quot;&lt;/span&gt;,
                                   domain &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;b&amp;quot;&lt;/span&gt;)

    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;add_default_role(&lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;)
    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;by_default_deploy(&lt;span style="color: #BA2121"&gt;&amp;quot;everything&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# End file.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;If we &lt;em&gt;now&lt;/em&gt; do a &amp;quot;checkout _all&amp;quot;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 checkout _all
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/.muddle
&lt;span style="color: #808080"&gt;Initialised build tree in /home/tibs/sw/m3/example3/domains/b&lt;/span&gt;
&lt;span style="color: #808080"&gt;Repository: svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&lt;/span&gt;
&lt;span style="color: #808080"&gt;Build description: builds/01.py&lt;/span&gt;


&lt;span style="color: #808080"&gt;Checking out build description ..&lt;/span&gt;

&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/src
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/b/builds builds
&lt;span style="color: #808080"&gt;A    builds/01.py&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 459.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/.muddle/tags/checkout/builds
&lt;span style="color: #808080"&gt;There is no rule to build label checkout:b_co/checked_out&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building checkout:cpio_co/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/cpio_co cpio_co
&lt;span style="color: #808080"&gt;A    cpio_co/hello_world.c&lt;/span&gt;
&lt;span style="color: #808080"&gt;A    cpio_co/Makefile&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 459.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/checkout/cpio_co
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;giving us:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AF
&lt;span style="color: #808080"&gt;domains/  .muddle/  src/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;or, in more detail (omitting &lt;tt class="docutils literal"&gt;.svn&lt;/tt&gt; directories):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.
|-- domains/
|   `-- b/
|       |-- .muddle/
|       |   |-- am_subdomain
|       |   |-- Description
|       |   |-- RootRepository
|       |   `-- tags/
|       |       `-- checkout/
|       |           `-- builds/
|       |               `-- checked_out
|       `-- src/
|           `-- builds/
|               |-- 01.py
|               `-- 01.pyc
|-- .muddle/
|   |-- Description
|   |-- RootRepository
|   `-- tags/
|       `-- checkout/
|           |-- builds/
|           |   `-- checked_out
|           `-- cpio_co/
|               `-- checked_out
`-- src/
    |-- builds/
    |   |-- 01.py
    |   `-- 01.pyc
    `-- cpio_co/
        |-- hello_world.c
        `-- Makefile
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Apart from the &lt;tt class="docutils literal"&gt;am_subdomain&lt;/tt&gt; file in its &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory, the
&lt;tt class="docutils literal"&gt;domains/b/&lt;/tt&gt; directory looks like a perfectly normal build.&lt;/p&gt;
&lt;p&gt;If we then do:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 build _all
&lt;span style="color: #808080"&gt;Building package:(b)pkg_b{x86}/postinstalled package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building checkout:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;b_co/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/b/b_co b_co
&lt;span style="color: #808080"&gt;A    b_co/hello_world.c&lt;/span&gt;
&lt;span style="color: #808080"&gt;A    b_co/Makefile&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 459.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/.muddle/tags/checkout/b_co
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;pkg_b&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/obj/pkg_b/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/install/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/domains/b/.muddle/tags/package/pkg_b
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;pkg_b&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;pkg_b&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example3/domains/b/obj/pkg_b/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;pkg_b&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example3/domains/b/obj/pkg_b/x86/hello_world /home/tibs/sw/m3/example3/domains/b/install/x86/hello_world&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:&lt;span style="color: #666666"&gt;(&lt;/span&gt;b&lt;span style="color: #666666"&gt;)&lt;/span&gt;pkg_b&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/obj/pkg_cpio/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/install/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/package/pkg_cpio
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example3/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example3/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example3/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example3/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example3/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example3/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;we end up with the subdomain built in its directory structure:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;domains/
`-- b/
    |-- install/
    |   `-- x86/
    |       `-- hello_world*
    |-- .muddle/
    |   |-- am_subdomain
    |   |-- Description
    |   |-- RootRepository
    |   `-- tags/
    |       |-- checkout/
    |       |   |-- b_co/
    |       |   |   `-- checked_out
    |       |   `-- builds/
    |       |       `-- checked_out
    |       `-- package/
    |           `-- pkg_b/
    |               |-- x86-built
    |               |-- x86-configured
    |               |-- x86-installed
    |               |-- x86-postinstalled
    |               `-- x86-preconfig
    |-- obj/
    |   `-- pkg_b/
    |       `-- x86/
    |           `-- hello_world*
    `-- src/
        |-- b_co/
        |   |-- hello_world.c
        |   `-- Makefile
        `-- builds/
            |-- 01.py
            `-- 01.pyc
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and the top-level build in its:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;`-- install/
|   `-- x86/
|       |-- bin/
|       |   `-- hello_world*
|       `-- hello_world.c
|-- .muddle/
|   |-- Description
|   |-- RootRepository
|   `-- tags/
|       |-- checkout/
|       |   |-- builds/
|       |   |   `-- checked_out
|       |   `-- cpio_co/
|       |       `-- checked_out
|       `-- package/
|           `-- pkg_cpio/
|               |-- x86-built
|               |-- x86-configured
|               |-- x86-installed
|               |-- x86-postinstalled
|               `-- x86-preconfig
|-- obj/
|   `-- pkg_cpio/
|       `-- x86/
|           `-- hello_world*
`-- src/
    |-- builds/
    |   |-- 01.py
    |   `-- 01.pyc
    `-- cpio_co/
        |-- hello_world.c
        `-- Makefile
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;If we ask after packages, we have both sets:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query packages
&lt;span style="color: #808080"&gt;pkg_b&lt;/span&gt;
&lt;span style="color: #808080"&gt;pkg_cpio&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(this should arguably report the domain of each package name as well - there
should probably be an option to select this).&lt;/p&gt;
&lt;p&gt;If we ask what domains we have, we get:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query domains

&lt;span style="color: #808080"&gt;b&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(the current printout of domains includes the &amp;quot;empty&amp;quot; or top-level domain in
its listing, which is slightly unobvious, and will probably be fixed at some
time).&lt;/p&gt;
&lt;p&gt;Our dependency rules are now extended to include those from the subdomain as
well:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 depend user-short
&lt;span style="color: #808080"&gt;-----&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/checked_out, checkout:builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/checked_out, checkout:cpio_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)b_co/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)b_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)b_co/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)b_co/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)b_co/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)b_co/checked_out, checkout:(b)b_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)b_co/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)b_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)builds/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)builds/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)builds/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)builds/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)builds/checked_out, checkout:(b)builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)builds/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:(b)builds/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;deployment:everything/deployed &amp;lt;-CollectDeploymentBuilder-- [ package:*{x86}/postinstalled, package:(b)*{x86}/postinstalled ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/built &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/configured ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/configured &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/preconfig ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/installed &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/built ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/postinstalled &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/installed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/preconfig &amp;lt;-MakeBuilder-- [ checkout:cpio_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/built &amp;lt;-MakeBuilder-- [ package:(b)pkg_b{x86}/configured ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/configured &amp;lt;-MakeBuilder-- [ package:(b)pkg_b{x86}/preconfig ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/installed &amp;lt;-MakeBuilder-- [ package:(b)pkg_b{x86}/built ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/postinstalled &amp;lt;-MakeBuilder-- [ package:(b)pkg_b{x86}/installed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/preconfig &amp;lt;-MakeBuilder-- [ checkout:(b)b_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;-----&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and our deployment has the expected build order:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query deps deployment:everything/deployed
&lt;span style="color: #808080"&gt;Build order for deployment:everything/deployed ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/checked_out&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:(b)b_co/checked_out&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/preconfig&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/preconfig&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/configured&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/configured&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/installed&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/installed&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:(b)pkg_b{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #808080"&gt;deployment:everything/deployed&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Which means that when we deploy:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 deploy
&lt;span style="color: #808080"&gt;Building deployment:everything/deployed&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building deployment:everything/deployed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/deploy/everything
&lt;span style="color: #808080"&gt;Copying /home/tibs/sw/m3/example3/install/x86/ to /home/tibs/sw/m3/example3/deploy/everything/&lt;/span&gt;
&lt;span style="color: #808080"&gt;Copying /home/tibs/sw/m3/example3/domains/b/install/x86/ to /home/tibs/sw/m3/example3/deploy/everything/usr&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/deployment/everything
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;we end up with everything deployed in the &lt;tt class="docutils literal"&gt;deploy/&lt;/tt&gt; directory at the
top-level:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;deploy/
`-- everything/
    |-- bin/
    |   `-- hello_world*
    |-- hello_world.c
    `-- usr/
        `-- hello_world*
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;bin/hello_world&lt;/tt&gt; comes from the top-level build, and &lt;tt class="docutils literal"&gt;usr/hello_world&lt;/tt&gt;
from the subdomain. The &lt;tt class="docutils literal"&gt;hello_world.c&lt;/tt&gt; is also from the top-level build
(the example Makefile for the &lt;tt class="docutils literal"&gt;cpio&lt;/tt&gt; package copies the source file into the
&lt;tt class="docutils literal"&gt;install/&lt;/tt&gt; directory).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="version-stamps-and-domains"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id5"&gt;Version stamps and domains&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Version stamps work with domains as well, although one may only generate them
for the top-level in a particular build tree.&lt;/p&gt;
&lt;p&gt;Thus we can try:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 stamp version
&lt;span style="color: #808080"&gt;Finding all checkouts... found 4&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;builds&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;builds: &amp;#39;svnversion&amp;#39; reports checkout has revision &amp;#39;459M&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;cpio_co&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;(b)b_co&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;(b)builds&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Found domains: set([DomainTuple(name=&amp;#39;b&amp;#39;, repository=&amp;#39;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&amp;#39;, description=&amp;#39;builds/01.py&amp;#39;)])&lt;/span&gt;

&lt;span style="color: #808080"&gt;Unable to work out revision ids for all the checkouts&lt;/span&gt;
&lt;span style="color: #808080"&gt;- although we did work out 3 of 4&lt;/span&gt;
&lt;span style="color: #808080"&gt;Problems were:&lt;/span&gt;
&lt;span style="color: #808080"&gt;* builds: &amp;#39;svnversion&amp;#39; reports checkout has revision &amp;#39;459M&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Problems prevent writing version stamp file&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;OK, that makes sense, since we had indeed edited that checkout, and had not
commited the changes. Luckily, it is sufficient for our purposes to save the
state without that edit:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 stamp save -force
&lt;span style="color: #808080"&gt;Forcing original revision ids when necessary&lt;/span&gt;
&lt;span style="color: #808080"&gt;Finding all checkouts... found 4&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;builds&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;builds: &amp;#39;svnversion&amp;#39; reports checkout has revision &amp;#39;459M&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;cpio_co&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;(b)b_co&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;(b)builds&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Found domains: set([DomainTuple(name=&amp;#39;b&amp;#39;, repository=&amp;#39;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&amp;#39;, description=&amp;#39;builds/01.py&amp;#39;)])&lt;/span&gt;

&lt;span style="color: #808080"&gt;Unable to work out revision ids for all the checkouts&lt;/span&gt;
&lt;span style="color: #808080"&gt;- although we did work out 3 of 4&lt;/span&gt;
&lt;span style="color: #808080"&gt;Problems were:&lt;/span&gt;
&lt;span style="color: #808080"&gt;* builds: &amp;#39;svnversion&amp;#39; reports checkout has revision &amp;#39;459M&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Writing to working.stamp&lt;/span&gt;
&lt;span style="color: #808080"&gt;Wrote revision data to working.stamp&lt;/span&gt;
&lt;span style="color: #808080"&gt;File has SHA1 hash 6425284f002c81c9849f2f23add025a710207509&lt;/span&gt;
&lt;span style="color: #808080"&gt;Renaming working.stamp to 6425284f002c81c9849f2f23add025a710207509.partial&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and that at least shows us that the stamp file &lt;em&gt;does&lt;/em&gt; record details of any
subdomains:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;[ROOT]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;description&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds/01.py&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[DOMAIN b]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;description&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds/01.py&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;b&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[CHECKOUT (b)b_co]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;domain&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;b&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;b_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;relative&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;b_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;revision&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;459&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[CHECKOUT (b)builds]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;domain&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;b&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;relative&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/b&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;revision&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;459&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[CHECKOUT cpio_co]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;cpio_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;relative&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;cpio_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;revision&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;459&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[PROBLEMS]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;problem1&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds: &amp;#39;svnversion&amp;#39; reports checkout has revision &amp;#39;459M&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-2001594413127322048?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/2001594413127322048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2001594413127322048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/2001594413127322048'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-6.html' title='muddle and its directories - part 6 - domains'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-360936150561961921</id><published>2010-09-29T20:46:00.001+01:00</published><updated>2010-09-29T20:46:25.687+01:00</updated><title type='text'>muddle and its directories - part 5 - adding and stamps</title><content type='html'>&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#adding-a-new-checkout-package" id="id1"&gt;Adding a new checkout/package&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#version-stamps" id="id2"&gt;Version stamps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="adding-a-new-checkout-package"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;Adding a new checkout/package&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Let's suppose we want to add a new package, based on a new checkout.
There is more than one way to do this, but the following shows a sensible
approach.&lt;/p&gt;
&lt;p&gt;We shall create our new package by just copying one we've already got:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; cp -a src/cpio_co src/fred
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We must remember to remove the outdated repository information:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm -rf src/fred/,svn/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;And make this checkout do something different:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; mv src/fred/hello_world.c src/fred/bye_world.c
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; sed -e s/hello_world/bye_world/g --in-place src/fred/Makefile
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; sed -e s/Hello/Byebye/g --in-place src/fred/bye_world.c
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;muddle has no knowledge of this checkout yet, so we need to add it to the
build description. We can simply edit &lt;tt class="docutils literal"&gt;src/builds/01.py&lt;/tt&gt; to add the lines:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #808080"&gt;muddled.checkouts.simple.relative(builder, &amp;quot;fred&amp;quot;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #808080"&gt;muddled.pkgs.make.simple(builder, &amp;quot;fred&amp;quot;, &amp;quot;x86&amp;quot;, &amp;quot;fred&amp;quot;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(yes, that leaves us with a package and checkout with the same name, but
that's not a problem, and is closer to the more conventional usage).&lt;/p&gt;
&lt;p&gt;That's enough to give us:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query checkouts
&lt;span style="color: #808080"&gt;builds&lt;/span&gt;
&lt;span style="color: #808080"&gt;cpio_co&lt;/span&gt;
&lt;span style="color: #808080"&gt;fred&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query deps deployment:cpio_dep/deployed
&lt;span style="color: #808080"&gt;Build order for deployment:cpio_dep/deployed ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:fred/checked_out&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/checked_out&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/preconfig&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:fred{x86}/preconfig&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/configured&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:fred{x86}/configured&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:fred{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:fred{x86}/installed&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/installed&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #808080"&gt;deployment:cpio_dep/deployed&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, if we were to try to build:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3
&lt;span style="color: #808080"&gt;Building deployment:cpio_dep/deployed&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building checkout:fred/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/fred fred
&lt;span style="color: #808080"&gt;svn: URL &amp;#39;http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/fred&amp;#39; doesn&amp;#39;t exist&lt;/span&gt;
&lt;span style="color: #808080"&gt;Can&amp;#39;t build deployment:cpio_dep/deployed - Command &amp;#39;svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/fred fred&amp;#39; execution failed - 1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This makes sense, because (a) we have not told muddle that the new checkout is
present in its directory structure, and (b) we have not actually checked it in
to the subversion repository it wants to look in.&lt;/p&gt;
&lt;p&gt;Since we've not yet finished developing this new package, we don't want to
check it in to the repository yet (and, in particular in our case, we do not
want to permanently add it to our example).&lt;/p&gt;
&lt;p&gt;So we need to make muddle believe that it has been checked out.&lt;/p&gt;
&lt;p&gt;As you might expect, there are two ways to do this. The one that you may
guess is to manipulate the &lt;tt class="docutils literal"&gt;.muddle/`&lt;/tt&gt; directory structure directly - so we
could just do:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; mkdir .muddle/tags/checkout/fred
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; touch .muddle/tags/checkout/fred/checked_out
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, that's a bit clumsy to type, so muddle provides a convenient command
for asserting a particular tag (just assuming you are comfortable with the
label syntax):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 assert checkout:fred/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/checkout/fred
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and now the tag file is present:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls .muddle/tags/checkout/fred
&lt;span style="color: #808080"&gt;checked_out&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and we can then do:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3
&lt;span style="color: #808080"&gt;Building deployment:cpio_dep/deployed&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:fred&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/obj/fred/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/package/fred
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:fred&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:fred&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example3/obj/fred/x86/bye_world bye_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:fred&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example3/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example3/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example3/obj/fred/x86/bye_world /home/tibs/sw/m3/example3/install/x86/bin/bye_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 bye_world.c /home/tibs/sw/m3/example3/install/x86/bye_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building deployment:cpio_dep/deployed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/deploy/cpio_dep
&lt;span style="color: #808080"&gt;Collecting package:*{x86}/*  for deployment to / ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;h = ---Roots---&lt;/span&gt;
&lt;span style="color: #808080"&gt;/ -&amp;gt; [ / (fs /home/tibs/sw/m3/example3/install/x86) mode = 40755 uid = 7007 gid = 7007 kids = /bin /hello_world.c /bye_world.c]&lt;/span&gt;
&lt;span style="color: #808080"&gt;---Map---&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bin/bye_world -&amp;gt; [ /bin/bye_world (fs /home/tibs/sw/m3/example3/install/x86/bin/bye_world) mode = 100755 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bin -&amp;gt; [ /bin (fs /home/tibs/sw/m3/example3/install/x86/bin) mode = 40755 uid = 7007 gid = 7007 kids = /bin/bye_world /bin/hello_world]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/hello_world.c -&amp;gt; [ /hello_world.c (fs /home/tibs/sw/m3/example3/install/x86/hello_world.c) mode = 100644 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bin/hello_world -&amp;gt; [ /bin/hello_world (fs /home/tibs/sw/m3/example3/install/x86/bin/hello_world) mode = 100755 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bye_world.c -&amp;gt; [ /bye_world.c (fs /home/tibs/sw/m3/example3/install/x86/bye_world.c) mode = 100644 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/ -&amp;gt; [ / (fs /home/tibs/sw/m3/example3/install/x86) mode = 40755 uid = 7007 gid = 7007 kids = /bin /hello_world.c /bye_world.c]&lt;/span&gt;
&lt;span style="color: #808080"&gt;---&lt;/span&gt;

&lt;span style="color: #808080"&gt;base = /&lt;/span&gt;
&lt;span style="color: #808080"&gt;Scanning instructions for role x86, domain None ..&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Writing /home/tibs/sw/m3/example3/deploy/cpio_dep/my_archive.cpio ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing / ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bin ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bin/bye_world ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bin/hello_world ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /hello_world.c ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bye_world.c ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing TRAILER!!! ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example3/.muddle/tags/deployment/cpio_dep
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This just leaves actually adding the new package to revision control
somewhere - in this case, the build description is saying (implicitly) that
this package is stored in the same subversion repository as the rest of the
example, and so one would need to add it there by the normal means (which is a
topic for another time).&lt;/p&gt;
&lt;blockquote&gt;
(The fact that this is &lt;em&gt;much&lt;/em&gt; easier to do for distributed revision
control systems like bazaar, mercurial or git is in itself a good reason
for using them!)&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="version-stamps"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id2"&gt;Version stamps&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Version stamps allow one to produce a simple text file (actually, an &lt;tt class="docutils literal"&gt;INI&lt;/tt&gt;
file) representing the current state of a build. This can be useful for
various purposes, but its main intent is to allow saving a build state so that
it can be accurately recreated at a later date (for instance, so one can
rebuild an earlier release to customers).&lt;/p&gt;
&lt;p&gt;The muddle &lt;tt class="docutils literal"&gt;stamp&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;unstamp&lt;/tt&gt; commands have documentation via muddle
&lt;tt class="docutils literal"&gt;help stamp&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;help unstamp&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;However, it is worth giving a quick example of creating a version stamp:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 stamp version
&lt;span style="color: #808080"&gt;Finding all checkouts... found 2&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;builds&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Processing Svn checkout &amp;#39;cpio_co&amp;#39;&lt;/span&gt;
&lt;span style="color: #808080"&gt;Creating directory /home/tibs/sw/m3/example/versions&lt;/span&gt;
&lt;span style="color: #808080"&gt;Writing to /home/tibs/sw/m3/example/versions/_temporary.stamp&lt;/span&gt;
&lt;span style="color: #808080"&gt;Wrote revision data to /home/tibs/sw/m3/example/versions/_temporary.stamp&lt;/span&gt;
&lt;span style="color: #808080"&gt;File has SHA1 hash 189085d413217cb1865868b5d9916085d22e6f50&lt;/span&gt;
&lt;span style="color: #808080"&gt;Renaming /home/tibs/sw/m3/example/versions/_temporary.stamp to /home/tibs/sw/m3/example/versions/01.stamp&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;As indicated above, we now have a new &lt;tt class="docutils literal"&gt;versions/&lt;/tt&gt; directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AFt
&lt;span style="color: #808080"&gt;versions/  deploy/  install/  obj/  src/  .muddle/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;containing the stamp file:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;versions
`-- 01.stamp
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Modern build descriptions are encouraged to specify a &lt;em&gt;build name&lt;/em&gt; (this is as
simple as adding a line of the form:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;build_name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;ExampleBuild&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;to the Python code). If this is given, then the version stamp file will use
that build name as its filename, otherwise it defaults to the filename of the
main build description file (&lt;tt class="docutils literal"&gt;01&lt;/tt&gt; in this case).&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;versions/&lt;/tt&gt; directory is suitable for putting into a version control
system, as one might expect, and future versions of muddle are likely to
provide more support for handling this (see &lt;a class="reference external" href="http://code.google.com/p/muddle/issues/detail?id=117"&gt;issue 117&lt;/a&gt; for some ideas on
this).&lt;/p&gt;
&lt;p&gt;The contents of a stamp file is deliberately human readable:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;[ROOT]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;description&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds/01.py&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[CHECKOUT builds]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;relative&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;builds&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;revision&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;458&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;[CHECKOUT cpio_co]&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;name&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;cpio_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;relative&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;cpio_co&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;repository&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;span style="color: #7D9029"&gt;revision&lt;/span&gt; &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;458&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;As normal. muddle will not stop you writing or editing stamp files. This may
conceivably be useful.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-360936150561961921?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/360936150561961921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/360936150561961921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/360936150561961921'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-5.html' title='muddle and its directories - part 5 - adding and stamps'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-1436785594073329789</id><published>2010-09-29T20:45:00.001+01:00</published><updated>2010-09-29T20:45:06.113+01:00</updated><title type='text'>muddle and its directories - part 4 - building</title><content type='html'>&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#building-a-package" id="id1"&gt;Building a package&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#deployment" id="id2"&gt;Deployment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#rebuilding-things" id="id3"&gt;Rebuilding things&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#do-what-i-say-not-what-i-do" id="id4"&gt;Do what I say, not what I do&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="building-a-package"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;Building a package&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Whilst it is possible for a package to be built from more than one checkout,
this is relatively uncommon, and it is quite usual for a package to correspond
directly to a checkout. As it does in this case.&lt;/p&gt;
&lt;p&gt;If one tries to build a package that doesn't exist, one will be told so:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 build cpio
&lt;span style="color: #808080"&gt;Building package:cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #808080"&gt;There is no rule to build label package:cpio{x86}/postinstalled&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;It's simple to find out what packages there are:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query packages
&lt;span style="color: #808080"&gt;pkg_cpio&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So let's build it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 build pkg_cpio
&lt;span style="color: #808080"&gt;Building package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/obj/pkg_cpio/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/install/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/package/pkg_cpio
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We now have two new directories:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AFt
&lt;span style="color: #808080"&gt;install/  obj/  src/  .muddle/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt; directory has not changed.&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory has gained some new tags in
&lt;tt class="docutils literal"&gt;.muddle/tags/package/pkg_cpio/&lt;/tt&gt;, reflecting the new state of the build:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.muddle/
|-- Description
|-- RootRepository
`-- tags/
    |-- checkout/
    |   |-- builds/
    |   |   `-- checked_out
    |   `-- cpio_co/
    |       `-- checked_out
    `-- package/
        `-- pkg_cpio/
            |-- x86-built
            |-- x86-configured
            |-- x86-installed
            |-- x86-postinstalled
            `-- x86-preconfig
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;obj/&lt;/tt&gt; directory contains the results of building packages. Thus we have
a new directory called &lt;tt class="docutils literal"&gt;obj/pkg_cpio/x86&lt;/tt&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;obj/
`-- pkg_cpio/
    `-- x86/
        `-- hello_world*
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Specifically, within &lt;tt class="docutils literal"&gt;obj/&lt;/tt&gt; there is a directory named after each package,
within which there is a directory named after each role for that package. For
convenience, the makefile can use the environment variable &lt;tt class="docutils literal"&gt;$(MUDDLE_OBJ)&lt;/tt&gt;
to refer to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;lt;root_dir&amp;gt;/obj/pkg_cpio/x86&lt;/span&gt;&lt;/tt&gt; (&lt;tt class="docutils literal"&gt;&amp;lt;root_dir&amp;gt;&lt;/tt&gt; indicates the
absolute path to the top-level build directory).&lt;/p&gt;
&lt;p&gt;There would normally be more use of subdirectories such as
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$(MUDDLE_OBJ)/bin&lt;/span&gt;&lt;/tt&gt; in a &amp;quot;real&amp;quot; build, and muddle provides some other
environment variables to help with these.&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;install/&lt;/tt&gt; contains the results of installing packages. Each &lt;tt class="docutils literal"&gt;{role}&lt;/tt&gt;
gets a separate directory in &lt;tt class="docutils literal"&gt;install/&lt;/tt&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;install/
`-- x86/
    |-- bin/
    |   `-- hello_world*
    `-- hello_world.c
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Again, the makefile can use the environment variable &lt;tt class="docutils literal"&gt;$(MUDDLE_INSTALL)&lt;/tt&gt; to
refer to this role-specific directory.&lt;/p&gt;
&lt;blockquote&gt;
As an aside, using the &lt;tt class="docutils literal"&gt;MUDDLE&lt;/tt&gt; environment variables in this way means
that if two packages (e.g., &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:a{b}/*&lt;/span&gt;&lt;/tt&gt; versus &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:c{d}/*&lt;/span&gt;&lt;/tt&gt;,
or even &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:a{b}/*&lt;/span&gt;&lt;/tt&gt; versus &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:a{d}/*&lt;/span&gt;&lt;/tt&gt;) both use the same
checkout, and thus the same makefile, the results of building the two
packages will still end up in different, predictable directories.&lt;/blockquote&gt;
&lt;p&gt;It is possible to find out the entire environment muddle passes to a makefile
with the &lt;tt class="docutils literal"&gt;makeenv&lt;/tt&gt; query:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query makeenv package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #808080"&gt;MUDDLE=/home/tibs/sw/m3/muddle3_labels/muddle/muddled/__main__.py&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_INCLUDE_DIRS=&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_INSTALL=/home/tibs/sw/m3/example/install/x86&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_INSTRUCT=/home/tibs/sw/m3/muddle3_labels/muddle/muddled/__main__.py instruct pkg_cpio{x86}&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_KIND=package&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_LABEL=package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_LD_LIBRARY_PATH=&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_LIB_DIRS=&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_NAME=pkg_cpio&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_OBJ=/home/tibs/sw/m3/example/obj/pkg_cpio/x86&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_OBJ_INCLUDE=/home/tibs/sw/m3/example/obj/pkg_cpio/x86/include&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_OBJ_LIB=/home/tibs/sw/m3/example/obj/pkg_cpio/x86/lib&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_OBJ_OBJ=/home/tibs/sw/m3/example/obj/pkg_cpio/x86/obj&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_PKGCONFIG_DIRS=&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_PKGCONFIG_DIRS_AS_PATH=&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_ROLE=x86&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_ROOT=/home/tibs/sw/m3/example&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_SRC=/home/tibs/sw/m3/example/src/cpio_co&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_TAG=built&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_TARGET_LOCATION=/&lt;/span&gt;
&lt;span style="color: #808080"&gt;MUDDLE_UNINSTRUCT=/home/tibs/sw/m3/muddle3_labels/muddle/muddled/__main__.py instruct pkg_cpio{x86}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Builds specifying cross-compilation toolchains and other options may have much
longer environments passed down.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="deployment"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id2"&gt;Deployment&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Deployment is the process of copying the files for the various roles from the
&lt;tt class="docutils literal"&gt;install/&lt;/tt&gt; directories to the &lt;tt class="docutils literal"&gt;deploy/&lt;/tt&gt; directories.&lt;/p&gt;
&lt;p&gt;Deployment is commonly the stage that prepares the &amp;quot;blob&amp;quot; that will be put
onto the final device (if one is building an embedded device), and perhaps
also aggregates the tools for doing so.&lt;/p&gt;
&lt;p&gt;In this build, we are producing a CPIO archive.&lt;/p&gt;
&lt;blockquote&gt;
(CPIO is a very old Unix archive format. For our purposes (&amp;quot;us&amp;quot; being
muddle), its advantage is that it is possible to flag files within the
archive with particular permission bits, to request creationg of device
nodes, and other thing that would require superuser privileges if done
&amp;quot;live&amp;quot; in the build tree.)&lt;/blockquote&gt;
&lt;p&gt;In this build we only have a single deployment target, so we don't need to
specify its name.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 deploy
&lt;span style="color: #808080"&gt;Building deployment:cpio_dep/deployed&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building deployment:cpio_dep/deployed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/deploy/cpio_dep
&lt;span style="color: #808080"&gt;Collecting package:*{x86}/*  for deployment to / ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;h = ---Roots---&lt;/span&gt;
&lt;span style="color: #808080"&gt;/ -&amp;gt; [ / (fs /home/tibs/sw/m3/example/install/x86) mode = 40755 uid = 7007 gid = 7007 kids = /bin /hello_world.c]&lt;/span&gt;
&lt;span style="color: #808080"&gt;---Map---&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bin/hello_world -&amp;gt; [ /bin/hello_world (fs /home/tibs/sw/m3/example/install/x86/bin/hello_world) mode = 100755 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/ -&amp;gt; [ / (fs /home/tibs/sw/m3/example/install/x86) mode = 40755 uid = 7007 gid = 7007 kids = /bin /hello_world.c]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/bin -&amp;gt; [ /bin (fs /home/tibs/sw/m3/example/install/x86/bin) mode = 40755 uid = 7007 gid = 7007 kids = /bin/hello_world]&lt;/span&gt;
&lt;span style="color: #808080"&gt;/hello_world.c -&amp;gt; [ /hello_world.c (fs /home/tibs/sw/m3/example/install/x86/hello_world.c) mode = 100644 uid = 7007 gid = 7007 kids = ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;---&lt;/span&gt;

&lt;span style="color: #808080"&gt;base = /&lt;/span&gt;
&lt;span style="color: #808080"&gt;Scanning instructions for role x86, domain None ..&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Writing /home/tibs/sw/m3/example/deploy/cpio_dep/my_archive.cpio ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing / ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bin ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /bin/hello_world ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing /hello_world.c ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Packing TRAILER!!! ..
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/deployment/cpio_dep
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;That leaves us with a new &lt;tt class="docutils literal"&gt;deploy/&lt;/tt&gt; directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AFt
&lt;span style="color: #808080"&gt;deploy/  install/  obj/  src/  .muddle/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;containing our CPIO archive:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;deploy/
`-- cpio_dep/
    `-- my_archive.cpio
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and the appropriate tag has been set in the &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory tree:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.muddle/tags/deployment/
`-- cpio_dep/
    `-- deployed
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="rebuilding-things"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id3"&gt;Rebuilding things&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;muddle provides a convenience command to rebuild a package:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 rebuild pkg_cpio
&lt;span style="color: #808080"&gt;Killing package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;Clearing tags: package:pkg_cpio{x86}/built package:pkg_cpio{x86}/installed package:pkg_cpio{x86}/postinstalled package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;Building package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you can see, this &amp;quot;kills&amp;quot; (deletes) the tags saying that the package has
been built, installed and postinstalled, and then rebuilds the
&lt;tt class="docutils literal"&gt;/postinstalled&lt;/tt&gt; tag. This does not, however, do anything about things that
&lt;em&gt;depend&lt;/em&gt; on this package.&lt;/p&gt;
&lt;p&gt;It is frequently more useful to use the &lt;tt class="docutils literal"&gt;distrebuild&lt;/tt&gt; command, which is a
conflation of the &lt;tt class="docutils literal"&gt;distclean&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;build&lt;/tt&gt; commands:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 distrebuild pkg_cpio
&lt;span style="color: #808080"&gt;Building: package:pkg_cpio{x86}/distclean ..&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/distclean&lt;span style="color: #666666"&gt;[&lt;/span&gt;T&lt;span style="color: #666666"&gt;]&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile distclean
&lt;span style="color: #808080"&gt;rm -f /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;Distclean is just a clean&lt;/span&gt;
&lt;span style="color: #808080"&gt;Killing: package:pkg_cpio{x86}/preconfig ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;Clearing tags: package:pkg_cpio{x86}/preconfig package:pkg_cpio{x86}/configured package:pkg_cpio{x86}/preconfig package:pkg_cpio{x86}/installed package:pkg_cpio{x86}/postinstalled package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;Building package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;distclean&lt;/tt&gt; also removes the tags for any packages that depended upon
this package (not very obvious in this case where we only had one, of course).&lt;/p&gt;
&lt;blockquote&gt;
(Beware - it unsets the state of other packages, but not the deployment.)&lt;/blockquote&gt;
&lt;p&gt;You can also, quite legally, do the same thing by direct manipulation of
the tag files in the &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directories:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm .muddle/tags/package/pkg_cpio/*
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 build pkg_cpio
&lt;span style="color: #808080"&gt;Building package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;That is, muddle doesn't care if you remove the tags directly, instead of via
the command line tool.&lt;/p&gt;
&lt;p&gt;You can even do things like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm .muddle/tags/checkout/builds/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 checkout _all
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/builds builds
&lt;span style="color: #808080"&gt;Checked out revision 459.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is quite deliberate. Whilst the muddle command line tool provides a
variery of useful shorthand commands (such as &amp;quot;distclean&amp;quot;, &amp;quot;distrebuild&amp;quot; and
&amp;quot;redeploy&amp;quot;), it is quite possible and even sensible to exert finer control
over a build by deleting (or, indeed, &amp;quot;touch&amp;quot;ing) tag files in the &lt;tt class="docutils literal"&gt;.muddle&lt;/tt&gt;
directory.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="do-what-i-say-not-what-i-do"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id4"&gt;Do what I say, not what I do&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Please note that although I have been explicitly requesting indiviual builds,
rebuilds, deployments and so on above, this is not necessarily the normal way
of using muddle. The muddle command line tool is carefully designed so that it
normally does &amp;quot;the right thing&amp;quot;, according to which directory you are in.&lt;/p&gt;
&lt;p&gt;So, if one is at the top level of the build, and has checked out everything,
it is more colloquial just to give the muddle command with no arguments than
to be overly specific.&lt;/p&gt;
&lt;p&gt;This is perhaps most easily shown by, well, showing it.&lt;/p&gt;
&lt;p&gt;We can revert to the just checked out state quite easily, by just removing
everything except the &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt; directories:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AF
&lt;span style="color: #808080"&gt;deploy/  install/  .muddle/  obj/  src/&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm -rf deploy/ install/ obj/
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm -rf .muddle/tags/package/ .muddle/tags/deployment/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;!-- allow an indented block next!

(Being able to do this is one of the reasons that out-of-tree builds
are considered a good thing - it means we can assume that the ``src/``
directory does not contain the results of building.) --&gt;
&lt;p&gt;Once we're back to the stage just after &lt;tt class="docutils literal"&gt;init&lt;/tt&gt;, we can just do:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3
&lt;span style="color: #808080"&gt;Building deployment:cpio_dep/deployed&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building deployment:cpio_dep/deployed
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Writing /home/tibs/sw/m3/example/deploy/cpio_dep/my_archive.cpio ..
&lt;span style="color: #808080"&gt;...&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/deployment/cpio_dep
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(I've shortened the log above, because by now it should be all too familiar.)&lt;/p&gt;
&lt;p&gt;Contrariwise, if we clean it all up again:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm -rf deploy/ install/ obj/
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; rm -rf .muddle/tags/package/ .muddle/tags/deployment/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and go into a particular checkout directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; &lt;span style="color: #008000"&gt;pushd &lt;/span&gt;src/cpio_co
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3
&lt;span style="color: #808080"&gt;Killing package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;Clearing tags: package:pkg_cpio{x86}/built package:pkg_cpio{x86}/installed package:pkg_cpio{x86}/postinstalled package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;Building package:pkg_cpio{x86}/*&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/distclean&lt;span style="color: #666666"&gt;[&lt;/span&gt;T&lt;span style="color: #666666"&gt;]&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/obj/pkg_cpio/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/install/x86
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile distclean
&lt;span style="color: #808080"&gt;rm -f /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;Distclean is just a clean&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/clean&lt;span style="color: #666666"&gt;[&lt;/span&gt;T&lt;span style="color: #666666"&gt;]&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile clean
&lt;span style="color: #808080"&gt;rm -f /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/preconfig
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/package/pkg_cpio
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/configured
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile config
&lt;span style="color: #808080"&gt;Nothing to do&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/built
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile
&lt;span style="color: #808080"&gt;cc -o /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/installed
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; make  -f Makefile install
&lt;span style="color: #808080"&gt;if [ ! -d /home/tibs/sw/m3/example/install/x86/bin ]; then mkdir /home/tibs/sw/m3/example/install/x86/bin; fi&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0755 /home/tibs/sw/m3/example/obj/pkg_cpio/x86/hello_world /home/tibs/sw/m3/example/install/x86/bin/hello_world&lt;/span&gt;
&lt;span style="color: #808080"&gt;install -m 0644 hello_world.c /home/tibs/sw/m3/example/install/x86/hello_world.c&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building package:pkg_cpio&lt;span style="color: #666666"&gt;{&lt;/span&gt;x86&lt;span style="color: #666666"&gt;}&lt;/span&gt;/postinstalled
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; &lt;span style="color: #008000"&gt;popd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;That is, muddle only rebuilds the packages that depend on this checkout. See
&lt;tt class="docutils literal"&gt;muddle help build&lt;/tt&gt; and its friends for more information on this.&lt;/p&gt;
&lt;p&gt;People who like to &lt;tt class="docutils literal"&gt;cd&lt;/tt&gt; around the filesystem a lot will probably
find this intuitive. Those of us who prefer to sit at the top-level and work
from there (not necessarily any more sensible, of course) are more likely just
to do:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 distrebuild pkg_cpio
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(yes, this has identical effect, and no, by now I'm not going to include the
listing yet again).&lt;/p&gt;
&lt;div class="note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p&gt;As an aside, if you want to preserve the source of a build,
then (if there aren't any domains) it is sufficient to do:&lt;/p&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; tar -zcvf build.tgz .muddle/Description .muddle/RootRepository .muddle/tags/checkout src
&lt;/pre&gt;&lt;/div&gt;
&lt;p class="last"&gt;&lt;a class="reference external" href="http://code.google.com/p/muddle/issues/detail?id=125"&gt;Issue 125&lt;/a&gt; suggests adding a muddle command to make this convenient
(including in the with-domains case).&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-1436785594073329789?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/1436785594073329789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1436785594073329789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1436785594073329789'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-4.html' title='muddle and its directories - part 4 - building'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7181560342296949121</id><published>2010-09-29T20:44:00.001+01:00</published><updated>2010-09-29T20:44:22.902+01:00</updated><title type='text'>muddle and its directories - part 3 - mechanics</title><content type='html'>&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-mechanics-of-the-build-the-build-description" id="id1"&gt;The mechanics of the build - the build description&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#some-naming-conventions" id="id2"&gt;Some naming conventions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#introspection-of-the-dependency-tree" id="id3"&gt;Introspection of the dependency tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#checking-out-the-source-code" id="id4"&gt;Checking out the source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-mechanics-of-the-build-the-makefile" id="id5"&gt;The mechanics of the build - the makefile&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="the-mechanics-of-the-build-the-build-description"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;The mechanics of the build - the build description&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The build description is one or more Python files, which the muddle command
runs before doing anything else.&lt;/p&gt;
&lt;blockquote&gt;
(A few muddle commands do not need a build description, obviously including
&lt;tt class="docutils literal"&gt;init&lt;/tt&gt;, but these are the exception.)&lt;/blockquote&gt;
&lt;p&gt;For various reasons, the main build description file is traditionally
called &lt;tt class="docutils literal"&gt;src/builds/01.py&lt;/tt&gt;. muddle automatically adds the directory
containing the main build description (the file named in
&lt;tt class="docutils literal"&gt;.muddle/Description&lt;/tt&gt;) to the PYTHONPATH for the build description. Put more
simply, the build description can &lt;tt class="docutils literal"&gt;import&lt;/tt&gt; other Python files in the same
directory, which makes it easy to split build descriptions if necessary.&lt;/p&gt;
&lt;p&gt;This example build has a fairly simple build description, in &lt;tt class="docutils literal"&gt;src/builds/01.py&lt;/tt&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #408080; font-style: italic"&gt;#!  /usr/bin/env python&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# An example of how to build a cpio archive as a&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# deployment - e.g. for a Linux initrd.&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.pkgs.make&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.deployments.cpio&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.checkouts.simple&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;describe_to&lt;/span&gt;(builder):
    &lt;span style="color: #408080; font-style: italic"&gt;# Checkout ..&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;relative(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;cpio_co&amp;quot;&lt;/span&gt;)
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkgs&lt;span style="color: #666666"&gt;.&lt;/span&gt;make&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;pkg_cpio&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;cpio_co&amp;quot;&lt;/span&gt;)
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;deployments&lt;span style="color: #666666"&gt;.&lt;/span&gt;cpio&lt;span style="color: #666666"&gt;.&lt;/span&gt;deploy(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;my_archive.cpio&amp;quot;&lt;/span&gt;,
                                    {&lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;: &lt;span style="color: #BA2121"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;},
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;cpio_dep&amp;quot;&lt;/span&gt;, [ &lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt; ])

    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;add_default_role(&lt;span style="color: #BA2121"&gt;&amp;quot;x86&amp;quot;&lt;/span&gt;)
    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;by_default_deploy(&lt;span style="color: #BA2121"&gt;&amp;quot;cpio_dep&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# End file.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Briefly, muddle looks for a function called &lt;tt class="docutils literal"&gt;describe_to()&lt;/tt&gt; in the build
description, and runs it to define the build.&lt;/p&gt;
&lt;p&gt;This particular example is quite old, and I'm not sure we'd write it quite
like that any more. Regardless, it says the following things:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;there is a checkout called &amp;quot;cpio_co&amp;quot;, which is checked out from the default
repository (as defined in &lt;tt class="docutils literal"&gt;.muddle/RootRepository&lt;/tt&gt;).&lt;/li&gt;
&lt;li&gt;the package named &lt;tt class="docutils literal"&gt;pkg_cpio&lt;/tt&gt; in role &lt;tt class="docutils literal"&gt;x86&lt;/tt&gt; is built from that checkout -
this will, by default, be done using a &lt;tt class="docutils literal"&gt;Makefile&lt;/tt&gt; in the checkout
directory.&lt;/li&gt;
&lt;li&gt;when deploying the final results of the build, a CPIO archive shall be
created, with the role &amp;quot;x86&amp;quot; going at the root of the filesystem in that
CPIO archive. The name of this deployment is &amp;quot;cpio_dep&amp;quot;.&lt;/li&gt;
&lt;li&gt;the default package role to build is &amp;quot;x86&amp;quot;&lt;/li&gt;
&lt;li&gt;the default thing to deploy is the &amp;quot;cpio_dep&amp;quot; deployment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="some-naming-conventions"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id2"&gt;Some naming conventions&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;There are some strong naming conventions associated with muddle build trees:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The build description lives in a checkout called &lt;tt class="docutils literal"&gt;src/builds/&lt;/tt&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;All packages build out-of-tree (that is, in the &lt;tt class="docutils literal"&gt;obj/&lt;/tt&gt; directory, which we
shall describe later), so that the &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt; directory &lt;em&gt;only&lt;/em&gt; contains the
checkout files as-checked-out.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If there is a checkout containing &amp;quot;helper&amp;quot; makefiles and other associated
things, used to build checkouts in other directories, it should be called
&lt;tt class="docutils literal"&gt;src/helpers/&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;(For instance, if one is building &lt;a class="reference external" href="http://code.google.com/p/kbus/"&gt;kbus&lt;/a&gt;, and downloading it directly from
its google code repository each time, then it is convenient to put the
muddle-specific makefile in a different checkout, possibly as
&lt;tt class="docutils literal"&gt;src/helpers/Makefile.kbus&lt;/tt&gt;)&lt;/p&gt;
&lt;p&gt;There was an earlier convention of using the name &lt;tt class="docutils literal"&gt;src/builders/&lt;/tt&gt; for such a
directory, but this is visually confusing, and does not work well with
tab-completion at the bash prompt.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Checkout names should reflect the name of the external package being built,
and generally also the version. So, for instance &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;screen-1.0.3&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Package names should be more general - if a package is built from
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;screen-1.0.3&lt;/span&gt;&lt;/tt&gt;, it would normally be named &lt;tt class="docutils literal"&gt;screen&lt;/tt&gt;. This allows for a
later change in the build to use (for instance) checkout &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;screen-1.0.4&lt;/span&gt;&lt;/tt&gt;
instead.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Deployment names should reflect the purpose of the deployment - for
instance, &lt;tt class="docutils literal"&gt;firmware&lt;/tt&gt; versus &lt;tt class="docutils literal"&gt;kernel&lt;/tt&gt;, and so on. This is very much
dependent on the purpose of the build itself.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;This particular build is not really following the naming convention
for checkouts, packages and deployments as described above. This is because
it is trying to make it very clear which name belongs to which label type
(thus &lt;tt class="docutils literal"&gt;co_cpio&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;pkg_cpio&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;dep_cpio&lt;/tt&gt;)&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;It is also moderately traditional to call the main Python file for a build
description &lt;tt class="docutils literal"&gt;01.py&lt;/tt&gt; (or &lt;tt class="docutils literal"&gt;02.py&lt;/tt&gt; if it is version 2, and so on). This is
not, however, a strong convention, it just makes the &amp;quot;main&amp;quot; file easy to
spot.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="introspection-of-the-dependency-tree"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id3"&gt;Introspection of the dependency tree&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;muddle does have some ability to display the dependency tree that is generated
from the build description, although it is not as user-friendly as we would
like (and, ultimately, there should be graphical tools).&lt;/p&gt;
&lt;p&gt;The simplest tool for dumping the dependency rules is the &lt;tt class="docutils literal"&gt;depends&lt;/tt&gt; command
(see &lt;tt class="docutils literal"&gt;muddle help depends&lt;/tt&gt; for more details on what it does).&lt;/p&gt;
&lt;p&gt;The following shows the dependency rules described directly by the build
description above:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 depends user-short
&lt;span style="color: #808080"&gt;-----&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/checked_out, checkout:builds/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:builds/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:builds/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/changes_committed &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/changes_pushed &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/changes_committed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/pulled &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/checked_out, checkout:cpio_co/up_to_date[T] ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/up_to_date[T] &amp;lt;-VcsCheckoutBuilder-- [ checkout:cpio_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;deployment:cpio_dep/deployed &amp;lt;-CpioDeploymentBuilder-- [ package:*{x86}/postinstalled ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/built &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/configured ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/configured &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/preconfig ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/installed &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/built ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/postinstalled &amp;lt;-MakeBuilder-- [ package:pkg_cpio{x86}/installed ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/preconfig &amp;lt;-MakeBuilder-- [ checkout:cpio_co/checked_out ]&lt;/span&gt;
&lt;span style="color: #808080"&gt;-----&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Each line above shows three things:&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;a target label.&lt;/li&gt;
&lt;li&gt;an arrow containing the name of the action to take to &amp;quot;satisfy&amp;quot; or &amp;quot;build&amp;quot;
that label (nb: in the current trunk of muddle, this is not present).&lt;/li&gt;
&lt;li&gt;a list of the labels that must be &amp;quot;satisfied&amp;quot; or &amp;quot;built&amp;quot; before that action
can be performed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It is sorted by target label, which unfortunately is not too much help, but
one can see that, for instance, the &lt;tt class="docutils literal"&gt;deployment:cpio_dep/deployed&lt;/tt&gt; label
depends on &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package:*{x86}/postinstalled&lt;/span&gt;&lt;/tt&gt;, where the &lt;tt class="docutils literal"&gt;*&lt;/tt&gt; is a wildcard
over all package names in the &lt;tt class="docutils literal"&gt;{x86}&lt;/tt&gt; role.&lt;/p&gt;
&lt;p&gt;A shorter and perhaps more helpful representation of that can be provided
using the &lt;tt class="docutils literal"&gt;query deps&lt;/tt&gt; command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query deps deployment:cpio_dep/deployed
&lt;span style="color: #808080"&gt;Build order for deployment:cpio_dep/deployed ..&lt;/span&gt;
&lt;span style="color: #808080"&gt;checkout:cpio_co/checked_out&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/preconfig&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/configured&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/built&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/installed&lt;/span&gt;
&lt;span style="color: #808080"&gt;package:pkg_cpio{x86}/postinstalled&lt;/span&gt;
&lt;span style="color: #808080"&gt;deployment:cpio_dep/deployed&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This shows all of the labels that must be built before
&lt;tt class="docutils literal"&gt;deployment:cpio_dep/deployed&lt;/tt&gt;, and in what order they will be built.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="checking-out-the-source-code"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id4"&gt;Checking out the source code&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Normally, after the &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command, one would just use a &amp;quot;bare&amp;quot; muddle
command to perform the rest of the checkouts, build them (as they are checked
out), and do any other steps indicated by the build description. However,
since I'm interested in the various stages of the build tree, I shall do all
of these things one by one.&lt;/p&gt;
&lt;p&gt;So we start by checking out the actual source for our build:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 checkout _all
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Building checkout:cpio_co/checked_out
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/cpio_co cpio_co
&lt;span style="color: #808080"&gt;A    cpio_co/hello_world.c&lt;/span&gt;
&lt;span style="color: #808080"&gt;A    cpio_co/Makefile&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 458.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/checkout/cpio_co
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;After doing this, we've now gained a new tag in the &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;`-- .muddle/
    |-- Description
    |-- RootRepository
    `-- tags/
        `-- checkout/
            |-- builds/
            |   `-- checked_out
            `-- cpio_co/
                `-- checked_out
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;indicating that we have successfully checked out the &lt;tt class="docutils literal"&gt;cpio_co&lt;/tt&gt; checkout,
and the source files for our missing checkout are now present in the &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt;
directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;`-- src/
    |-- builds/
    |   |-- 01.py
    |   |-- 01.pyc
    |   `-- .svn/
    `-- cpio_co/
        |-- hello_world.c
        |-- Makefile
        `-- .svn/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(whilst I'm showing the &lt;tt class="docutils literal"&gt;.svn/&lt;/tt&gt; directories here, I've removed the listing
of their contents).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-mechanics-of-the-build-the-makefile"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id5"&gt;The mechanics of the build - the makefile&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This build only has a single checkout, which produces a single package. As
such it also has a single makefile, &lt;tt class="docutils literal"&gt;src/cpio_co/Makefile&lt;/tt&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Makefile for cpio_co&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# Just dumps some compiled C into the right place.&lt;/span&gt;

&lt;span style="color: #19177C"&gt;INSTALL&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;install

all:
        &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;CC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; -o &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/hello_world hello_world.c

install:
        &lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt; &lt;span style="color: #666666"&gt;[&lt;/span&gt; ! -d &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/bin &lt;span style="color: #666666"&gt;]&lt;/span&gt;; &lt;span style="color: #008000; font-weight: bold"&gt;then &lt;/span&gt;mkdir &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/bin; &lt;span style="color: #008000; font-weight: bold"&gt;fi&lt;/span&gt;
        &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; -m 0755 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/hello_world &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/bin/hello_world
        &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; -m 0644 hello_world.c &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/hello_world.c

config:
        @echo Nothing to &lt;span style="color: #008000; font-weight: bold"&gt;do&lt;/span&gt;

clean:
        rm -f &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/hello_world

distclean: clean
        @echo Distclean is just a clean

&lt;span style="color: #408080; font-style: italic"&gt;# end file.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We saw when querying the builds dependencies (in &lt;a class="reference internal" href="#introspection-of-the-dependency-tree"&gt;Introspection of the
dependency tree&lt;/a&gt;) that various dependency rules had &lt;tt class="docutils literal"&gt;MakeBuilder&lt;/tt&gt; as their
action. This action knows what targets in a makefile to call in order to build
a particular &lt;tt class="docutils literal"&gt;package:&lt;/tt&gt; label tag.&lt;/p&gt;
&lt;p&gt;The target label tags (the &lt;tt class="docutils literal"&gt;/xxx&lt;/tt&gt; at the end of a label) correspond to
makefile targets as follows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="48%" /&gt;
&lt;col width="52%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Target tag&lt;/th&gt;
&lt;th class="head"&gt;Makefile target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;/preconfig&lt;/td&gt;
&lt;td&gt;&amp;lt;none&amp;gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/configured&lt;/td&gt;
&lt;td&gt;config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/built&lt;/td&gt;
&lt;td&gt;all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/installed&lt;/td&gt;
&lt;td&gt;install&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/postinstalled&lt;/td&gt;
&lt;td&gt;&amp;lt;none&amp;gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="48%" /&gt;
&lt;col width="52%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Target tag&lt;/th&gt;
&lt;th class="head"&gt;Makefile target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;/clean&lt;/td&gt;
&lt;td&gt;clean&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;/distclean&lt;/td&gt;
&lt;td&gt;distclean&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/blockquote&gt;
&lt;p&gt;It can be useful to think of a package as &amp;quot;progressing&amp;quot; from &lt;tt class="docutils literal"&gt;/preconfig&lt;/tt&gt;
through to &lt;tt class="docutils literal"&gt;/postinstalled&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;preconfig&lt;/tt&gt; does not correspond to a make target, and there is no default
action for it. Things that depend on a package existing (but nothing else)
will depend on the &lt;tt class="docutils literal"&gt;/preconfig&lt;/tt&gt; tagged package label.&lt;/p&gt;
&lt;p&gt;There is no action defined by default for &lt;tt class="docutils literal"&gt;/preconfig&lt;/tt&gt;. That doesn't stop a
particular build from defining one - for instance, &lt;tt class="docutils literal"&gt;ExpandingMakeBuilder&lt;/tt&gt; is a
MakeBuilder subclass which expands a &lt;tt class="docutils literal"&gt;.tgz&lt;/tt&gt; file into source files for the
later stages to compile and install (see &lt;tt class="docutils literal"&gt;muddled.pkgs.make&lt;/tt&gt;).&lt;/p&gt;
&lt;p&gt;Although there is no make target associated with &lt;tt class="docutils literal"&gt;/postinstalled&lt;/tt&gt;, it is at
this stage that &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;pkg-config&lt;/span&gt;&lt;/tt&gt; files are rewritten (if requested), and this
is the tag that should be used when another package depends on something
being &amp;quot;fully&amp;quot; built.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7181560342296949121?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7181560342296949121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7181560342296949121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7181560342296949121'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-3.html' title='muddle and its directories - part 3 - mechanics'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-527688784382063774</id><published>2010-09-29T20:43:00.001+01:00</published><updated>2010-09-29T20:43:30.880+01:00</updated><title type='text'>muddle and its directories - part 2 - example build</title><content type='html'>&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-simple-example-build" id="id1"&gt;A simple example build&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-muddle-directory" id="id2"&gt;The &lt;tt class="docutils literal"&gt;.muddle&lt;/tt&gt; directory&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-description-file" id="id3"&gt;The &lt;tt class="docutils literal"&gt;Description&lt;/tt&gt; file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-rootrepository-file" id="id4"&gt;The &lt;tt class="docutils literal"&gt;RootRepository&lt;/tt&gt; file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-tags-directory" id="id5"&gt;The &lt;tt class="docutils literal"&gt;tags/&lt;/tt&gt; directory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#other-contents" id="id6"&gt;Other contents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#the-src-builds-directory" id="id7"&gt;The &lt;tt class="docutils literal"&gt;src/builds&lt;/tt&gt; directory&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="a-simple-example-build"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;A simple example build&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The muddle repository has a variety of example build descriptions, of varying
complexity.&lt;/p&gt;
&lt;blockquote&gt;
Perhaps inevitably, not all of the examples are maintained as well as they
should be. If you do find problems with any of them, please raise an issue
about it on the &lt;a class="reference external" href="http://code.google.com/p/muddle/issues/list"&gt;muddle issues page&lt;/a&gt;.&lt;/blockquote&gt;
&lt;p&gt;We shall use the &amp;quot;cpio&amp;quot; example.&lt;/p&gt;
&lt;p&gt;We start with a new, empty directory:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; mkdir example
&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; &lt;span style="color: #008000"&gt;cd &lt;/span&gt;example
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and then use the muddle &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 init svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio builds/01.py
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle
&lt;span style="color: #808080"&gt;Initialised build tree in /home/tibs/sw/m3/example&lt;/span&gt;
&lt;span style="color: #808080"&gt;Repository: svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;span style="color: #808080"&gt;Build description: builds/01.py&lt;/span&gt;


&lt;span style="color: #808080"&gt;Checking out build description ..&lt;/span&gt;

&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/src
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; svn checkout  http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio/builds builds
&lt;span style="color: #808080"&gt;A    builds/01.py&lt;/span&gt;
&lt;span style="color: #808080"&gt;Checked out revision 458.&lt;/span&gt;
&lt;span style="color: #000080; font-weight: bold"&gt;&amp;gt;&lt;/span&gt; Make directory /home/tibs/sw/m3/example/.muddle/tags/checkout/builds
&lt;span style="color: #808080"&gt;Done.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This leaves us with two new directories:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; ls -AF
&lt;span style="color: #808080"&gt;.muddle/  src/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Or, in more detail (with the &lt;tt class="docutils literal"&gt;.svn/&lt;/tt&gt; directory in &lt;tt class="docutils literal"&gt;src/builds/&lt;/tt&gt; shown as a
&amp;quot;stub&amp;quot;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.
|-- .muddle/
|   |-- Description
|   |-- RootRepository
|   `-- tags/
|       `-- checkout/
|           `-- builds/
|               `-- checked_out
`-- src/
    `-- builds/
        |-- 01.py
        |-- 01.pyc
        `-- .svn/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Whilst the name and content of the &lt;tt class="docutils literal"&gt;src/builds&lt;/tt&gt; directory might differ, this
is the normal state of a muddle build tree after the &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-muddle-directory"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id2"&gt;The &lt;tt class="docutils literal"&gt;.muddle&lt;/tt&gt; directory&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory is, in many ways, the heart of the muddle build
tree.&lt;/p&gt;
&lt;p&gt;In the first place, it identifies a directory as the top-level of a muddle
build. Indeed, the muddle command line tool looks in the current directory,
and then upwards through the filesystem, to find a &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory.
If it cannot find one, then it decides that it is not in a muddle build tree,
and behaves accordingly (depending on what action it was asked to do).&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory always contains at least two files and one
directory:&lt;/p&gt;
&lt;div class="section" id="the-description-file"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id3"&gt;The &lt;tt class="docutils literal"&gt;Description&lt;/tt&gt; file&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; cat .muddle/Description
&lt;span style="color: #808080"&gt;builds/01.py&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;which should be recognisable from the &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command. It tells muddle where
its build description was checked out (in the &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt; directory, since that
is where checkouts go).&lt;/p&gt;
&lt;p&gt;You should not normally need to edit this file, but if you do, the next time
you run muddle, it will believe that the build description is in the new
location.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-rootrepository-file"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id4"&gt;The &lt;tt class="docutils literal"&gt;RootRepository&lt;/tt&gt; file&lt;/a&gt;&lt;/h2&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; cat .muddle/RootRepository
&lt;span style="color: #808080"&gt;svn+http://muddle.googlecode.com/svn/trunk/muddle/examples/cpio&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Again, this should be recognisable from the &lt;tt class="docutils literal"&gt;init&lt;/tt&gt; command. This specifies
the default repository, which muddle will assume is being used for checkouts
unless the build description says otherwise.&lt;/p&gt;
&lt;p&gt;You should not normally need to edit this file either, but again muddle will
believe its contents after a change.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-tags-directory"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id5"&gt;The &lt;tt class="docutils literal"&gt;tags/&lt;/tt&gt; directory&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;tags/&lt;/tt&gt; directory contains the current state of the build - it is
essentially a database of &amp;quot;labels satisfied&amp;quot;, stored in the filesystem.&lt;/p&gt;
&lt;p&gt;In the current state:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;.muddle/tags
`-- checkout/
    `-- builds/
        `-- checked_out
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;we can see that the label &lt;tt class="docutils literal"&gt;checkout:builds/checked_out&lt;/tt&gt; has been &amp;quot;built&amp;quot; (or
has had its target satisfied). This corresponds to having checked out the
&lt;tt class="docutils literal"&gt;builds&lt;/tt&gt; checkout, which is indeed what has been done. We shall see later
that it is possible to change the build state by deleting or &amp;quot;&lt;tt class="docutils literal"&gt;touch&lt;/tt&gt;&amp;quot;ing
tag files.&lt;/p&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;checked_out&lt;/tt&gt; file created by muddle does have content - it contains
a timestamp:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; cat .muddle/tags/checkout/builds/checked_out
&lt;span style="color: #808080"&gt;2010-09-28 11:14:34&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;but this content is never actually used for anything, and if you do add a tag
file, it is quite sufficient to use &lt;tt class="docutils literal"&gt;touch&lt;/tt&gt; to create an empty file.&lt;/p&gt;
&lt;p&gt;If we ask muddle what checkouts it knows about:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; m3 query checkouts
&lt;span style="color: #808080"&gt;builds&lt;/span&gt;
&lt;span style="color: #808080"&gt;cpio_co&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;we see two checkouts. The absence of any tag files for the &amp;quot;cpio_co&amp;quot;
checkout tells us that it hasn't been checked out yet.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="other-contents"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#id6"&gt;Other contents&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There may also be other things in the &lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt; directory, notably an
&lt;tt class="docutils literal"&gt;instructions/&lt;/tt&gt; directory (used for deployment instructions), and an
&lt;tt class="docutils literal"&gt;am_subdomain&lt;/tt&gt; file (described when we talk about domains), but we shall
ignore these for now.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="the-src-builds-directory"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id7"&gt;The &lt;tt class="docutils literal"&gt;src/builds&lt;/tt&gt; directory&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The other directory present is the &lt;tt class="docutils literal"&gt;src/&lt;/tt&gt; directory, which, so far, contains
a single subdirectory for the build description.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;`src/
 `-- builds/
     |-- 01.py
     |-- 01.pyc
     `-- .svn/
&lt;/pre&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-527688784382063774?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/527688784382063774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/527688784382063774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/527688784382063774'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-2.html' title='muddle and its directories - part 2 - example build'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-6617964611727664637</id><published>2010-09-29T20:33:00.001+01:00</published><updated>2010-09-29T20:50:45.169+01:00</updated><title type='text'>muddle and its directories - part 1 - introduction</title><content type='html'>&lt;p&gt;This is a look at how muddle works, specifically looking at the directory
structure of a muddle build.&lt;/p&gt;
&lt;p&gt;Since it is quite long, I am splitting it into a series of 7 posts, of varying
lengths. The whole thing will also ultimately be integrated into the &amp;quot;proper&amp;quot;
muddle documentation.&lt;/p&gt;
&lt;p&gt;If you are just going to use muddle to check out and build an existing build
tree, then this will probably be much too much information, although the
short section &lt;a class="reference internal" href="#an-overview-of-the-directory-structure"&gt;An overview of the directory structure&lt;/a&gt; (at the end of this
introductory post) may be useful.&lt;/p&gt;
&lt;p&gt;If you are going to be developing new muddle builds, then this text should
enable you to do so more effectively.&lt;/p&gt;
&lt;p&gt;If you are going to be reading the muddle source code, or developing muddle
itself, then it should explain much of the intent behind muddle's workings.&lt;/p&gt;
&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title first"&gt;Contents&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#introduction" id="id1"&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#notation-in-this-text" id="id2"&gt;Notation in this text&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#an-overview-of-the-directory-structure" id="id3"&gt;An overview of the directory structure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="introduction"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id1"&gt;Introduction&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;muddle is three or four different things, entwined:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;It is a command line tool, providing useful tools for managing build trees
on Linux.&lt;/li&gt;
&lt;li&gt;It is a Python package, &lt;tt class="docutils literal"&gt;muddled&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;It is a simple dependency tracking and analysis tool, with its state made
evident via the file structure.&lt;/li&gt;
&lt;li&gt;It is a binding of the above to the common tasks required for managing,
building and preparing deployments of Linux software from common sources to
multiple architectures and platforms.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In a perfect world (perhaps the eventual &amp;quot;muddle 3&amp;quot;) these would be better
separated. In particular, it would be nice if it was obvious that muddle can
be adapted for things other than Linux build trees.&lt;/p&gt;
&lt;p&gt;The best short introduction to muddle is still that written by Richard Watts
(its primary author), the &lt;tt class="docutils literal"&gt;README&lt;/tt&gt; for the project, titled &amp;quot;Welcome to
Muddle&amp;quot;, which can be found online at:&lt;/p&gt;
&lt;blockquote&gt;
&lt;a class="reference external" href="http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html"&gt;http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;I recommend it for further study.&lt;/p&gt;
&lt;p&gt;This document is meant to be a longer and more discursive introduction to some
of the basics of muddle, with a concentration on how the muddle build tree
works as a directory tree, and with worked examples.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="notation-in-this-text"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id2"&gt;Notation in this text&lt;/a&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Directory names are consistently shown with a trailing &lt;tt class="docutils literal"&gt;/&lt;/tt&gt;, as by &lt;tt class="docutils literal"&gt;ls &lt;span class="pre"&gt;-F&lt;/span&gt;&lt;/tt&gt;.
Since I'm talking about directories and files a lot, I think this makes it
easier to tell which is which.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The &amp;quot;tree&amp;quot; listings of directory structures are produced with the command
&lt;tt class="docutils literal"&gt;tree&lt;/tt&gt;, normally as:&lt;/p&gt;
&lt;div class="highlight" style="background: #f8f8f8"&gt;&lt;pre style="line-height: 125%"&gt;&lt;span style="color: #000080; font-weight: bold"&gt;$&lt;/span&gt; tree -aF -I .svn --noreport
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;i.e., showing files and directories that start with a dot, suffixing
directory names with &lt;tt class="docutils literal"&gt;/&lt;/tt&gt;, not showing &lt;tt class="docutils literal"&gt;.svn/&lt;/tt&gt; directories, and not
reporting on the number of files and directories. In a few places the &amp;quot;stub&amp;quot;
of a &lt;tt class="docutils literal"&gt;.svn/&lt;/tt&gt; directory (that is, just its name) may be shown - this should
be obvious from context.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;When referrring to the parts of a label (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;type:(domain)name{role}/tag&lt;/span&gt;&lt;/tt&gt;) it
is useful to keep the punctuation that indicates that part (so, &lt;tt class="docutils literal"&gt;type:&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;(domain)&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;name&lt;/tt&gt; (no punctuation!), &lt;tt class="docutils literal"&gt;{role}&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;/tag&lt;/tt&gt;).&lt;/p&gt;
&lt;p&gt;Remember that, in the current scheme of things, only &lt;tt class="docutils literal"&gt;package:&lt;/tt&gt; labels use
&lt;tt class="docutils literal"&gt;{role}&lt;/tt&gt;, and &amp;quot;normal&amp;quot; builds do not use &lt;tt class="docutils literal"&gt;(domain)&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;In this document I use the command &lt;tt class="docutils literal"&gt;m3&lt;/tt&gt; instead of &lt;tt class="docutils literal"&gt;muddle&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The simple reason for this is that I made the examples using the version of
muddle I'm currently working on, the &lt;tt class="docutils literal"&gt;muddle3_labels&lt;/tt&gt; (&amp;quot;labels all the way
down&amp;quot;) development branch, and I'm using &lt;tt class="docutils literal"&gt;m3&lt;/tt&gt; to distinguish it from the
&amp;quot;normal&amp;quot; &lt;tt class="docutils literal"&gt;muddle&lt;/tt&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(For the purposes of these examples this should not matter, as the
functionality is substantially the same, although the output of some of
the commands may be slightly different.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, it is also a useful reminder that the muddle command need not be
called &lt;tt class="docutils literal"&gt;muddle&lt;/tt&gt;. This is particularly important to remember when writing
makefiles that call back to muddle - they should use &lt;tt class="docutils literal"&gt;$(shell $(MUDDLE)
&lt;span class="pre"&gt;...)&lt;/span&gt;&lt;/tt&gt; rather than the tempting &lt;tt class="docutils literal"&gt;$(shell muddle &lt;span class="pre"&gt;...)&lt;/span&gt;&lt;/tt&gt;, for that very
reason.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="an-overview-of-the-directory-structure"&gt;
&lt;h1&gt;&lt;a class="toc-backref" href="#id3"&gt;An overview of the directory structure&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Normal practice is to keep a muddle build in its own directory. This is not a
requirement, but it helps keep it more obvious that it &lt;em&gt;is&lt;/em&gt; a build.&lt;/p&gt;
&lt;p&gt;The muddle directories are as follows:&lt;/p&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.muddle/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;contains information about the build state, and signifies that this &lt;em&gt;is&lt;/em&gt; a
muddle build.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;src/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;contains the build description and any other checkouts.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;obj/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;generated by muddle to hold the results of building packages.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;install/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;generated by muddle to hold the results of &amp;quot;installing&amp;quot; packages (this will
be explained later on).&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;deploy/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;generated by muddle to hold the results of &amp;quot;deploying&amp;quot; things in
&lt;tt class="docutils literal"&gt;install/&lt;/tt&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;versions/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;generated by muddle to hold the result of &lt;tt class="docutils literal"&gt;muddle stamp version&lt;/tt&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;domains/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;present if there are sub-domains, muddle will create this directory if it is needed.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;instructions/&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;present if there are instruction files for use in deployment. muddle will
create this directory if it is needed.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;am_subdomain&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;generated by muddle in subdomains. Ignore it.&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-6617964611727664637?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/6617964611727664637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/6617964611727664637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/6617964611727664637'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/muddle-and-its-directories-part-1.html' title='muddle and its directories - part 1 - introduction'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7895442702094075989</id><published>2010-09-27T16:17:00.001+01:00</published><updated>2010-09-27T16:24:04.794+01:00</updated><title type='text'>Some notes on cross-compiling in a muddled world</title><content type='html'>&lt;p&gt;Obviously one of the main aims of developing muddle has been to make it easier
to build cross-compiled systems, since that's what I spend a lot of my time
doing.&lt;/p&gt;
&lt;p&gt;Lately I've been taking a DEB-based build and turning it into a source-based
build. This article is some notes on things I've learnt (or had reinforced) in
the process.&lt;/p&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="makefiles"&gt;
&lt;h1&gt;Makefiles&lt;/h1&gt;
&lt;p&gt;For the purpose of this post, I'm specifically talking about use of GNU make -
other make programs may have different requirements (and portability between
make programs is a different issue).&lt;/p&gt;
&lt;p&gt;So, some tips for making makefiles that will play well with muddle (whether
they are &lt;tt class="docutils literal"&gt;Makefile.muddle&lt;/tt&gt; files, called directly by muddle itself, or new
makefiles for a particular project).&lt;/p&gt;
&lt;div class="section" id="additive-assignment"&gt;
&lt;h2&gt;Additive assignment&lt;/h2&gt;
&lt;p&gt;Always use &lt;tt class="docutils literal"&gt;CFLAGS+=&lt;/tt&gt; and not &lt;tt class="docutils literal"&gt;CFLAGS=&lt;/tt&gt; in your makefile (and similarly
for other variables that may be inherited from &amp;quot;outside&amp;quot;, such as
&lt;tt class="docutils literal"&gt;LDFLAGS&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;CPPFLAGS&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;CXXFLAGS&lt;/tt&gt;).&lt;/p&gt;
&lt;p&gt;Consider as an example if the makefile does not specify &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-Wall&lt;/span&gt;&lt;/tt&gt; in its C
flags, but the user wishes to do so. If the makefile sets:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
CFLAGS = -Iinclude -o2
&lt;/pre&gt;
&lt;p&gt;then this is difficult, but if instead the makefile does:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
CFLAGS += -Iinclude -o2
&lt;/pre&gt;
&lt;p&gt;then the caller can safely add their own flag(s).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="don-t-be-overspecific"&gt;
&lt;h2&gt;Don't be overspecific&lt;/h2&gt;
&lt;p&gt;For somewhate similar reasons, never, ever actually set &lt;tt class="docutils literal"&gt;CC&lt;/tt&gt; and its ilk
in the Makefile.&lt;/p&gt;
&lt;p&gt;Too often, the developer of a system may need to do the equivalent of:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
CC = &amp;quot;gcc -m32&amp;quot;
&lt;/pre&gt;
&lt;p&gt;or even:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
LD=$(CC)
&lt;/pre&gt;
&lt;p&gt;Whilst there are ways of overriding &lt;tt class="docutils literal"&gt;CC=xxx&lt;/tt&gt; settings in the makefile,
these are unobvious, and if the setting was &lt;em&gt;amending&lt;/em&gt; the value (i.e., if
the makefile itself did &lt;tt class="docutils literal"&gt;CC=gcc &lt;span class="pre"&gt;-m32&lt;/span&gt;&lt;/tt&gt;) then it is bound to go wrong...&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="immediate-versus-deferred"&gt;
&lt;h2&gt;Immediate versus deferred&lt;/h2&gt;
&lt;p&gt;Remember the difference (we're assuming GNU make) between &lt;tt class="docutils literal"&gt;=&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;:=&lt;/tt&gt;,
and which one will get evaluated multiple times and thus slow things down.&lt;/p&gt;
&lt;p&gt;Specifically, if you're going to do:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
PKG_OBJDIR := $(shell $(MUDDLE) query objdir package:pkg{role}/built)
&lt;/pre&gt;
&lt;p&gt;then it is worth knowing that &lt;tt class="docutils literal"&gt;:=&lt;/tt&gt; will evaluate this once, and &lt;tt class="docutils literal"&gt;=&lt;/tt&gt; will
cause it to be evaluated each time &lt;tt class="docutils literal"&gt;$(PKG_OBJDIR)&lt;/tt&gt; is used. Clearly, we
assume that a package's objdir is not going to change, and we would rather
not run the muddle command line program multiple times if we don't need to.&lt;/p&gt;
&lt;p&gt;(Here I recommend reading the GNU make documentation, which can be found at
&lt;a class="reference external" href="http://www.gnu.org/software/make/manual/make.html"&gt;http://www.gnu.org/software/make/manual/make.html&lt;/a&gt;. Look up &amp;quot;immediate&amp;quot;
versus &amp;quot;deferred&amp;quot; expansion.)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="muddle-not-muddle"&gt;
&lt;h2&gt;$(MUDDLE), not muddle&lt;/h2&gt;
&lt;p&gt;Speaking of which, in a muddle-based world, &lt;em&gt;always&lt;/em&gt; use &lt;tt class="docutils literal"&gt;$(MUDDLE)&lt;/tt&gt; in a
makefile, instead of an explicit &lt;tt class="docutils literal"&gt;muddle&lt;/tt&gt;. muddle itself sets this
environment variable to the muddle command-line program, which may not
actually be called muddle (in my muddle3 development environment, I use
&lt;tt class="docutils literal"&gt;m3&lt;/tt&gt;), and also may not be on the PATH.&lt;/p&gt;
&lt;blockquote&gt;
(This is similar to the strong recommendation to always say &lt;tt class="docutils literal"&gt;$(MAKE)&lt;/tt&gt;
instead of &lt;tt class="docutils literal"&gt;make&lt;/tt&gt;, although this latter carries more implications of
what happens to your environment than is the case with muddle.)&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="the-evils-of-target-arch"&gt;
&lt;h2&gt;The evils of TARGET_ARCH&lt;/h2&gt;
&lt;p&gt;And finally, don't try to use an environment variable called &amp;quot;TARGET_ARCH&amp;quot;.&lt;/p&gt;
&lt;p&gt;If &lt;tt class="docutils literal"&gt;$(TARGET_ARCH)&lt;/tt&gt; has a value, then GNU make will insert it onto the
&lt;tt class="docutils literal"&gt;$(CC)&lt;/tt&gt; command line (and maybe other comamnd lines, as well).
This is not documented behaviour (it is not mentioned in the above
referenced manual), although one can find out about it by searching the net.
It looks as if it is expecting this to be some sort of flags for the
compilation (so it &lt;em&gt;should&lt;/em&gt; be called &lt;tt class="docutils literal"&gt;TARGET_ARCH_FLAGS&lt;/tt&gt;), but no-one
seems to know or remember why it was introduced.&lt;/p&gt;
&lt;p&gt;In fact, GNU make treats a lot of environment variables specially, many of
which are not documented. You can use:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
make -p
&lt;/pre&gt;
&lt;p&gt;to get a listing of these, as well as the actual implicit rules used (for
&lt;tt class="docutils literal"&gt;$(CC)&lt;/tt&gt; command lines, etc.), allowing one to determine where
&lt;tt class="docutils literal"&gt;$(TARGET_ARCH)&lt;/tt&gt; might actually be used.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="random-other-notes"&gt;
&lt;h1&gt;Random other notes&lt;/h1&gt;
&lt;div class="section" id="libicu"&gt;
&lt;h2&gt;libicu&lt;/h2&gt;
&lt;p&gt;Many packages and libraries are difficult to build with cross-compilation -
it's not something best served by the autotools framework, and it's not
something that most package builders will have needed to worry about.&lt;/p&gt;
&lt;p&gt;There are exceptions, however, and one of the nicest may be &lt;tt class="docutils literal"&gt;libicu&lt;/tt&gt;
(&lt;tt class="docutils literal"&gt;libicu4c&lt;/tt&gt;, from &lt;a class="reference external" href="http://site.icu-project.org/"&gt;http://site.icu-project.org/&lt;/a&gt;).
Its documentation clearly explains how to cross-compile it (basically, build
it once on the host, and then use that host build as an enabler for building
for the target), and the mechanism to do the building works well.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="assembler-c-and-underscores"&gt;
&lt;h2&gt;Assembler, C and underscores&lt;/h2&gt;
&lt;p&gt;Various mechanisms need to know whether external C symbols need an extra
underscore (&lt;tt class="docutils literal"&gt;_&lt;/tt&gt;) prepending for use from assembler. &lt;tt class="docutils literal"&gt;configure&lt;/tt&gt; can't
decide this, because it wants to do it by trying to build and run a program
(which won't work for cross compilation!). In the better packages, it just
refuses to guess, and tells the user to find out and define a value to let it
know. In the less helpful packages, it silently defaults to one choice or the
other.&lt;/p&gt;
&lt;p&gt;The former choice is a pain, but clearly the correct thing to do.&lt;/p&gt;
&lt;p&gt;The latter choice, found, for instance, in &lt;tt class="docutils literal"&gt;libgcrypt11&lt;/tt&gt;, is unhelpful. In this
particular instance, if it can't tell (because it is cross compiling) it
defaults to &amp;quot;yes&amp;quot;, which was the wrong choice. This took a while to debug.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="gcc-as-linker"&gt;
&lt;h2&gt;gcc as linker&lt;/h2&gt;
&lt;p&gt;It is an advantage to use &lt;tt class="docutils literal"&gt;gcc&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;g++&lt;/tt&gt; as the linker program
(&lt;tt class="docutils literal"&gt;$(LD)&lt;/tt&gt;), because they implicitly know where their libraries are. Some
packages insist on using &lt;tt class="docutils literal"&gt;ld&lt;/tt&gt; instead, which does not.&lt;/p&gt;
&lt;p&gt;One package tried to decide a value by parsing the output of &lt;tt class="docutils literal"&gt;ld&lt;/tt&gt;'s &amp;quot;help&amp;quot;
output, which failed in various ways.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="muddle-and-pkg-config"&gt;
&lt;h2&gt;muddle and pkg-config&lt;/h2&gt;
&lt;p&gt;Whilst I may grumble about autotools in general, it should be noted that
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;pkg-config&lt;/span&gt;&lt;/tt&gt; does not seem to be too great a problem, as it is quite
possible to amend the text files it uses to describe libraries.&lt;/p&gt;
&lt;p&gt;muddle does this quite well, but only if you tell it (via the appropriate
arguments to &lt;tt class="docutils literal"&gt;make.twolevel()&lt;/tt&gt; or whatever) that this should be done.
In the current version of muddle, this means specifying the
&lt;tt class="docutils literal"&gt;rewriteAutoconf&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;usesAutoconf&lt;/tt&gt; arguments as &lt;tt class="docutils literal"&gt;True&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="libtool-grumbles"&gt;
&lt;h2&gt;libtool grumbles&lt;/h2&gt;
&lt;p&gt;libtool itself may or may not be so bad, but when it is used without
consideration for future cross-compilation, it can be a real problem.&lt;/p&gt;
&lt;p&gt;For the moment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;BAD packages that insist on putting &lt;tt class="docutils literal"&gt;/lib&lt;/tt&gt; on the library search path
explicitly. Bad libtools for not handling this. There &lt;em&gt;may&lt;/em&gt; be a fix round
the corner, but of course this will never appear in many packages, since
they will not be updating their autotools setup...&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The whole libtool and &lt;tt class="docutils literal"&gt;can't install to library ending with&lt;/tt&gt; problem,
which is a bug in design, and I've still not figure out how to fix in any
clean way...&lt;/p&gt;
&lt;p&gt;(if you haven't come across this, it's a particular problem for some
gstreamer plugins, and seems in the short term to be a show-stopper)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7895442702094075989?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7895442702094075989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/09/some-notes-on-cross-compiling-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7895442702094075989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7895442702094075989'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/09/some-notes-on-cross-compiling-in.html' title='Some notes on cross-compiling in a muddled world'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7078179762714284583</id><published>2010-06-08T13:30:00.000+01:00</published><updated>2010-06-08T13:30:38.429+01:00</updated><title type='text'>We shall be at EuroPython 2010</title><content type='html'>Both Richard and I are giving talks at &lt;a href="http://www.europython.eu/"&gt;EuroPython 2010&lt;/a&gt;&amp;nbsp;in Birmingham. Richard will be talking about muddle, and I shall be talking about Kbus, starting (as currently scheduled) at 17:00 on the afternoon of Monday 19th July.&lt;br /&gt;
&lt;br /&gt;
I'm intending to be at the conference all four days (Monday through Thursday), whilst Richard may only be there on Monday.&lt;br /&gt;
&lt;br /&gt;
Hope to see you there...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7078179762714284583?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7078179762714284583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/06/we-shall-be-at-europython-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7078179762714284583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7078179762714284583'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/06/we-shall-be-at-europython-2010.html' title='We shall be at EuroPython 2010'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-1927089834628287469</id><published>2010-04-25T15:45:00.006+01:00</published><updated>2010-04-25T16:18:49.304+01:00</updated><title type='text'>Interesting times for OTT video</title><content type='html'>&lt;p&gt;So it looks as though we're about to be living in interesting times for OTT video.&lt;/p&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;p&gt;Apple and Adobe seem to be having a spat over Flash; specifically, over Adobe's irresistable force of content vs Apple's immovable object of control. A side-effect of this is likely to be that the long-awaited Flash 10.1 for devices will end up on Android first.&lt;/p&gt;

&lt;p&gt;This is going to be a bit of a pain for a lot of people; STB manufacturers will need to end up either embedding an X server (for the Linux version) or running Android (for the android version) and neither of those is a good plan - X is big and wastes cycles, and more importantly is terribly buggy for a TV-grade product. Android is small and efficient but entirely convinced that it is a mobile phone and it's very hard to dissuade it from thinking so. I'm thinking that the best way around this at the moment is to run their userlands side-by-side, but it's not a pretty best way around. Hopefully most people will buy their way out via startups like &lt;a href="http://www.vidiactive.com"&gt;Vidiactive&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;In other news, &lt;a href="http://www.theora.org/"&gt;Theora&lt;/a&gt; for HTML5 video seems not to be about to go away, and Google are rumoured to be releasing VP8 next month, whilst the MPEG seem to be pressing ahead with their &lt;a href="http://www.h265.net/"&gt;H.265&lt;/a&gt; effort.&lt;/p&gt;

&lt;p&gt;Contrary to rumour, Theora and VP8 should not be the performance killers they're generally supposed to be, except on legacy systems. Owners of ST710x s are probably hosed, but both codecs are designed to be fast on general-purpose CPUs so the current generation of chips should be perfectly happy with SD VP8. HD will probably require either a GPU or a programmable video accelerator - On2 used to claim on their website that they could get 720p VP8 decode out of a 1.5GHz ARMv5, so I'm betting an OMAP3730 should be able to get D1 out of its ARM and 720p if you split decode between the cores: Theora 360p decode pretty much works on an N900.&lt;/p&gt;

&lt;p&gt;There are, of course, three elephants in the room&lt;/p&gt;

&lt;p&gt;The first is adoption: I think in practice we're going to see the world move over to VP8/Vorbis and HTML5 video over the next few years. Flash is just too nasty, big and expensive to survive - particularly since the spec seems to just keep growing. This is not necessarily bad news for Adobe: they've never monetised the Flash client and it is frankly just a drain on their development resources that they can happily live without.&lt;/p&gt;

&lt;p&gt;The second is audio: Little-known fact - you don't have to pay royalties for streaming H.264 over the internet but the same is not true of any of the popular audio formats: MP3, AAC and AC3 royalty rates are all much larger than the $0.10/unit H.264 royalty - which in any case only applies if you ship more than 5k units or so of a decoder - and none of them allow you to stream their audio over the network for free, though they're obviously waiting to see how things pan out before asserting their rights. From a royalty regime point of view it's much more important to replace AC3 and MP3 with Vorbis than it is to replace HTML5 with Theora. Particularly since the MP3 licensors, in particular, are apt to charge punitive rates to implementations which take other formats too - this being one reason why IPTV broadcasts generally avoid mp3.&lt;/p&gt;

&lt;p&gt;The third is, of course, content access. YouTube in particular has been notable in taking a traditional-media attitude to online video: they'll talk to you, if you have 1m subscribers. If you don't, you don't get their content.&lt;/p&gt;

&lt;p&gt;Hopefully, media providers like the BBC and YouTube will take a liberal position and realise that all they need for monetisation is some compliance provisions, such as are already in place with WMDRM. Otherwise, we'll be in for the usual content-access fight as the providers attempt to leverage their content to control the market in decoding devices, hosing consumers in the process. This never works, but it doesn't seem to stop people from trying.&lt;/p&gt;

&lt;p&gt;One thing that would help free formats' cause here is an open-source DRM system. The idea isn't a contradiction in terms - there is no reason why you shouldn't 'voluntarily' lock down your STB so as to prevent you from taking digital copies of media without compromising the freedom of the rest of the system, and it is certainly better to have a free, open standard for DRM than to either lock all worthwhile content behind expensive, proprietory technology or to allow unrestricted piracy.&lt;/p&gt;

&lt;p&gt;If we're lucky, google checkout/paypal and some smarts from the content providers should see micropayment VoD actually bear fruit. I remember going to a seminar about that in 1993.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-1927089834628287469?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/1927089834628287469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/04/interesting-times-for-ott-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1927089834628287469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1927089834628287469'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/04/interesting-times-for-ott-video.html' title='Interesting times for OTT video'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7207910266774701465</id><published>2010-03-25T20:31:00.001Z</published><updated>2010-03-25T20:31:32.973Z</updated><title type='text'>Why KBUS?</title><content type='html'>&lt;p&gt;So why are we developing KBUS, rather than using some other messaging system?&lt;/p&gt;
&lt;blockquote&gt;
(I'm going to assume you've seen the previous blog items on KBUS, and/or
read the KBUS documentation on its Google code page.)&lt;/blockquote&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;div class="section" id="our-background"&gt;
&lt;h1&gt;Our background&lt;/h1&gt;
&lt;p&gt;We work primarily in the embedded world, specifically on Set-Top Boxes (STBs).
As such, typical software elements include video and audio decoders (or the
interfaces to them, if this is done by hardware), user interface via remote
control or keyboard, and some form of GUI, typically a web browser.&lt;/p&gt;
&lt;p&gt;Clearly, some mechanism is required to provide communication between all of
these elements.&lt;/p&gt;
&lt;p&gt;We have had experience of bad solutions in the past - their flaws include such
things as race conditions (for instance, when a browser crashes, it cannot
reliably resume communication with the other processes it needs to liaise
with), unreliable implementations (frustrating when one is not allowed to fix
them) and poor documentation (well, some of that was fixable).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="aims"&gt;
&lt;h1&gt;Aims&lt;/h1&gt;
&lt;p&gt;We thus set out with the following aims for our solution:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Simple models to &amp;quot;think with&amp;quot;, so that we can have a well understood system.&lt;/li&gt;
&lt;li&gt;Predictable delivery.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Always&lt;/em&gt; get a reply to a request.&lt;/li&gt;
&lt;li&gt;Messages (on a particular bus) are in the same order for all recipients.&lt;/li&gt;
&lt;li&gt;Small implementation size.&lt;/li&gt;
&lt;li&gt;Base code available in C (C++, for instance, is not always available on the
platforms we work with).&lt;/li&gt;
&lt;li&gt;Good usability from Python (well, that was my requirement)&lt;/li&gt;
&lt;li&gt;We'd really prefer an open source package, and we definitely want one that
is actively maintained.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and that didn't really seem to leave us with an option other than writing it
ourselves.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="simple-models"&gt;
&lt;h1&gt;Simple models&lt;/h1&gt;
&lt;div class="section" id="names-for-things"&gt;
&lt;h2&gt;Names for things&lt;/h2&gt;
&lt;p&gt;We've striven for simple names for things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;KBUS devices are the buses over which communication happens.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Ksocks are the connections to those buses. The name is meant to suggest they
are a bit like sockets, but not quite.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(I'm not actually terribly happy with &amp;quot;Ksock&amp;quot;, but it's difficult to
come up with good names for things, and it's better than the working
name of &amp;quot;Elephant&amp;quot; that I was using for a short while in early
development.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The basic messaging entities are Senders, Listeners and Repliers - one
should already be able to guess what they do.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The basic types of messages are Announcements, Requests, Replies - again,
these should be fairly obvious.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Message names are defined fairly simply, with (we hope) just enough
flexibility, and the parts of a message (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;to&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;from&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;in_reply_to&lt;/span&gt;&lt;/tt&gt;, etc.) are hopefully not too hard to understand from their
names.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;I'm sorry about Limpets.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="interfaces"&gt;
&lt;h2&gt;Interfaces&lt;/h2&gt;
&lt;p&gt;There are three levels of interface provided:&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;The &amp;quot;bare Unix&amp;quot; level.&lt;/p&gt;
&lt;p&gt;We use a kernel module to provide our devices, which are named as
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;/dev/kbus0&lt;/span&gt;&lt;/tt&gt; (for bus 0), &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;/dev/kbus1&lt;/span&gt;&lt;/tt&gt; (for bus 1), and so on.&lt;/p&gt;
&lt;p&gt;Ksocks are then implemented with file operations - &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;open&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;read&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;write&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;close&lt;/span&gt;&lt;/tt&gt; and IOCTLs), with which experienced Unix programmers
should already be familiar,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The Python API. This was written as the primary testing API, and works with
classes that match the main named things. I believe this to be fairly easy
to use. I also use it as the main way of illustrating how KBUS works.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The C library. This hides the details of the &amp;quot;bare Unix&amp;quot; level, and also
removes the worry about handling such things as &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;ernno&lt;/span&gt;&lt;/tt&gt; when using
IOTCLs. It is intended to be the normal means of using KBUS from C, and
should also be useful when writing interfaces in other languages (which can
typically call C).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class="section" id="the-kbus-kernel-module"&gt;
&lt;h2&gt;The KBUS kernel module&lt;/h2&gt;
&lt;p&gt;Using a kernel module means that:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;We can have a file interface, which makes KBUS easier to use.&lt;/li&gt;
&lt;li&gt;We can have a real expectation of our &amp;quot;daemon&amp;quot; not crashing (it is much
easier to write a kernel module that is reliable, partly because there are
so many constraints on how one does it, partly because one is executing in a
different context, and partly because kernel mechanisms mediate the modules
interaction with user space).&lt;/li&gt;
&lt;li&gt;We get to use relatively sophisticated and proven datastructures. Kernel
modules are expected to use the provided mechanisms for handling lists
and other datatypes. This avoids a lot of reinventing the wheel, or
dependency on other libraries which might not be present.&lt;/li&gt;
&lt;li&gt;The kernel hides a lot of the complicated stuff (both at the top and bottom
level) from us, so we can't do it wrong (well, it's much harder). For
instance, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;read&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;write&lt;/span&gt;&lt;/tt&gt; at the user level get filtered down into
more predictable calls at the kernel module level.&lt;/li&gt;
&lt;li&gt;We stand to gain from the kernel handling such issues as multiple CPUs,
threading and so on.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="messages"&gt;
&lt;h2&gt;Messages&lt;/h2&gt;
&lt;p&gt;In order to keep KBUS itself simple, KBUS does not say anything about the
message content. It restricts itself to defining the message header and the
mechanisms for managing messages.&lt;/p&gt;
&lt;blockquote&gt;
(We do have a nearly finished ASN.1 library for message data, and are
looking at XMPP support, but these will be extras, not core KBUS. And,
of course, one can use other mechanisms as one wishes.)&lt;/blockquote&gt;
&lt;p&gt;As indicated in the section on naming, the fields in the header aim to be easy
to understand, and we try to define &lt;em&gt;just&lt;/em&gt; the fields we need.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="predictable-delivery"&gt;
&lt;h1&gt;Predictable delivery&lt;/h1&gt;
&lt;p&gt;It is acceptable for a Listener to miss messages (although there are ways around
that), but a Replier shall never miss the Requests sent to it.&lt;/p&gt;
&lt;p&gt;We also want to guarantee that each Request shall produce a Reply (even if it
is a Reply indicating failure to deliver the Request).&lt;/p&gt;
&lt;p&gt;So:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;If a sender attempts to send a Request, but does not have room on its
message queue for the (corresponding) Reply, then the message will not be
sent, and the send will fail. At the &amp;quot;bare Unix&amp;quot; level, this means that the
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;send&lt;/span&gt;&lt;/tt&gt; IOCTL returns an error - the failure is immediate.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If a replier cannot receive a particular message, because its queue is full,
then the message will not be sent, and the send will fail with an error.
Again, this failure is immediate.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If a message has the ALL_OR_FAIL flag set, then a send will only succeed if
the message could be added to all the (intended) recipient’s message
queues (listeners as well).  Otherwise, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;send&lt;/span&gt;&lt;/tt&gt; returns -EBUSY.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If a message has the ALL_OR_WAIT flag set, then a send will only succeed if
the message could be added to all the (intended) recipient’s message
queues (listeners as well).  Otherwise &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;send&lt;/span&gt;&lt;/tt&gt; returns -EAGAIN.&lt;/p&gt;
&lt;p&gt;(The sender then needs to discard the message, or play the
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;poll&lt;/span&gt;&lt;/tt&gt;/&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;select&lt;/span&gt;&lt;/tt&gt; game to wait for the send to finish).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that we believe these last two mechanisms are primarily of use when
debugging systems.&lt;/p&gt;
&lt;p&gt;Finally:&lt;/p&gt;
&lt;blockquote&gt;
&amp;quot;&amp;quot;&amp;quot;KBUS guarantees that each Request will (eventually) be matched by a
consequent Reply (or Status) message, and only one such.&amp;quot;&amp;quot;&amp;quot;&lt;/blockquote&gt;
&lt;p&gt;If the replier can't give a Reply, KBUS will generate one (e.g.,
&amp;quot;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.KBUS.Replier.Unbound&lt;/span&gt;&lt;/tt&gt;&amp;quot; or &amp;quot;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.KBUS.ReplierGoneAway&lt;/span&gt;&lt;/tt&gt;&amp;quot;).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="message-order-is-the-same-for-all"&gt;
&lt;h1&gt;Message order is the same for all&lt;/h1&gt;
&lt;p&gt;It is important that if sender A sends message M(a), and sender B sends
message M(b), then all recipients of both messages will see them in the same
order.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;(Imagine sending instructions to a video decoder and a video recorder.
Clearly both may need to receive the same instructions, and it is
important to receive the instructions in the appropriate order.&lt;/p&gt;
&lt;p&gt;Similarly, consider a logging Listener. This too clearly wants to receive
messages in the same order as the other Listeners. It especially wants to
see Requests and Replies in the appropriate order.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Since KBUS (the kernel module) has control over both ends of the transactions,
this is fairly simple to guarantee.&lt;/p&gt;
&lt;!-- Are we Pythonic yet?
- - - - - - - - - - - - - - - - - - - -
Well, it's an aim. For quick amusement, we can look at the Zen of Python and
try to see how we're doing:

::

  &gt;&gt;&gt; import this
  Beautiful is better than ugly.

I can't really judge that, as I'm too close!

::

  Explicit is better than implicit.
  Simple is better than complex.
  Complex is better than complicated.

Messaging is complex, we try not to make it complicated to do.

We also try to implement only what we need, not "other stuff that might be
useful".

::

  Flat is better than nested.

I think KBUS is a "flat" system.

::

  Sparse is better than dense.

OK... not sure how that applies.

::

  Readability counts.

Again, you'll have to judge - I hope we're making a system that helps provide
readable code.

::

  Special cases aren't special enough to break the rules.
  Although practicality beats purity.

That's a difficult balance to judge - we're trying.

::

  Errors should never pass silently.
  Unless explicitly silenced.

These definitely *are* KBUS aims.

::

  In the face of ambiguity, refuse the temptation to guess.
  There should be one- - and preferably only one - -obvious way to do it.
  Although that way may not be obvious at first unless you're Dutch.
  Now is better than never.
  Although never is often better than *right* now.

Hmm.

::

  If the implementation is hard to explain, it's a bad idea.
  If the implementation is easy to explain, it may be a good idea.

These apply - I hope we're getting the balance right.

::

  Namespaces are one honking great idea - - let's do more of those!

Erm...  KBUS appears to be noticeably lacking in the namespaces arena. --&gt;
&lt;/div&gt;
&lt;div class="section" id="why-not-use"&gt;
&lt;h1&gt;Why not use?&lt;/h1&gt;
&lt;p&gt;What else could we have used?&lt;/p&gt;
&lt;p&gt;There appear to be two main things we could have considered, DBUS and zeromq.&lt;/p&gt;
&lt;div class="section" id="dbus"&gt;
&lt;h2&gt;DBUS&lt;/h2&gt;
&lt;p&gt;I've not spent an awful lot of time looking at DBUS, but my initial thoughts
are that:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;I don't understand it. Its documentation seems to show an over complex
model, with no quick way in to understanding it, and a wish to split things
into as many levels as possible.&lt;/li&gt;
&lt;li&gt;It is socket oriented (not a kernel module), which is probably the best
approach for a user-space daemon, but&lt;/li&gt;
&lt;li&gt;it is in user-space, with the problems that can entail.&lt;/li&gt;
&lt;li&gt;I am told it is not all reliable...&lt;/li&gt;
&lt;li&gt;...or even all implemented&lt;/li&gt;
&lt;li&gt;Perhaps most importantly, it doesn't preserve message ordering.&lt;/li&gt;
&lt;li&gt;It is large.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But it is widely used (hmm) and has been around quite a while.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="zeromq-0mq"&gt;
&lt;h2&gt;zeromq / 0mq&lt;/h2&gt;
&lt;p&gt;zeromq (or 0mq) looks rather nice. It has good introductions, and seems to
have a clear idea of what its aims are, in particular aiming for speed
and scalability.&lt;/p&gt;
&lt;p&gt;Its messages are minimalistic in strucure (a name and then content), which is
really rather nice. It is also very cross platform, both in the &amp;quot;implemented
on&amp;quot; sense, and in the &amp;quot;available for language X&amp;quot; sense.&lt;/p&gt;
&lt;p&gt;It doesn't appear to b e aiming for the sort of &amp;quot;predicability&amp;quot; we're after
(or so I deduce from a scan of the documentation). And it is written in C++,
which rules it out for some prospective platforms.&lt;/p&gt;
&lt;p&gt;However, this looks like one it would be fun to play with, and I definitely need to
learn more about it.&lt;/p&gt;
&lt;blockquote&gt;
(It's very tempting to think about it as a potential means of moving KBUS
messages over networks, for instance.)&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="what-else"&gt;
&lt;h2&gt;What else?&lt;/h2&gt;
&lt;p&gt;I must have missed systems that I really should know about.&lt;/p&gt;
&lt;p&gt;(Although note I'm ignoring many &amp;quot;enterprise space&amp;quot; systems, which often do
seek guarantees of delivery, but at the cost of being an enterprise system.)&lt;/p&gt;
&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7207910266774701465?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7207910266774701465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/03/why-kbus.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7207910266774701465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7207910266774701465'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/03/why-kbus.html' title='Why KBUS?'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-1602921380774730180</id><published>2010-03-25T19:50:00.001Z</published><updated>2010-03-25T19:50:16.003Z</updated><title type='text'>Saving and restoring the state of a muddle build</title><content type='html'>&lt;p&gt;So over the last week or so I've been working on adding commands to muddle so
that we can store and restore &amp;quot;version&amp;quot; information for a build tree.&lt;/p&gt;
&lt;p&gt;The basic idea is to be able to save enough information to a file to allow
reconstructing the main build structure, and the content of every checkout.&lt;/p&gt;
&lt;p&gt;A build description doesn't necessarily suffice for this, firstly because you
don't actually have to specify a revision id for a particular checkout
(one can default to HEAD), and secondly because the user of a build might have
updated checkouts since the build description was first used to extract it.&lt;/p&gt;
&lt;p&gt;So, here is some documentation for the result (so far, at least).&lt;/p&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;p&gt;The following applies to muddle revision 317 and after. I do not
promise that details will not change (but I don't think they will).
I also assume there may be bugs.&lt;/p&gt;
&lt;p&gt;If you have comments/suggestions, please let me know.&lt;/p&gt;
&lt;div class="section" id="muddle-version-stamping"&gt;
&lt;h1&gt;Muddle version stamping&lt;/h1&gt;
&lt;div class="section" id="build-names"&gt;
&lt;h2&gt;Build names&lt;/h2&gt;
&lt;p&gt;First of all, it is now possible to give a (hopefully) meaningful name to a
build - for instance, one might call the project &amp;quot;Thing&amp;quot; build on Intel
'ProjectThing_Intel'.&lt;/p&gt;
&lt;p&gt;This is done by adding a &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;build_name&lt;/span&gt;&lt;/tt&gt; property to the Builder class. What this
means in practice is that in the build description you can now do:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
builder.build_name = 'ProjectThing_Intel'
&lt;/pre&gt;
&lt;p&gt;The name may only contain alphanumerics, underscores and hyphens.&lt;/p&gt;
&lt;p&gt;If no name is given, the name of the build description file (without the &amp;quot;.py&amp;quot;
extension) is used - so, for instance, the ProjectThing build might typically
default to being called '01'.&lt;/p&gt;
&lt;p&gt;Build names are intended to be more generic than the build description file
name - after all, one of our projects in particular has progressed from
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;01.py&lt;/span&gt;&lt;/tt&gt; to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;02.py&lt;/span&gt;&lt;/tt&gt; and may one day change again. It would make sense for
the build name to stay the same throughout, however.&lt;/p&gt;
&lt;blockquote&gt;
(Note that since the build name is set in the build description, it need
not necessarily be a constant - so one could conceive of automatically
naming 'ProjectThing_ARM' and 'ProjectThing_Intel' builds.)&lt;/blockquote&gt;
&lt;p&gt;You can find out the current build name with:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
muddle query name
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="stamp-files"&gt;
&lt;h2&gt;Stamp files&lt;/h2&gt;
&lt;p&gt;A stamp file is a description of a current build. Specifically, it describes
the overall build (root repository and description), the names of any domains
in the build, and a full description of each checkout used by the build.&lt;/p&gt;
&lt;p&gt;For each checkout, all of the information needed to retrieve exactly the
version in use (from its remote repository) is remembered.&lt;/p&gt;
&lt;p&gt;If any checkouts contain uncommitted data, or do not appear to match an exact
revision in their remote repository (in other words, if it appears that it
would not be possible to retrieve them as-is from the remote repository), then
the stamping process will warn the user, and will create a &amp;quot;partial&amp;quot; stamp
file (extension &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.partial&lt;/span&gt;&lt;/tt&gt;, instead of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.stamp&lt;/span&gt;&lt;/tt&gt;).&lt;/p&gt;
&lt;p&gt;Note the file is a simple text file (it's actually a Windows-style .INI file,
in fact), which means that it is possible to edit it with a text editor, if
wished.&lt;/p&gt;
&lt;p&gt;Muddle provides several commands for handling stamp files:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;save&lt;/span&gt;&lt;/tt&gt; creates a stamp file.&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;diff&lt;/span&gt;&lt;/tt&gt; compare two stamp files. (This could do with providing
the ability to compare with the current build, and also with a remote
stamp file - these should be fairly easy to add.)&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;unstamp&lt;/span&gt;&lt;/tt&gt; creates a build from a stamp file. It understands how to
retrieve a stamp file over the internet in various ways, as well as how to
use a local file.&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;restore&lt;/span&gt;&lt;/tt&gt; is a synonym for &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;unstamp&lt;/span&gt;&lt;/tt&gt; - it's not entirely
clear to me if &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;unstamp&lt;/span&gt;&lt;/tt&gt; would be better replaced with this alias, so
that all &amp;quot;stamp&amp;quot; related actions are subcommands of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt;&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;version&lt;/span&gt;&lt;/tt&gt; is a specialisation of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;save&lt;/span&gt;&lt;/tt&gt;. and is
discussed below.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="version-stamp-files"&gt;
&lt;h2&gt;Version stamp files&lt;/h2&gt;
&lt;p&gt;A new conventional muddle directory is introduced, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;versions/&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;This lives at the same level as &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.muddle/&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;domains/&lt;/span&gt;&lt;/tt&gt;, and is
covnentionally used to store version stamps.&lt;/p&gt;
&lt;p&gt;A version stamp is created with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;version&lt;/span&gt;&lt;/tt&gt;. It writes a stamp file
called &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;lt;build_name&amp;gt;.stamp&lt;/span&gt;&lt;/tt&gt; to the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;versions/&lt;/span&gt;&lt;/tt&gt; directory.&lt;/p&gt;
&lt;p&gt;The assumption is that one does &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;stamp&lt;/span&gt; &lt;span class="pre"&gt;version&lt;/span&gt;&lt;/tt&gt; to create a new
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;versions/&lt;/span&gt;&lt;/tt&gt; directory and put the (nicely named) stamp file there. One can then
commit this &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;versions/&lt;/span&gt;&lt;/tt&gt; directory to whatever repository one wishes, just as
is done for the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/builds/&lt;/span&gt;&lt;/tt&gt; directory.&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;unstamp&lt;/span&gt;&lt;/tt&gt; then understands how to do:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
muddle unstamp  bzr+ssh://kynesim.co.uk/repo  versions/ProjectThing.stamp
&lt;/pre&gt;
&lt;p&gt;to clone the directory &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;versions/&lt;/span&gt;&lt;/tt&gt; from
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;bzr+ssh://kynesim.co.uk/repo/versions&lt;/span&gt;&lt;/tt&gt;,
and then unstamp the stamp file indicated. This is deliberately very similar
to the way that &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt; &lt;span class="pre"&gt;init&lt;/span&gt;&lt;/tt&gt; works.&lt;/p&gt;
&lt;p&gt;A developer may also, of course, make copies of a version stamp file and
commit them - for instance:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
cd versions/
cp ProjectThing.stamp ProjectThing-v1_0.stamp
&lt;/pre&gt;
&lt;p&gt;The file must, however, still have extension &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.stamp&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="more-information"&gt;
&lt;h2&gt;More information&lt;/h2&gt;
&lt;p&gt;More information is available by doing:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
muddle help stamp
muddle help unstamp
&lt;/pre&gt;
&lt;div class="section" id="what-is-tested"&gt;
&lt;h3&gt;What is tested&lt;/h3&gt;
&lt;p&gt;I've tested stamping and unstamping with local stamp files.&lt;/p&gt;
&lt;p&gt;I've tested version stamping, and then unstamping with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;file+file://&lt;/span&gt;&lt;/tt&gt; URLs,
both direct to the stamp file and also via the &amp;quot;init-like&amp;quot; mechanism.&lt;/p&gt;
&lt;p&gt;I've tested version stamping, committing to a local BZR repository, and then
unstamping with a &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;file+bzr://&lt;/span&gt;&lt;/tt&gt; URL, both direct to the stamp file and via the
&amp;quot;init-like&amp;quot; mechanism.&lt;/p&gt;
&lt;p&gt;Subversion and git are not tested.&lt;/p&gt;
&lt;p&gt;Direct file unstamping is not supported for git (there seems to be no way to
&amp;quot;extract&amp;quot; a single file without doing a proper clone). I assume if one wishes
to do this one would use a URL provided by a webserver.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="with-thanks-to"&gt;
&lt;h3&gt;With thanks to&lt;/h3&gt;
&lt;p&gt;The Python library, and particularly to
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;#64;property&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;collections.MutableMapping&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;ConfigParser&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;difflib&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;hashlib&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;urllib&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;urlparse&lt;/span&gt;&lt;/tt&gt; and all the usual suspects.&lt;/p&gt;
&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-1602921380774730180?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/1602921380774730180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/03/saving-and-restoring-state-of-muddle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1602921380774730180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1602921380774730180'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/03/saving-and-restoring-state-of-muddle.html' title='Saving and restoring the state of a muddle build'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-7394743882376510848</id><published>2010-02-28T19:35:00.002Z</published><updated>2010-02-28T20:27:35.352Z</updated><title type='text'>KBUS Limpets - an introduction with goldfish</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;This is a metaphorical goldfish&amp;nbsp;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qx1s1TvxI/AAAAAAAAABU/G_iKTesQEXg/s1600-h/01_goldfish.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qx1s1TvxI/AAAAAAAAABU/G_iKTesQEXg/s320/01_goldfish.png" /&gt;&lt;/a&gt;called A.&lt;/div&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.blogger.com/post-create.g?blogID=5625827309301120857" name="more"&gt;&lt;/a&gt;&lt;br /&gt;
This is another metaphorical goldfish&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qx1s1TvxI/AAAAAAAAABU/G_iKTesQEXg/s1600-h/01_goldfish.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qx1s1TvxI/AAAAAAAAABU/G_iKTesQEXg/s320/01_goldfish.png" /&gt;&lt;/a&gt;called B.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;A and B live in a metaphorical goldfish bowl.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4qyjajyNHI/AAAAAAAAABc/YCJK3mm6b3M/s1600-h/02_bowl.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4qyjajyNHI/AAAAAAAAABc/YCJK3mm6b3M/s200/02_bowl.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Each metaphorical goldfish bowl has a KBUS device in it - this bowl has KBUS device 0:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qyr1FW1sI/AAAAAAAAABk/eHccQMadrAA/s1600-h/03_kbus_bowl.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qyr1FW1sI/AAAAAAAAABk/eHccQMadrAA/s200/03_kbus_bowl.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;Here are the two fish in their bowl.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4qzNgMpGwI/AAAAAAAAABs/3Yf4hOEGIVk/s1600-h/04_fish_in_bowl.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4qzNgMpGwI/AAAAAAAAABs/3Yf4hOEGIVk/s200/04_fish_in_bowl.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Metaphorical goldfish are simple creatures. They can only communicate with each other using KBUS messages.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_TVhZ4iJwUyk/S4q_d_gLb_I/AAAAAAAAAB0/ziey_fgfpeA/s1600-h/05_fish_talk.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://3.bp.blogspot.com/_TVhZ4iJwUyk/S4q_d_gLb_I/AAAAAAAAAB0/ziey_fgfpeA/s200/05_fish_talk.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Here is another metaphorical goldfish bowl. This one contains metaphorical goldfish called R and G. Their bowl has KBUS device 3.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4q_qZPMQsI/AAAAAAAAAB8/bPa5w9_l-Rg/s1600-h/04_fish_in_bowl2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4q_qZPMQsI/AAAAAAAAAB8/bPa5w9_l-Rg/s200/04_fish_in_bowl2.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Unfortunately, A and B cannot communicate with R and G. Even if the two metaphorical goldfish bowls are running on the same computer, KBUS does not permit sending KBUS messages between different KBUS devices.&lt;br /&gt;
&lt;br /&gt;
Luckily, KBUS provides Limpets.&lt;br /&gt;
&lt;br /&gt;
A Limpet lives on the side of a metaphorical goldfish bowl, and communicates with another Limpet on another metaphorical bowl.&lt;br /&gt;
&lt;br /&gt;
Here we have Limpet 1 connected to a Ksock on KBUS device 0, and Limpet 2 connected to a Ksock on KBUS device 3:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_TVhZ4iJwUyk/S4rAJhr6iHI/AAAAAAAAACM/o7uNsJpTZsU/s1600-h/06_limpet_pair.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_TVhZ4iJwUyk/S4rAJhr6iHI/AAAAAAAAACM/o7uNsJpTZsU/s320/06_limpet_pair.png" /&gt;&lt;/a&gt;&lt;/div&gt;Limpets always come in pairs. Each Limpet can proxy KBUS messages from the KBUS device in its metaphorical goldfish bowl to and from the other Limpet in its pair.&lt;br /&gt;
&lt;br /&gt;
Think of them as using very low power line-of-sight lasers to send messages between each other.&lt;br /&gt;
&lt;br /&gt;
So a pair of Limpets hide the fact that the two KBUS devices are not the same. This means that fish A and G can talk just as if they were in the same bowl:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4rAZ_cE0yI/AAAAAAAAACU/OaHeiKRLPTQ/s1600-h/07_A_talks_to_G.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_TVhZ4iJwUyk/S4rAZ_cE0yI/AAAAAAAAACU/OaHeiKRLPTQ/s320/07_A_talks_to_G.png" /&gt;&lt;/a&gt;&amp;nbsp; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;To the metaphorical goldfish, it is as if the messages magically pass between the two KBUS devices, and thus A and B can communicate with R and G.&lt;/div&gt;&lt;br /&gt;
This mechanism even allows such communication if there are intermediate bowls:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4rRWqBv5AI/AAAAAAAAACk/HOduP8Ed1Rk/s1600-h/08_3_bowls.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4rRWqBv5AI/AAAAAAAAACk/HOduP8Ed1Rk/s320/08_3_bowls.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;hr /&gt;A few more technical details. &lt;br /&gt;
&lt;br /&gt;
KBUS Limpets are currently experimental, and have not been extensively tested yet. Limpet daemons are available in Python and C (which intercommunicate happily).&lt;br /&gt;
&lt;br /&gt;
In order to keep Limpets and their implementation as simple as possible, we're willing to put up with some limitations:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;We use TCP/IP or named sockets to communicate between Limpets,&amp;nbsp; which means one Limpet in each pair has to be a server, and thus started up first.&lt;/li&gt;
&lt;li&gt;All Limpets on a connected network must have unique ids.&lt;/li&gt;
&lt;li&gt;Limpets may not be used to form a network with loops in it. This greatly simplifies message management.&lt;/li&gt;
&lt;li&gt;We assume a "safe" or trusted network - if it acts like a Limpet, it is a Limpet.&lt;/li&gt;
&lt;li&gt; Finally, one cannot connect both ends of a Limpet pair to the same KBUS device (the same KBUS device number on different computers is OK, of course).&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-7394743882376510848?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/7394743882376510848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/02/kbus-limpets-introduction-with-goldfish.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7394743882376510848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/7394743882376510848'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/02/kbus-limpets-introduction-with-goldfish.html' title='KBUS Limpets - an introduction with goldfish'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_TVhZ4iJwUyk/S4qx1s1TvxI/AAAAAAAAABU/G_iKTesQEXg/s72-c/01_goldfish.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3302882773242055784</id><published>2010-02-14T12:41:00.001Z</published><updated>2010-02-14T12:41:55.958Z</updated><title type='text'>A simple introduction to using KBUS</title><content type='html'>&lt;p&gt;This is intended as a very simple introduction to the basics of how to use
KBUS. As such, I'm sure I could improve it, but it's been waiting for long
enough now that I think I should publish it anyway.&lt;/p&gt;
&lt;a name='more'&gt;&lt;/a&gt;
&lt;p&gt;We shall start with a single &amp;quot;actor&amp;quot;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt; from kbus import *
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;I'm generally against doing an import of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;*&lt;/span&gt;&lt;/tt&gt;, but it's reasonably safe with
the KBUS python module, and it makes the tutorial shorter.&lt;/p&gt;
&lt;p&gt;First our actor needs to connect to KBUS itself, by opening a Ksock:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rosencrantz = Ksock(0)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This specifies which KBUS device to connect to. If KBUS is installed, then
device &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;0&lt;/span&gt;&lt;/tt&gt; will always exist, so it is a safe choice. The default is to open
the device for read and write - this makes sense since we will want to write
messages to it.&lt;/p&gt;
&lt;p&gt;Once we've done that, we can try sending a message:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; ahem = Message('$.Actor.Speak', 'Ahem')
&amp;gt;&amp;gt;&amp;gt; rosencrantz.send_msg(ahem)
MessageId(0, 1)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first line creates a new message named &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Actor.Speak&lt;/span&gt;&lt;/tt&gt;, with the
message data &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;quot;Ahem&amp;quot;&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;(All message names are composed of ``$`` followed by a series of
dot-separated parts.)&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;The second line sends it. For convenience, the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;send_msg&lt;/span&gt;&lt;/tt&gt; method also
returns the &lt;em&gt;message id&lt;/em&gt; assigned to the message by KBUS - this can be used
to identify a specific message.&lt;/p&gt;
&lt;p&gt;This will succeed, but doesn't do anything very useful, because no-one is
listening. So, we shall need a second process, which we shall start in a
new terminal.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt; from kbus import *
&amp;gt;&amp;gt;&amp;gt; audience = Ksock(0)
&amp;gt;&amp;gt;&amp;gt; audience.bind('$.Actor.Speak')
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here, the audience has opened the same KBUS device (messages cannot be sent
between different KBUS devices). We've still opened it for
write, since they might, for instance, want to be able to send &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Applause&lt;/span&gt;&lt;/tt&gt;
messages later on. They've then 'bound to' the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Actor.Speak&lt;/span&gt;&lt;/tt&gt; message,
which means they will receive any messages that are sent with that name.&lt;/p&gt;
&lt;blockquote&gt;
(In fact, all messages with that name sent by anyone, not just by
rosencrantz.)&lt;/blockquote&gt;
&lt;p&gt;Now, if rosencrantz speaks:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rosencrantz.send_msg(ahem)
MessageId(0, 2)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;the audience can listen:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; audience.read_next_msg()
Message('$.Actor.Speak', data='Ahem', from_=1L, id=MessageId(0,2))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;A friendlier representation of the message is given if one prints it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
 &amp;gt;&amp;gt;&amp;gt; print _
&amp;lt;Announcement '$.Actor.Speak', id=[0:2], from=1, data='Ahem'&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;quot;Plain&amp;quot; messages are also termed &amp;quot;announcements&amp;quot;, since they are just being
broadcast to whoever might be listening.&lt;/p&gt;
&lt;p&gt;Note that this shows that the message received has the same &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;MessageId&lt;/span&gt;&lt;/tt&gt; as
the message sent (which is good!).&lt;/p&gt;
&lt;p&gt;Of course, if the audience tries to listen again, they're not going to &amp;quot;hear&amp;quot;
anything new:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; message = audience.read_next_msg()
&amp;gt;&amp;gt;&amp;gt; print message
None
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and so they really need to set up a loop to wait for messages, something like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; import select
&amp;gt;&amp;gt;&amp;gt; while 1:
...    (r,w,x) = select.select([audience], [], [])
...    # At this point, r should contain audience
...    message = audience.read_next_msg()
...    print 'We heard', message.name, message.data
...
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;(although perhaps with more error checking, and maybe even a timeout, in a
real example).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So if rosencrantz speaks again:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rosencrantz.send_msg(Message('$.Actor.Speak', 'Hello there'))
MessageId(0, 3)
&amp;gt;&amp;gt;&amp;gt; rosencrantz.send_msg(Message('$.Actor.Speak', 'Can you hear me?'))
MessageId(0, 4)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;the audience should be able to hear him:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
We heard $.Actor.Speak Hello there
We heard $.Actor.Speak Can you hear me?
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So now we'll introduce another participant:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt; from kbus import *
&amp;gt;&amp;gt;&amp;gt; guildenstern = Ksock(0)
&amp;gt;&amp;gt;&amp;gt; guildenstern.bind('$.Actor.*')
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here, guildenstern is binding to any message whose name starts with
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Actor.&lt;/span&gt;&lt;/tt&gt;. In retrosepct this, of course, makes sense for the audience, too
- let's fix that:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;lt;CTRL-C&amp;gt;
Traceback (most recent call last):
  File &amp;quot;&amp;lt;stdin&amp;gt;&amp;quot;, line 3, in &amp;lt;module&amp;gt;
KeyboardInterrupt
&amp;gt;&amp;gt;&amp;gt; audience.bind('$.Actor.*')
&amp;gt;&amp;gt;&amp;gt; while 1:
...    msg = audience.wait_for_msg()
...    print 'We heard', msg.name, msg.data
...
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(as a convenience, the Ksock class provides the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;wait_for_msg()&lt;/span&gt;&lt;/tt&gt; wrapper
around &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;select.select&lt;/span&gt;&lt;/tt&gt;, which is shorter to type...).&lt;/p&gt;
&lt;p&gt;And maybe rosencrantz will want to hear his colleague:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rosencrantz.bind('$.Actor.*')
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So let guildenstern speak:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; guildenstern.send_msg(Message('$.Actor.Speak', 'Pssst!'))
MessageId(0, 5)
&amp;gt;&amp;gt;&amp;gt; # Remember guildenstern is also listening to '$.Actor.*'
&amp;gt;&amp;gt;&amp;gt; print guildenstern.read_next_msg()
&amp;lt;Announcement '$.Actor.Speak', id=[0:5], from=3, data='Pssst!'&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and rosencrantz hears:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; print rosencrantz.read_next_msg()
&amp;lt;Announcement '$.Actor.Speak', id=[0:5], from=3, data='Pssst!'&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, when we look to the audience, we see:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
We heard $.Actor.Speak Pssst!
We heard $.Actor.Speak Pssst!
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is because the audience has bound to the message twice - it is hearing it
once because it asked to receive every &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Actor.Speak&lt;/span&gt;&lt;/tt&gt; message, and again
because it asked to hear any message matching &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$.Actor.*&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The solution is simple - ask not to hear the more specific version:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;lt;CTRL-C&amp;gt;
Traceback (most recent call last):
  File &amp;quot;&amp;lt;stdin&amp;gt;&amp;quot;, line 3, in &amp;lt;module&amp;gt;
KeyboardInterrupt
&amp;gt;&amp;gt;&amp;gt; audience.unbind('$.Actor.Speak')
&amp;gt;&amp;gt;&amp;gt; while 1:
...    msg = audience.wait_for_msg()
...    print 'We heard', msg.from_, 'say', msg.name, msg.data
...
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that we've also amended the printout to say who the message was from.
Each Ksock connection has an id associated with it - for instance:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rosencrantz.ksock_id()
1L
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;and every message indicates who sent it, so:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; print 'I heard', message.from_, 'say', message.name, message.data
I heard 3 say $.Actor.Speak Pssst!
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;We've shown that KBUS allows one to &amp;quot;announce&amp;quot; (or, less politely,
&amp;quot;shout&amp;quot;) messages, but KBUS also supports asking questions. Thus:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; guildenstern.bind('$.Actor.Guildenstern.query', True)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;allows Guildenstern to bind to this new message name as a Replier.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;(Only one person may be bound as Replier for a particular message
name at any one time, so that it is unambiguous who is expected to do
the replying.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also, if a Sender tries to send a Request, but no-one has bound to that
message name as a Replier, then an error is raised (contrast that with
ordinary messages, where if no-one is listening, the message just gets
ignored).)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If Rosencrantz then sends a Request of that name:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; req = Request('$.Actor.Guildenstern.query', 'Were you speaking to me?')
&amp;gt;&amp;gt;&amp;gt; rosencrantz.send_msg(req)
MessageId(0, 6)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Guildenstern can receive it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; msg2 = guildenstern.read_next_msg()
&amp;gt;&amp;gt;&amp;gt; print 'I heard', msg2
I heard &amp;lt;Request '$.Actor.Guildenstern.query', id=[0:6], from=1, flags=0x3 (REQ,YOU), data='Were you speaking to me?'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; msg3 = guildenstern.read_next_msg()
&amp;gt;&amp;gt;&amp;gt; print msg3
&amp;lt;Request '$.Actor.Guildenstern.query', id=[0:6], from=1, flags=0x1 (REQ), data='Were you speaking to me?'&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;As we should expect, guildenstern is getting the message twice, once because
he has bound as a listener to '$.Actor.*', and once because he is bound as a
Replier to this specific message.&lt;/p&gt;
&lt;blockquote&gt;
&lt;em&gt;(There is, in fact, a way to ask KBUS to only deliver one copy of
a given message, and if guildenstern had used that, he would only have
received the Request that was marked for him to answer. I'm still a little
undecided how often this mechanism should be used, though.)&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;Looking at the two messages, the first is the Request specifically to
guildenstern, which he is meant to answer:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; print msg2.wants_us_to_reply()
True
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(and that is what the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;YOU&lt;/span&gt;&lt;/tt&gt; in the flags means).&lt;/p&gt;
&lt;p&gt;And rosencrantz himself will also have received a copy:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; print rosencrantz.read_next_msg()
&amp;lt;Request '$.Actor.Guildenstern.query', id=[0:6], from=1, flags=0x1 (REQ), data='Were you speaking to me?'&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Guildenstern can then reply:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 3: Guildenstern&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; reply = reply_to(msg2, 'Yes, I was')
&amp;gt;&amp;gt;&amp;gt; print reply
&amp;lt;Reply '$.Actor.Guildenstern.query', to=1, in_reply_to=[0:6], data='Yes, I was'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; guildenstern.send_msg(reply)
MessageId(0, 7)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;reply_to&lt;/span&gt;&lt;/tt&gt; convenience function crafts a new &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;Reply&lt;/span&gt;&lt;/tt&gt; message, with the
various message parts set in an appropriate manner. And thus:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 1: Rosencrantz&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
&amp;gt;&amp;gt;&amp;gt; rep = rosencrantz.read_next_msg()
&amp;gt;&amp;gt;&amp;gt; print 'I heard', rep.from_, 'say', rep.name, rep.data
I heard 3 say $.Actor.Guildenstern.query Yes, I was
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that Rosencrantz didn't need to bind to this message to receive it - he
will always get a Reply to any Request he sends (KBUS goes to some lengths to
guarantee this, so that even if Guildenstern closes his Ksock, it will
generate a &amp;quot;gone away&amp;quot; message for him).&lt;/p&gt;
&lt;p&gt;And, of course:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="compound"&gt;
&lt;p class="compound-first"&gt;&lt;em&gt;Terminal 2: Audience&lt;/em&gt;&lt;/p&gt;
&lt;pre class="compound-last literal-block"&gt;
We heard 1 say $.Actor.Guildenstern.query Were you speaking to me?
We heard 3 say $.Actor.Guildenstern.query Yes, I was
&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, in summary:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;To send or receive messages, a process opens a Ksock.&lt;/li&gt;
&lt;li&gt;A process can send messages (be a Sender).&lt;/li&gt;
&lt;li&gt;A process can bind to receive messages (be a Listener) by message name.&lt;/li&gt;
&lt;li&gt;When binding to a message name, wildcards can be used.&lt;/li&gt;
&lt;li&gt;When binding to a message name, a process can say it wants to receive
Requests with that name (be a Replier)&lt;/li&gt;
&lt;li&gt;It is not an error to send an ordinary message if no-one is listening.&lt;/li&gt;
&lt;li&gt;It is an error to send a Request if there is no Replier.&lt;/li&gt;
&lt;li&gt;There can only be one Replier for a given message name.&lt;/li&gt;
&lt;li&gt;There can be any number of Listeners for a given message name.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p&gt;Running the examples in this introduction requires having
the KBUS kernel module installed. If this is not already done, and you have
the KBUS sources, then &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;cd&lt;/span&gt;&lt;/tt&gt; to the kernel module directory (i.e.,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;kbus&lt;/span&gt;&lt;/tt&gt; in the sources) and do:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
make
make rules
sudo insmod kbus.ko
&lt;/pre&gt;
&lt;p&gt;When you've finished the examples, you can remove the kernel module again
with:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
sudo rmmod kbus.ko
&lt;/pre&gt;
&lt;p class="last"&gt;The message ids shown in the examples are correct if you've just installed
the kernel module - the second number in each message id will be different
(although always ascending) otherwise.&lt;/p&gt;
&lt;/div&gt;
&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3302882773242055784?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3302882773242055784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/02/simple-introduction-to-using-kbus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3302882773242055784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3302882773242055784'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/02/simple-introduction-to-using-kbus.html' title='A simple introduction to using KBUS'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4712563161213063221</id><published>2010-01-21T11:27:00.000Z</published><updated>2010-01-21T11:27:33.897Z</updated><title type='text'>Small KBUS utility</title><content type='html'>Just committed &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;errno.py&lt;/span&gt; to &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;kbus/utils&lt;/span&gt; - this is a simple utility to conver Unix error numbers into their corresponding mnemonic and text, or vice versa:&lt;br /&gt;
&lt;pre&gt;&amp;nbsp;$ errno.py EPERM
EPERM is error 1 (0x1): Operation not permitted

&lt;/pre&gt;but also, if the error is one used by KBUS, to give the appropriate text from the KBUS documentation:&lt;pre&gt;$ errno.py 32
Error 32 (0x20) is EPIPE: Broken pipe

KBUS:
On attempting to send *to* a specific replier, the replier with that id is no
longer bound to the given message's name.

&lt;/pre&gt;because I can never remember which magic number corresponds to what particular usage.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4712563161213063221?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4712563161213063221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2010/01/small-kbus-utility.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4712563161213063221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4712563161213063221'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2010/01/small-kbus-utility.html' title='Small KBUS utility'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4886098586062350313</id><published>2009-12-24T18:40:00.004Z</published><updated>2009-12-24T18:48:44.014Z</updated><title type='text'>Just before I leave for Christmas ..</title><content type='html'>&lt;p&gt;There should probably have been more of these updates, but we've been a bit busy here and so the blog hasn't been getting the attention it deserves. That'll hopefully be rectified soonish.&lt;/p&gt;

&lt;p&gt;Anyway, the news in brief:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Advanced STB: we have a prototype OMAP3530-based STB design for which we've got boards back now, based on the ever-popular Beagleboard - SD only, but if I can fire up the DSP we should at least be able to decode SD versions of all the obscure codecs that no-one's ever heard of. Now all we have to do is write the firmware.. (and work out how the HD version will work).

&lt;li&gt; USB IR widgets - would have been on sale except that someone's gone and bought all my spares. So: if you want one, do comment here or drop me a line and I'll get one sent out as soon as the next batch is ready. They'll hopefully be available via convenient web shop early in the New Year.

&lt;li&gt; I've recently been doing quite a bit of work with GWT and Hadoop; both seem fairly sane and sensible. Something of an odd feeling to be back in a development regime not dominated by the cost of bugs - you start to realise that project planning does work for some people, somewhere.

&lt;li&gt; Site of the day: &lt;a href="http://www.h265.net/"&gt;http://www.h265.net&lt;/a&gt; . The idea of H.264 performance / 3 frankly scares me - especially in 3D. Time for those parallel-decode assurance flags people have been muttering about.

&lt;li&gt; tibs has been doing some work on muddle, with the result that it's now faster, better, shinier, etc. Domains now work in a meaningful way and I've now churned out enough build trees that I'm pretty confident it's not going to fall over on anyone immediately.
&lt;/ul&gt;

&lt;p&gt;Anyway, a good Christmas and New Year to everyone (anyone?) reading this; I'm off for a few days' relaxation (see, I told you I would one day..).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4886098586062350313?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4886098586062350313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/12/just-before-i-leave-for-christmas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4886098586062350313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4886098586062350313'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/12/just-before-i-leave-for-christmas.html' title='Just before I leave for Christmas ..'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-698135301977045861</id><published>2009-11-15T19:11:00.004Z</published><updated>2009-11-15T19:16:27.722Z</updated><title type='text'>maintaining muddle feels a bit like being davros</title><content type='html'>As a result of some recent changes to muddle - mainly tibs's code - you can now merge two build trees (which we call domains) into a single overarching build tree.
&lt;br&gt;
I've now added a couple of bits (check out r243) and I have a bit of a port of an ASTB build tree and a client's STB stack running. 
&lt;br&gt;
With the addition of a couple of simple hooks on each side, I can write 100 lines of python which automatically checks out two entirely unrelated build trees, merges them together, builds them both (on demand, checking out code from various repositories in git, svn, and bzr, and supplying the right kernel includes across the boundary) and then merges the resulting filesystems. On demand.
&lt;br&gt;
It's not finished yet, but it's quite impressive to watch it go.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-698135301977045861?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/698135301977045861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/11/maintaining-muddle-feels-bit-like-being.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/698135301977045861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/698135301977045861'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/11/maintaining-muddle-feels-bit-like-being.html' title='maintaining muddle feels a bit like being davros'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-825109225825726604</id><published>2009-10-22T12:17:00.005+01:00</published><updated>2009-10-22T13:43:27.628+01:00</updated><title type='text'>USB widgets are go (part 2)</title><content type='html'>&lt;p&gt;Well, we're getting there on the USB IR widgets - we now have &lt;a href="http://www.creactive-design.co.uk/"&gt;Creactive&lt;/a&gt; doing some industrial design for us on the casings and the second spin of prototype PCBs is at the shop - back next week, hopefully.&lt;/p&gt;

&lt;p&gt;Our core consumer functions are as they always were - will work with any RC5 remote control, programmable via USB serial port, no install on any major platform. As a result of having sourced some cheap remote controls, we'll also be supporting a proprietory NEC remote protocol and selling moderately cheap dedicated remotes to anyone who wants them (to control your model railway, for example).&lt;/p&gt;

&lt;p&gt;We've managed to cram on a few new features for the geeks this time:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;Boards can be made using 3.3V or 5V parts.
 &lt;li&gt;SOT-23 LDO so you can power the boards from somewhat unregulated supplies - eg. to use them without being plugged into a USB port.
 &lt;li&gt;UART, I2C and SPI brought out so you can use them as bridges (not all at the same time, though).
 &lt;li&gt;More I/Os brought out so you can have ADC inputs and control pins.
&lt;/ul&gt;

&lt;p&gt;And we should be able to open-source both the schematic and the software, though as the software is still encumbered by Microchip's licence for the USB code it sadly can't be GPL.&lt;/p&gt;

&lt;p&gt;Oh, we've lopped a couple of millimetres off the size in each direction too :-).&lt;/p&gt;

&lt;p&gt;Anyway, watch this space and do get in touch if interested - early product should be available soon and if you ask us nicely we'll sell you some of the pre-production batch.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-825109225825726604?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/825109225825726604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/10/usb-widgets-are-go-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/825109225825726604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/825109225825726604'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/10/usb-widgets-are-go-part-2.html' title='USB widgets are go (part 2)'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-973675998234410101</id><published>2009-10-21T20:32:00.006+01:00</published><updated>2009-10-22T14:50:10.950+01:00</updated><title type='text'></title><content type='html'>Grr. Apologies if the code examples in the previous post are truncated at the right - this is because of the way blogger tries so hard to make the blog a nice column down the middle of your browser. Which is a laudable aim for a plain text article, but doesn't work so well for code examples. If I have time I'll look into it (some more) in the future (I've already tweaked the blog settings to try to make previous posts look sensible).  &lt;p&gt;Update: OK, I think I've fixed that. Now on to trying to make "cut" work in posts...&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;And in a serious moment of serendipity, I've just discovered that Blogger have now added the ability to do "cut" posts, just as I wanted, by (a) enabling the new editor interface (done) and (b) putting:&lt;br /&gt;
&lt;pre&gt;&amp;lt;-- more --&amp;gt;
&lt;/pre&gt;&lt;p&gt;in the appropriate place in the post. So I've gone back and done that to my muddle posts, and they now don't dominate the entire blog. Which is good.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-973675998234410101?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/973675998234410101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/10/grr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/973675998234410101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/973675998234410101'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/10/grr.html' title=''/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-1122498055982536422</id><published>2009-10-21T20:30:00.004+01:00</published><updated>2009-10-22T14:50:43.039+01:00</updated><title type='text'>muddle: Cross-compiling V8</title><content type='html'>&lt;p&gt;So, I'm transferring a native (Intel) build of various things to a cross-compiled build for the ARM (specifically, for my beagleboard).&lt;/p&gt;&lt;p&gt;Today's tasks were &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;sqlite&lt;/span&gt;&lt;/tt&gt; (which was harder than I expected) and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;V8&lt;/span&gt;&lt;/tt&gt;, &lt;a class="reference external" href="http://code.google.com/p/v8/"&gt;Google's open source JavaScript engine&lt;/a&gt;.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;p&gt;V8 is built using &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt;, which it turns out is not &lt;em&gt;particularly&lt;/em&gt; well aimed at the cross compilation fans amongst us.&lt;/p&gt;&lt;p&gt;It turns out that you &lt;em&gt;can&lt;/em&gt; set environment variables (such as &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;CC&lt;/span&gt;&lt;/tt&gt;) to tell &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; which compiler to use, but of course you need to know all the calls to the toolchain it is going to make, in order to catch them all. The easiest way to do that seems to be to run &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt; &lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt; (i.e., tell me what commands you'll obey, but don't actually do them), which does work, but means that if you update the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; build environment, and coincidentally the script mutates to use new parts of the toolchain, they won't be covered. Which is rather awful.&lt;/p&gt;&lt;blockquote&gt;&lt;div class="note"&gt;&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;&lt;p class="last"&gt;I'm rather hoping I've missed something here, and there's actually a better way of doing this. Although any way that includes editing the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; script supplied by the original package won't count as &amp;quot;better&amp;quot;.&lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;Anyway, it turns out that the muddle way to build &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;V8&lt;/span&gt;&lt;/tt&gt; is fairly simple - a small bit of muddle code, and a simple helper Makefile.&lt;/p&gt;&lt;p&gt;First, the muddle code:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Make sure our host has scons available&lt;/span&gt;
aptget&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;platform_host_tools&amp;#39;&lt;/span&gt;, role, [&lt;span style="color: #BA2121"&gt;&amp;#39;scons&amp;#39;&lt;/span&gt;])

&lt;span style="color: #408080; font-style: italic"&gt;# Set up the cross compilation environment variables&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# - we retrieve the environment that will be applied to all packages&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# and add the environment variables to it&lt;/span&gt;
label &lt;span style="color: #666666"&gt;=&lt;/span&gt; label_from_string(&lt;span style="color: #BA2121"&gt;&amp;#39;package:*{*}/*&amp;#39;&lt;/span&gt;)
env &lt;span style="color: #666666"&gt;=&lt;/span&gt; builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;get_environment_for(label)
env&lt;span style="color: #666666"&gt;.&lt;/span&gt;set(&lt;span style="color: #BA2121"&gt;&amp;quot;MUDDLE_CROSS_COMPILE&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;/opt/codesourcery/arm-2008q3/bin/arm-none-linux-gnueabi-&amp;quot;&lt;/span&gt;)
env&lt;span style="color: #666666"&gt;.&lt;/span&gt;set(&lt;span style="color: #BA2121"&gt;&amp;quot;MUDDLE_ARCH&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;arm&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# For reasons to do with the particular system I&amp;#39;m building, the V8&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# sources get checked out into &amp;#39;src/platform/v8&amp;#39;. There&amp;#39;s nothing&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# special about revision &amp;#39;3108&amp;#39; - it&amp;#39;s just today&amp;#39;s revision&lt;/span&gt;
muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;twolevel&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder,
        co_dir&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #BA2121"&gt;&amp;quot;platform&amp;quot;&lt;/span&gt;,
        co_name&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #BA2121"&gt;&amp;quot;v8&amp;quot;&lt;/span&gt;,
        repo_url&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #BA2121"&gt;&amp;quot;svn+http://v8.googlecode.com/svn/trunk&amp;quot;&lt;/span&gt;,
        rev&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #BA2121"&gt;&amp;quot;3106&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# I then have an out-of-tree Makefile to build V8 in our context,&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# in &amp;#39;src/helpers/v8&amp;#39;&lt;/span&gt;
make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
            name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;v8&amp;quot;&lt;/span&gt;,          &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
            roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; [role],
            checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;helpers&amp;#39;&lt;/span&gt;,
            makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;v8&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))

&lt;span style="color: #408080; font-style: italic"&gt;# And we can&amp;#39;t build the package until we&amp;#39;ve checked its files out&lt;/span&gt;
muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;v8&amp;quot;&lt;/span&gt;,     &lt;span style="color: #408080; font-style: italic"&gt;# this package&lt;/span&gt;
                                        role,     &lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;v8&amp;quot;&lt;/span&gt;,     &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                        &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;It looks as if I'm going to standardise on the cross compilation environment variable names as given, and I'm using the technique often enough that the rather clumsy mechanism for setting them will probably get streamlined fairly soon.&lt;/p&gt;&lt;p&gt;The only other thing that is needed, then, is the Makefile, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/helpers/v8/Makefile.muddle&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;&lt;blockquote&gt;&lt;div class="note"&gt;&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;&lt;p class="last"&gt;We started out calling the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;helpers&lt;/span&gt;&lt;/tt&gt; directory &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builders&lt;/span&gt;&lt;/tt&gt; (because it has stuff used to build other things), but I find it irritating having to discriminate between &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/builds&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/builders&lt;/span&gt;&lt;/tt&gt;, so I'm trying out the new name to see if it works.&lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;The original of this makefile was not cross-platform. I believe this version should work in that situation as well.&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Muddle makefile to control v8 builds&lt;/span&gt;

&lt;span style="color: #19177C"&gt;V8_SRC&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;shell &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; query dir &lt;span style="color: #BA2121"&gt;&amp;quot;checkout:v8{*}/*&amp;quot;&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

&lt;span style="color: #BC7A00"&gt;ifneq ($(MUDDLE_ARCH),)&lt;/span&gt;
        &lt;span style="color: #19177C"&gt;FLAGS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #19177C"&gt;arch&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_ARCH&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        &lt;span style="color: #19177C"&gt;ENV&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #19177C"&gt;CXX&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_CROSS_COMPILE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;g++ &lt;span style="color: #19177C"&gt;CC&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_CROSS_COMPILE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;gcc
&lt;span style="color: #BC7A00"&gt;else&lt;/span&gt;
        &lt;span style="color: #19177C"&gt;FLAGS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;
        &lt;span style="color: #19177C"&gt;ENV&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;
&lt;span style="color: #BC7A00"&gt;endif&lt;/span&gt;

&lt;span style="color: #19177C"&gt;SCONS_CMD&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;scons -C . -f &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;V8_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/SConstruct -Y &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;V8_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

all:
        &lt;span style="color: #666666"&gt;(&lt;/span&gt;&lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;ENV&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;SCONS_CMD&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;FLAGS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #19177C"&gt;library&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;shared &lt;span style="color: #19177C"&gt;mode&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;release&lt;span style="color: #666666"&gt;)&lt;/span&gt;
        &lt;span style="color: #666666"&gt;(&lt;/span&gt;&lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;ENV&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;SCONS_CMD&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;FLAGS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #19177C"&gt;library&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;shared &lt;span style="color: #19177C"&gt;mode&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;debug&lt;span style="color: #666666"&gt;)&lt;/span&gt;

config:
        -rm -rf &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

install:
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_INCLUDE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/v8
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_LIB&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/usr/lib

        install -m 0644 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;V8_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/include/v8.h       &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_INCLUDE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/v8/v8.h
        install -m 0644 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;V8_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/include/v8-debug.h &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_INCLUDE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/v8/v8-debug.h
        install -m 0755 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8.so   &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_LIB&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8.so
        install -m 0755 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8_g.so &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_LIB&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8_g.so
        install -m 0755 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8.so   &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/usr/lib/libv8.so
        install -m 0755 &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/libv8_g.so &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/usr/lib/libv8_g.so
        &lt;span style="color: #008000"&gt;echo &lt;/span&gt;&lt;span style="color: #19177C"&gt;INSTALL&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

clean:
        &lt;span style="color: #666666"&gt;(&lt;/span&gt;&lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;SCONS_CMD&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; --clean&lt;span style="color: #666666"&gt;)&lt;/span&gt;

distclean:
        -rm -rf &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; switches used are:&lt;/p&gt;&lt;blockquote&gt;&lt;ul class="simple"&gt;&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;&amp;lt;directory&amp;gt;&lt;/span&gt;&lt;/tt&gt; -- &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;cd&lt;/span&gt;&lt;/tt&gt; to this directory before building&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-f&lt;/span&gt; &lt;span class="pre"&gt;&amp;lt;path&amp;gt;&lt;/span&gt;&lt;/tt&gt; -- the given &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;&amp;lt;path&amp;gt;&lt;/span&gt;&lt;/tt&gt; is the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; build script&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-Y&lt;/span&gt; &lt;span class="pre"&gt;&amp;lt;directory&amp;gt;&lt;/span&gt;&lt;/tt&gt; -- look for &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;import&lt;/span&gt;&lt;/tt&gt; files in the given directory (the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt;&lt;/tt&gt; documentation talks about this as specifying the repository path, but that sounds like a use of the same term for a different purpose)&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;p&gt;The disposal of the various resultant files within the muddle build tree matches the Intel build.&lt;/p&gt;&lt;p&gt;There are some caveats; notably that I've checked that the build produces ARM files, but haven't yet had a chance to &lt;em&gt;test&lt;/em&gt; them, and the Makefile could clearly do with some tidying up -- for a start, it's clearly very clumsy to do &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;cd&lt;/span&gt; &lt;span class="pre"&gt;&amp;lt;somewhere&amp;gt;;&lt;/span&gt; &lt;span class="pre"&gt;scons&lt;/span&gt; &lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;.&lt;/span&gt;&lt;/tt&gt; instead of just doing &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;scons&lt;/span&gt; &lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;&amp;lt;somewhere&amp;gt;&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-1122498055982536422?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/1122498055982536422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/10/muddle-cross-compiling-v8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1122498055982536422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/1122498055982536422'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/10/muddle-cross-compiling-v8.html' title='muddle: Cross-compiling V8'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-3128787796437389106</id><published>2009-10-16T13:46:00.004+01:00</published><updated>2009-10-16T15:22:14.193+01:00</updated><title type='text'>We're hiring!</title><content type='html'>In case you hadn't heard:
&lt;blockquote&gt;
&lt;p&gt;Kynesim is urgently in need of developers to expand our team.

&lt;p&gt;We're a small, friendly technology consultancy firm located on Castle Hill, Cambridge with strong links to the University of Cambridge, for which our Managing Director routinely teaches.

&lt;p&gt;We provide top flight hardware and software development services to a variety of clients; mostly doing STB work, embedded Linux (although WinCE expertise welcomed), quite a bit of wireless/embedded micro stuff, but we have been known to do everything from soldering bits onto PICs to writing web applications. We have an outstanding track record of delivering complex and challenging technology on tight deadlines.

&lt;p&gt;Code is mostly in C and C++ with a smattering of assembler, Python and Java and a surprising amount of Javascript and HTML. C# is hovering threateningly on the horizon. A good working knowledge of C and/or C++ is essential.

&lt;p&gt;Starting as soon as possible, this role would suit Computer Science or Maths graduates. We aim to recruit bright, hard working people willing to muck in with challenging tasks they may not have met before.

&lt;p&gt;In return, we provide a decent salary, free food including a pub lunch on Mondays, interesting work, a Playstation 3, proper flexitime and occasional soft toys.

&lt;p&gt;Sound fun? Contact &lt;a href=mailto:rrw@kynesim.co.uk&gt;Richard Watts&lt;/a&gt; for further details.
&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-3128787796437389106?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/3128787796437389106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/10/were-hiring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3128787796437389106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/3128787796437389106'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/10/were-hiring.html' title='We&apos;re hiring!'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4297139409712070064</id><published>2009-09-25T12:20:00.004+01:00</published><updated>2009-09-25T12:31:32.060+01:00</updated><title type='text'>The FOSS community finally gets a dose of China ..</title><content type='html'>&lt;p&gt;I notice that the FOSS people are finally being bitten by &lt;a href="http://lwn.net/Articles/352366/"&gt;the Chinese problem&lt;/a&gt;. The rest of us in CE have, of course, had this problem for years - there are manufacturers out there whose business model is to buy a new product, suck the software image out, reverse-engineer the hardware and then sell their own cut-price version - and more OEMs who do this on the side, selling off-label cut-price versions of the products they make for western consumers to the generic domestic market, from where they naturally turn up here.&lt;/p&gt;

&lt;p&gt;There's no effective way to stop this short of tivoisation, which is why it's such a popular tactic and why GPL3 is particularly invidious in CE: none of us want to tivoise our products - it's stupid, time-consuming and difficult (plus we want to hack them ourselves). But if we don't, we get maybe two months' grace before our software gets knocked off and the product driven off the market.&lt;/p&gt;

&lt;p&gt;This is a natural side-effect of Asian manufacturing economics: anything you make in the UK will always be more expensive than in the far east, because the far east has much lower regulatory compliance costs - they're allowed to run machines that no-one in the UK would countenance, under lax employment law and with no IP enforcement to speak of.&lt;/p&gt;

&lt;p&gt;So perhaps the free software community will be a little more forgiving to those of us who lock them out of our products in future; we're really not that evil (well, some of us aren't) - just trying to get some sort of return on our investment before we're instantly outcompeted.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4297139409712070064?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4297139409712070064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/foss-community-finally-gets-dose-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4297139409712070064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4297139409712070064'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/foss-community-finally-gets-dose-of.html' title='The FOSS community finally gets a dose of China ..'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4614964479385362372</id><published>2009-09-16T15:22:00.002+01:00</published><updated>2009-09-16T15:27:41.386+01:00</updated><title type='text'>Marketing</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jZksK0ARsdE/SrD1uvN7WII/AAAAAAAAAAU/2kb7ZAOGObo/s1600-h/Photo+on+2009-09-15+at+17.58.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://4.bp.blogspot.com/_jZksK0ARsdE/SrD1uvN7WII/AAAAAAAAAAU/2kb7ZAOGObo/s400/Photo+on+2009-09-15+at+17.58.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5382071738005411970" /&gt;&lt;/a&gt;
At a team discussion yesterday, we realised the marketing potential of my cast. This is what we came up with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4614964479385362372?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4614964479385362372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/marketing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4614964479385362372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4614964479385362372'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/marketing.html' title='Marketing'/><author><name>AkleyMac</name><uri>http://www.blogger.com/profile/02975348699886380547</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_jZksK0ARsdE/SrD1uvN7WII/AAAAAAAAAAU/2kb7ZAOGObo/s72-c/Photo+on+2009-09-15+at+17.58.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4855070662586386047</id><published>2009-09-10T16:57:00.003+01:00</published><updated>2009-09-10T17:21:53.412+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IR widget; USB'/><title type='text'>IR Widget - the next step</title><content type='html'>Hello all,&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Just a quick update on the IR Widget.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Trying to control games consoles has proved a little difficult - it appears that not all of the controls for video playback on the PS3 (for example fast-forward, rewind) can come from a keyboard. The only available controls are: bring up a menu, navigate around with the arrow keys and select the appropriate option. The situation is similar on the XBox 360. While this is functional, it's not so nice to use - we want now for the widget to pretend to be a games controller as well as a keyboard, as that has buttons to do what we want. However, this could take a little while to implement due to memory constraints. Richard has offered to solve this with some refactoring and buffer sharing tricks.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;I have now added some functionality to allow us to send modifier keys (ctrl, alt etc) which it turns out are essential for some of the media controls in Linux.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;I have also now made the programming interface work under OS X, although Windows is a little more fussy - I'm still messing around with INF files.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Work still in progress, so keep checking back!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4855070662586386047?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4855070662586386047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/ir-widget-next-step.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4855070662586386047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4855070662586386047'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/ir-widget-next-step.html' title='IR Widget - the next step'/><author><name>AkleyMac</name><uri>http://www.blogger.com/profile/02975348699886380547</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-747782844973995224</id><published>2009-09-09T20:00:00.003+01:00</published><updated>2009-10-22T14:50:55.506+01:00</updated><title type='text'>muddle: Linux on the Beagleboard (part 0)</title><content type='html'>&lt;p&gt;I've been playing with a &lt;a class="reference external" href="http://beagleboard.org/"&gt;beagleboard&lt;/a&gt; at work, as part of the initial investigation towards an advance STB (set top box). It's based around TI OMAP technology (so it's got an ARM with a DSP on the side).&lt;/p&gt;&lt;p&gt;Anyway, my initial investigation put Android on it (in a fairly dumb manner), and I've spent the last couple of days getting the head-of-tree OMAP Linux to boot on it, with busybox. This last I hope, when it's a little more polished, to use as a replacement for the &amp;quot;simple linux&amp;quot; example in the muddle distribution.&lt;/p&gt;&lt;p&gt;Anyway, here as a teaser is today's version of the build description for OMAP Linux on a beagleboard:&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;#! /usr/bin/env python&lt;/span&gt;

&lt;span style="color: #BA2121; font-style: italic"&gt;&amp;quot;&amp;quot;&amp;quot;Muddle build description for a &amp;quot;plain&amp;quot; OMAP build on the Beagleboard.&lt;/span&gt;

&lt;span style="color: #BA2121; font-style: italic"&gt;At least initially, we&amp;#39;re trying to build a Linux+busybox system.&lt;/span&gt;

&lt;span style="color: #BA2121; font-style: italic"&gt;The role we&amp;#39;re providing is &amp;#39;omap&amp;#39;.&lt;/span&gt;
&lt;span style="color: #BA2121; font-style: italic"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;os&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.deployments.filedep&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;filedep&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.pkgs.aptget&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;aptget&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.checkouts.simple&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.depend&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;from&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.depend&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; label_from_string
&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.pkgs.make&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;make&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;wget&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;def&lt;/span&gt; &lt;span style="color: #0000FF"&gt;describe_to&lt;/span&gt;(builder):

    role &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;omap&amp;#39;&lt;/span&gt;
    roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; [&lt;span style="color: #BA2121"&gt;&amp;#39;omap&amp;#39;&lt;/span&gt;]

    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;add_default_role(role)

    &lt;span style="color: #408080; font-style: italic"&gt;# filedep.deploy(builder, target_dir, name, roles)&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# Register a file deployment.&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# The deployment will take the roles specified in the role list, and build&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# them into a deployment at deploy/[name].&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# The deployment should eventually be located at target_dir.&lt;/span&gt;

    filedep&lt;span style="color: #666666"&gt;.&lt;/span&gt;deploy(builder,
                   &lt;span style="color: #BA2121"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;,
                   &lt;span style="color: #BA2121"&gt;&amp;#39;omap&amp;#39;&lt;/span&gt;,
                   roles)

    &lt;span style="color: #408080; font-style: italic"&gt;# There&amp;#39;s a variety of things we need on (this, the host) system&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# in order to build - I hope I&amp;#39;ve got this right (difficult to tell&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# as I already have some stuff installed on *my* development system)&lt;/span&gt;
    aptget&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;development_packages&amp;#39;&lt;/span&gt;, role,
            [&lt;span style="color: #BA2121"&gt;&amp;#39;zlib1g-dev&amp;#39;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;#39;uboot-mkimage&amp;#39;&lt;/span&gt;])

    &lt;span style="color: #408080; font-style: italic"&gt;# According to http://omappedia.org/wiki/LinuxOMAP_Kernel_Project, we get&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# our OMAP kernel from:&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;omap_kernel&amp;#39;&lt;/span&gt;,
            &lt;span style="color: #BA2121"&gt;&amp;#39;git+git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git&amp;#39;&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# We&amp;#39;ll aim to make that with an out-of-tree makefile&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# We could make a tailored subclass of muddled.pkgs.linux_kernel, and use&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# that to build our kernel. I may still do that once I&amp;#39;ve figured out how&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# it is different (one notable change is we&amp;#39;re building uImage instead of&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# zImage). For now, it&amp;#39;s probably easier to have a Makefile.muddle&lt;/span&gt;
    make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
                name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;omap_kernel&amp;quot;&lt;/span&gt;,    &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
                roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; roles,
                checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builders&amp;quot;&lt;/span&gt;,
                deps &lt;span style="color: #666666"&gt;=&lt;/span&gt; [],
                makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;omap_kernel&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))

    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;omap_kernel&amp;quot;&lt;/span&gt;,  &lt;span style="color: #408080; font-style: italic"&gt;# this package&lt;/span&gt;
                                    role,           &lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;omap_kernel&amp;quot;&lt;/span&gt;,  &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                    &lt;span style="color: #008000"&gt;None&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# On top of that, we want to build busybox&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# According to the busybox website, we can retrieve sources via git:&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# To grab a copy of the BusyBox repository using anonymous git access::&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#   git clone git://busybox.net/busybox.git&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# Once you have the repository, stable branches can be checked out by&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# doing::&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#   git checkout remotes/origin/1_NN_stable&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# Once you&amp;#39;ve checked out a copy of the source tree, you can update your&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# source tree at any time so it is in sync with the latest and greatest by&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# entering your BusyBox directory and running the command::&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#   git pull&lt;/span&gt;

    &lt;span style="color: #408080; font-style: italic"&gt;# So, for the moment, at least, let&amp;#39;s go with the latest from source&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# control (when we&amp;#39;re finalising this, we&amp;#39;re maybe better identifying&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# a particular release to stick to)&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;busybox&amp;#39;&lt;/span&gt;,
            &lt;span style="color: #BA2121"&gt;&amp;#39;git+git://busybox.net/busybox.git&amp;#39;&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# We&amp;#39;ll aim to make that with an out-of-tree makefile&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# &amp;#39;deps&amp;#39; is a list of package names, which our make depends on.&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# Specifically, for each &amp;lt;name&amp;gt; in &amp;#39;deps&amp;#39;, and for each &amp;lt;role&amp;gt; in &amp;#39;roles&amp;#39;,&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# we will depend on &amp;quot;package:&amp;lt;name&amp;gt;{&amp;lt;role&amp;gt;}/postinstalled&amp;quot;&lt;/span&gt;
    make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
                name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;busybox&amp;quot;&lt;/span&gt;,    &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
                roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; roles,
                checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builders&amp;quot;&lt;/span&gt;,
                deps &lt;span style="color: #666666"&gt;=&lt;/span&gt; [ &lt;span style="color: #BA2121"&gt;&amp;#39;omap_kernel&amp;#39;&lt;/span&gt; ],
                makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;busybox&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))

    &lt;span style="color: #408080; font-style: italic"&gt;# And we also depend on having actually checked out busybox&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;busybox&amp;quot;&lt;/span&gt;,      &lt;span style="color: #408080; font-style: italic"&gt;# this package&lt;/span&gt;
                                    role,           &lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;busybox&amp;quot;&lt;/span&gt;,      &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                    &lt;span style="color: #008000"&gt;None&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# Can we use the same bootloader and such that we already had for the&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# android build? I don&amp;#39;t see why not.&lt;/span&gt;

    &lt;span style="color: #408080; font-style: italic"&gt;# The bootloader and related items, which go into the FAT32 partition on&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# the flash card, are retrieved from the net (eventually, I hope we&amp;#39;ll be&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# building u-boot, but for now the binary should do)&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;MLO&amp;#39;&lt;/span&gt;,
            &lt;span style="color: #BA2121"&gt;&amp;#39;wget+http://free-electrons.com/pub/demos/beagleboard/android/MLO&amp;#39;&lt;/span&gt;)
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;u-boot&amp;#39;&lt;/span&gt;,
            &lt;span style="color: #BA2121"&gt;&amp;#39;wget+http://free-electrons.com/pub/demos/beagleboard/android/u-boot.bin&amp;#39;&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# We need some way of getting them installed - let&amp;#39;s foreshadow the day when&lt;/span&gt;
    &lt;span style="color: #408080; font-style: italic"&gt;# we actually want to build u-boot ourselves, and pretend&lt;/span&gt;
    make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
                name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;u-boot&amp;quot;&lt;/span&gt;,    &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
                roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; roles,
                checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builders&amp;quot;&lt;/span&gt;,
                deps &lt;span style="color: #666666"&gt;=&lt;/span&gt; [],
                makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;u-boot&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;u-boot&amp;quot;&lt;/span&gt;,       &lt;span style="color: #408080; font-style: italic"&gt;# this package&lt;/span&gt;
                                    role,           &lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                    &lt;span style="color: #BA2121"&gt;&amp;quot;u-boot&amp;quot;&lt;/span&gt;,       &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                    &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
    &lt;span style="color: #408080; font-style: italic"&gt;# Oh, and this one as well...&lt;/span&gt;
    rule &lt;span style="color: #666666"&gt;=&lt;/span&gt; muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;depend&lt;span style="color: #666666"&gt;.&lt;/span&gt;depend_one(&lt;span style="color: #008000"&gt;None&lt;/span&gt;,
                              label_from_string(&lt;span style="color: #BA2121"&gt;&amp;#39;package:u-boot/installed&amp;#39;&lt;/span&gt;),
                              label_from_string(&lt;span style="color: #BA2121"&gt;&amp;#39;checkout:MLO/checked_out&amp;#39;&lt;/span&gt;))
    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset&lt;span style="color: #666666"&gt;.&lt;/span&gt;add(rule)

    &lt;span style="color: #408080; font-style: italic"&gt;# And, of course, we need (the rest of) our Linux filesystem&lt;/span&gt;
    muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;absolute(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;rootfs&amp;#39;&lt;/span&gt;,
            &lt;span style="color: #BA2121"&gt;&amp;#39;bzr+ssh://bzr@palmera.c.kynesim.co.uk//opt/kynesim/projects/052/rootfs&amp;#39;&lt;/span&gt;)
    make&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple(builder, &lt;span style="color: #BA2121"&gt;&amp;#39;rootfs&amp;#39;&lt;/span&gt;, role, &lt;span style="color: #BA2121"&gt;&amp;#39;rootfs&amp;#39;&lt;/span&gt;, config&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000"&gt;False&lt;/span&gt;,
            makefileName&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #BA2121"&gt;&amp;#39;Makefile.muddle&amp;#39;&lt;/span&gt;)

    &lt;span style="color: #408080; font-style: italic"&gt;# But we depend on busybox to have installed the various binaries first&lt;/span&gt;
    rule &lt;span style="color: #666666"&gt;=&lt;/span&gt; muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;depend&lt;span style="color: #666666"&gt;.&lt;/span&gt;depend_one(&lt;span style="color: #008000"&gt;None&lt;/span&gt;,
                              label_from_string(&lt;span style="color: #BA2121"&gt;&amp;#39;package:rootfs/installed&amp;#39;&lt;/span&gt;),
                              label_from_string(&lt;span style="color: #BA2121"&gt;&amp;#39;package:busybox/installed&amp;#39;&lt;/span&gt;))
    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset&lt;span style="color: #666666"&gt;.&lt;/span&gt;add(rule)

    &lt;span style="color: #408080; font-style: italic"&gt;# Deploy all our roles&lt;/span&gt;
    builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;by_default_deploy_list(roles)
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;I'm fairly sure there are some parts of that which could be a lot nicer, and it doesn't make entire sense without some extra infrastructure, but I'm already please with how compact the code I need to build the system is, compare to how I'd have done it before.&lt;/p&gt;&lt;p&gt;I shall try to blog some more at a later date with some explanations of how the whole thing goes together...&lt;/p&gt;&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-747782844973995224?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/747782844973995224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/muddle-linux-on-beagleboard-part-0.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/747782844973995224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/747782844973995224'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/muddle-linux-on-beagleboard-part-0.html' title='muddle: Linux on the Beagleboard (part 0)'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-4609348842499179483</id><published>2009-09-08T19:40:00.002+01:00</published><updated>2009-09-08T19:42:27.189+01:00</updated><title type='text'>Handy hints for debugging optimised assembly, number 2431</title><content type='html'>If you're trying to see what effect your optimisations have on assembly code, a useful hint is often to put volatile assembler labels at strategic points in your code.

&lt;pre&gt;
asm volatile ("foo1:");
&lt;/pre&gt;

in GNU C/C++ source will turn into something like:

&lt;pre&gt;
#APP
# 667 "src/iatools.cpp" 1
 foo1:
# 0 "" 2
#NO_APP 
&lt;/pre&gt;

in the assembler. This may have some slightly adverse effects on the optimiser (though not too many - labels have no side-effects), but it means you can bracket loops you're trying to optimise quite successfully without having to read the runes to work out which bits of assembler correspond to which bits of C.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-4609348842499179483?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/4609348842499179483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/handy-hints-for-debugging-optimised.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4609348842499179483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/4609348842499179483'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/handy-hints-for-debugging-optimised.html' title='Handy hints for debugging optimised assembly, number 2431'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-8391091112016800341</id><published>2009-09-03T13:11:00.005+01:00</published><updated>2009-09-03T13:33:04.410+01:00</updated><title type='text'>USB, meet Infra-red</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jZksK0ARsdE/Sp-z6nRMunI/AAAAAAAAAAM/RZwFcYmnr8Y/s1600-h/pic_lowres.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 222px;" src="http://4.bp.blogspot.com/_jZksK0ARsdE/Sp-z6nRMunI/AAAAAAAAAAM/RZwFcYmnr8Y/s320/pic_lowres.jpg" alt="" id="BLOGGER_PHOTO_ID_5377214299658566258" border="0" /&gt;&lt;/a&gt;
Been looking at this for a while now, and we've finally got something working.&lt;p&gt;

This little widget will allow us to use an infra-red remote to control media playback (or do pretty much anything else) on pretty much any PC without the need for additional drivers (so long as it can support a USB keyboard).&lt;/p&gt;&lt;p&gt;

It is programmable over USB using a simple command line interface allowing the user to configure it on a per-button basis. Currently working on configurations for controlling a PS3 for video playback.&lt;/p&gt;&lt;p&gt;

More work being done, so watch this space!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-8391091112016800341?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/8391091112016800341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/09/usb-meet-infared.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8391091112016800341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8391091112016800341'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/09/usb-meet-infared.html' title='USB, meet Infra-red'/><author><name>AkleyMac</name><uri>http://www.blogger.com/profile/02975348699886380547</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_jZksK0ARsdE/Sp-z6nRMunI/AAAAAAAAAAM/RZwFcYmnr8Y/s72-c/pic_lowres.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-604380050069712265</id><published>2009-08-29T18:28:00.000+01:00</published><updated>2009-08-29T18:35:22.925+01:00</updated><title type='text'>XUL ain't so bad after all ..</title><content type='html'>&lt;p&gt;I've been doing quite a bit of XUL hacking lately and I think it's actually beginning to make sense. The main problems seem to be a lack of documentation and Javascript's usual habit of trying to continue in the face of overwhelming odds which means you don't get told about errors at the point of error, but some unspecified time later.&lt;/p&gt;


&lt;p&gt;In particular, it took me a while to work out that if you set your &lt;tt&gt;browser.chromeURL&lt;/tt&gt; property to XUL without a browser marked as &lt;tt&gt;type=content-primary&lt;/tt&gt;, your entire XUL gets replaced with the target window content. Any linked Javascript then runs twice - once just before the XUL gets replaced, tricking you into believing that your XUL is fine - and then again afterward for some reason.&lt;/p&gt;


&lt;p&gt;There's also a slightly odd interaction of command-line arguments with windows: the primary window gets &lt;tt&gt;window.arguments[0]&lt;/tt&gt;, subsequent &lt;tt&gt;window.open()&lt;/tt&gt;'d ones don't and if your content is doing the open, you need to resort to slightly nasty tricks like setting properties in window listeners. Ugh.&lt;/p&gt;


&lt;p&gt;In other news, I'll be at ESC UK in October and at IBC on September 14th and 15th so hope to run into people there.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-604380050069712265?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/604380050069712265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/08/xul-aint-so-bad-after-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/604380050069712265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/604380050069712265'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/08/xul-aint-so-bad-after-all.html' title='XUL ain&apos;t so bad after all ..'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-5794573334038003999</id><published>2009-08-28T10:00:00.000+01:00</published><updated>2009-08-28T10:17:40.538+01:00</updated><title type='text'></title><content type='html'>In case you hadn't guessed, I like muddle.

I was formally convinced (i.e., by practice rather than theory) a few weeks ago, when I had to work on a system that already had a muddle description (in fact, the same system into which "george" was being incorporated). With muddle, it was quick and easy to add new software to the system, trivial to update all the packages (&lt;span style="font-family: courier new;"&gt;muddle update&lt;/span&gt; is your friend for updating all the packages in a system from their individual revision control systems - having worked with a "build" system that didn't have this facility, that is &lt;span style="font-style: italic;"&gt;so&lt;/span&gt; refreshing), and easy to rebuild individual parts.

If we hadn't had muddle for this system, we'd still have had to build Makefiles or some other ad-hoc scripting mechanism to make the builds reproducible (been there, done that, ick). With muddle, that step can be avoided (it saves time, in deciding what to do), and the &lt;span style="font-style: italic;"&gt;same&lt;/span&gt; mechanism can be used for multiple projects (again, it saves time, in learning an individual setup).
&lt;blockquote&gt;
    (There's a lot to be said for a solution that is ready-made, and avoids the need for deciding what solution to use &lt;span style="font-style: italic;"&gt;this time &lt;/span&gt;- it's where ASCII, UML and XML have all scored in their time. It's not that the solution need be perfect, just that it be a decent solution that you could have chosen independently, and that everyone is already predisposed to agree on. Such can save months of discussion and reimplementing the wheel.)
&lt;/blockquote&gt;
Using file-system based tags is useful, too.

If you look in the &lt;span style="font-family: courier new;"&gt;.muddle/tags/packages&lt;/span&gt; directories, you'll find the status of each package made visible. Delete one of the tag files, and muddle will believe you that that step is undone (so deleting all of them is one way of making it rebuild a package from scratch).

Since &lt;span style="font-style: italic;"&gt;checkout&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;deployment&lt;/span&gt; are intrinsically separate from the normal building process, they have their own tags, outside the above. And that's the right thing, too.

Perhaps the biggest lesson, though, is to keep going back to the muddle README (this is the first section in the sphinx-ified documentation). It's a good read (it's what made me think muddle2 was &lt;span style="font-style: italic;"&gt;really&lt;/span&gt; on the right track), but it is also quite information dense - almost everything in there is stuff that you will want to refer back to.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-5794573334038003999?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/5794573334038003999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/08/in-case-you-hadnt-guessed-i-like-muddle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5794573334038003999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/5794573334038003999'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/08/in-case-you-hadnt-guessed-i-like-muddle.html' title=''/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-8218932313622037480</id><published>2009-08-28T09:59:00.003+01:00</published><updated>2009-10-22T14:51:11.470+01:00</updated><title type='text'>Adding a new program to a muddle build description</title><content type='html'>&lt;p&gt;So I have a program (which I shall, for the sake of argument, call &amp;quot;george&amp;quot;, because that is not its name) which relies upon &lt;a class="reference external" href="http://ffmpeg.org/"&gt;ffmpeg&lt;/a&gt; and &lt;a class="reference external" href="http://tstools.berlios.de/"&gt;tstools&lt;/a&gt;, and which I want to incorporate into an existing muddle build.&lt;/p&gt;&lt;p&gt;This article describes how I did it. The resultant code is that used in the real system (except that the names have been changed).&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;p&gt;I shall assume that you've read the &lt;a class="reference external" href="http://code.google.com/p/muddle/"&gt;muddle&lt;/a&gt; documentation, and in particular the &lt;a class="reference external" href="http://muddle.googlecode.com/svn/trunk/muddle/docs/_build/html/README.html"&gt;Welcome to Muddle&lt;/a&gt; readme.&lt;/p&gt;&lt;p&gt;As described in the muddle documentation, the project I'm amending is laid out in the traditional manner:&lt;/p&gt;&lt;pre class="literal-block"&gt;+- .muddle/
+- src
|  +- builds/
|  |  +- 01.py
|  +- builders/
|  +- package1/
|  +- package2/
|  +- ...
+- obj/
+- install/
+- deploy/
&lt;/pre&gt;&lt;p&gt;where &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/buids/01.py&lt;/span&gt;&lt;/tt&gt; is the build description, and the various &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;package1&lt;/span&gt;&lt;/tt&gt;, etc., are existing software packages that are being built already.&lt;/p&gt;&lt;blockquote&gt;(Naming the main build description &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;01.py&lt;/span&gt;&lt;/tt&gt; appears already to be a tradition in muddle. It could, of course, be called something else, perhaps named after the project.)&lt;/blockquote&gt;&lt;p&gt;The project I'm building is being deployed on a system similar to that I'm building on, so the same toolchain is being used, and I do not need to specify the compiler and so on. This also means that any &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;configure&lt;/span&gt;&lt;/tt&gt; scripts can configure against the system I'm building on, and get results that make sense on the target. This is unusually simple, but makes the examples a lot easier to read.&lt;/p&gt;&lt;div class="section" id="id1"&gt;&lt;h1&gt;ffmpeg&lt;/h1&gt;&lt;p&gt;For this program, we need a fairly recent version of ffmpeg, so we need to get it from the ffmpeg site. We are not, however, particularly interested (at this stage) in tracking future changes to the library.&lt;/p&gt;&lt;p&gt;ffmpeg is available as spot releases, via SVN, or via GIT. Since the project I'm adding to uses GIT to store its checkouts, it makes sense to use the GIT version of ffmpeg, and thus I can just &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;git&lt;/span&gt; &lt;span class="pre"&gt;clone&lt;/span&gt;&lt;/tt&gt; ffmpeg (and libswscale) and add them to the project's repository directly. This means we'll be working with a local checkout, rather than a remote one, which will also speed up the process of checking out when doing a build from scratch.&lt;/p&gt;&lt;p&gt;That leaves us with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/ffmpeg&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;&lt;p&gt;muddle prefers packages to build out-of-tree, so that it is possible to build for more than one target without needing to &amp;quot;clean&amp;quot; the source tree. ffmpeg supports this, so that's nice.&lt;/p&gt;&lt;p&gt;Since &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/ffmpeg&lt;/span&gt;&lt;/tt&gt; is taken directly from the outside world, we'd rather not add muddle specific build files, configuration files, etc., to that directory. The convention for muddle is to have a separate &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builders&lt;/span&gt;&lt;/tt&gt; directory containing muddle specific infrastructure for an external package - so, in this case:&lt;/p&gt;&lt;pre class="literal-block"&gt;src/builders/ffmpeg/Makefile.muddle
&lt;/pre&gt;&lt;p&gt;tells muddle how to build ffmpeg. If we needed (for instance) an &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;init.d&lt;/span&gt;&lt;/tt&gt; script, or other support files, then this would be a natural place to keep them as well.&lt;/p&gt;&lt;p&gt;The code I need to add to the build script (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builds/01.py&lt;/span&gt;&lt;/tt&gt;) is then:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# ffmpeg&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# - we have a GIT clone of ffmpeg&amp;#39;s own repository in our repository already&lt;/span&gt;
muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;relative(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# - we have our own information on how to build it&lt;/span&gt;
make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
            name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;,        &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
            roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; [&lt;span style="color: #BA2121"&gt;&amp;quot;project&amp;quot;&lt;/span&gt;],
            checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builders&amp;quot;&lt;/span&gt;,
            deps &lt;span style="color: #666666"&gt;=&lt;/span&gt; [],
            makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))

&lt;span style="color: #408080; font-style: italic"&gt;# building ffmpeg requires the Makefile.muddle in builders/ffmpeg&lt;/span&gt;
muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;, &lt;span style="color: #408080; font-style: italic"&gt;# This package&lt;/span&gt;
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;project&amp;quot;&lt;/span&gt;,&lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;, &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                        &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;In other words:&lt;/p&gt;&lt;ol class="arabic"&gt;&lt;li&gt;&lt;p class="first"&gt;We are checking out &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;ffmpeg&lt;/span&gt;&lt;/tt&gt; from our own repository (so it is a &amp;quot;relative&amp;quot; checkout - an &amp;quot;absolute&amp;quot; checkout would need to specify an external repository).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;We build package &amp;quot;ffmpeg&amp;quot; for the role &amp;quot;project&amp;quot; using the checkout &amp;quot;builders&amp;quot; (for simplicity I'm checking out all of the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builders&lt;/span&gt;&lt;/tt&gt; directory). This doesn't depend on anything else. We're going to use the named makefile.&lt;/p&gt;&lt;p&gt;(Note that we've earlier done:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #008000; font-weight: bold"&gt;import&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;muddled.pkgs.make&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;as&lt;/span&gt; &lt;span style="color: #0000FF; font-weight: bold"&gt;make&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;in order to keep the code easier to read.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;As a shorthand, we tell muddle that that same package (&amp;quot;ffmpeg&amp;quot;) in the given role depends on the checkout of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;ffmpeg&lt;/span&gt;&lt;/tt&gt; - in other words we can't build the ffmpeg library until we've checked it out.&lt;/p&gt;&lt;p&gt;We could have done that last step directly by specifying a dependency in the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;deps&lt;/span&gt;&lt;/tt&gt; argument to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;make.medium&lt;/span&gt;&lt;/tt&gt;, but that would involve constructing the appropriate label (not actually that hard, but the &amp;quot;helper&amp;quot; function is probably slightly easier).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;Makefile.muddle&lt;/span&gt;&lt;/tt&gt; then looks like:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Build ffmpeg.&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# Ask muddle where the ffmpeg package has been checked out&lt;/span&gt;
&lt;span style="color: #19177C"&gt;FFMPEG_SRC&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;shell &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; query dir &lt;span style="color: #BA2121"&gt;&amp;quot;checkout:ffmpeg{*}/*&amp;quot;&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

all: FORCE
        &lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; make

&lt;span style="color: #408080; font-style: italic"&gt;# Do our configuration building in the MUDDLE_OBJ_OBJ directory. ffmpeg&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# supports remote configuration building, by specifying the path to the&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# configure script. It then leaves (a link to) the Makefile in that directory,&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# so that we can &amp;quot;cd&amp;quot; there and build &amp;quot;directly&amp;quot;.&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;#&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# When configuring, say that our files will end up (when installed) in &amp;quot;/&amp;quot;,&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# because, on the target machine, they should.&lt;/span&gt;
config:
        -rm -rf &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        &lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;FFMPEG_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/configure --prefix&lt;span style="color: #666666"&gt;=&lt;/span&gt;/

&lt;span style="color: #408080; font-style: italic"&gt;# When installing, we&amp;#39;re installing within the muddle infrastructrure,&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# not onto the target machine. So we need to use DESTDIR to say &amp;quot;although&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# you want to install into &amp;quot;/&amp;quot;, pretend that &amp;quot;/&amp;quot; is rooted at MUDDLE_OBJ&amp;quot;.&lt;/span&gt;
install:
        &lt;span style="color: #008000"&gt;cd&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;; make &lt;span style="color: #19177C"&gt;DESTDIR&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; install

distclean:
        -rm -rf &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

clean: FORCE
        make -C &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;FFMPEG_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; clean

FORCE:
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="section" id="tsstools"&gt;&lt;h1&gt;tsstools&lt;/h1&gt;&lt;p&gt;The second package we need to build is tstools.&lt;/p&gt;&lt;p&gt;Unfortunately, tsools does not support building out-of-tree. The best solution to this would have been to fix it (particularly since I am the tstools maintainer), but for speed I didn't bother, and it allows an example of how one might work around this sort of problem.&lt;/p&gt;&lt;p&gt;Again, for simplicity, and because this project does not care about future changes to tstools (particularly if the build mechanism should change!), we take a copy of tstools into our own repository.&lt;/p&gt;&lt;p&gt;The build script code for tstools is very similar to that for ffmpeg:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# tstools&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# - we have a copy of tstools&amp;#39; own repository in our repository already&lt;/span&gt;
muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;checkouts&lt;span style="color: #666666"&gt;.&lt;/span&gt;simple&lt;span style="color: #666666"&gt;.&lt;/span&gt;relative(builder, &lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;)

&lt;span style="color: #408080; font-style: italic"&gt;# - we have our own information on how to build it&lt;/span&gt;
make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
            name &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;,       &lt;span style="color: #408080; font-style: italic"&gt;# package name&lt;/span&gt;
            roles &lt;span style="color: #666666"&gt;=&lt;/span&gt; [&lt;span style="color: #BA2121"&gt;&amp;quot;project&amp;quot;&lt;/span&gt;],
            checkout &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;builders&amp;quot;&lt;/span&gt;,
            deps &lt;span style="color: #666666"&gt;=&lt;/span&gt; [],
            makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; os&lt;span style="color: #666666"&gt;.&lt;/span&gt;path&lt;span style="color: #666666"&gt;.&lt;/span&gt;join(&lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;,&lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;))

muddled&lt;span style="color: #666666"&gt;.&lt;/span&gt;pkg&lt;span style="color: #666666"&gt;.&lt;/span&gt;package_depends_on_checkout(builder&lt;span style="color: #666666"&gt;.&lt;/span&gt;invocation&lt;span style="color: #666666"&gt;.&lt;/span&gt;ruleset,
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;,  &lt;span style="color: #408080; font-style: italic"&gt;# This package&lt;/span&gt;
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;project&amp;quot;&lt;/span&gt;,  &lt;span style="color: #408080; font-style: italic"&gt;# in this role&lt;/span&gt;
                                        &lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;,  &lt;span style="color: #408080; font-style: italic"&gt;# depends on this checkout&lt;/span&gt;
                                        &lt;span style="color: #008000"&gt;None&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;So we once again have a &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;Makefile.muddle&lt;/span&gt;&lt;/tt&gt;, predictable in &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builders/tstools/Makefile.muddle&lt;/span&gt;&lt;/tt&gt;:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Build tstools.&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# tstools doesn&amp;#39;t currently support building out-of-tree, so we&amp;#39;ll have to cope&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# - primarily by cleaning before each build, and then copying the result out of tree&lt;/span&gt;

&lt;span style="color: #408080; font-style: italic"&gt;# Ask muddle where the tstools package has been checked out&lt;/span&gt;
&lt;span style="color: #19177C"&gt;TSTOOLS_SRC&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;shell &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; query dir &lt;span style="color: #BA2121"&gt;&amp;quot;checkout:tstools{*}/*&amp;quot;&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/trunk

&lt;span style="color: #408080; font-style: italic"&gt;# Force a clean before our build in case someone else has built&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# This *is* a pain, but is best solved by making tstools build out-of-tree&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# for itself&lt;/span&gt;
all: FORCE
        make -C &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; clean
        make -C &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

&lt;span style="color: #408080; font-style: italic"&gt;# We install the include files into MUDDLE_OBJ_INCLUDE. At the moment we&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# aren&amp;#39;t deploying them to the target system, but if we were we&amp;#39;d be&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# putting them into one of the main &amp;quot;include&amp;quot; directories, which would&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# be rather unfriendly. So that&amp;#39;s worth bearing in mind...&lt;/span&gt;
install: all
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_LIB&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        -mkdir -p &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_INCLUDE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        cp &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/lib/* &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_LIB&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;
        cp &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/*.h   &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ_INCLUDE&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

config:
&lt;span style="color: #408080; font-style: italic"&gt;        # Nothing to do here&lt;/span&gt;

distclean:
        make -C &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; distclean
        -rm -rf &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_OBJ&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

clean: FORCE
        make -C &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_SRC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; clean

FORCE:
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="section" id="george"&gt;&lt;h1&gt;george&lt;/h1&gt;&lt;p&gt;Finally, we have the program itself. This is the only thing we're actually going to want on the target system, since we're building against static libraries.&lt;/p&gt;&lt;p&gt;Since this is a program that is written for this system, and thus we don't need a separate checkout for the muddle specific Makefile, the muddle description code is very simple:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;make&lt;span style="color: #666666"&gt;.&lt;/span&gt;medium(builder,
            &lt;span style="color: #BA2121"&gt;&amp;quot;george&amp;quot;&lt;/span&gt;,
            [&lt;span style="color: #BA2121"&gt;&amp;quot;project&amp;quot;&lt;/span&gt;],
            &lt;span style="color: #BA2121"&gt;&amp;quot;george&amp;quot;&lt;/span&gt;,
            [&lt;span style="color: #BA2121"&gt;&amp;quot;ffmpeg&amp;quot;&lt;/span&gt;, &lt;span style="color: #BA2121"&gt;&amp;quot;tstools&amp;quot;&lt;/span&gt;],
            config &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #008000"&gt;False&lt;/span&gt;,
            makefileName &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;quot;Makefile.muddle&amp;quot;&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;Specifically, we're building the package &amp;quot;george&amp;quot;, for the &amp;quot;project&amp;quot; role, based on the checkout &amp;quot;george&amp;quot;. By default this is a simple checkout, and thus we don't need to specify how to get &amp;quot;george&amp;quot;. We depend on the two packages named, so they must already have been built. &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;config=False&lt;/span&gt;&lt;/tt&gt; means we don't need to do a configuration step (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;make&lt;/span&gt; &lt;span class="pre"&gt;configure&lt;/span&gt;&lt;/tt&gt;).&lt;/p&gt;&lt;p&gt;We could have called the Makefile just &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;Makefile&lt;/span&gt;&lt;/tt&gt;, but it seemed clearer to me to make it specific that it is a &lt;em&gt;muddle&lt;/em&gt; makefile, since muddle makefiles depend on the muddle infrastructure to work (to set all those special environment variables).&lt;/p&gt;&lt;p&gt;The makefile for &amp;quot;george&amp;quot; (which is in the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;src/george&lt;/span&gt;&lt;/tt&gt; directory) is then:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #408080; font-style: italic"&gt;# Build george&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# MUDDLE_INCLUDE_DIRS is given to us as a list of the include directories&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# we said we depended on.&lt;/span&gt;
&lt;span style="color: #408080; font-style: italic"&gt;# The incantation below says &amp;quot;For everything in MUDDLE_INC_DIRS, prefix &amp;#39;-I&amp;#39;&amp;quot;&lt;/span&gt;
&lt;span style="color: #19177C"&gt;INCS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INCLUDE_DIRS:%&lt;span style="color: #666666"&gt;=&lt;/span&gt;-I%&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

&lt;span style="color: #408080; font-style: italic"&gt;# Similarly for MUDDLE_LIB_DIRS&lt;/span&gt;
&lt;span style="color: #19177C"&gt;LIBS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_LIB_DIRS:%&lt;span style="color: #666666"&gt;=&lt;/span&gt;-L%&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

&lt;span style="color: #19177C"&gt;FFMPEG_LIBS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;-lavformat -lavcodec -lavutil -lswscale -lz -lbz2 -lm

&lt;span style="color: #19177C"&gt;TSTOOLS_LIBS&lt;/span&gt;&lt;span style="color: #666666"&gt;=&lt;/span&gt;-ltstools

&lt;span style="color: #408080; font-style: italic"&gt;# Default to building in the current directory&lt;/span&gt;
O ?&lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;CURDIR&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

&lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;O&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/george:        george.c
        &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;CC&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;CCFLAGS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; -o &lt;span style="color: #19177C"&gt;$@&lt;/span&gt; george.c &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;INCS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;LIBS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;FFMPEG_LIBS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;TSTOOLS_LIBS&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;

install:
        cp &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;O&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/george &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;MUDDLE_INSTALL&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/bin

config:
&lt;span style="color: #408080; font-style: italic"&gt;        # Nothing to do&lt;/span&gt;

distclean: clean
&lt;span style="color: #408080; font-style: italic"&gt;        # Nothing to do&lt;/span&gt;

clean:
        rm -f &lt;span style="color: #008000; font-weight: bold"&gt;$(&lt;/span&gt;O&lt;span style="color: #008000; font-weight: bold"&gt;)&lt;/span&gt;/george
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;MUDDLE_INCLUDE_DIRS&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;MUDDLE_LIB_DIRS&lt;/span&gt;&lt;/tt&gt; magic is explained in the muddle documentation - it gives me a list of the include directories and library directories implied by the dependencies I've stated for this package (so if I get those wrong, that will show up here).&lt;/p&gt;&lt;p&gt;The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$(O)&lt;/span&gt;&lt;/tt&gt; business is building george out-of-tree, so that we can have several different builds of the same source at the same time.&lt;/p&gt;&lt;p&gt;Note that the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install&lt;/span&gt;&lt;/tt&gt; target is copying the &amp;quot;george&amp;quot; executable to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$(MUDDLE_INSTALL)/bin&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;&lt;p&gt;The flow of built objects in muddle is, more or less:&lt;/p&gt;&lt;pre class="literal-block"&gt;src/ --compile--&amp;gt; obj/ --install--&amp;gt; install/ --deploy--&amp;gt; deploy/
&lt;/pre&gt;&lt;p&gt;Both ffmpeg and tstools were compiled and the results placed into &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;obj/&lt;/span&gt;&lt;/tt&gt; subdirectories.  Since they are not destined for the target system, however, they are not copied to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install/&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;&lt;p&gt;&amp;quot;george&amp;quot; &lt;em&gt;is&lt;/em&gt; to be put on the target system, so it is copied to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install/.../bin&lt;/span&gt;&lt;/tt&gt; -- the exact location depends upon the role, etc.&lt;/p&gt;&lt;blockquote&gt;(Copying things from &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install/&lt;/span&gt;&lt;/tt&gt; to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;deploy/&lt;/span&gt;&lt;/tt&gt; is done by muddle automatically as part of the deployment phase, so we don't need to do anything special for that - again, see the muddle documentation.)&lt;/blockquote&gt;&lt;p&gt;It is perhaps unfortunate that the Makefile target called &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install&lt;/span&gt;&lt;/tt&gt; is used for both purposes, but that does fit with the normal &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;make&lt;/span&gt;&lt;/tt&gt; usages. Of course, if we were wanting ffmpeg libraries on the final system, we'd have to extend the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;install&lt;/span&gt;&lt;/tt&gt; target in its &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;Makefile.muddle&lt;/span&gt;&lt;/tt&gt; to copy files from &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;MUDDLE_OBJ&lt;/span&gt;&lt;/tt&gt; to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;MUDDLE_INSTALL&lt;/span&gt;&lt;/tt&gt;, but that's an example for another time.&lt;/p&gt;&lt;/div&gt;&lt;div class="section" id="other-things"&gt;&lt;h1&gt;Other things&lt;/h1&gt;&lt;p&gt;Since muddle is dependency based, it can be useful to look at the dependencies. The main command to do this is:&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;$ muddle depend user
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;which shows all the build description dependencies, or (for instance):&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;$ muddle depend user &amp;#39;package:ffmpeg{project}/*&amp;#39;
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;which shows all the dependencies for package &amp;quot;ffmpeg&amp;quot; in role &amp;quot;project&amp;quot;, with any tag (nb: &lt;em&gt;package&lt;/em&gt; &amp;quot;ffmpeg&amp;quot; is distinct from &lt;em&gt;checkout&lt;/em&gt; &amp;quot;ffmpeg&amp;quot;, which is separate and distinct - again, see the muddle documentation).&lt;/p&gt;&lt;blockquote&gt;(&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddled.depend.Label()&lt;/span&gt;&lt;/tt&gt; can be used to construct a label from its parts, and thus may help to remember what those parts are.)&lt;/blockquote&gt;&lt;p&gt;Meanwhile, as I iterated towards getting &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;builders/ffmpeg/Makefile.muddle&lt;/span&gt;&lt;/tt&gt; correct,&lt;/p&gt;&lt;blockquote&gt;&lt;div class="highlight"&gt;&lt;pre&gt;$ muddle distclean ffmpeg
&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;was also my friend.&lt;/p&gt;&lt;p&gt;Finally, all of the information about the current build is kept under the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.muddle&lt;/span&gt;&lt;/tt&gt; directory. It is kept in very simple form, and the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;muddle&lt;/span&gt;&lt;/tt&gt; command reads the information &amp;quot;as given&amp;quot;. This means that if I get my system into a strange or broken situation, and want to clear muddle's memory of what has been done, I can simply delete the appropriate tags (which are just text files containing a timestamp) from the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.muddle&lt;/span&gt;&lt;/tt&gt; directory structure.&lt;/p&gt;&lt;p&gt;This turns out to be very useful when trying to develop a system, and is much easier to handle than the tangle one tends to get into with traditional (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;make&lt;/span&gt;&lt;/tt&gt; based) build and deployment systems.&lt;/p&gt;&lt;!-- vim: set filetype=rest tabstop=8 shiftwidth=2 expandtab: --&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-8218932313622037480?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/8218932313622037480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/08/adding-new-program-to-muddle-build_28.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8218932313622037480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/8218932313622037480'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/08/adding-new-program-to-muddle-build_28.html' title='Adding a new program to a muddle build description'/><author><name>Tibs</name><uri>http://www.blogger.com/profile/09445896520800874072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://2.bp.blogspot.com/_TVhZ4iJwUyk/SwG1PbAFvJI/AAAAAAAAAAM/8Dul3pt4uRQ/S220/tigerente-sketch.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5625827309301120857.post-124672600606507499</id><published>2009-08-06T23:21:00.000+01:00</published><updated>2009-08-06T23:23:21.670+01:00</updated><title type='text'>First post..</title><content type='html'>Welcome to Kynesim's blog. This will be mostly technology with a side-order of comments on the UK tech business and the odd useful Linux hint.

.. or you can read our &lt;a href="http://www.kynesim.co.uk/"&gt;official website&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5625827309301120857-124672600606507499?l=kynesim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kynesim.blogspot.com/feeds/124672600606507499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kynesim.blogspot.com/2009/08/first-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/124672600606507499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5625827309301120857/posts/default/124672600606507499'/><link rel='alternate' type='text/html' href='http://kynesim.blogspot.com/2009/08/first-post.html' title='First post..'/><author><name>Richard</name><uri>http://www.blogger.com/profile/15413093214412156645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
