[Bio] / ReleaseTools / newrel Repository:
ViewVC logotype

Annotation of /ReleaseTools/newrel

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : efrank 1.2 #!/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 : efrank 1.1 #
11 : efrank 1.2 # 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 : efrank 1.1 #
17 : efrank 1.2 # Note, <releaseName> is just name, e.g., 1.2.3. No path.
18 : efrank 1.1 #
19 :     # PackageVersions is a list of
20 : efrank 1.2 # <PackageName> <version>
21 : efrank 1.1 # e.g.,
22 : efrank 1.2 # 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 :     packageVersionsFileName=""
35 :    
36 :     #-----------------------------------------------------------------------
37 :     #++ process options
38 :    
39 :     set -- `getopt f: $*`
40 :     if [ $? = 0 ]; then
41 :     while [ $1 != -- ]
42 :     do
43 :     case $1 in
44 :     -f) packageVersionsFileName=$2; shift;;
45 :     esac
46 :     shift
47 :     done
48 :     shift
49 :     fi
50 :    
51 :    
52 :     #-----------------------------------------------------------------------
53 :     #++ check for correct number of arguments
54 : efrank 1.1 #
55 : efrank 1.2 if [ "$#" -ne 1 ]; then
56 :     echo "Usage: newrel <releaseName> -f <PackageVersionsFileName>"
57 :     exit 2
58 :     fi
59 :     newReleaseName=$1
60 :    
61 :     echo "Add code to enforce naming rules for release name...should be form i.j.k"
62 :     echo
63 :    
64 :     if [ $packageVersionsFileName = "" ]; then
65 :     echo "You must give a PackageVersions file name via -f "
66 :     exit 2
67 :     fi
68 :    
69 :     #-----------------------------------------------------------------------
70 :     # ++ Does the PackageVersionsFile exist?
71 :    
72 :     if [ ! -r $packageVersionsFileName ]; then
73 :     echo "PackageVersionsFile $packageVersionsFileName not readable"
74 :     exit 2
75 :     fi
76 :    
77 :    
78 :     #-----------------------------------------------------------------------
79 :     #++ Validate format of PackageVersions
80 :     # Require all packages have tag names. None are HEAD
81 :    
82 :     echo "Add code to Validate format of PackageVersions. Require all packages have tag names. None are HEAD"
83 :     echo
84 :    
85 :     #-----------------------------------------------------------------------
86 :     #++ Sanity check the release
87 :    
88 :     if [ -z "$RTROOT" ]; then
89 :     echo "No RTROOT set"
90 :     exit 2
91 :     fi
92 :    
93 :     releaseArea=$RTROOT/dist/releases
94 :    
95 :     if [ ! -r "$releaseArea" ]; then
96 :     echo "No release Areas: " $releaseArea
97 :     exit 2
98 :     fi
99 :    
100 :     newRelease=$releaseArea/$newReleaseName
101 :    
102 :     if [ -r $newRelease ]; then
103 :     echo "Release $newReleaseName already exists in release area, $releaseArea"
104 :     exit 2
105 :     fi
106 :    
107 :     #-----------------------------------------------------------------------
108 :     #++ OK, make the new release directory and put config file there
109 :     # and PackageVersions file
110 :    
111 :     # Don't know how PackageVersions file was specified to us. Could be
112 :     # absolute path or not. Just remember where we are so we can do the
113 :     # copy, below
114 :    
115 :     invokedFromDir=`pwd`
116 :    
117 :     # Warp us there, Mr. Sulu
118 :    
119 :     cd $releaseArea
120 :     mkdir $newReleaseName
121 :    
122 :     if [ ! -r $newReleaseName ]; then
123 :     echo "Failed to make new release directory"
124 :     exit 2
125 :     fi
126 :    
127 :     cd $newReleaseName
128 :    
129 :     # put in a rgConfig that points to ourselves. This will let us
130 :     # call other ReleaseTools tools to help us build this thing.
131 :    
132 :     echo "baserelname=$newReleaseName" > rtConfig
133 :    
134 :     if [ ! -r rtConfig ]; then
135 :     echo "Failed to make rtConfig file...you clean up the mess"
136 :     exit 2
137 :     fi
138 :    
139 :     # copy in the PackageVersions file. Note that we make sure it
140 :     # goes in with the right name, "PackageVersions"
141 :    
142 :     cd $invokedFromDir
143 :     cp -p $packageVersionsFileName $releaseArea/$newReleaseName/PackageVersions
144 :    
145 :     installedPackageVersionsFile=$releaseArea/$newReleaseName/PackageVersions
146 :    
147 :     cd $releaseArea/$newReleaseName
148 :    
149 :     #-----------------------------------------------------------------------
150 :     #++ Load it with the packages.
151 :    
152 :     # this uses the PackageVersions we just dumped in
153 :    
154 :     cd $releaseArea/$newReleaseName
155 :     for pkg in `awk '{print $1 }' $installedPackageVersionsFile` ; do
156 :     echo getting $pkg
157 :     packageVer=`grep $pkg $installedPackageVersionsFile | awk '{print $2}'`
158 :     echo cvs co -r $packageVer $pkg
159 :     cvs co -r $packageVer $pkg
160 :     done
161 :    
162 :     #-----------------------------------------------------------------------
163 :     #++ Zorch all the CVS directories.
164 :    
165 :     cd $releaseArea/$newReleaseName
166 :    
167 :     # brain fade...can't get -exec to work for me and am in rush:
168 :    
169 :     rm -rf `find . -type d -name CVS -print`

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3