mirror of https://github.com/CGAL/cgal
164 lines
7.0 KiB
Bash
Executable File
164 lines
7.0 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Creating a new CGAL internal/public release.
|
|
#
|
|
# Radu Ursu, Sylvain Pion, 2004-2006.
|
|
|
|
# TODO :
|
|
# - Add a command-line option "--local" to avoid putting stuff on the web, etc.
|
|
# - Use svn revision instead of separate internal release number ?
|
|
# - Cleanup the public/internal separation:
|
|
# - have CGAL_VERSION_NR be not affected by the internal version
|
|
# - have CGAL_REVISION be the revision (replacing the internal number)
|
|
# - The public release case should pass the info to create_internal_release.
|
|
# [new] : create_internal_release should not know about internal/public mode.
|
|
# - Merge [some parts] into ./create_internal_release ?
|
|
# - There should be command line options to set public/internal,
|
|
# and the major/minor/bugfix/version_file release numbers.
|
|
# this should be obsolete now that we generate public/internal at once.
|
|
|
|
# SVN working copy directory, default is "trunk"
|
|
if [ -z "$1" ] ; then
|
|
SOURCES_DIR=trunk
|
|
else
|
|
SOURCES_DIR="$1"
|
|
fi
|
|
|
|
|
|
# Set the following to "y" in case of public release.
|
|
IS_PUBLIC_RELEASE="n"
|
|
|
|
# The internal release number is extracted/updated from this file :
|
|
VERSION_FILE="version_number"
|
|
|
|
# Where to put the resulting tarball and where to send the announce.
|
|
HTML_DIR="/u/bombyx/geometrica/CGAL/Members/Releases"
|
|
URL="http://cgal.inria.fr/CGAL/Members/Releases"
|
|
MAILTO="cgal-develop-l@postino.mpi-sb.mpg.de"
|
|
|
|
# SVN repository
|
|
SVNCGAL="svn+ssh://scm.gforge.inria.fr/svn/cgal"
|
|
|
|
PATH=$PATH:/usr/local/bin:/usr/bin/gnu
|
|
TAR=/usr/bin/gnu/tar
|
|
GZIP=/usr/bin/gnu/gzip
|
|
|
|
#TMPDIR="/tmp"
|
|
TMPDIR="${HOME}/CGAL/internal_release_making"
|
|
|
|
LOGFILE="${TMPDIR}/create_release.log.`date -I`.$$"
|
|
|
|
|
|
cd ${TMPDIR} || return
|
|
|
|
# Update the working copy
|
|
svn update ${SOURCES_DIR} >> ${LOGFILE} 2>&1
|
|
CGAL_SVN_REVISION=`svn info ${SOURCES_DIR} | grep Revision | cut -d' ' -f2`
|
|
|
|
# Set the major/minor/bugfix release numbers
|
|
NUMBERS_DIR=${SOURCES_DIR}/Maintenance/release_building
|
|
MAJOR_NUMBER=`cat ${NUMBERS_DIR}/MAJOR_NUMBER` # 2 digits max
|
|
MINOR_NUMBER=`cat ${NUMBERS_DIR}/MINOR_NUMBER` # 2 digits max
|
|
BUGFIX_NUMBER=`cat ${NUMBERS_DIR}/BUGFIX_NUMBER` # 1 digit max
|
|
|
|
# The internal release number is considered only in non-public mode.
|
|
if [ $IS_PUBLIC_RELEASE = "n" ]; then
|
|
[ -r $VERSION_FILE ] || return
|
|
INTERNAL_NUMBER=$(( `cat $VERSION_FILE` + 1 ))
|
|
rm -f $VERSION_FILE
|
|
printf "%d\n" "${INTERNAL_NUMBER}" >> $VERSION_FILE
|
|
INTERNAL_STRING="-I-${INTERNAL_NUMBER}"
|
|
internal_nr=`printf "%4s" "${INTERNAL_NUMBER}" | sed "y/ /0/"`
|
|
else
|
|
INTERNAL_NUMBER=0
|
|
INTERNAL_STRING=""
|
|
internal_nr="1000"
|
|
fi
|
|
|
|
# Do not show the bugfix number if it is 0.
|
|
if [ $BUGFIX_NUMBER != "0" ]; then
|
|
BUGFIX_STRING=".$BUGFIX_NUMBER"
|
|
else
|
|
BUGFIX_STRING=""
|
|
fi
|
|
release_name="CGAL-${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}${INTERNAL_STRING}"
|
|
echo "${release_name}" >> ${LOGFILE} 2>&1
|
|
major_nr=`printf "%2s" "${MAJOR_NUMBER}" | sed "y/ /0/"`
|
|
minor_nr=`printf "%2s" "${MINOR_NUMBER}" | sed "y/ /0/"`
|
|
bugfix_nr=`printf "%1s" "${BUGFIX_NUMBER}" | sed "y/ /0/"`
|
|
release_number="1${major_nr}${minor_nr}${bugfix_nr}${internal_nr}"
|
|
echo "Release number is ${release_number}" >> ${LOGFILE} 2>&1
|
|
|
|
# Create the release
|
|
${SOURCES_DIR}/Scripts/developer_scripts/create_internal_release -r ${release_name} -n ${release_number} -d ${TMPDIR} >> ${LOGFILE} 2>&1
|
|
# Add the SVN revision to version.h
|
|
cd "${release_name}" >> ${LOGFILE} 2>&1
|
|
mv include/CGAL/version.h include/CGAL/version.h.internal >> ${LOGFILE} 2>&1
|
|
sed -e "s/define CGAL_SVN_REVISION .*/define CGAL_SVN_REVISION $CGAL_SVN_REVISION/" include/CGAL/version.h.internal > include/CGAL/version.h 2>> ${LOGFILE}
|
|
rm include/CGAL/version.h.internal >> ${LOGFILE} 2>&1
|
|
cd ..
|
|
# Make the release tarball
|
|
${TAR} -cf "${release_name}.tar" "${release_name}" >> ${LOGFILE} 2>&1
|
|
${GZIP} "${release_name}.tar" >> ${LOGFILE} 2>&1
|
|
cp "${release_name}.tar.gz" "${HTML_DIR}" >> ${LOGFILE} 2>&1
|
|
echo "${release_name}.tar.gz" > "${HTML_DIR}/LATEST"
|
|
mail -s "[automatic] ${release_name} is released" ${MAILTO} <<EOF
|
|
|
|
You can fetch it at :
|
|
${URL}/${release_name}.tar.gz
|
|
|
|
EOF
|
|
|
|
# Now we tag.
|
|
echo "Tagging ${SOURCES_DIR} with $release_name" >> ${LOGFILE} 2>&1
|
|
svn cp -m "Internal release tag for $release_name" ${SOURCES_DIR} $SVNCGAL/tags/internal-releases/$release_name >> ${LOGFILE} 2>&1
|
|
|
|
# Build the SRPM
|
|
echo "Making the SRPM file" >> ${LOGFILE} 2>&1
|
|
rm -rf rpm >> ${LOGFILE} 2>&1
|
|
cp -r ${SOURCES_DIR}/Maintenance/rpm . >> ${LOGFILE} 2>&1
|
|
cp ${release_name}.tar.gz rpm/SOURCES/ >> ${LOGFILE} 2>&1
|
|
mv rpm/SPECS/CGAL.spec rpm/SPECS/CGAL.spec.old >> ${LOGFILE} 2>&1
|
|
sed -e "s/define internal_release.*/define internal_release $INTERNAL_NUMBER/" rpm/SPECS/CGAL.spec.old > rpm/SPECS/CGAL.spec 2>> ${LOGFILE}
|
|
make -C rpm CGAL.src >> ${LOGFILE} 2>&1
|
|
echo "`basename rpm/SRPMS/*.src.rpm`" > "${HTML_DIR}/LATEST_SRPM" 2>> ${LOGFILE}
|
|
mv rpm/SRPMS/*.src.rpm "${HTML_DIR}" >> ${LOGFILE} 2>&1
|
|
rm -rf rpm >> ${LOGFILE} 2>&1
|
|
|
|
# Build public release version
|
|
echo "Making the public version of the tarball" >> ${LOGFILE} 2>&1
|
|
public_release_number="1${major_nr}${minor_nr}${bugfix_nr}1000"
|
|
public_release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}"
|
|
public_release_name="CGAL-${public_release_version}"
|
|
mv ${release_name} $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 -f examples/*/cgal_test demo/*/cgal_test >> ${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}
|
|
rm include/CGAL/version.h.internal >> ${LOGFILE} 2>&1
|
|
cd .. >> ${LOGFILE} 2>&1
|
|
${TAR} -cf "${public_release_name}.tar" "${public_release_name}" >> ${LOGFILE} 2>&1
|
|
${GZIP} "${public_release_name}.tar" >> ${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
|
|
# Do a Zip file as well.
|
|
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
|
|
|
|
# Build the SRPM of the public version
|
|
echo "Making the SRPM public file" >> ${LOGFILE} 2>&1
|
|
rm -rf rpm >> ${LOGFILE} 2>&1
|
|
cp -r ${SOURCES_DIR}/Maintenance/rpm . >> ${LOGFILE} 2>&1
|
|
cp ${public_release_name}.tar.gz rpm/SOURCES/ >> ${LOGFILE} 2>&1
|
|
mv rpm/SPECS/CGAL.spec rpm/SPECS/CGAL.spec.old >> ${LOGFILE} 2>&1
|
|
sed -e "s/define internal_release.*/define internal_release 0/" rpm/SPECS/CGAL.spec.old > rpm/SPECS/CGAL.spec 2>> ${LOGFILE}
|
|
make -C rpm CGAL.src >> ${LOGFILE} 2>&1
|
|
# echo "`basename rpm/SRPMS/*.src.rpm`" > "${HTML_DIR}/LATEST_SRPM" 2>> ${LOGFILE}
|
|
mv rpm/SRPMS/*.src.rpm "${HTML_DIR}/${release_name}-public/" >> ${LOGFILE} 2>&1
|
|
rm -rf rpm >> ${LOGFILE} 2>&1
|
|
|
|
# Remove local directory and tarball
|
|
rm -rf ${public_release_name} >> ${LOGFILE} 2>&1
|
|
rm ${release_name}.tar.gz ${public_release_name}.tar.gz ${public_release_name}.zip >> ${LOGFILE} 2>&1
|