Commit 6b213d28 by Christian Kern

Merge branch 'embb9_tarball_script' into development

parents db74f3e9 ffa2f18a
...@@ -40,11 +40,6 @@ function (CreateDoxygenDocumentationTarget) ...@@ -40,11 +40,6 @@ function (CreateDoxygenDocumentationTarget)
if (TARGET doxygen) if (TARGET doxygen)
# Do nothing, since the repeated adding causes an error # Do nothing, since the repeated adding causes an error
else() else()
set(DOXYGEN_TEMPLATE_FILES
"doc/reference/header.html")
file(COPY ${DOXYGEN_TEMPLATE_FILES} DESTINATION ${PROJECT_BINARY_DIR})
add_custom_target ( add_custom_target (
doxygen doxygen
#ALL #ALL
......
...@@ -125,7 +125,7 @@ SHOW_USED_FILES = NO ...@@ -125,7 +125,7 @@ SHOW_USED_FILES = NO
SHOW_FILES = YES SHOW_FILES = YES
SHOW_NAMESPACES = YES SHOW_NAMESPACES = YES
FILE_VERSION_FILTER = FILE_VERSION_FILTER =
LAYOUT_FILE = @CMAKE_SOURCE_DIR@/doc/reference/DoxygenLayout.xml LAYOUT_FILE = "@CMAKE_SOURCE_DIR@/doc/reference/DoxygenLayout.xml"
CITE_BIB_FILES = CITE_BIB_FILES =
# ============================================================================== # ==============================================================================
...@@ -167,7 +167,7 @@ EXCLUDE_SYMBOLS = *test* \ ...@@ -167,7 +167,7 @@ EXCLUDE_SYMBOLS = *test* \
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO EXAMPLE_RECURSIVE = NO
IMAGE_PATH = @CMAKE_SOURCE_DIR@/doc IMAGE_PATH = "@CMAKE_SOURCE_DIR@/doc"
INPUT_FILTER = INPUT_FILTER =
FILTER_PATTERNS = FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO FILTER_SOURCE_FILES = NO
...@@ -205,10 +205,9 @@ IGNORE_PREFIX = cm ...@@ -205,10 +205,9 @@ IGNORE_PREFIX = cm
GENERATE_HTML = YES GENERATE_HTML = YES
HTML_OUTPUT = html HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html HTML_FILE_EXTENSION = .html
HTML_HEADER = header.html
HTML_FOOTER = HTML_FOOTER =
HTML_STYLESHEET = HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doc/reference/DoxygenHTMLStyle.css HTML_EXTRA_STYLESHEET = "@CMAKE_SOURCE_DIR@/doc/reference/DoxygenHTMLStyle.css"
HTML_EXTRA_FILES = HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_SAT = 100
......
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
<script type="text/javascript">
var is_modules_page = location.pathname.match(".*modules.html");
$(document).ready(function() { if (toggleLevel && is_modules_page) toggleLevel(2); });
</script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->
create_tarball.sh diff
...@@ -23,47 +23,74 @@ ...@@ -23,47 +23,74 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
#function for printing usage
usage() { usage() {
echo "Create a tarball of the project. Specify the project root with"; echo "Create a tarball of the project. Specify the project root with the";
echo "-d parameter."; echo "-d parameter. Optionally, specify the -v switch to get verbose output";
echo ""; echo "and/or the -q switch, for non-interactive (without user inputs)";
echo "Version number and project name is automatically derived from CMakeLists.txt in the project root."; echo "processing.";
echo "Tarball that will be created: [PROJECT_NAME]_[VERSION_NUMBER].tar.gz"; echo "";
echo "Example call (from the scripts directory as working directory):"; echo "Version number and project name is automatically derived from CMakeLists.txt";
echo "$0 -d ../"; echo "in the project's root.";
echo ""; echo "Tarball name: [PROJECT_NAME]_[VERSION_NUMBER].tar.gz";
echo "Usage: $0 [-d <root project dir>]" 1>&2; exit 1; echo "Example call (from the scripts directory as working directory):";
echo "$0 -d ../";
echo "";
echo "Usage: $0 [-d <root project dir>] [-v] [-q]" 1>&2; exit 1;
} }
#check if all dependencies are fulfilled
for DEPENDENCY in rsync pdflatex bibtex cp tar mktemp cd grep cmake find file echo python realpath sed
do
command -v $DEPENDENCY >/dev/null 2>&1 || { echo >&2 "This script requires $DEPENDENCY but it's not installed. Exiting."; exit 1; }
done
while getopts ":d:" o; do #get command line options
case "${o}" in while getopts "d:vq" o; do
case "${o}" in
d) d)
d=${OPTARG} d=${OPTARG}
;; ;;
v)
v=1
;;
q)
q=1
;;
*) *)
usage usage
;; ;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
#used as wrapper, for switching between verbose and normal mode
redirect_cmd() {
if [ -z "${v}" ]; then
"$@" > /dev/null 2>&1
else
"$@"
fi
}
#user has to specify directory
if [ -z "${d}" ]; then if [ -z "${d}" ]; then
usage usage
fi fi
#the specified directory has to exist
if [ ! -d "$d" ]; then if [ ! -d "$d" ]; then
echo "Error, directory $d does not exist or is not a directory!" echo "--> ! Error, directory $d does not exist or is not a directory!"
echo "" echo ""
usage usage
fi fi
CMAKEFILE="$d/CMakeLists.txt" CMAKEFILE="$d/CMakeLists.txt"
if [ ! -f "$CMAKEFILE" ]; then if [ ! -f "$CMAKEFILE" ]; then
echo "Error, could no locate CMakeLists.txt" echo "--> ! Error, could no locate CMakeLists.txt"
echo "" echo ""
usage usage
fi fi
#derive version number from cmake script #derive version number from cmake script
...@@ -71,109 +98,266 @@ VERSION_MAJOR=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_MAJOR | sed "s/^[^0-9]*\( ...@@ -71,109 +98,266 @@ VERSION_MAJOR=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_MAJOR | sed "s/^[^0-9]*\(
VERSION_MINOR=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_MINOR | sed "s/^[^0-9]*\([0-9]\+\)[^0-9]*$/\1/g"` VERSION_MINOR=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_MINOR | sed "s/^[^0-9]*\([0-9]\+\)[^0-9]*$/\1/g"`
VERSION_PATCH=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_PATCH | sed "s/^[^0-9]*\([0-9]\+\)[^0-9]*$/\1/g"` VERSION_PATCH=`cat $CMAKEFILE | grep EMBB_BASE_VERSION_PATCH | sed "s/^[^0-9]*\([0-9]\+\)[^0-9]*$/\1/g"`
VERSION_NUMBER="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" VERSION_NUMBER="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
#generate tarball name
PROJECT_NAME=`cat $CMAKEFILE | grep project.*\(.*\) | sed "s/^[^(]*(\([^)]*\)).*$/\1/g" | tr '[:upper:]' '[:lower:]'` PROJECT_NAME=`cat $CMAKEFILE | grep project.*\(.*\) | sed "s/^[^(]*(\([^)]*\)).*$/\1/g" | tr '[:upper:]' '[:lower:]'`
n="${PROJECT_NAME}-${VERSION_NUMBER}" n="${PROJECT_NAME}-${VERSION_NUMBER}"
TARBALL_NAME="${n}.tar.gz" TARBALL_NAME="${n}.tar.gz"
#verify that tarball doesn't allow forbidden characters
if ! [[ $TARBALL_NAME =~ ^[a-zA-Z0-9|\.|\_|-]+$ ]]; then if ! [[ $TARBALL_NAME =~ ^[a-zA-Z0-9|\.|\_|-]+$ ]]; then
echo "Want to create tarball with name $TARBALL_NAME." >&2 echo "--> Want to create tarball with name $TARBALL_NAME." >&2
echo 'Filename not valid, only a-z, A-Z, .,- and _ characters are allowed' >&2 # write to stderr echo '--> ! Filename not valid, only a-z, A-Z, .,- and _ characters are allowed' >&2 # write to stderr
exit 1 exit 1
fi fi
echo "Do you wish to create a tarball with the name $TARBALL_NAME in the current directory?" if [ -z "${q}" ]; then
select yn in "Yes" "No"; do #in interactive mode, ask the user if the tarball shall be created with this filename
case $yn in echo "--> Do you wish to create a tarball with the name $TARBALL_NAME in the current directory?"
Yes ) break;; select yn in "Yes" "No"; do
No ) echo Leaving tarball creation; exit;; case $yn in
esac Yes ) break;;
done No ) echo Leaving tarball creation; exit 1;;
esac
done
else
echo "--> Tarball with name $TARBALL_NAME will be created."
fi
#check if file with the tarball_name already exists. In interactive mode, ask the user if this file shall be deleted. Otherwise just exit.
if [ -f "$TARBALL_NAME" ]; then if [ -f "$TARBALL_NAME" ]; then
echo "File $TARBALL_NAME exists. Delete file?" if [ -z "${q}" ]; then
select yn in "Yes" "No"; do echo "--> File $TARBALL_NAME exists. Delete file?"
case $yn in select yn in "Yes" "No"; do
Yes ) break;; case $yn in
No ) echo Leaving tarball creation; exit;; Yes ) break;;
esac No ) echo Leaving tarball creation; exit 1;;
done esac
rm $TARBALL_NAME done
if [ -f "$TARBALL_NAME" ]; then rm $TARBALL_NAME
echo "Could not delete $TARBALL_NAME" if [ -f "$TARBALL_NAME" ]; then
exit echo "Could not delete $TARBALL_NAME"
fi exit 1
fi
else
echo "--> ! File $TARBALL_NAME exists. Delete first. Exiting."
exit 1;
fi
fi fi
#temporary directory for doxygen
MYTMPDIR_DOXY_BUILD=`mktemp -d`
#temporary directory for building other things (e.g. Latex or integrating snippets into examples)
MYTMPDIR_BUILD=`mktemp -d`
#temporary target directory, from this the tarball will be created
MYTMPDIR=`mktemp -d`
echo "--> Creating temporary directories $MYTMPDIR $MYTMPDIR_BUILD $MYTMPDIR_DOXY_BUILD"
#install traps, deleting the temporary directories when exiting
function finish {
rm -rf $MYTMPDIR
rm -rf $MYTMPDIR_DOXY_BUILD
rm -rf $MYTMPDIR_BUILD
}
trap finish EXIT
PROJECT_DIR_FULLPATH=`realpath ${d}`
echo "--> Generating Doxygen"
REMEMBER_CUR_DIR=$(pwd)
cd "$MYTMPDIR_DOXY_BUILD"
echo "---> Initialize CMake"
redirect_cmd cmake "$PROJECT_DIR_FULLPATH"
echo "---> Call CMake with target Doxygen"
redirect_cmd cmake --build . --target doxygen
REFMAN_TEXFILE="$MYTMPDIR_DOXY_BUILD/latex/refman.tex"
DO_CREATE_LATEXDOC=true
if [ ! -f "$REFMAN_TEXFILE" ]; then
echo "---> ! Could not find doxygen tex source $REFMAN_TEXFILE. Leaving tarball creation."
exit 1;
fi
#to resolve all references, pdf and bibtex have to be run more than once. With 4 runs, we should get everything right.
PDFRUNS=4
echo "---> Build Doxygen PDF reference"
if [ "$DO_CREATE_LATEXDOC" = true ] ; then
cd "$MYTMPDIR_DOXY_BUILD/latex"
for ((i=1; i<=$PDFRUNS; i++)); do
echo "----> LaTeX Run ($i/$PDFRUNS)"
redirect_cmd pdflatex refman.tex
redirect_cmd bibtex refman
done
fi
MYTMPDIR=`mktemp -d`
echo "Using temporary directory $MYTMPDIR" cd "$REMEMBER_CUR_DIR"
trap "rm -rf $MYTMPDIR" EXIT
echo "--> Calling rsync to temporary folder 1/2 ($MYTMPDIR)"
echo "Calling rsync to temporary folder"
#this is the rsync, to the folder from which the tarball will be created later. Exclude everything, that should not be in the tarball. Also exclude things, that are generated somewhere else, like examples.
rsync \ redirect_cmd rsync \
--exclude ".git" \ --exclude ".git" \
--exclude ".gitignore" \ --exclude ".gitignore" \
--exclude "build*/" \ --exclude ".gitattributes" \
--exclude "scripts/*.tar.gz" \ --exclude "build*/" \
--exclude "scripts/cpplint.py" \ --exclude "scripts/*.tar.gz" \
--exclude "scripts/create_tarball.sh" \ --exclude "scripts/cpplint.py" \
--exclude "scripts/insert_license.sh" \ --exclude "scripts/create_tarball.sh" \
--exclude "scripts/license.*" \ --exclude "scripts/insert_license.sh" \
--exclude "scripts/license_*" \ --exclude "scripts/license.*" \
--exclude "scripts/remove_license.sh" \ --exclude "scripts/license_*" \
--exclude "mtapi/MTAPI.mm" \ --exclude "scripts/remove_license.sh" \
--exclude ".cproject" \ --exclude "mtapi/MTAPI.mm" \
--exclude ".gitattributes" \ --exclude ".cproject" \
--exclude ".project" \ --exclude ".gitattributes" \
--exclude "*.blg" \ --exclude ".project" \
--exclude "*.fls" \ --exclude "*.blg" \
--exclude "*.bbl" \ --exclude "*.fls" \
--exclude "*.fdb_latexmk" \ --exclude "*.bbl" \
--exclude "*.log" \ --exclude "*.fdb_latexmk" \
--exclude "*.out" \ --exclude "*.log" \
--exclude "*.toc" \ --exclude "*.out" \
--exclude "*.aux" \ --exclude "*.toc" \
--exclude "doc/tutorial/sty" \ --exclude "*.aux" \
--exclude "doc/tutorial/pics" \ --exclude "doc/tutorial/sty" \
--exclude "doc/tutorial/content" \ --exclude "doc/tutorial/pics" \
--exclude "doc/tutorial/*.tex" \ --exclude "doc/tutorial/content" \
--exclude "doc/tutorial/*.bib" \ --exclude "doc/tutorial/*.tex" \
--exclude "doc/reference/*.xml" \ --exclude "doc/tutorial/*.bib" \
--exclude "doc/reference/*.dox" \ --exclude "doc/reference/*.xml" \
--exclude "doc/reference/*.in" \ --exclude "doc/reference/*.dox" \
--exclude "doc/reference/header.html" \ --exclude "doc/reference/*.in" \
--exclude "doc/reference/*.css" \ --exclude "doc/reference/header.html" \
--exclude "doc/examples/insert_snippets.py" \ --exclude "doc/reference/*.css" \
--exclude ".travis.yml" \ --exclude "doc/examples" \
--archive --recursive ${d} $MYTMPDIR/${n} --exclude "doc/examples/insert_snippets.py" \
--exclude ".travis.yml" \
echo "Replace version number in README" --archive --recursive ${d} $MYTMPDIR/${n}
echo "--> Replace version number in README"
README_FILE="$MYTMPDIR/${n}/README.md" README_FILE="$MYTMPDIR/${n}/README.md"
#replace version number in readme
if [ -f $README_FILE ]; then if [ -f $README_FILE ]; then
sed -i "s/\[VERSION_NUMBER_TEMPLATE\]/$VERSION_NUMBER/g" $README_FILE sed -i "s/\[VERSION_NUMBER_TEMPLATE\]/$VERSION_NUMBER/g" $README_FILE
fi fi
echo "Checking line endings" echo "--> Calling rsync to temporary folder 2/2 ($MYTMPDIR_BUILD)"
#doing a rsync to another temporary folder, which will be used to build things, like e.g. the tutorial pdf.
redirect_cmd rsync \
--archive --recursive ${d} $MYTMPDIR_BUILD
echo "--> Generating Tutorial PDF"
TUTORIAL_TEX_DIR="$MYTMPDIR_BUILD/doc/tutorial"
REMEMBER_CUR_DIR=$(pwd)
TUTORIAL_PDF_SOURCE="$TUTORIAL_TEX_DIR/tutorial.pdf"
TUTORIAL_PDF_TARGET="$MYTMPDIR/${n}/doc/tutorial/tutorial.pdf"
if [ -f "$TUTORIAL_TEX_DIR/tutorial.tex" ]; then
cd "$TUTORIAL_TEX_DIR"
for ((i=1; i<=$PDFRUNS; i++)); do
echo "---> LaTeX Run ($i/$PDFRUNS)"
redirect_cmd pdflatex tutorial.tex
redirect_cmd bibtex tutorial
done
if [ -f "$TUTORIAL_PDF_SOURCE" ]; then
cp $TUTORIAL_PDF_SOURCE $TUTORIAL_PDF_TARGET
fi
fi
cd "$REMEMBER_CUR_DIR"
REFMAN_TARGET="$MYTMPDIR/${n}/doc/reference/reference.pdf"
REFMAN_SOURCE="$MYTMPDIR_DOXY_BUILD/latex/refman.pdf"
echo "--> Integrating Example Snippets"
REMEMBER_CUR_DIR=$(pwd)
EXAMPLES_DIR="$MYTMPDIR_BUILD/doc/examples"
INTEGRATE_SNIPPETS_SCRIPT="insert_snippets.py"
EXAMPLES_TARGET_DIR="$MYTMPDIR/${n}/doc/"
if [ -f $EXAMPLES_DIR/$INTEGRATE_SNIPPETS_SCRIPT ]; then
cd "$EXAMPLES_DIR"
echo "---> Calling integrate script"
redirect_cmd python insert_snippets.py
if [ -d $EXAMPLES_TARGET_DIR ]; then
echo "---> Copy integrated examples back"
#The examples have been integrated. Copy the integrated source files.
redirect_cmd rsync --archive --recursive $EXAMPLES_DIR $EXAMPLES_TARGET_DIR \
--exclude=*snippet.h \
--exclude=*fragmented.h \
--exclude=*snippet.cc \
--exclude=*fragmented.cc \
--exclude=*$INTEGRATE_SNIPPETS_SCRIPT
fi
fi
cd "$REMEMBER_CUR_DIR"
echo "--> Copy reference manual"
if [ -f $REFMAN_SOURCE ]; then
cp $REFMAN_SOURCE $REFMAN_TARGET
else
echo "--> ! Could not find doxygen pdf document $REFMAN_SOURCE. Exiting"
exit 1;
fi
if [ -d $MYTMPDIR_DOXY_BUILD/html ]; then
redirect_cmd rsync --archive --recursive $MYTMPDIR_DOXY_BUILD/html/ $MYTMPDIR/${n}/doc/reference/doxygen_html_generated
else
echo "Doxygen HTML was not generated. Tarball will not contain HTML reference documentation. Exiting."
exit 1;
fi
echo "--> Checking line endings"
#check for files, that have windows file endings. Those are forbidden.
WINLINES=`find $MYTMPDIR/${n} -not -type d -exec file "{}" ";" | grep CRLF` WINLINES=`find $MYTMPDIR/${n} -not -type d -exec file "{}" ";" | grep CRLF`
if [ -n "$WINLINES" ]; then if [ -n "$WINLINES" ]; then
echo "Detected Dos line endings in following files:" echo "Detected Dos line endings in following files:"
echo "$WINLINES" echo "$WINLINES"
echo "Warning: The project guidelines forbid Dos line endings. Continue creating tarball?" echo "Error: The project guidelines forbid Dos line endings. Exiting."
select yn in "Yes" "No"; do exit 1;
case $yn in fi
Yes ) break;;
No ) echo Leaving tarball creation; exit;; #sanity check... verify, that expected targets are there, otherwise abort...
esac if ! [ -f $MYTMPDIR/${n}/doc/examples/main.cc ]; then
done echo "--> ! Examples missing. Exiting."
fi exit 1;
fi
echo "Calling tar"
if ! [ -f $MYTMPDIR/${n}/doc/tutorial/tutorial.pdf ]; then
echo "--> ! Tutorial PDF missing. Exiting."
exit 1;
fi
if ! [ -f $MYTMPDIR/${n}/doc/reference/reference.pdf ]; then
echo "--> ! Reference PDF documentation missing. Exiting."
exit 1;
fi
if ! [ -f $MYTMPDIR/${n}/doc/reference/doxygen_html_generated/index.html ]; then
echo "--> ! Reference HTML documentation missing. Exiting."
exit 1;
fi
#finally, build the tarball.
echo "--> Calling tar"
tar -czf $TARBALL_NAME -C $MYTMPDIR ${n} tar -czf $TARBALL_NAME -C $MYTMPDIR ${n}
echo "Done. Created $TARBALL_NAME." echo "--> Done. Created $TARBALL_NAME."
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 sign in to comment