On Sat, 6 Oct 2007, Stefan Reinauer wrote: > * Robinson Tryon <[EMAIL PROTECTED]> [071006 17:42]: >> What about pulling the version directly out of SVN at build time? Like this: >> >> svn info | sed -n 's/.*Revision: \([0-9]*\)/\1/ p' >> >> As long as the Makefile lives at the top level of the project, this >> value should always reflect the latest commit in the current checkout. > > unless you svn up certain subdirectories..
Also svn:externals gives problems, even "svn info -R" wont go down into them. There are also a few other problems: svn info is internationalized, so for sed to work reliably LANG=C is needed. .*Revision: will read out the revision from the latest svn up. Last Changed Rev: will read out the latest comitted change, which is more what we desire. svnversion -c might be better, but it doesn't recurse, and has an interesting output format in the general case (but sed will fix it!) To summarize some pros & cons: 1. $Rev$-based in files (at run time or build time): + granular control of which files' revisions are considered + clearly calculates version number only from desired files + does not depend on svn during build - more complex, need to remember which files to tag with $Rev$-based code 2. svn build time based + easy to code both in source and makefiles - need to be careful about which svn revision numbers are actually used to determine the "global" version number (latest svn up or comitted) - recursion down into subdirectories and svn:externals needs to be carefully considered - makes the build environment dependent on svn and svn meta data, which may cause concern in external automated build environments (like OS distributors) /ulf -- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios