BRAT version and version updates (was Re: How do I tell brat version?)

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Mar 23 2001 - 07:06:40 EST

  • Next message: Christian Holm Christensen: "Re: Proposal for T4-T5 unpacking format"

    Hi Steve et al, 
    
    I know this mail is rather long, but please keep it for further
    reference. You'll find some useful hints (if your working on a Un*x
    machine or via CygWin) at the end of the message. 
     
    At some point, I might turn this into a web-page, or printable
    document. 
    
    On Thu, 22 Mar 2001 19:44:36 -0600
    "Stephen J. Sanders" <ssanders@ukans.edu> wrote
    concerning ": How do I tell brat version?":
    > Hi,  In a recent message Christian admonished us to update to BRAT
    > version 1.15.  I have been regularly running
    > 
    > cvs update
    > 
    > so I guess I'm up-to-date.  However, I am not sure how to check the
    > version #.  
    
      brat-config --version 
    
    That's it. When some thinks it's time for a new revision number, s/he
    changes the number in the beginning of test/brat-config. I've
    previously described procedure for version/revision in a mail to
    brahms-dev-l. It boils down to: 
    
    * Revision bumps should occour when: 
    
      -  New functionality to an existing class.  
      -  New class added but not thourougly tested yet. 
      -  Important bug fixes. 
      -  Updates to temporary ASCII calibration files. 
    
    * Minor version bumps should occour when:
    
      -  A new class is tested and done. 
      -  Functionality is removed from an existing class. 
    
    * Major version bumps are not allowed before explicit consent of
      at least Flemming and Kris, and should be announced at least one
      week ahead.
    
    Revision changes reflects important updates to the current development
    cycle. 
    
    Minor version updates reflects the start of a new development cycle. 
    
    Major version updates reflects _major_ changes to _all_ of BRAT. 
      
    > If I try
    > 
    > cvs status
    
    The CVS Revision number has nothing to do with our version
    numbers. The CVS revision number is used by CVS only and for internal
    book-keeping. We use CVS tags to reflect our version number. For
    instance, doing
    
      cd $BRATSYS 
      cvs log Makefile | less 
      RCS file: /afs/rhic/brahms/BRAHMS_CVS/brat/Makefile,v
      Working file: Makefile
      head: 1.44
      branch:
      locks: strict
      access list:
      symbolic names:
              BRAT-1-15-1: 1.44
              BRAT-1-15-0: 1.44
              BRAT-1-14-1: 1.42
      <output truncated>
    
    you'll see the tag "BRAT-1-15-1". It is our convention to tag files in
    CVS with a tag that has the BNF: 
    
      BRAT-<major>-<minor>-<revision> 
    
    ("." is not allowed in tags!), and setting such tags is part of the
    updating procedure. cvs status does not give you that
    information. Also note, that the CVS revision number that corresponds
    to the tag is shown, should one have any need for it. 
    
    So in summary, to update the versin number of BRAT, do: 
    
    1: Start by cleaning your source tree to "checkout status" 
    
         make distclean 
    
    2: Build:
    
         make install 
    
    3: If the above step fails, go back an edit the source code. Now
       test:
    
         (cd test && ./run_test)
    
    4: Inspect the output from test/run_test in test/run_test.log. If any
       step failed, go back and edit the source code. 
    
    5: Check that the your working source tree is up to date with the CVS
       repository: 
    
         cvs -n update 
    
       (the flag '-n' is "no-act"). If any conflicts is reported (flag as
       a "C" at the begining of a line in front of file name) be prepared
       to merge in the changes. If you update BRAT frequently enough, then
       this should not be something that happens very often. 
    
    6: If any files was updated in the CVS repository (as flag by a "U" at
       the begining of a line in front of file name), update them:
    
         cvs update -A -d -P
    
    7: If any files was updated in the previous step, go back and do step
       1 to 3 again. 
    
    8: Assuming everything is just dandy (no errors, everything up to
       date), you can now update the version of BRAT. Edit the version
       definition in test/brat-config 
    
         vi test/brat-config 
    
       (If you do not like vi, use what ever editor you prefer -
       i.e. Emacs), From 
    
         #!/bin/sh
         #
         # $Id: ... $
         # $Author: ... $
         # $Date: ... $
         # $CopyRight: BRAHMS Collaboration 2000
         #
         # BRAT version
    
         versdef="<old major>.<old minor>.<old revision>"
    
       to 
    
         #!/bin/sh
         #
         # $Id: ... $
         # $Author: ... $
         # $Date: ... $
         # $CopyRight: BRAHMS Collaboration 2000
         #
         # BRAT version
    
         versdef="<old major>.<new minor>.<new revision>w"
    
       where 
        
          <new minor>    = <old minor>
          <new revision> = <old revision> + 1
    
       if it's a revision update, or 
    
          <new minor>    = <old minor> + 1
          <new revision> = <old revision> 
    
       if it's a minor update. 
    
    9: Now commit to the CVS repository: 
    
         cvs ci 
    
    10: And finally tag the repository:
    
         cvs tag BRAT-<major>-<new minor>-<new revision>
    
    Please notice, that tags are "sticky", so if that your working copy
    will be labelled with the tag you gave. To update to CVS head, do 
    
         cvs update -A -P -d 
    
    Finally, if you wan't to get an explicit version of BRAT, use "export"
    rather then "co": 
    
         cvs -d /afs/rhic/brahms/BRAHMS_CVS export \
    	 -r BRAT-<major>-<minor>-<revision> \
    	 -d brat-<major>.<minor>.<revision> brat 
    
    The source tree will be a "snapshot" with out the CVS management
    directories (named "CVS" in each subdiretory) and so does not
    consitute a working directory. I strongly suggest having two BRAT
    source trees, one that is a snapshot in the above sense for
    production, and a devlopment source tree (checkout), for playing
    around with. 
    
    Set up your environment to use the snapshot by default:
    
    * CSH family:
    
        setenv BRATSYS /some/where/brat-<major>.<minor>.<revision>
        setenv BRATHOME ${BRATSYS} 
        if (!$?LD_LIBRARY_PATH) then 
           setenv LD_LIBRARY_PATH ${BRATSYS}/lib/${BRAHMS_ARCH} 
        else 
           setenv LD_LIBRARY_PATH ${BRATSYS}/lib/${BRAHMS_ARCH}:${LD_LIBRARY_PATH}
        endif 
        if (!$?PATH) then 
           setenv PATH ${BRATSYS}/bin/${BRAHMS_ARCH} 
        else 
           setenv PATH ${BRATSYS}/bin/${BRAHMS_ARCH}:${PATH}
        endif 
    
    * SH family 
    
       BRATSYS=/some/where/brat-<major>.<minor>.<revision>
       BRATHOME=${BRATHOME}
       if [ "x$LD_LIBRARY_PATH" = "x" ] ; then 
           LD_LIBRARY_PATH=${BRATSYS}/lib/${BRAHMS_ARCH} 
       else
           LD_LIBRARY_PATH=${BRATSYS}/lib/${BRAHMS_ARCH}:${LD_LIBRARY_PATH}
       fi 
       if [ "x$PATH" = "x" ] ; then 
           PATH=${BRATSYS}/bin/${BRAHMS_ARCH} 
       else
           PATH=${BRATSYS}/bin/${BRAHMS_ARCH}:${PATH}
       fi 
    
    and make shell script for setting up to use your development version:
    
    * CSH Family:
    
      Make the file ~/bin/usedevbrat.csh with the contents: 
    
        #!/bin/csh
    
        setenv BRATSYS /some/where/brat
        setenv BRATHOME ${BRATSYS} 
        if (!$?LD_LIBRARY_PATH) then 
           setenv LD_LIBRARY_PATH ${BRATSYS}/lib/${BRAHMS_ARCH} 
        else 
           setenv LD_LIBRARY_PATH ${BRATSYS}/lib/${BRAHMS_ARCH}:${LD_LIBRARY_PATH}
        endif 
        if (!$?PATH) then 
           setenv PATH ${BRATSYS}/bin/${BRAHMS_ARCH} 
        else 
           setenv PATH ${BRATSYS}/bin/${BRAHMS_ARCH}:${PATH}
        endif 
    
      In you your ~/.login put 
    
        alias brat_dev "source ${HOME}/bin/usedevbrat.csh"
    
    * SH family: 
    
      In your ~/.profile, define the shell function brat_dev as: 
    
         function brat_dev { 
           BRATSYS=/some/where/brat-<major>.<minor>.<revision>
           BRATHOME=${BRATHOME}
           if [ "x$LD_LIBRARY_PATH" = "x" ] ; then 
             LD_LIBRARY_PATH=${BRATSYS}/lib/${BRAHMS_ARCH} 
           else
             LD_LIBRARY_PATH=${BRATSYS}/lib/${BRAHMS_ARCH}:${LD_LIBRARY_PATH}
           fi 
           if [ "x$PATH" = "x" ] ; then 
             PATH=${BRATSYS}/bin/${BRAHMS_ARCH} 
           else
             PATH=${BRATSYS}/bin/${BRAHMS_ARCH}:${PATH}
           fi 
         }
    
    Now you can "execute" brat_dev in your shell, and your development
    snapshot will be the BRAT version you use.
    
    Some other usefull aliases/shell functions: 
    
    * CSH family: 
    
      Put the two lines (exactly two!) below in your ~/.login file. 
    
        alias brat-compile 'g++ `brat-config --cflags --modlibs` `root-config --cflags --glibs` -Wall -g `basename \!* .cxx`.cxx -o `basename \!* .cxx`'
        alias root-compile 'g++ `root-config --cflags --glibs` -Wall -g `basename \!* .cxx`.cxx -o `basename \!* .cxx`'
    
    * SH family: 
    
      Put the shell functions in your ~/.profile: 
    
        function brat-compile {
          if [ $# -lt 1 ] ; then 
            echo "brat-compile need exactly one argument"
            return 1
          fi
          name=`basename $1 .cxx` 
          g++ -Wall -g $name.cxx -o $name \
              `root-config --cflags --glibs` \
              `brat-config --cflags --modlibs` 
        }
    
        function root-compile {
          if [ $# -lt 1 ] ; then 
            echo "root-compile need exactly one argument"
            return 1
          fi
          name=`basename $1 .cxx` 
          g++ -Wall -g $name.cxx -o $name \
              `root-config --cflags --glibs`
        }
    
    Assuming you have a program in foo.cxx using BRAT do one of 
    
      brat-compile foo.cxx 
      brat-compile foo 
    
    to make the program "foo". Similar for programs that only use ROOT. In
    the SH family, you can also make the shell functions: 
    
        function brat-module {
          if [ $# -lt 1 ] ; then 
            echo "root-module need exactly one argument"
            return 1
          fi
          name=`basename $1 .cxx` 
          g++ -Wall -g -c $name.cxx -o $name.o \
              `root-config --cflags` `brat-config --cflags` 
          rootcint -f ${name}Cint.cxx -c `brat-config --cflags` ${name} 
          g++ -Wall -g -c ${name}Cint.cxx -o ${name}Cint.o \
              `root-config --cflags` `brat-config --cflags` 
          g++ -shared -Wl,-soname,${name}.so -o ${name}.so \
    	  ${name}Cint.o -o ${name}.o
          rm -f ${name}Cint.cxx ${name}Cint.h ${name}Cint.o ${name}.o
        }
    
        function root-module {
          if [ $# -lt 1 ] ; then 
            echo "root-module need exactly one argument"
            return 1
          fi
          name=`basename $1 .cxx` 
          g++ -Wall -g -c $name.cxx -o $name.o `root-config --cflags`
          rootcint -f ${name}Cint.cxx -c ${name} 
          g++ -Wall -g -c ${name}Cint.cxx -o ${name}Cint.o \
    	  `root-config --cflags`
          g++ -shared -Wl,-soname,${name}.so -o ${name}.so \
    	  ${name}Cint.o -o ${name}.o
          rm -f ${name}Cint.cxx ${name}Cint.h ${name}Cint.o ${name}.o
        }
    
    to make loadable class file foo.so from files foo.cxx and foo.h in the
    current directory (substitute foo with the name of your class), by
    doing one of 
    
         brat-module foo 
         brat-module foo.cxx 
     
    I hope you'll find these tips useful. 
    
    Yours, 
    
    Christian  -----------------------------------------------------------
    Holm Christensen                             Phone:  (+45) 35 35 96 91 
      Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
      DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
      Denmark                                    Email:       cholm@nbi.dk
    



    This archive was generated by hypermail 2b29 : Fri Mar 23 2001 - 07:07:03 EST