openerp-doc team mailing list archive
-
openerp-doc team
-
Mailing list archive
-
Message #00866
lp:~openerp-doc/openerp-doc-utils/doc-build-scripts-improvements-xmo into lp:~openerp-doc/openerp-doc-utils/doc-build-scripts
Xavier (Open ERP) has proposed merging lp:~openerp-doc/openerp-doc-utils/doc-build-scripts-improvements-xmo into lp:~openerp-doc/openerp-doc-utils/doc-build-scripts.
Requested reviews:
OpenERP Documentation Experts (openerp-doc)
For more details, see:
https://code.launchpad.net/~openerp-doc/openerp-doc-utils/doc-build-scripts-improvements-xmo/+merge/143679
A few improvements to the main shell script:
* Improve/simplify useless uses of test and cat
* Use pushd correctly
* Use file constants for mail attachments
--
https://code.launchpad.net/~openerp-doc/openerp-doc-utils/doc-build-scripts-improvements-xmo/+merge/143679
Your team OpenERP Documentation Experts is requested to review the proposed merge of lp:~openerp-doc/openerp-doc-utils/doc-build-scripts-improvements-xmo into lp:~openerp-doc/openerp-doc-utils/doc-build-scripts.
=== modified file 'build_doc.sh'
--- build_doc.sh 2012-06-27 09:00:36 +0000
+++ build_doc.sh 2013-01-17 12:52:21 +0000
@@ -4,6 +4,7 @@
DOCSCRIPT=${DOCDIR}/doc-build-scripts
LOGFILE=${DOCDIR}/build_doc.log
ERRORFILE=${DOCDIR}/build_doc.err
+BZRLOG=${DOCDIR}/bzr-log-l10.txt
EMAIL_REPORT=openerp-doc@xxxxxxxxxxxxxxxxxxx
function email_error {
@@ -12,7 +13,7 @@
"doc.openerp.com: error when building $version doc." \
"$DOCSCRIPT/email_error_body.txt" \
-s "localhost" \
- -a "$DOCDIR/build_doc.err, $DOCDIR/build_doc.log, $DOCDIR/bzr-log-l10.txt" \
+ -a "$ERRORFILE, $LOGFILE, $BZRLOG" \
| msmtp -t --read-envelope-from
echo "Sending email with error and log files."
}
@@ -23,7 +24,7 @@
"doc.openerp.com: success when building $version doc." \
"$DOCSCRIPT/email_success_body.txt" \
-s "localhost" \
- -a "$DOCDIR/bzr-log-l10.txt" \
+ -a "$BZRLOG" \
| msmtp -t --read-envelope-from
echo "Sending email with success message and last bzr logs."
}
@@ -39,29 +40,27 @@
fi
nice -n 12 make html 2>>${ERRORFILE} 1>>${LOGFILE}
for i in `ls -1 i18n/`; do
- pushd .
- cd "i18n/$i"
+ pushd "i18n/$i"
make clean
echo "Building i18n/$i"
- echo "Building i18n/$i" 1>>${LOGFILE}
+ echo "Building i18n/$i" >> ${LOGFILE}
nice -n 12 make html 2>>${ERRORFILE} 1>>${LOGFILE}
mv "build/html" "../../build/html/$i"
popd
done
- cat ${ERRORFILE} | grep ERROR
- errno=$?
- if [ "$errno" == "0" ];then
- echo "Error: make html exitcode: $errno" >> ${ERRORFILE}
+
+ if grep -q ERROR ${ERRORFILE}; then
+ echo "Error: make html generated errors" >> ${ERRORFILE}
+ return 1
+ else
+ return 0
fi
- return $errno
}
# Assume to be in a doc-openerp-vX.X directory.
function bzrpull {
- bzr pull
- errno=$?
- if [ "$errno" != "0" ];then
- echo "Error: bzr pull exitcode: $errno" >> ${ERRORFILE}
+ if ! bzr pull; then
+ echo "Error: bzr pull error" >> ${ERRORFILE}
fi
}
@@ -69,18 +68,16 @@
function build_and_move {
version=$1
revno=`bzr revno`
- bzr log -l10 > $DOCDIR/bzr-log-l10.txt
+ bzr log -l10 > $BZRLOG
filename="${DOCDIR}/www-$version-rev$revno"
if [ "$version" != "trunk" -a -e $filename ]; then
echo "$filename already exists, do nothing."
else
echo "building doc to create $filename"
- makehtml $version
- ok=$?
- if [ "${ok}" != "0" ]; then
- echo "$filename OK" 1>>${LOGFILE}
+ if makehtml $version; then
+ echo "$filename OK" >> ${LOGFILE}
else
- echo "An error has occured when generating $filename" 1>> ${ERRORFILE}
+ echo "An error has occured when generating $filename" >> ${ERRORFILE}
fi
mv build/html $filename
Follow ups