- 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,19 +13,20 @@
# [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
while [ $1 ]; do
case "$1" in case "$1" in
-h|-help|--h|--help) -h|-help|--h|--help)
echo 'Usage : create_new_release [--help] [--rpm] [--do-it] <packages directory>' echo 'Usage : create_new_release [--help] [--rpm] [--public] [--do-it] <packages directory>'
echo echo
echo ' --help : prints this usage help' echo ' --help : prints this usage help'
echo ' --rpm : also build the corresponding SRPMs' echo ' --rpm : also build the corresponding SRPMs'
echo ' --public : also build the corresponding public versions'
echo ' --do-it : the real thing (NOT for local tests! Only for the release master!),' echo ' --do-it : the real thing (NOT for local tests! Only for the release master!),'
echo ' does write operations (updating the version_number, svn tag,' echo ' does write operations (updating the version_number, svn tag,'
echo ' sending mail, copying on the web server...)' echo ' sending mail, copying on the web server...)'
@ -34,26 +35,26 @@ case "$1" in
;; ;;
--rpm) --rpm)
DO_RPM="y" DO_RPM="y"
shift shift; continue
;;
--public)
DO_PUBLIC="y"
shift; continue
;; ;;
--do-it) --do-it)
DO_IT="y" # The Real Thing DO_IT="y"
shift shift; continue
;; ;;
--rpm) -*)
# This option's handling is duplicated because I don't have the machinery echo "Unrecognized option : $1"
# to handle options in any order yet. exit
DO_RPM="y" ;;
shift *)
SOURCES_DIR="$1"
shift; continue
;; ;;
esac esac
done
# SVN working copy directory, default is "trunk"
if [ -z "$1" ] ; then
SOURCES_DIR=trunk
else
SOURCES_DIR="$1"
fi
# The internal release number is extracted/updated from this file : # The internal release number is extracted/updated from this file :
@ -157,6 +158,7 @@ if [ "$DO_RPM" ]; then
fi fi
# Build public release version # Build public release version
if [ "$DO_PUBLIC" ]; then
echo "Making the public version of the tarball" >> ${LOGFILE} 2>&1 echo "Making the public version of the tarball" >> ${LOGFILE} 2>&1
public_release_number="1${major_nr}${minor_nr}${bugfix_nr}1000" public_release_number="1${major_nr}${minor_nr}${bugfix_nr}1000"
public_release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}" public_release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}"
@ -175,12 +177,13 @@ 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