Commit f02f0635 authored by Davis King's avatar Davis King

Removed the old version keeping files in the docs folder now that the

dlib/CMakeLists.txt file is keeping the version numbers.  Also changed all
relevant scripts to grab the version information from CMakeLists.txt.
parent 86614971
#/bin/sh
#
# This script defines some helper functions used by other scripts in the docs
# folder.
get_short_revision_number()
{
RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'`
}
get_last_modified_date()
{
RESULT=`hg log $1 -l1 --template '{date|date}\n' | awk '{ print $2" "$3", " $5}'`
}
get_dlib_version()
{
cat ../dlib/CMakeLists.txt | awk '/set\(CPACK_PACKAGE_VERSION_'$1'/{ match($2,"\"(.*)\"",a); print a[1]}'
}
# call like: set_dlib_version MAJOR 42
set_dlib_version()
{
sed -i -e 's/\(set(CPACK_PACKAGE_VERSION_'$1' *"\).*\(".*\)/\1'$2'\2/' ../dlib/CMakeLists.txt
}
MAJOR_NUM=`get_dlib_version MAJOR`
MINOR_NUM=`get_dlib_version MINOR`
PATCH_NUM=`get_dlib_version PATCH`
#!/bin/bash #!/bin/bash
. bash_helper_functions
report_failure () report_failure ()
{ {
...@@ -70,11 +71,11 @@ htmlify_cmake () ...@@ -70,11 +71,11 @@ htmlify_cmake ()
echo $1 >> $1.html; echo $1 >> $1.html;
echo "</title></head><body bgcolor='white'><pre>" >> $1.html; echo "</title></head><body bgcolor='white'><pre>" >> $1.html;
# line 1: make comments green # line 1: make comments green
# line 2: add links into the add_subdirectory directives # line 2: add links into the add_subdirectory directives
# line 3: make literal quotes red # line 3: make literal quotes red
# line 4: make the directives show up blue # line 4: make the directives show up blue
# line 5: make variable names show up purple # line 5: make variable names show up purple
sed -e "s/^\([ ]*#.*\)/<font color='#009900'>\1<\/font>/" \ sed -e "s/^\([ ]*#.*\)/<font color='#009900'>\1<\/font>/" \
-e "s/add_subdirectory\([ ]*\)(\([ ]*\)\([^ ]*\)\([ ]*\)\([^ )]*\)/add_subdirectory\1(\2\3\4<a href='\3\/CMakeLists.txt.html'>\5<\/a>/" \ -e "s/add_subdirectory\([ ]*\)(\([ ]*\)\([^ ]*\)\([ ]*\)\([^ )]*\)/add_subdirectory\1(\2\3\4<a href='\3\/CMakeLists.txt.html'>\5<\/a>/" \
-e "s/\"\([^\"]*\)\"/\"<font color='#CC0000'>\1<\/font>\"/g" \ -e "s/\"\([^\"]*\)\"/\"<font color='#CC0000'>\1<\/font>\"/g" \
...@@ -95,26 +96,15 @@ htmlify_python() ...@@ -95,26 +96,15 @@ htmlify_python()
done done
} }
get_short_revision_number()
{
RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'`
}
get_last_modified_date()
{
RESULT=`hg log $1 -l1 --template '{date|date}\n' | awk '{ print $2" "$3", " $5}'`
}
makedocs () makedocs ()
{ {
COUNTER_FILE=.current_release_number
MINOR_COUTNER_FILE=.current_minor_release_number
REVNUM_FILE=.logger_revnum REVNUM_FILE=.logger_revnum
# figure out the short number that identifies this particular changeset # figure out the short number that identifies this particular changeset
get_short_revision_number `cat $REVNUM_FILE` get_short_revision_number `cat $REVNUM_FILE`
LOGGER_REVNUM=$RESULT LOGGER_REVNUM=$RESULT
...@@ -124,22 +114,20 @@ makedocs () ...@@ -124,22 +114,20 @@ makedocs ()
# The revision number we are currently at # The revision number we are currently at
CHANGESET_ID=`hg id -i | sed -e 's/\+//'` CHANGESET_ID=`hg id -i | sed -e 's/\+//'`
get_short_revision_number $CHANGESET_ID get_short_revision_number $CHANGESET_ID
REVISION=$RESULT REVISION=$RESULT
MAJOR_NUM=`cat $COUNTER_FILE`
MINOR_NUM=`cat $MINOR_COUTNER_FILE`
if [ "$1" = "makerel" ] if [ "$1" = "makerel" ]
then then
RELEASE=${MAJOR_NUM}.${MINOR_NUM} RELEASE=${MAJOR_NUM}.${MINOR_NUM}
else else
RELEASE=${MAJOR_NUM}.`echo ${MINOR_NUM}+1|bc`-RC RELEASE=${MAJOR_NUM}.${MINOR_NUM}.${PATCH_NUM}
fi; fi;
# get XML versions of the change logs # get XML versions of the change logs
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc` BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc`
NEXT_LOGGER_REVNUM=`echo $LOGGER_REVNUM + 1 | bc` NEXT_LOGGER_REVNUM=`echo $LOGGER_REVNUM + 1 | bc`
echo Getting the mercurial change logs for revisions $NEXT_LOGGER_REVNUM:$REVISION echo Getting the mercurial change logs for revisions $NEXT_LOGGER_REVNUM:$REVISION
...@@ -147,20 +135,14 @@ makedocs () ...@@ -147,20 +135,14 @@ makedocs ()
echo Getting the mercurial change logs for revisions $BASE_LOGGER_REVNUM:$LOGGER_REVNUM echo Getting the mercurial change logs for revisions $BASE_LOGGER_REVNUM:$LOGGER_REVNUM
hg log -v ../dlib ../examples ../tools ../python_examples --style=xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_log.txt || report_failure hg log -v ../dlib ../examples ../tools ../python_examples --style=xml -r$BASE_LOGGER_REVNUM:$LOGGER_REVNUM > docs/old_log.txt || report_failure
# grab a clean copy of the repository # grab a clean copy of the repository
rm -rf docs/cache rm -rf docs/cache
rm -rf docs/web rm -rf docs/web
rm -rf docs/chm/docs rm -rf docs/chm/docs
rm -rf cache.$$ hg archive docs/cache || report_failure
hg archive cache.$$ || report_failure # Don't need the docs folder in the cache, moreover, deleting it here avoids letting the makerel script include it in the dlib tar balls.
# put the stuff we need into the docs/cache folder rm -rf docs/cache/docs
mkdir docs/cache rm docs/cache/README.txt
mv cache.$$/dlib docs/cache/
mv cache.$$/examples docs/cache/
mv cache.$$/python_examples docs/cache/
mv cache.$$/tools docs/cache/
rm -rf cache.$$
echo "#ifndef DLIB_REVISION_H" > docs/cache/dlib/revision.h echo "#ifndef DLIB_REVISION_H" > docs/cache/dlib/revision.h
echo "// Version: " $RELEASE >> docs/cache/dlib/revision.h echo "// Version: " $RELEASE >> docs/cache/dlib/revision.h
...@@ -168,6 +150,7 @@ makedocs () ...@@ -168,6 +150,7 @@ makedocs ()
echo "// Mercurial Revision ID: " $CHANGESET_ID >> docs/cache/dlib/revision.h echo "// Mercurial Revision ID: " $CHANGESET_ID >> docs/cache/dlib/revision.h
echo "#define DLIB_MAJOR_VERSION " $MAJOR_NUM >> docs/cache/dlib/revision.h echo "#define DLIB_MAJOR_VERSION " $MAJOR_NUM >> docs/cache/dlib/revision.h
echo "#define DLIB_MINOR_VERSION " $MINOR_NUM >> docs/cache/dlib/revision.h echo "#define DLIB_MINOR_VERSION " $MINOR_NUM >> docs/cache/dlib/revision.h
echo "#define DLIB_PATCH_VERSION " $PATCH_NUM >> docs/cache/dlib/revision.h
echo "#endif" >> docs/cache/dlib/revision.h echo "#endif" >> docs/cache/dlib/revision.h
......
#!/bin/bash #!/bin/bash
. bash_helper_functions
# if the first argument to this script is the word major then the # If the first argument to this script is the word major then the
# major version number is updated and the minor is set back to 0 # major version number is updated and the minor is set back to 0.
report_failure () report_failure ()
{ {
...@@ -15,44 +16,41 @@ report_failure () ...@@ -15,44 +16,41 @@ report_failure ()
REVNUM_FILE=.logger_revnum REVNUM_FILE=.logger_revnum
COUNTER_FILE=.current_release_number CHANGESET_ID=`hg id -i | sed -e 's/\+//'`
MINOR_COUTNER_FILE=.current_minor_release_number
rm -rf release || report_failure
mkdir release || report_failure
RELEASE=`cat $COUNTER_FILE | awk '{ print $1 + 1}'`
if [ "$1" = "major" ] if [ "$1" = "major" ]
then then
MAJOR_NUM=`cat $COUNTER_FILE | awk '{print $1 + 1}'` MAJOR_NUM=`echo $MAJOR_NUM+1|bc`
MINOR_NUM=0 MINOR_NUM=0
echo $MAJOR_NUM > $COUNTER_FILE
echo $MINOR_NUM > $MINOR_COUTNER_FILE
else else
MAJOR_NUM=`cat $COUNTER_FILE` MINOR_NUM=`echo $MINOR_NUM+1|bc`
MINOR_NUM=`cat $MINOR_COUTNER_FILE | awk '{print $1 + 1}'`
echo $MINOR_NUM > $MINOR_COUTNER_FILE
fi; fi;
set_dlib_version MAJOR $MAJOR_NUM
./makedocs makerel || exit 1 set_dlib_version MINOR $MINOR_NUM
set_dlib_version PATCH 0
rm -rf release || report_failure
mkdir release || report_failure
RELEASE=${MAJOR_NUM}.${MINOR_NUM} RELEASE=${MAJOR_NUM}.${MINOR_NUM}
# Commit changes to the version numbers so that the makedocs script will use them.
echo Create Mercurial tags and commit release
hg tag v$RELEASE || report_failure
hg commit -m "Created release v$RELEASE" || report_failure
./makedocs makerel || exit 1
CHANGESET_ID=`hg id -i | sed -e 's/\+//'`
echo $CHANGESET_ID > $REVNUM_FILE echo $CHANGESET_ID > $REVNUM_FILE
set_dlib_version PATCH 99
hg commit -m "Record last changeset and set PATCH version to 99"
cd release || report_failure cd release || report_failure
RELDIR=`echo dlib-$RELEASE` RELDIR=`echo dlib-$RELEASE`
mkdir $RELDIR mkdir $RELDIR
cd $RELDIR || report_failure cd $RELDIR || report_failure
cp -r ../../docs/cache/dlib . || report_failure cp -r ../../docs/cache/* . || report_failure
cp -r ../../docs/cache/examples . || report_failure
cp -r ../../docs/cache/python_examples . || report_failure
cp -r ../../docs/cache/tools . || report_failure
echo Version: $RELEASE >> dlib/README.txt echo Version: $RELEASE >> dlib/README.txt
echo "Date: `date`" >> dlib/README.txt echo "Date: `date`" >> dlib/README.txt
...@@ -89,9 +87,5 @@ mv $SOURCE_TAR.bz2 v$RELEASE ...@@ -89,9 +87,5 @@ mv $SOURCE_TAR.bz2 v$RELEASE
mv $SOURCE_ZIP v$RELEASE mv $SOURCE_ZIP v$RELEASE
echo Create Mercurial tags and commit release
cd ..
hg tag v$RELEASE || report_failure
hg commit -m "Created release v$RELEASE"
...@@ -43,6 +43,7 @@ from subprocess import Popen, PIPE, STDOUT ...@@ -43,6 +43,7 @@ from subprocess import Popen, PIPE, STDOUT
import signal import signal
from threading import Thread from threading import Thread
import time import time
import re
# change directory to this module path # change directory to this module path
...@@ -340,9 +341,10 @@ def readme(fname): ...@@ -340,9 +341,10 @@ def readme(fname):
def read_version(): def read_version():
"""Read version information """Read version information
""" """
major = readme('./docs/.current_release_number').strip() major = re.findall("set\(CPACK_PACKAGE_VERSION_MAJOR.*\"(.*)\"", open('dlib/CMakeLists.txt').read())[0]
minor = readme('./docs/.current_minor_release_number').strip() minor = re.findall("set\(CPACK_PACKAGE_VERSION_MINOR.*\"(.*)\"", open('dlib/CMakeLists.txt').read())[0]
return major + '.' + minor patch = re.findall("set\(CPACK_PACKAGE_VERSION_PATCH.*\"(.*)\"", open('dlib/CMakeLists.txt').read())[0]
return major + '.' + minor + '.' + patch
def rmtree(name): def rmtree(name):
...@@ -546,7 +548,7 @@ setup( ...@@ -546,7 +548,7 @@ setup(
version=read_version(), version=read_version(),
keywords=['dlib', 'Computer Vision', 'Machine Learning'], keywords=['dlib', 'Computer Vision', 'Machine Learning'],
description='A toolkit for making real world machine learning and data analysis applications', description='A toolkit for making real world machine learning and data analysis applications',
long_description=readme('./README.txt'), long_description=readme('dlib/README.txt'),
author='Davis King', author='Davis King',
author_email='davis@dlib.net', author_email='davis@dlib.net',
url='https://github.com/davisking/dlib', url='https://github.com/davisking/dlib',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment