Update create_new_release to use the cmake script.

This commit is contained in:
Maxime Gimeno 2018-09-03 15:30:53 +02:00
parent f6aa83e09c
commit b5474fd02e
1 changed files with 37 additions and 71 deletions

View File

@ -5,7 +5,6 @@
# Radu Ursu, Sylvain Pion, 2004-2006. # Radu Ursu, Sylvain Pion, 2004-2006.
# TODO : # TODO :
# - Use svn revision instead of separate internal release number ?
# - Cleanup the public/internal separation: # - Cleanup the public/internal separation:
# - have CGAL_VERSION_NR be not affected by the internal version # - have CGAL_VERSION_NR be not affected by the internal version
# - have CGAL_REVISION be the revision (replacing the internal number) # - have CGAL_REVISION be the revision (replacing the internal number)
@ -13,45 +12,44 @@
# [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 ?
DO_RPM="" # Also build RPMs (no RPMs by default)
DO_PUBLIC="" # Also build the public versions DO_PUBLIC="" # Also build the public versions
DO_IT="" # Real mode (svn tag, copy to HTTP server), versus local testing DO_IT="" # Real mode (copy to HTTP server), versus local testing
DO_NOT_TAG="" # If set, do not call svn tag DO_NOT_TAG="" # If set, do not call tag
DO_TAG="" # If set, svn tag is called anyway DO_TAG="" # If set, tag is called anyway
NO_TESTUITE="" # If set, the LATEST file is not updated NO_TESTUITE="" # If set, the LATEST file is not updated
NO_SCM="" # If set, git pull is not called. NO_SCM="" # If set, git pull is not called.
SOURCES_DIR="$PWD/trunk" # SVN working copy directory, default is "$PWD/trunk" SOURCES_DIR="$PWD" # Directory containing the sources, default is "$PWD"
VERBOSE="" # Verbose mode (displays log to standard err) VERBOSE="" # Verbose mode (displays log to standard err)
BETA="" #If set, will change the release number and version number accordingly. BETA="" #If set, will change the release number and version number accordingly.
SCM=svn DESTINATION="/tmp"
IS_MASTER=""
SOURCES_DIR_HAS_BEEN_SET= SOURCES_DIR_HAS_BEEN_SET=
CANDIDATES_DIR_HAS_BEEN_SET=
printerr() { printerr() {
echo "$@" >&2; echo "$@" >&2;
} }
usage() { usage() {
printerr "Usage : $0 [--help] [--rpm] [--public] [--do-it] [--beta <n>] <packages dir> [<candidates dir>]" printerr "Usage : $0 [--help] [--public] [--do-it] [--beta <n>] <packages dir>"
printerr printerr
printerr ' --help : prints this usage help' printerr ' --help : prints this usage help'
printerr ' --rpm : also build the corresponding SRPMs'
printerr ' --public : also build the corresponding public versions' printerr ' --public : also build the corresponding public versions'
printerr ' --do-it : the real thing (NOT for local tests! Only for the release' printerr ' --do-it : the real thing (NOT for local tests! Only for the release'
printerr ' master! Does write operations (updating the version_number,' printerr ' master! Does write operations (updating the version_number,'
printerr ' svn tag, copying on the web server...)' printerr ' tag, copying on the web server...)'
printerr ' --do-not-tag : when used with --do-it, the tag is not created.' printerr ' --do-not-tag : when used with --do-it, the tag is not created.'
printerr ' --tag : when used without --do-it, the tag is created, but files' printerr ' --tag : when used without --do-it, the tag is created, but files'
printerr ' are not published' printerr ' are not published'
printerr ' --no-scm-update : do not "svn update" or "git pull"' printerr ' --no-scm-update : do not "git pull"'
printerr ' --no-testsuite : when used with --do-it, the tag is made, files are published,' printerr ' --no-testsuite : when used with --do-it, the tag is made, files are published,'
printerr ' but the LATEST file is not updated.' printerr ' but the LATEST file is not updated.'
printerr ' --verbose : print log to standard output, instead of the log file' printerr ' --verbose : print log to standard output, instead of the log file'
printerr ' --beta <n> : followed by a number. When used with --public, will modify printerr ' --beta <n> : followed by a number. When used with --public, will modify
the release number and the release version name to include beta<n>' the release number and the release version name to include beta<n>'
printerr ' --dest : followed by the path to where the release should be created. Default is /tmp.'
printerr ' --is_master : replace the Ic in the name by I.'
printerr ' <packages dir> : the directory containing the packages [default is trunk]' printerr ' <packages dir> : the directory containing the packages [default is trunk]'
printerr ' <candidates dir> : the directory containing the candidate packages [no default]'
} }
@ -62,12 +60,8 @@ while [ $1 ]; do
usage; usage;
exit; exit;
;; ;;
--rpm)
DO_RPM="y"
shift; continue
;;
--public) --public)
DO_PUBLIC="y" DO_PUBLIC="ON"
shift; continue shift; continue
;; ;;
--do-it) --do-it)
@ -91,7 +85,7 @@ while [ $1 ]; do
shift; continue shift; continue
;; ;;
--verbose) --verbose)
VERBOSE="y" VERBOSE="ON"
shift; continue shift; continue
;; ;;
--beta) --beta)
@ -104,6 +98,15 @@ while [ $1 ]; do
shift; shift;
continue continue
;; ;;
--dest)
shift
DESTINATION=$1
shift;continue
;;
--is_master)
IS_MASTER="y"
shift;continue
;;
-*) -*)
printerr "Unrecognized option : $1" printerr "Unrecognized option : $1"
exit exit
@ -132,8 +135,6 @@ VERSION_FILE="version_number"
HTML_DIR="/u/agrion/geometrica/CGAL/Members/Releases" HTML_DIR="/u/agrion/geometrica/CGAL/Members/Releases"
URL="http://cgal.inria.fr/CGAL/Members/Releases" URL="http://cgal.inria.fr/CGAL/Members/Releases"
# SVN repository
SVNCGAL="svn+ssh://scm.gforge.inria.fr/svn/cgal"
PATH=$PATH:/usr/local/bin:/usr/bin/gnu PATH=$PATH:/usr/local/bin:/usr/bin/gnu
@ -172,18 +173,11 @@ if [ -d "${SOURCES_DIR}/.git" ]; then
pushd "${SOURCES_DIR}" pushd "${SOURCES_DIR}"
[ -z "$NO_SCM" ] && git pull [ -z "$NO_SCM" ] && git pull
CGAL_GIT_HASH=`git rev-parse HEAD` CGAL_GIT_HASH=`git rev-parse HEAD`
CGAL_SVN_REVISION=99999
popd popd
SCM=git
else else
[ -z "$NO_SCM" ] && svn update ${SOURCES_DIR} echo "Not a git repository"
CGAL_SVN_REVISION=`svn info ${SOURCES_DIR} | grep Revision | cut -d' ' -f2` exit 1
CGAL_GIT_HASH=n/a
fi fi
if [ "$SCM" = "svn" -a -n "${CANDIDATES_DIR_HAS_BEEN_SET}" ]; then
[ -z "$NO_SCM" ] && svn update ${CANDIDATES_DIR}
fi
# Set the major/minor/bugfix release numbers # Set the major/minor/bugfix release numbers
NUMBERS_DIR=${SOURCES_DIR}/Maintenance/release_building NUMBERS_DIR=${SOURCES_DIR}/Maintenance/release_building
MAJOR_NUMBER=`cat ${NUMBERS_DIR}/MAJOR_NUMBER` # 2 digits max MAJOR_NUMBER=`cat ${NUMBERS_DIR}/MAJOR_NUMBER` # 2 digits max
@ -202,13 +196,13 @@ if [ -r $VERSION_FILE ]; then
INTERNAL_NUMBER=$(( `cat $VERSION_FILE` + 1 )) INTERNAL_NUMBER=$(( `cat $VERSION_FILE` + 1 ))
[ -n "$DO_TAG" ] && printf "%d\n" "${INTERNAL_NUMBER}" > $VERSION_FILE [ -n "$DO_TAG" ] && printf "%d\n" "${INTERNAL_NUMBER}" > $VERSION_FILE
else else
INTERNAL_NUMBER=$((`svn ls $SVNCGAL/tags/internal-releases | awk "/${MAJOR_NUMBER}\\.${MINOR_NUMBER}${BUGFIX_STRING}/ "'{FS="-|/"; print $4}' | sort -n | tail -1` + 1 )) echo "Need a \"version_number\" file."
fi fi
if [ -z "$INTERNAL_NUMBER" ]; then if [ -z "$INTERNAL_NUMBER" ]; then
INTERNAL_NUMBER=1 INTERNAL_NUMBER=1
fi fi
if [ -n "${CANDIDATES_DIR_HAS_BEEN_SET}" ]; then if [ -z "${IS_MASTER}" ]; then
INTERNAL_STRING="-Ic-${INTERNAL_NUMBER}" INTERNAL_STRING="-Ic-${INTERNAL_NUMBER}"
else else
INTERNAL_STRING="-I-${INTERNAL_NUMBER}" INTERNAL_STRING="-I-${INTERNAL_NUMBER}"
@ -217,10 +211,11 @@ fi
internal_nr=`printf "%4s" "${INTERNAL_NUMBER}" | sed "y/ /0/"` internal_nr=`printf "%4s" "${INTERNAL_NUMBER}" | sed "y/ /0/"`
if [ -r "${NUMBERS_DIR}/release_name" ]; then if [ -r "${NUMBERS_DIR}/release_name" ]; then
release_name=`cat "${NUMBERS_DIR}/release_name"`${INTERNAL_STRING} release_version=`cat "${NUMBERS_DIR}/release_name"`${INTERNAL_STRING}
else else
release_name="CGAL-${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}${INTERNAL_STRING}" release_version="${MAJOR_NUMBER}.${MINOR_NUMBER}${BUGFIX_STRING}${INTERNAL_STRING}"
fi fi
release_name="CGAL-${release_version}"
echo "${release_name}" echo "${release_name}"
major_nr=`printf "%2s" "${MAJOR_NUMBER}" | sed "y/ /0/"` major_nr=`printf "%2s" "${MAJOR_NUMBER}" | sed "y/ /0/"`
minor_nr=`printf "%2s" "${MINOR_NUMBER}" | sed "y/ /0/"` minor_nr=`printf "%2s" "${MINOR_NUMBER}" | sed "y/ /0/"`
@ -235,8 +230,12 @@ fi
function cleanup() { function cleanup() {
# Remove local directory and tarball # Remove local directory and tarball
rm -rf ./"${release_name}" if [ -d ${release_name} ]; then
rm ${release_name}.tar.gz rm -rf ./"${release_name}"
fi
if [ -f ${release_name}.tar.gz ]; then
rm ${release_name}.tar.gz
fi
if [ -n "$DO_PUBLIC" ]; then if [ -n "$DO_PUBLIC" ]; then
[ -d "${public_release_name}" ] && rm -rf ./"${public_release_name}" [ -d "${public_release_name}" ] && rm -rf ./"${public_release_name}"
rm -rf doc rm -rf doc
@ -249,14 +248,8 @@ function cleanup() {
trap cleanup EXIT trap cleanup EXIT
# Create the release # Create the release
if [ -n "$CANDIDATES_DIR_HAS_BEEN_SET" ]; then cmake -DPUBLIC="${DO_PUBLIC}" -DDESTINATION="${DESTINATION}" -DCGAL_VERSION="${release_version}" -DCGAL_VERSION_NR="${release_number}" -DVERBOSE="${VERBOSE}" -P ${SOURCES_DIR}/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
${SOURCES_DIR}/Scripts/developer_scripts/create_internal_release -a ${SOURCES_DIR} -c ${CANDIDATES_DIR} -r ${release_name} -n ${release_number} cd "${DESTINATION}/${release_name}"
else
${SOURCES_DIR}/Scripts/developer_scripts/create_internal_release -a ${SOURCES_DIR} -r ${release_name} -n ${release_number}
fi
# Add the SVN revision to version.h
cd "${release_name}"
sed -i -e "s/define CGAL_SVN_REVISION .*/define CGAL_SVN_REVISION $CGAL_SVN_REVISION/" include/CGAL/version.h
sed -i -e "s/define CGAL_GIT_HASH .*/define CGAL_GIT_HASH $CGAL_GIT_HASH/" include/CGAL/version.h sed -i -e "s/define CGAL_GIT_HASH .*/define CGAL_GIT_HASH $CGAL_GIT_HASH/" include/CGAL/version.h
cd .. cd ..
# Make the release tarball # Make the release tarball
@ -284,20 +277,8 @@ if [ -n "$DO_TAG" ]; then
if [ -n "$NO_TESTSUITE" ]; then if [ -n "$NO_TESTSUITE" ]; then
TAG_MSG_EXTRA=" (no testsuite)" TAG_MSG_EXTRA=" (no testsuite)"
fi fi
[ "$SCM" = "svn" ] && svn cp -m "Internal release tag for $release_name$TAG_MSG_EXTRA (automated commit)" ${SOURCES_DIR} $SVNCGAL/tags/internal-releases/$release_name
fi fi
# Build the SRPM
if [ "$DO_RPM" ]; then
echo "Making the SRPM file"
rm -rf rpm
cp -r ${SOURCES_DIR}/Maintenance/rpm .
cp ${release_name}.tar.gz rpm/SOURCES/
make -C rpm CGAL.src CGAL_INTERNAL_RELEASE=${INTERNAL_NUMBER}
echo "`basename rpm/SRPMS/*.src.rpm`" > "${HTML_DIR}/LATEST_SRPM"
mv rpm/SRPMS/*.src.rpm "${HTML_DIR}"
rm -rf rpm
fi
# Build public release version # Build public release version
if [ -n "$DO_PUBLIC" ]; then if [ -n "$DO_PUBLIC" ]; then
@ -318,10 +299,6 @@ if [ -n "$DO_PUBLIC" ]; then
mv -T ${release_name} $public_release_name mv -T ${release_name} $public_release_name
cd ${public_release_name} cd ${public_release_name}
rm -rf bench* Bench* test package_info developer_scripts doc winutils include/CGAL/Test include/CGAL/Testsuite/
rm -f examples/*/cgal_test* demo/*/cgal_test*
find . -name .scm-urls -exec rm '{}' '+'
rm -f .scm-branch
# Modify the version numbers in <CGAL/version.h> # Modify the version numbers in <CGAL/version.h>
sed -i -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 sed -i -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
@ -345,17 +322,6 @@ if [ -n "$DO_PUBLIC" ]; then
ln -s "${release_name}-public" "$HTML_DIR/CGAL-last-public" ln -s "${release_name}-public" "$HTML_DIR/CGAL-last-public"
fi fi
# Build the SRPM of the public version
if [ -n "$DO_RPM" -a -n "$DO_PUBLIC" ]; then
echo "Making the SRPM public file"
rm -rf rpm
cp -r ${SOURCES_DIR}/Maintenance/rpm .
cp ${public_release_name}.tar.gz rpm/SOURCES/
make -C rpm CGAL.src
# echo "`basename rpm/SRPMS/*.src.rpm`" > "${HTML_DIR}/LATEST_SRPM"
mv rpm/SRPMS/*.src.rpm "${HTML_DIR}/${release_name}-public/"
rm -rf rpm
fi
if [ -n "$DO_PUBLIC" ]; then if [ -n "$DO_PUBLIC" ]; then
# Build the Windows installer # Build the Windows installer