views:

73

answers:

3

I am having trouble defining and automating my build process despite simple requirements:

  1. Every build should have a unique build number.
  2. Every tagged release should be reproducible

What I have:

  • A C++, Red Hat Enterprise Linux 5.x, Subversion development environment.
  • A build machine ( actually a virtual machine )
  • A version.h file with #defines for major, minor, and buildnumber.
  • A script for incrementing the version.h buildnumber.
  • A rpmbuild spec file that exports the tagged Subversion source, builds, and makes the rpm installer packages.

Questions:

  • Assuming multiple developers per project, when should the build number be incremented and version.h file be checked-in? The build machine? Some sort of Subversion hook? Pre-build or post-build?

Thanks in advance for those willing to take the time to share their experience with build processes.

-Ed Linux newbie. Former Windows C++/.NET developer.

+1  A: 

Why not modify your build process so that it grabs the latest revision number from the repository and uses that as the build number?

Assuming svn incorporates all of the elements that go into a build of your product, that should give you a unique number per potential differing build, and make it easy to match up what the state of the codebase was at the time of building. If there are other elements that can vary with time, you could add another item concatenated to the revision number - perhaps a date/time value.

You'll never have to worry about manually incrementing it, because each time a developer commits they'll increment the revision number automatically.

Amber
I like this idea as well as Andrew's date idea.I am not clear, is a Subversion revision number applied to a file which is incremented each time the file is commited?Or is it a project thing; a project revision number that gets incremented each time *any* file gets checked in?Thank you all for your replies,-Ed
Ed
Subversion revision #'s are global for the entire repository - *any* commit to that repository, regardless of what files it affects, increments the revision number.
Amber
Svn info displays different revision numbers for different locations of the same repo?[esutton@localhost LRADDS_BnS]$ pwd/home/esutton/projects/LRADDS_BnS[esutton@localhost LRADDS_BnS]$ svn infoURL: https://10.0.0.134:8443/svn/LRADDS_BnS/trunkRepository Root: https://10.0.0.134:8443/svn/LRADDS_BnSRevision: 665Last Changed Rev: 665Last Change Date: 13 Apr[esutton@localhost LRADDS_BnS]$ cd doc[esutton@localhost doc]$ svn infoURL: https://10.0.0.134:8443/svn/LRADDS_BnS/trunk/docRepository Root: https://10.0.0.134:8443/svn/LRADDS_BnSRevision: 703Last Changed Rev: 702 : Apr 19
Ed
See `svnversion` to get global revision info: http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.ref.svnversion
Amber
+1  A: 

Don't store the build number directly in your file, use the subversion revision number (or some other monotonically-increasing value, like the date/time) as your build identifier. In the past, I've used the value of date -u +"%Y%m%d%H%M%S", as we were using CVS not SVN.

Andrew Aylett
+1  A: 

We have teams of upto 40+ developers adding code to our product. Each developer submits their change to a central location for the product. This forms an ordered list of code submissions. Scripts then take each submission and integrates it into a test build based on the last released configuration and any previous submitted changes in the current round. Unit tests are run after each code submission is compiled, also any acceptance tests added in the current round are also run. At the end of each day unit tests and regression tests are run against the evolving build.

Twice a week the list of submitted code changes is wrapped up and that becomes the a new released configuration of the product and the codebase is updated.

lilburne