RE: [CMake] Version embedding - how to cause a command when make is run?
From: Alan W. Irwin (on cmake list) Yes, [svnversion] is the whole point! It is much easier than using individual revision nubmers for each file. Although not nearly as informative. I just tried svnversion, and it only gives a range of Revision numbers for the source tree. That's a non-unique way of identifying source trees How so? As I understand the range is the range of project revision nubmers at which the most recent changes for files has occurred. But I am fairly new to SVN after switching from CVS, so I would like to know how identical svnversion output from different source trees would come about? Maybe I should ask that on the svn list as well . However, simplicity that usually might work often trumps correct complexity Well, I never said I was NOT already doing the other, in fact i said I WAS doing it! I had some of the aformentioned hair-tearing to get the '.h' files to record correct revision, in the executable, without a great deal of repetitive output, as I recall. Complexity that is hard to get correct often results in incorrect complexity :-/ I can even think of a few ways that 'correct' method fails. Like modifying the source without checking in. IN svnversion, the all-important 'M' indicator appears in that case. Of course the dreaded 'M' would only tell you that there's little hope of reconstructing the exact source, that someone failed to use the revision control suitably -- which would be good to know if true. The whole thing can help undertake proper record keeping but I don't think it should quite take the place of proper record keeping right?. It'd be nice to be fool-proof but being clever-deliberate-saboteur-proof is much more difficult and not really required for my project at this time! I hope. ADD_CUSTOM_COMMAND(TARGET signature. I guess you missed that suggestion. Not true. I am merely not discussing it at this time because I have not yet really tried it out, I am discussing whether that is actually the way to 'DWIM' , you might still convince me otherwise! But thanks for the suggestion and if it is possible to get non-unique svnversion I'll be glad you pointed out the possiblity! ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Version embedding - how to cause a command when make is run?
As Alan points out, you shouldn't trust the output of svn info as gospel unless you also verify that svn status gives you *empty* output. In the case that Alan identifies of trying to track down where a bug was introduced, a quick svn status check would show you which files were *not* up to date with respect to the svn info output... (local modifications, local additions/deletions and files unknown to svn are all reported by svn status) HTH, David On 10/5/07, Alan W. Irwin [EMAIL PROTECTED] wrote: On 2007-10-05 14:28+0100 Atwood, Robert C wrote: From: Alan W. Irwin (on cmake list) Yes, [svnversion] is the whole point! It is much easier than using individual revision nubmers for each file. Although not nearly as informative. I just tried svnversion, and it only gives a range of Revision numbers for the source tree. That's a non-unique way of identifying source trees How so? As I understand the range is the range of project revision nubmers at which the most recent changes for files has occurred. But I am fairly new to SVN after switching from CVS, so I would like to know how identical svnversion output from different source trees would come about? Maybe I should ask that on the svn list as well . If you confine yourself to committing, then that (AFAIK) always increments the maximum number in the range so you should be okay for that use case. However, suppose you use svn update --revision because one of your mass commits introduced a bug and you are systematically trying old revisions of files to see which is responsible. (I have been there and done that!) To take a concrete but simple example, suppose you have five files which all have 3 possibilities (1,2,3) for the revision number. IOW, each file changed for each revision. Then using svn update --revision you can create 3^5 = 243 different combinations of revision numbers for the various source files in your source tree, and svnversion will identify all such different source trees identically. In fairness, you might not use svn update --revision that often so svnversion will normally give you a unique identifier, but as the concrete example shows, not always, particularly when exploring old revisions to help track down a bug. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Version embedding - how to cause a command when make is run?
How about: svn info file:///home/juans/svn_repository/svnroot/ | grep '^Revision:' | sed -e 's/^[^0-9]*//' on the repository. Or just: svn info | grep '^Revision:' | sed -e 's/^[^0-9]*//' After doing a svn update, the latest revision on the url seems to be accurate. Unfortunately the number seems to apply to the whole repository. I guess it's a good way to make sure you are up to date. svnlook youngest seems to do something, but it appears to only work on the same filesystem as the repository. Regards, Juan David Cole wrote: How about svn status -u or a filtered version of svn status -v ? On 10/5/07, Atwood, Robert C [EMAIL PROTECTED] wrote: I hope its okay to copy this to Subversion list, as it has veered away from cmake ... Alan said (on Cmake list): take a concrete but simple example, suppose you have five files which all have 3 possibilities (1,2,3) for the revision number. IOW, each file changed for each revision. Then using svn update --revision you can create 3^5 = 243 different combinations of revision numbers for the various source files in your source tree, and svnversion will identify all such different source trees identically. I expected that sort of thing with CVS, I thought it worked differently in SVN where the number is more related to the whole project than the individual file. But I stand corrected. An actual test demonstrates that you are correct, svnversion 0:6 is displayed if one of the files is back-updated to 4, and no special flag is specified in svnversion output. See console log below. David said (on Cmake list): also verify that svn status gives you *empty* output. Actually , 'svn status' also produces empty output in this case (where a file has been back-updated) So it is not obvious that there's any difference, as Alan suggested orignally. Thanks for the headsup! Robert [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file C. Third (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn up -r 4 FileC.txt UFileC.txt Updated to revision 4. [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 4 2007-10-05 15:49:14Z rcatwood $ This is file C. First (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn status [rcatwood testproj]$ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Juan Sanchez [EMAIL PROTECTED] 800-538-8450 Ext. 54395 512-602-4395 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Version embedding - how to cause a command when make is run?
Looks to me like the output of svn status -u will give you something like... Status against revision: 1234 ... when everything is up to date with respect to svn info. And it will give something like... *1001 FileAtPrevRevision.cxx Status against revision: 1234 ... when there is a file stuck at a previous revision. So... revising my original statement slightly: If the output of svn status -u is a single line matching ^Status against revision: then you can trust the output of svn info as meaning : this is a build against this revision without any known deviations from the revision. Svn list : correct me if I'm wrong. :-) HTH, David On 10/5/07, David Cole [EMAIL PROTECTED] wrote: How about svn status -u or a filtered version of svn status -v ? On 10/5/07, Atwood, Robert C [EMAIL PROTECTED] wrote: I hope its okay to copy this to Subversion list, as it has veered away from cmake ... Alan said (on Cmake list): take a concrete but simple example, suppose you have five files which all have 3 possibilities (1,2,3) for the revision number. IOW, each file changed for each revision. Then using svn update --revision you can create 3^5 = 243 different combinations of revision numbers for the various source files in your source tree, and svnversion will identify all such different source trees identically. I expected that sort of thing with CVS, I thought it worked differently in SVN where the number is more related to the whole project than the individual file. But I stand corrected. An actual test demonstrates that you are correct, svnversion 0:6 is displayed if one of the files is back-updated to 4, and no special flag is specified in svnversion output. See console log below. David said (on Cmake list): also verify that svn status gives you *empty* output. Actually , 'svn status' also produces empty output in this case (where a file has been back-updated) So it is not obvious that there's any difference, as Alan suggested orignally. Thanks for the headsup! Robert [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file C. Third (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn up -r 4 FileC.txt UFileC.txt Updated to revision 4. [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 4 2007-10-05 15:49:14Z rcatwood $ This is file C. First (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn status [rcatwood testproj]$ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Version embedding - how to cause a command when make is run?
Not being a member of the subversion list. And doubting that non cmake members can email this list. Please email us the results of your query to the subversion list. Juan David Cole wrote: Looks to me like the output of svn status -u will give you something like... Status against revision: 1234 ... when everything is up to date with respect to svn info. And it will give something like... *1001 FileAtPrevRevision.cxx Status against revision: 1234 ... when there is a file stuck at a previous revision. So... revising my original statement slightly: If the output of svn status -u is a single line matching ^Status against revision: then you can trust the output of svn info as meaning : this is a build against this revision without any known deviations from the revision. Svn list : correct me if I'm wrong. :-) HTH, David On 10/5/07, David Cole [EMAIL PROTECTED] wrote: How about svn status -u or a filtered version of svn status -v ? On 10/5/07, Atwood, Robert C [EMAIL PROTECTED] wrote: I hope its okay to copy this to Subversion list, as it has veered away from cmake ... Alan said (on Cmake list): take a concrete but simple example, suppose you have five files which all have 3 possibilities (1,2,3) for the revision number. IOW, each file changed for each revision. Then using svn update --revision you can create 3^5 = 243 different combinations of revision numbers for the various source files in your source tree, and svnversion will identify all such different source trees identically. I expected that sort of thing with CVS, I thought it worked differently in SVN where the number is more related to the whole project than the individual file. But I stand corrected. An actual test demonstrates that you are correct, svnversion 0:6 is displayed if one of the files is back-updated to 4, and no special flag is specified in svnversion output. See console log below. David said (on Cmake list): also verify that svn status gives you *empty* output. Actually , 'svn status' also produces empty output in this case (where a file has been back-updated) So it is not obvious that there's any difference, as Alan suggested orignally. Thanks for the headsup! Robert [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file C. Third (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn up -r 4 FileC.txt UFileC.txt Updated to revision 4. [rcatwood testproj]$ svnversion 0:6 [rcatwood testproj]$ cat * $Id: FileA.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file A. Third (after propset) revision. $Id: FileB.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file B. Third (after propset) revision. $Id: FileC.txt 4 2007-10-05 15:49:14Z rcatwood $ This is file C. First (after propset) revision. $Id: FileD.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file D. Third (after propset) revision. $Id: FileE.txt 6 2007-10-05 15:50:26Z rcatwood $ This is file E. Third (after propset) revision. [rcatwood testproj]$ [rcatwood testproj]$ svn status [rcatwood testproj]$ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Juan Sanchez [EMAIL PROTECTED] 800-538-8450 Ext. 54395 512-602-4395 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Version embedding - how to cause a command when make is run?
-Original Message- From: Juan Sanchez Not being a member of the subversion list. And doubting that non cmake members can email this list. Please email us the results of your query Okay, if people don't think it irrelevant to Cmake. I'm sensitive to the fact this discussion is mostly getting to be about sbuversion instead of Cmake! ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Version embedding - how to cause a command when make is run?
From: Alan W. Irwin [...]I've tried the following in CMakeLists, placing the output of 'svnversion' and similar commands into an included source file and it works [...] Can some form of dependency be set so that if any source file is changed [...] Or, should I use another way to do what I want? One possibility is to use subversion (which presumably you are using since you referred to svnversion) keyword functionality. For example, if you put $Id$ into your source code comments, That does not work, since the comments do not go into the executable. You have to include the $Id:$ into strings and the strings have to actually get used or else the optimizer strips them out. I have done that for years using CVS, which does not have any whole-repository revision. My approach to this was to include a little routine at the end of each file that returns the revision string for that file, then a routine in th main that calls all the file routines... Etc. I haven't used svnversion myself, but it looks like all it does is summarize revision numbers in the entire repository. Yes, that's the whole point! It is much easier than using individual revision nubmers for each file and that is one big improvement of subversion over CVS. Think about it. The drawback is that it is only available via that external command 'svnversion' and not as a keyword. Back to hair tearing :-/ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Version embedding - how to cause a command when make is run?
On 2007-10-04 18:20+0100 Atwood, Robert C wrote: From: Alan W. Irwin [...]I've tried the following in CMakeLists, placing the output of 'svnversion' and similar commands into an included source file and it works [...] Can some form of dependency be set so that if any source file is changed [...] Or, should I use another way to do what I want? One possibility is to use subversion (which presumably you are using since you referred to svnversion) keyword functionality. For example, if you put $Id$ into your source code comments, That does not work, since the comments do not go into the executable. That's just a (poorly chosen) example. You can put $Id$ or $Revision anywhere in the code that insures it gets into the executable. Yes, [svnversion] is the whole point! It is much easier than using individual revision nubmers for each file. Although not nearly as informative. I just tried svnversion, and it only gives a range of Revision numbers for the source tree. That's a non-unique way of identifying source trees since you could have extremely different source trees with the exact same revision range. However, simplicity that usually might work often trumps correct complexity so I anticipated in my previos post that you might want to stick with svnversion and actually mentioned one possibility for that case (add a custom command using the TARGET signature). I guess you missed that suggestion. If that suggestion doesn't work, then another alternative is to generate a special header file filled with svnversion results at cmake time which your souce code #includes in a way to make sure the svnversion results gets into your executable(s). I believe cmake is smart enough to ignore changed time stamps on that generated source file if the contents are identical, but if not you can try cmake -E copy_if_different to get the time stamp right. Note, I believe there are many different ways of implementing what you want. I am just giving you some ideas here (and somebody else has as well), and you will have to experiment and dig into the documentation to get one of these ideas to work. So good luck. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake