- Add better command-line parsing code

- Add a "--public" option that selects building of public versions.
  (so it's disabled by default)
This commit is contained in:
Sylvain Pion 2006-07-14 09:32:35 +00:00
parent 3a1d192aca
commit c8b5db64c9
1 changed files with 64 additions and 61 deletions

View File

@ -13,47 +13,48 @@
# [new] : create_internal_release should not know about internal/public mode. # [new] : create_internal_release should not know about internal/public mode.
# - Merge [some parts] into ./create_internal_release ? # - Merge [some parts] into ./create_internal_release ?
# Real mode (svn tag, mail, copy to HTTP server), versus local testing (puts stuff in tmp/) DO_RPM="" # Also build RPMs (no RPMs by default)
DO_IT="" DO_PUBLIC="" # Also build the public versions
DO_IT="" # Real mode (svn tag, mail, copy to HTTP server), versus local testing
# Also build RPMs (no RPMs by default) SOURCES_DIR="trunk" # SVN working copy directory, default is "trunk"
DO_RPM=""
# Parsing command-line # Parsing command-line
case "$1" in while [ $1 ]; do
-h|-help|--h|--help) case "$1" in
echo 'Usage : create_new_release [--help] [--rpm] [--do-it] <packages directory>' -h|-help|--h|--help)
echo echo 'Usage : create_new_release [--help] [--rpm] [--public] [--do-it] <packages directory>'
echo ' --help : prints this usage help' echo
echo ' --rpm : also build the corresponding SRPMs' echo ' --help : prints this usage help'
echo ' --do-it : the real thing (NOT for local tests! Only for the release master!),' echo ' --rpm : also build the corresponding SRPMs'
echo ' does write operations (updating the version_number, svn tag,' echo ' --public : also build the corresponding public versions'
echo ' sending mail, copying on the web server...)' echo ' --do-it : the real thing (NOT for local tests! Only for the release master!),'
echo ' <packages directory> : the directory containing the packages [default is trunk]' echo ' does write operations (updating the version_number, svn tag,'
exit echo ' sending mail, copying on the web server...)'
;; echo ' <packages directory> : the directory containing the packages [default is trunk]'
--rpm) exit
DO_RPM="y" ;;
shift --rpm)
;; DO_RPM="y"
--do-it) shift; continue
DO_IT="y" # The Real Thing ;;
shift --public)
;; DO_PUBLIC="y"
--rpm) shift; continue
# This option's handling is duplicated because I don't have the machinery ;;
# to handle options in any order yet. --do-it)
DO_RPM="y" DO_IT="y"
shift shift; continue
;; ;;
esac -*)
echo "Unrecognized option : $1"
# SVN working copy directory, default is "trunk" exit
if [ -z "$1" ] ; then ;;
SOURCES_DIR=trunk *)
else SOURCES_DIR="$1"
SOURCES_DIR="$1" shift; continue
fi ;;
esac
done
# The internal release number is extracted/updated from this file : # The internal release number is extracted/updated from this file :
@ -157,30 +158,32 @@ if [ "$DO_RPM" ]; then
fi fi
# Build public release version # Build public release version
echo "Making the public version of the tarball" >> ${LOGFILE} 2>&1 if [ "$DO_PUBLIC" ]; then
public_release_number="1${major_nr}${minor_nr}${bugfix_nr}1000" echo "Making the public version of the tarball" >> ${LOGFILE} 2>&1
public_release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}" public_release_number="1${major_nr}${minor_nr}${bugfix_nr}1000"
public_release_name="CGAL-${public_release_version}" public_release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}"
mv ${release_name} $public_release_name >> ${LOGFILE} 2>&1 public_release_name="CGAL-${public_release_version}"
mv ${release_name} $public_release_name >> ${LOGFILE} 2>&1
cd ${public_release_name} >> ${LOGFILE} 2>&1 cd ${public_release_name} >> ${LOGFILE} 2>&1
rm -rf test Packages developer_scripts doc_tex winutils >> ${LOGFILE} 2>&1 rm -rf test Packages developer_scripts doc_tex winutils >> ${LOGFILE} 2>&1
rm -f examples/*/cgal_test demo/*/cgal_test >> ${LOGFILE} 2>&1 rm -f examples/*/cgal_test demo/*/cgal_test >> ${LOGFILE} 2>&1
mv include/CGAL/version.h include/CGAL/version.h.internal >> ${LOGFILE} 2>&1 mv include/CGAL/version.h include/CGAL/version.h.internal >> ${LOGFILE} 2>&1
sed -e "s/define CGAL_VERSION .*/define CGAL_VERSION $public_release_version/" -e "s/define CGAL_VERSION_NR .*/define CGAL_VERSION_NR $public_release_number/" include/CGAL/version.h.internal > include/CGAL/version.h 2>> ${LOGFILE} sed -e "s/define CGAL_VERSION .*/define CGAL_VERSION $public_release_version/" -e "s/define CGAL_VERSION_NR .*/define CGAL_VERSION_NR $public_release_number/" include/CGAL/version.h.internal > include/CGAL/version.h 2>> ${LOGFILE}
rm include/CGAL/version.h.internal >> ${LOGFILE} 2>&1 rm include/CGAL/version.h.internal >> ${LOGFILE} 2>&1
echo -n $public_release_number > VERSION 2>&1 echo -n $public_release_number > VERSION 2>&1
cd .. >> ${LOGFILE} 2>&1 cd .. >> ${LOGFILE} 2>&1
tar -cf "${public_release_name}.tar" "${public_release_name}" >> ${LOGFILE} 2>&1 tar -cf "${public_release_name}.tar" "${public_release_name}" >> ${LOGFILE} 2>&1
gzip "${public_release_name}.tar" >> ${LOGFILE} 2>&1 gzip "${public_release_name}.tar" >> ${LOGFILE} 2>&1
mkdir "${HTML_DIR}/${release_name}-public" >> ${LOGFILE} 2>&1 mkdir "${HTML_DIR}/${release_name}-public" >> ${LOGFILE} 2>&1
cp "${public_release_name}.tar.gz" "${HTML_DIR}/${release_name}-public/" >> ${LOGFILE} 2>&1 cp "${public_release_name}.tar.gz" "${HTML_DIR}/${release_name}-public/" >> ${LOGFILE} 2>&1
# Do a Zip file as well. # Do a Zip file as well for the public version.
zip -q -r ${public_release_name}.zip ${public_release_name} >> ${LOGFILE} 2>&1 zip -q -r ${public_release_name}.zip ${public_release_name} >> ${LOGFILE} 2>&1
cp "${public_release_name}.zip" "${HTML_DIR}/${release_name}-public/" >> ${LOGFILE} 2>&1 cp "${public_release_name}.zip" "${HTML_DIR}/${release_name}-public/" >> ${LOGFILE} 2>&1
fi
# Build the SRPM of the public version # Build the SRPM of the public version
if [ "$DO_RPM" ]; then if [ -n "$DO_RPM" -a -n "$DO_PUBLIC" ]; then
echo "Making the SRPM public file" >> ${LOGFILE} 2>&1 echo "Making the SRPM public file" >> ${LOGFILE} 2>&1
rm -rf rpm >> ${LOGFILE} 2>&1 rm -rf rpm >> ${LOGFILE} 2>&1
cp -r ${SOURCES_DIR}/Maintenance/rpm . >> ${LOGFILE} 2>&1 cp -r ${SOURCES_DIR}/Maintenance/rpm . >> ${LOGFILE} 2>&1
@ -194,5 +197,5 @@ if [ "$DO_RPM" ]; then
fi fi
# Remove local directory and tarball # Remove local directory and tarball
rm -rf ${public_release_name} >> ${LOGFILE} 2>&1 rm -rf ${release_name} ${public_release_name} >> ${LOGFILE} 2>&1
rm ${release_name}.tar.gz ${public_release_name}.tar.gz ${public_release_name}.zip >> ${LOGFILE} 2>&1 rm ${release_name}.tar.gz ${public_release_name}.tar.gz ${public_release_name}.zip >> ${LOGFILE} 2>&1