[Bio] / ReleaseTools / newrel Repository:
ViewVC logotype

View of /ReleaseTools/newrel

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Mon Dec 22 20:56:36 2003 UTC (15 years, 11 months ago) by efrank
Branch: MAIN
CVS Tags: V00-00-06
Changes since 1.1: +163 -9 lines

newrel:
  now makes a new release.  see header for description.  basically,
   you tell it the name of the release to make, it makes sure it isn't
   laready in the release area then takes a file you give it and
   it it uses it as a PackageVersions file.  then it checks everything
   out and rm's the CVS subdirs.

#!/bin/sh

########################################################################
# Given a definition, creates a new release.  Eventually, we want
# something more sophisticated, but for now we just read a file
# that defines all the packages to include in the release, along with
# tag names.  An example of more sophisticated would be to help the
# user form that file by looking at a test release and the underlying
# release it is based upon.
#
# Usage:
#    newrel <releaseName> -f <PackageVersionsFileName>
#        makes new dir called <releaseName> in release area, copies
#        the PackageVersionsFile there and fills the directory
#        with packages as specified.
#
#        Note, <releaseName> is just name, e.g., 1.2.3. No path.
#
# PackageVersions is a list of
#  <PackageName> <version>
# e.g.,
#   ReleaseTools V00-00-05
#   FigCommon V00-00-01
#   FigKernelPackages V00-00-02
#   FigKernelScripts V00-00-01
#   FigPeer2PeerTools V00-00-00
#   FigWebPages V00-00-00
#   FigWebServices V00-00-02
########################################################################


#-----------------------------------------------------------------------
#++ vars
packageVersionsFileName=""

#-----------------------------------------------------------------------
#++ process options

   set -- `getopt f: $*`
   if [ $? = 0 ]; then
       while [ $1 != -- ]
	 do
	 case $1 in
	     -f) packageVersionsFileName=$2; shift;;
	 esac
	 shift
       done
       shift
   fi
   

#-----------------------------------------------------------------------
#++ check for correct number of arguments
#
   if [ "$#" -ne 1 ]; then
       echo "Usage: newrel <releaseName> -f <PackageVersionsFileName>"
       exit 2
   fi
   newReleaseName=$1

   echo "Add code to enforce naming rules for release name...should be form i.j.k"
   echo

   if [ $packageVersionsFileName = "" ]; then
       echo "You must give a PackageVersions file name via -f "
       exit 2
   fi

#-----------------------------------------------------------------------
# ++ Does the PackageVersionsFile exist?

   if [ ! -r $packageVersionsFileName ]; then 
       echo "PackageVersionsFile $packageVersionsFileName not readable"
       exit 2
   fi
 

#-----------------------------------------------------------------------
#++ Validate format of PackageVersions
#   Require all packages have tag names.  None are HEAD

   echo "Add code to Validate format of PackageVersions.  Require all packages have tag names.  None are HEAD"
   echo

#-----------------------------------------------------------------------
#++ Sanity check the release

   if [ -z "$RTROOT" ]; then
       echo "No RTROOT set"
       exit 2
   fi

   releaseArea=$RTROOT/dist/releases

   if [ ! -r "$releaseArea" ]; then
       echo "No release Areas: " $releaseArea
       exit 2
   fi

   newRelease=$releaseArea/$newReleaseName

   if [ -r $newRelease ]; then
       echo "Release $newReleaseName already exists in release area, $releaseArea"
       exit 2
   fi

#-----------------------------------------------------------------------
#++ OK, make the new release directory and put config file there
#   and PackageVersions file 

   # Don't know how PackageVersions file was specified to us.  Could be
   # absolute path or not.  Just remember where we are so we can do the
   # copy, below

   invokedFromDir=`pwd`
 
   # Warp us there, Mr. Sulu

   cd $releaseArea
   mkdir $newReleaseName

   if [ ! -r $newReleaseName ]; then
       echo "Failed to make new release directory"
       exit 2
   fi
   
   cd $newReleaseName

   # put in a rgConfig that points to ourselves.  This will let us
   # call other ReleaseTools tools to help us build this thing.

   echo "baserelname=$newReleaseName" > rtConfig

   if [ ! -r  rtConfig ]; then
       echo "Failed to make rtConfig file...you clean up the mess"
       exit 2
   fi

   # copy in the PackageVersions file.  Note that we make sure it
   # goes in with the right name, "PackageVersions"

   cd $invokedFromDir
   cp -p $packageVersionsFileName $releaseArea/$newReleaseName/PackageVersions

   installedPackageVersionsFile=$releaseArea/$newReleaseName/PackageVersions

   cd $releaseArea/$newReleaseName

#-----------------------------------------------------------------------
#++ Load it with the packages.

   # this uses the PackageVersions we just dumped in

   cd $releaseArea/$newReleaseName
   for pkg in `awk '{print $1 }' $installedPackageVersionsFile` ; do
       echo getting $pkg
       packageVer=`grep $pkg $installedPackageVersionsFile | awk '{print $2}'`
       echo cvs co  -r $packageVer  $pkg
       cvs co  -r $packageVer  $pkg
   done

#-----------------------------------------------------------------------
#++ Zorch all the CVS directories.

   cd $releaseArea/$newReleaseName

   # brain fade...can't get -exec to work for me and am in rush:

   rm -rf `find . -type d -name CVS -print`

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3