<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Bear&#039;s Journal &#187; build/release</title>
	<atom:link href="http://code-bear.com/bearlog/category/buildrelease/feed/" rel="self" type="application/rss+xml" />
	<link>http://code-bear.com/bearlog</link>
	<description>Gravity is the root of lightness; stillness, the ruler of movement</description>
	<lastBuildDate>Sat, 03 Jul 2010 08:10:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>		<item>
		<title>Fennec on Android &#8211; nightly builds</title>
		<link>http://code-bear.com/bearlog/2010/05/19/fennec-on-android-nightly-builds/</link>
		<comments>http://code-bear.com/bearlog/2010/05/19/fennec-on-android-nightly-builds/#comments</comments>
		<pubDate>Wed, 19 May 2010 04:33:51 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2010/05/19/fennec-on-android-nightly-builds/</guid>
		<description><![CDATA[With a lot of help from Aki, Ben (heck the entire RelEng team) and the Mozilla Mobile team, my work to enable nightly signed builds of Fennec for Android were landed.
\o/
This was an interesting task because it involved a little bit of each job in the RelEng world at Mozilla:
I had to update the puppet [...]]]></description>
			<content:encoded><![CDATA[<p>With a lot of help from Aki, Ben (heck the entire <a href="https://wiki.mozilla.org/ReleaseEngineering">RelEng</a> team) and the <a href="https://wiki.mozilla.org/Mobile">Mozilla Mobile</a> team, my work to enable <a href="http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mobile-trunk/fennec.apk">nightly signed builds of Fennec for Android</a> were landed.</p>
<p><b>\o/</b></p>
<p>This was an interesting task because it involved a little bit of each job in the <a href="http://wiki.mozilla.org/ReleaseEngineering">RelEng</a> world at <a href="http://mozilla.com">Mozilla</a>:</p>
<p>I had to update the <a href="http://www.puppetlabs.com/">puppet</a> manifest which we use to distribute files and manage configurations for the build farm so the signing keystore and configuration file would get to all of the production build servers. I also had to write a small <a href="http://python.org">Python</a> program to make the actual call to Jarsigner because if we just called it from within the <a href="http://buildbot.net">Buildbot</a> step, the output would include the keystore passwords and that appears on the build server&#8217;s web page &#8211; not good.</p>
<p>I also had to drill deep into the various parts of the <a href="http://mozilla.com">Mozilla</a> <a href="http://buildbot.net">Buildbot</a> configuration and custom code because the Android build was new and just different enough from the other mobile builds that it wasn&#8217;t just a cut-n-paste solution.</p>
<p>And all of this I was doing the <a href="http://mozilla.com">Mozilla</a> way for the first time and let&#8217;s just say they have some unique custom code :)</p>
<p>But today the first half of the task was completed and that allows the <a href="http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mobile-trunk/fennec.apk">nightly signed builds</a> to <a href="http://dougt.org/wordpress/2010/05/got-android-we-need-you/" title="android nightly builds">be made public</a>. What remains is to remove some work-arounds (for the packaging and tests) and then to start building the steps required to generate a release version of Fennec for Android.</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2010/05/19/fennec-on-android-nightly-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What exactly is Build/Release</title>
		<link>http://code-bear.com/bearlog/2010/01/29/what-exactly-is-buildrelease/</link>
		<comments>http://code-bear.com/bearlog/2010/01/29/what-exactly-is-buildrelease/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 06:28:41 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[mutterings]]></category>
		<category><![CDATA[developers]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2010/01/29/what-exactly-is-buildrelease/</guid>
		<description><![CDATA[To understand why the Build/Release process is what I consider the most important part of any project, I first have to define what I consider to be the parts of the Build/Release process.
Build/Release starts from when the first line of code is created and continues all the way to when a user installs and runs [...]]]></description>
			<content:encoded><![CDATA[<p>To understand why the Build/Release process is what I consider the most important part of any project, I first have to define what I consider to be the parts of the Build/Release process.</p>
<p>Build/Release starts from when the first line of code is created and continues all the way to when a user installs and runs your application or accesses some part of your server or service. Yep, it&#8217;s inter-woven into all aspects of a project simply because if you don&#8217;t have quality steps all thru that process you end up with crap. It may be pretty shiny crap, but it&#8217;s still crap.</p>
<p>I find one of the better ways to visualize Build/Release is to work backwards from the customer and outline what it would take to research and solve any problem the customer is having. This often is classified by developers as bugs, but I&#8217;ve gotten more accustomed to thinking of them as Issues &#8211; because sometimes it&#8217;s not a coding defect that is causing the Issue, but rather a process or UX problem.</p>
<p>Your project, let&#8217;s call it twerzle has just been installed on your customer&#8217;s laptop and <b>bang</b> &#8211; they have a problem. What happens next depends on how prepared you were during the Release part of the Build/Release process.</p>
<ul>
<li>Do you have a support link or area on your project page</li>
<li>Is the version number or other project identifier easily discovered or located</li>
<li>Do you have a way for the user to give you the information you need without them having to be a digital forensics major?</li>
</ul>
<p>These items will change from release to release, so you need to have outlined what steps are required to update your web site and secondary documentation &#8211; you do have a README file or CHANGES file and that information is accessible right? So our twerzle user has found your support link on the page they downloaded the app and that page also has what the latest version is so they don&#8217;t have to guess &#8211; what is next?</p>
<ul>
<li>Is this link a simple email box? Is someone assigned to answer the emails? Do you have an auto-responder?</li>
<li>Is the link to a support forum? Has someone been tasked to monitor the forums? Is there a sticky-post showing the README contents?</li>
<li>Is the link to an IRC forum &#8211; better hope you have 24hr coverage because that&#8217;s a fast way to an irked user if no one is around to answer them 24&#215;7</li>
</ul>
<p>So, community support methods and practices aside (that&#8217;s a whole other subject that I don&#8217;t even begin to understand fully), you now have a support request from a user and for the sake of our example, it actually contains a version number and a complete description of the problem. This is when you find out if you have a <i>real</i> Build/Release process.</p>
<p>Given the version information for the issue, can you now go back and install a clean instance of that exact version? No, I am not talking about a developer having what they think is a clean checkout of the source. I am talking about being able to retrieve the exact distribution image and then being able to install it on a computer that has <b>NO</b> development environment. Yep, this step is where most projects fail as they depend on developers to reproduce issues. But that works only for coding defects &#8211; not for application usage or environment issues.</p>
<p>That is what the crux of Build/Release is, the ability to have all of the information that goes into a project&#8217;s distribution available to back-track and solve any issue a customer may have. What goes into this nebulous hand-waving bundle depends on a lot of details, but it almost always boils down to three items:</p>
<ol>
<li>Reproducibility</li>
<li>Documentation</li>
<li>Deployment</li>
</ol>
<p>Reproducibility means simply, do you have available all of the source code, the libraries, and the environment needed to build said source code available for each release you have made. If you do not, then you cannot truly reproduce a release and while you may be able to figure out what the problem is, you will not be able to fix it <b>for that release</b>. You will have to fix it in the trunk and hope that the code is the same and that the fix doesn&#8217;t break other things.</p>
<p>Documentation is all of the things that make up the how and why of the building and creation of a distribution. What versions of libraries are needed, what steps are to be taken, what tools and assumptions are being used and what the process is to bundle all of that into a distribution. Yes, here source code and scripts do count &#8211; as long as you include them in the distribution snapshot :)</p>
<p>Deployment is basically all of the above but from the point of view of non-developers. What is the process to deploy a new release for testing, how do you take the developer generated items and QA them. Once they are tested, what are the steps for deployment to the public. Do you have upgrade steps, are there extra tools and/or documentation that needs to be generated for upgrades versus new installs.</p>
<p>I realize I have only given a very short overview of what I consider a Build/Release process is but most of the time the above is what a lot of projects don&#8217;t do well for a lot of little reasons. I myself need to sit down and try and map out how I will communicate more details since it is so project specific.</p>
<p>Thanks for reading and I hope my bumbling attempt at communicating this process has come across in a useful manner.</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2010/01/29/what-exactly-is-buildrelease/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is a Release Candidate anyways</title>
		<link>http://code-bear.com/bearlog/2010/01/15/what-is-a-release-candidate-anyways/</link>
		<comments>http://code-bear.com/bearlog/2010/01/15/what-is-a-release-candidate-anyways/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 23:55:20 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[mutterings]]></category>
		<category><![CDATA[developers]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2010/01/15/what-is-a-release-candidate-anyways/</guid>
		<description><![CDATA[Fritzy posted a comment that got me thinking about what exactly are &#8220;good habits&#8221; (aka Best Practices) for open source build/release projects and while I&#8217;m not going to outline them all here in this post, I do want to cover one item: the Release Candidate.
What is a Release Candidate? The Apache Incubator site has a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://disqus.com/fritzy/">Fritzy</a> posted a <a href="http://code-bear.com/bearlog/2010/01/15/how-not-to-qa-your-open-source-project/#comment-30000250">comment</a> that got me thinking about what exactly are &#8220;good habits&#8221; (aka Best Practices) for open source build/release projects and while I&#8217;m not going to outline them all here in this post, I do want to cover one item: the Release Candidate.</p>
<p>What is a Release Candidate? The <a href="http://incubator.apache.org">Apache Incubator</a> site has a <a href="http://incubator.apache.org/guides/releasemanagement.html#glossary-release-candidate">guide</a> that defines it as</p>
<blockquote>
<h3 style="font-size: 16px; font-weight: bold;"><span style="font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 14px; -webkit-border-horizontal-spacing: 4px; -webkit-border-vertical-spacing: 4px;"><a name="glossary-release-candidate" id="glossary-release-candidate">Release Candidate</a></span></h3>
<div class="section-content" style="padding-left: 1em; padding-right: 1em;">
<p><span style="font-family: Arial, Geneva, Helvetica, sans-serif; font-size: 14px; -webkit-border-horizontal-spacing: 4px; -webkit-border-vertical-spacing: 4px;">Collection of artifacts to be tested and voted on in order to release them. Sometimes folks use this term to refer only to a candidate source package.</span></p>
</p></div>
</blockquote>
<p>and while that&#8217;s a rather dry wording, it does outline the most crucial piece &#8211; that it is a collection of artifacts (aka source files, images, etc.) that are to be considered for the next release. Those items are generated from a &#8220;frozen&#8221; source tree and used to test that the release candidate is ready for distribution.</p>
<p>In all but the extreme edge cases, a Release Candidate is a very specific thing that can only come about because the Developers and the QA team have decided that the current set of bug-fixes and/or new features are stable enough to be ready for <i>consideration</i> as the next release. This does not mean you can take the latest generated output from your continuous integration tool (or at worse case the tarball the developer was using as his test install) and move that to the web site and stamp a v2.0 sticker on it.</p>
<p>Only for the most basic of projects can you consider the developer version of a distribution to be ready for release &#8211; the vast majority of projects all have secondary information to be included and also will require additional changes to any number of support-related documents or sites. At the very least you need to create your ChangeLog to outline what has been fixed and what is new.</p>
<p>So a release candidate starts with what the developers have created, gets updated and massaged so that it contains the extra information that makes a distribution and <i>then</i> that part is tested in a non-developer environment. Once those tests are done can you consider it ready to be installed or distributed to the public.</p>
<p>The flip side is what things can cause a release candidate to not be considered &#8211; that in my opinion, is a very short list and depends on how the project defines &#8220;show stopper&#8221; so it&#8217;s hard to generalize into a post. The one item for me that is always an immediate veto is if it is discovered that code that isn&#8217;t part of a bug fix or a feature that was scheduled for the release is found to have been introduced. The reason why is really simple &#8211; how can you properly test code if you don&#8217;t have the bug notes or feature notes to guide you in testing.</p>
<p>That is basically a very fast overview of what I consider a release candidate to be. I&#8217;m going to work on an outline for what I think are the core tenets for any open source project and start a blog post series covering them.</p>
<p>thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2010/01/15/what-is-a-release-candidate-anyways/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Leopard changed default partition table type breaking makediskimage.sh</title>
		<link>http://code-bear.com/bearlog/2007/11/08/leopard-changed-default-partition-table-type-breaking-makediskimagesh/</link>
		<comments>http://code-bear.com/bearlog/2007/11/08/leopard-changed-default-partition-table-type-breaking-makediskimagesh/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 08:26:42 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mutterings]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2007/11/08/leopard-changed-default-partition-table-type-breaking-makediskimagesh/</guid>
		<description><![CDATA[Not sure where exacly I found makediskimage.sh, heck probably saw another project using it, but for sure it has saved a lot of hassle back when I was learning how to create disk image files.
Unfortunately it doesn&#8217;t have any author or history so I never knew who to thank :(
With the Leopard upgrade it suddenly [...]]]></description>
			<content:encoded><![CDATA[<p>Not sure where exacly I found makediskimage.sh, heck probably saw another project using it, but for sure it has saved a lot of hassle back when I was learning how to create disk image files.</p>
<p>Unfortunately it doesn&#8217;t have any author or history so I never knew who to thank :(</p>
<p>With the Leopard upgrade it suddenly stopped working.  The HFS format step was failing and was just outputing it&#8217;s help text.  Looking at the line just above in the script that generated that output, I noticed that the echo output was not correct:</p>
<blockquote><pre>...
created: /tmp/20096.dmg
Creating HFS partition Chandler_iosx_debug_0.7.3.dev-r15733 on /tmp/20096.dmg at

usage: newfs_hfs [-h | -w] [-N] [hfsplus-options] special-device
options:
...
</pre>
</blockquote>
<p>The line that starts &#8220;Creating HFS partition&#8230;&#8221; should end with &#8220;at /dev/disk5s1&#8243; &#8211; what drive the HFS formatting would have happened on.</p>
<p>The bash script segment responsible for that is:</p>
<blockquote><pre>DEVICES=`hdid -nomount $TMPFILE`
DEVMASTER=`echo $DEVICES| awk '{ print $1 }'`
DEVHFS=`echo $DEVICES| awk '{ print $5 }'`
echo Creating HFS partition $NAME on $TMPFILE at $DEVHFS
newfs_hfs -v "$NAME" $DEVHFS
</pre>
</blockquote>
<p>The line of interest is the output of hdid &#8211; up until Leopard it would output something like:</p>
<blockquote><pre>oliver:~ bear$ hdid -nomount /tmp/bear.dmg
/dev/disk2          	Apple_partition_scheme
/dev/disk2s1        	Apple_partition_map
/dev/disk2s2        	Apple_HFS
</pre>
</blockquote>
<p>Which shows the drive and two partitions, but under Leopard it now outputs:</p>
<blockquote><pre>imac3:~ bear$ hdid -nomount /tmp/bear.dmg
/dev/disk5          	GUID_partition_scheme
/dev/disk5s1        	Apple_HFS
</pre>
</blockquote>
<p>When you pass that to an environment variable (which, remember, removes all line feeds and makes it into a long string) you now get:</p>
<blockquote><pre>DEVHFS=/dev/disk5  GUID_partition_scheme  /dev/disk5s1  Apple_HFS</pre>
</blockquote>
<p>Instead of</p>
<blockquote><pre>DEVHFS=/dev/disk2  Apple_partition_scheme  /dev/disk2s1  Apple_partition_map  /dev/disk2s2  Apple_HFS</pre>
</blockquote>
<p>Basically to try and get to an actual point :) &#8211; when
<pre>awk '{ print $5 }'</pre>
<p> is run on the new output there isn&#8217;t a fifth item so you get nothing back.</p>
<p>The fix is to switch to a method that isn&#8217;t dependent on the layout of the columns *and* the lines:</p>
<blockquote><pre>DEVHFS=`hdid -nomount $TMPFILE | grep Apple_HFS | awk '{ print $1 }'`</pre>
</blockquote>
<p>Now we take the raw output, grep for the line we really want and grab the first column of that.  With the extra bonus of it working now on all OS X&#8217;s I could get my hands on to test.</p>
<p>Anywho, just wanted to post this in case someone else runs into their makediskimage.sh script suddenly start to fail.</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2007/11/08/leopard-changed-default-partition-table-type-breaking-makediskimagesh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reply to The Tao of Mac post about Chandler</title>
		<link>http://code-bear.com/bearlog/2007/09/17/reply-to-the-tao-of-mac-post-about-chandler/</link>
		<comments>http://code-bear.com/bearlog/2007/09/17/reply-to-the-tao-of-mac-post-about-chandler/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 22:00:58 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[osaf]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2007/09/17/reply-to-the-tao-of-mac-post-about-chandler/</guid>
		<description><![CDATA[comments have not been enabled so I&#8217;m answering the question here and going to do a trackback&#8230;
Rui Carmo posted a small bit about Chandler:
I used to think this would be able to stand up to the Outlook hegemony, but I find the current GUI hopelessly confusing. And what’s with the need for a separate Intel [...]]]></description>
			<content:encoded><![CDATA[<p>comments have not been enabled so I&#8217;m answering the question here and going to do a trackback&#8230;</p>
<p><a href="http://the.taoofmac.com/space/RuiCarmo">Rui Carmo</a> posted a <a href="http://the.taoofmac.com/space/links/2007/09/12/1458">small bit</a> about <a href="http://chandlerproject.org">Chandler</a>:</p>
<blockquote><p>I used to think this would be able to stand up to the Outlook hegemony, but I find the current GUI hopelessly confusing. And what’s with the need for a separate Intel package?</p></blockquote>
<p>While I can&#8217;t answer about the GUI thought I can about why we publish a separate package for Intel-based OS X Macs.</p>
<p>Basically the decision was made back when our choices when Panther and Tiger were both PPC and Intel was *very* new, was to go with two package that were smaller in size.  Another concern was that the techniques for creating a universal binary was still new and un-proven in the Python and wxPython realm.</p>
<p>Thankfully that is not an issue now and one of the things I&#8217;m working on is a change to do exactly that.  I still feel that we will probably have a huge download size but I guess we will find out.</p>
<p>update:  of course after hitting send I realized I can speak also about the GUI issue:  The Chandler GUI reflects/exposes a very powerful set of tools to help manage and deal with incoming items (mail, tasks, etc) and also the daily routine of deciding just what needs to be done when and how.  So it *is* very busy and that can, I think, come off as confusing.  What&#8217;s missing in our Preview is a road-map for completely new users.</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2007/09/17/reply-to-the-tao-of-mac-post-about-chandler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>my take on where RCS is now</title>
		<link>http://code-bear.com/bearlog/2007/06/27/my-take-on-where-rcs-is-now/</link>
		<comments>http://code-bear.com/bearlog/2007/06/27/my-take-on-where-rcs-is-now/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 08:24:16 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[mutterings]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2007/06/27/my-take-on-where-rcs-is-now/</guid>
		<description><![CDATA[Back when OSAF was looking into replacing CVS about the only stable and wide-spread option I found was Subversion and while it had some flaws, compared to CVS it was much better. At the time I had heard of other projects using things like BitKeeper and Perforce and other commercial apps., but that&#8217;s the kicker [...]]]></description>
			<content:encoded><![CDATA[<p>Back when <a href="http://osafoundation.org">OSAF</a> was looking into replacing CVS about the only stable and wide-spread option I found was <a href="http://subversion.tigris.org/">Subversion</a> and while it had some flaws, compared to CVS it was much better. At the time I had heard of other projects using things like BitKeeper and Perforce and other commercial apps., but that&#8217;s the kicker &#8211; they were commercial and as an Open Source shop we really wanted to use Open Source tools.</p>
<p>So we went with <a href="http://subversion.tigris.org/">Subversion</a> and really haven&#8217;t had any regrets. Merges and branches were much saner and after the Subversion team released the FSFS (filesystem storage) the server side repository issues went away.</p>
<p>Recently tho people have been asking me about distributed version control systems like <a href="http://www.selenic.com/mercurial/wiki/">mercurial</a>, <a href="http://bazaar-vcs.org/">bazaar</a> and <a href="http://www.darcs.net/">darcs</a>.</p>
<p>The first two I&#8217;ve been following indirectly by keeping track of the work the Mozilla build/release team have done in trying to pick their next system. See J. Paul Reeds blog entry <a href="http://weblogs.mozillazine.org/preed/2007/04/version_control_system_shootou_1.html">Version Control System Redux Redux</a> and also their <a href="http://wiki.mozilla.org/Version_Control_System_Requirements">wiki page</a> for details. The short-form result is they haven&#8217;t chosen one yet.</p>
<p><a href="http://www.darcs.net/">darcs</a> I&#8217;ve been following more directly because I&#8217;ve started using it to try and help the <a href="http://buildbot.net">Buildbot</a> team with some patch and bug work. So far, while it&#8217;s been different, I haven&#8217;t had any issues but I also haven&#8217;t gotten much beyond the more basic operations. I plan on posting a more detailed look at it after I do some true distributed operations.</p>
<p>One of the newer programs (for me that is) that has hit the nets with some force is <a href="http://git.or.cz/">GIT</a> but I think that is because recently Linus Torvalds recently gave a talk at Google about it and seems to be on a tear promoting it :)</p>
<p>But it really seems to be worth looking into. A recent article about it&#8217;s design, <a href="http://eagain.net/articles/git-for-computer-scientists/">GIT for Computer Scientists</a>, really showed some interesting internal concepts and I like what I see. So I need to figure out how to work it into my project space to give it a fair look.</p>
<p>There are a couple other distributed systems I haven&#8217;t talked about, Monotone and Arch, but that&#8217;s because I know next to nothing about them. If you want to find out details on them I would recommend reading the <a href="http://versioncontrolblog.com/">Version Control Blog</a> for articles about them &#8211; it&#8217;s a great read.</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2007/06/27/my-take-on-where-rcs-is-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>getting the exit code from a batch file that is run from a python program</title>
		<link>http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/</link>
		<comments>http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/#comments</comments>
		<pubDate>Fri, 01 Jun 2007 08:12:19 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[build/release]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/</guid>
		<description><![CDATA[Normally I like to keep titles short and simple, but this time I wanted to get all of the keywords up front so anyone else who has this problem can find it :)
First an outline of the problem and how Chandler uses batch files.
Chandler uses two batch files (and two bash scripts for OS X [...]]]></description>
			<content:encoded><![CDATA[<p>Normally I like to keep titles short and simple, but this time I wanted to get all of the keywords up front so anyone else who has this problem can find it :)</p>
<p>First an outline of the problem and how <a href="http://chandler.osafoundation.org">Chandler</a> uses batch files.</p>
<p>Chandler uses two batch files (and two bash scripts for OS X and Linux) to start Chandler and our own build of Python from the command line.  The scripts make sure the environment is somewhat sane and preset the PATH and PYTHONPATH variables to avoid any local environment issues from &#8220;leaking&#8221; into the Chandler runtime environment.</p>
<p>To make sure that our values don&#8217;t leak back out into the user&#8217;s environment we use <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx?mfr=true">setlocal/endlocal</a> to &#8220;wall off&#8221; our changes, but this comes with a price.  Once the endlocal boundary is crossed you lose the value of ERRORLEVEL and any variable you may have put ERRORLEVEL into for safe keeping, for example:</p>
<pre>set RC=
setlocal
somecommand.exe
set RC=%ERRORLEVEL%
echo %RC% %ERRORLEVEL%
endlocal
echo %RC% %ERRORLEVEL%
</pre>
<p>Assuming somecommand.exe returns 1 you will get this for your output:</p>
<pre>1 1
0 0
</pre>
<p>Not exactly helpful is it?  While working on the problem Andi from work discovered a possible solution that is pretty slick &#8211; take advantage of the command chaining of &#38; and the delayed expansion of environment variables:</p>
<pre>set RC=
setlocal
somecommand.exe
echo %ERRORLEVEL%
endlocal &#38; set RC=%ERRORLEVEL%
echo %RC%
</pre>
<p>This will generate the proper result so combine that with exit /B and it generates the proper result.</p>
<pre>endlocal &#38; exit /B %ERRORLEVEL%
</pre>
<p>Except for one small problem :)</p>
<p>exit /B doesn&#8217;t &#8220;transfer&#8221; properly when the batch file is called from a Python program using subprocess.  I even worked on variations that involved shell=True and other attempts.  It just would not take the return code and pass it on.</p>
<p>After spinning my wheels for a while on this, dropping it for a couple days and then coming back and spinning more wheels I finally decided to look at some of the bug reports for <a href="http://jira.codehaus.org/browse/MAVEN-1124">Ant and Maven</a> to see how they solved it.  It turns out that they really don&#8217;t solve the problem of getting the exit code value but rather just get *any* value to be set to flag that something had happened.  The reason for this is because they have a wider range of OS&#8217;s to support: windows 95 on up to the current version.</p>
<p>But while reading the bug comments I hit upon an idea that ended up working!  Yea for Open Source because otherwise the info would have been buried behind some corporate firewall.</p>
<p>The variation I ended up with was this:</p>
<pre>set RC=
setlocal
somecommand.exe
endlocal &#38; set RC=%ERRORLEVEL%
goto omega

:returncode
exit /B %RC%

:omega
call :returncode %RC%
</pre>
<p>This combines the exit /B trick with the &#38; trick and adds a pretty slick wrinkle (if I do say so myself ;) &#8212; by calling the subroutine I can use exit /B to set the errorlevel and because the call is the <strong>last </strong>command of the batch file that errorlevel is passed out to the caller just like you expect it to be.</p>
<p>So hopefully Google will find this and enable someone to spin their wheels for far less time than I ended up doing :)</p>
]]></content:encoded>
			<wfw:commentRss>http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
