[Bio] / ReleaseTools / newrel Repository:
ViewVC logotype

Diff of /ReleaseTools/newrel

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Mon Dec 1 15:16:53 2003 UTC revision 1.3, Tue Dec 23 13:43:25 2003 UTC
# Line 1  Line 1 
1    #!/bin/sh
2    
3    ########################################################################
4    # Given a definition, creates a new release.  Eventually, we want
5    # something more sophisticated, but for now we just read a file
6    # that defines all the packages to include in the release, along with
7    # tag names.  An example of more sophisticated would be to help the
8    # user form that file by looking at a test release and the underlying
9    # release it is based upon.
10  #  #
11  # Given a definition, creates a new release.  Typical use cases:  # Usage:
12    #    newrel <releaseName> -f <PackageVersionsFileName>
13    #        makes new dir called <releaseName> in release area, copies
14    #        the PackageVersionsFile there and fills the directory
15    #        with packages as specified.
16  #  #
17  #   o newrel <releaseName> -b <baseRelease>  #        Note, <releaseName> is just name, e.g., 1.2.3. No path.
 #        makes new dir called <releaseName> in release area and fills it  
 #        with packages as specified in <baseRelease>. Note that typically  
 #        the baseRelease is a work area in which you have already defined  
 #        everything and built and tested it.  Does various book keeping  
 #        tasks.  
18  #  #
19  # PackageVersions is a list of  # PackageVersions is a list of
20  #  <PackageName>Ver=<version> lines  #  <PackageName> <version>
21  # e.g.,  # e.g.,
22  #  ReleaseToolsVer=1.0.0  #   ReleaseTools V00-00-05
23    #   FigCommon V00-00-01
24    #   FigKernelPackages V00-00-02
25    #   FigKernelScripts V00-00-01
26    #   FigPeer2PeerTools V00-00-00
27    #   FigWebPages V00-00-00
28    #   FigWebServices V00-00-02
29    ########################################################################
30    
31    
32    #-----------------------------------------------------------------------
33    #++ vars
34    
35    releaseArea=""                     # $RTROOT/dist/releases, if RTROOT set
36    packageVersionsFileName=""         # Command arg from user.
37    newReleaseName=""                  # Command arg passed by user.
38    newReleasePathAndName=""           # $releaseArea/$newReleaseName
39    invokedFromDir=`pwd`
40    
41    
42    #-----------------------------------------------------------------------
43    #++ process options
44    
45       set -- `getopt f: $*`
46       if [ $? = 0 ]; then
47           while [ $1 != -- ]
48             do
49             case $1 in
50                 -f) packageVersionsFileName=$2; shift;;
51             esac
52             shift
53           done
54           shift
55       fi
56    
57    
58    #-----------------------------------------------------------------------
59    #++ check for correct number of arguments
60  #  #
61       if [ "$#" -ne 1 ]; then
62           echo "Usage: newrel <releaseName> -f <PackageVersionsFileName>"
63           exit 2
64       fi
65       newReleaseName=$1
66    
67       echo "Add code to enforce naming rules for release name...should be form i.j.k"
68       echo
69    
70       if [ $packageVersionsFileName = "" ]; then
71           echo "You must give a PackageVersions file name via -f "
72           exit 2
73       fi
74    
75    #-----------------------------------------------------------------------
76    # ++ Does the PackageVersionsFile exist?
77    
78       if [ ! -r $packageVersionsFileName ]; then
79           echo "PackageVersionsFile $packageVersionsFileName not readable"
80           exit 2
81       fi
82    
83    
84    #-----------------------------------------------------------------------
85    #++ Validate format of PackageVersions
86    #   Require all packages have tag names.  None are HEAD
87    
88       echo "Add code to Validate format of PackageVersions.  Require all packages have tag names.  None are HEAD"
89       echo
90    
91    #-----------------------------------------------------------------------
92    #++ Sanity check the release
93    
94       if [ -z "$RTROOT" ]; then
95           echo "No RTROOT set"
96           exit 2
97       fi
98    
99       releaseArea=$RTROOT/dist/releases
100    
101       if [ ! -r "$releaseArea" ]; then
102           echo "No release Areas: " $releaseArea
103           exit 2
104       fi
105    
106       newReleasePathAndName=$releaseArea/$newReleaseName
107    
108       if [ -r $newReleasePathAndName ]; then
109           echo "Release $newReleaseName already exists in release area, $releaseArea"
110           exit 2
111       fi
112    
113    #-----------------------------------------------------------------------
114    #++ OK, make the new release directory and put config file there
115    #   and PackageVersions file
116    
117       # Don't know how PackageVersions file was specified to us.  Could be
118       # absolute path or not.  Just remember where we are so we can do the
119       # copy, below
120    
121       invokedFromDir=`pwd`
122    
123       # Warp us there, Mr. Sulu
124    
125       cd $releaseArea
126       mkdir $newReleaseName
127    
128       if [ ! -r $newReleaseName ]; then
129           echo "Failed to make new release directory"
130           exit 2
131       fi
132    
133       cd $newReleaseName
134    
135       # put in a rgConfig that points to ourselves.  This will let us
136       # call other ReleaseTools tools to help us build this thing.
137    
138       echo "baserelname=$newReleaseName" > rtConfig
139    
140       if [ ! -r  rtConfig ]; then
141           echo "Failed to make rtConfig file...you clean up the mess"
142           exit 2
143       fi
144    
145       # copy in the PackageVersions file.  Note that we make sure it
146       # goes in with the right name, "PackageVersions"
147    
148       cd $invokedFromDir
149       cp -p $packageVersionsFileName $newReleasePathAndName/PackageVersions
150    
151       installedPackageVersionsFile=$newReleasePathAndName/PackageVersions
152    
153       cd $newReleasePathAndName
154    
155    #-----------------------------------------------------------------------
156    #++ Load it with the packages.
157    
158       # this uses the PackageVersions we just dumped in
159    
160       cd $newReleasePathAndName
161       for pkg in `awk '{print $1 }' $installedPackageVersionsFile` ; do
162           echo getting $pkg
163           packageVer=`grep $pkg $installedPackageVersionsFile | awk '{print $2}'`
164           echo cvs co  -r $packageVer  $pkg
165           cvs co  -r $packageVer  $pkg
166       done
167    
168    #-----------------------------------------------------------------------
169    #++ Now that we have the packages, make the directory structure for
170    #  the release. We do that by deferring to the makefile in ReleaseTools.
171    #  Since the version of ReleaseTools can change release to release, we
172    #  use the info in the PackageVersions file we were called with.
173    
174       cd $newReleasePathAndName
175       if [ -r ReleaseTools ]; then
176           cp -p ReleaseTools/Makefile.top Makefile
177           make installdirs
178       else
179           echo "WARNING: No ReleaseTools in PackageVersions.  You're going to regret it...continuing anyway."
180       fi
181    
182    
183    #-----------------------------------------------------------------------
184    #++ Zorch all the CVS directories.
185    
186       cd $newReleasePathAndName
187    
188       # brain fade...can't get -exec to work for me and am in rush:
189    
190       rm -rf `find . -type d -name CVS -print`

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3