# HG changeset patch # User Dongsheng Song # Date 1237194830 -28800 # Node ID 1de6cbdcc619b0d6527e8b8fdc3cecdb0801ef19 # Parent 17fe2fe3837376f5f6348edd5dbebff9345fbd55 Add some sanity checks diff -r 17fe2fe38373 -r 1de6cbdcc619 contrib/hg-package --- a/contrib/hg-package Mon Mar 16 16:52:31 2009 +0800 +++ b/contrib/hg-package Mon Mar 16 17:13:50 2009 +0800 @@ -4,7 +4,12 @@ rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'` for l in en zh; do - (cd ${build_dir}/${l}; + ( + if [ ! -d "${build_dir}/${l}" ] ; then + continue + fi + + cd ${build_dir}/${l}; f='html' if [ -f "${f}/index.html" ] ; then @@ -35,19 +40,26 @@ if [ "${upload_pass}x" != "x" ]; then ( cd ${build_dir} - curl -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py + curl -s -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py + if [[ "0" != $? ]]; then + exit 1 + fi for l in en zh; do - python googlecode_upload.py -u "dongsheng.song" -w "$1" \ - -p "i18n-zh" -l "Type-Docs,hgbook" \ - -s "Distributed revision control with Mercurial - ${l} - pdf" \ - hgbook-${l}-${rev_id}.pdf.gz + if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then + python googlecode_upload.py -u "dongsheng.song" -w "$1" \ + -p "i18n-zh" -l "Type-Docs,hgbook" \ + -s "Distributed revision control with Mercurial - ${l} - pdf" \ + hgbook-${l}-${rev_id}.pdf.gz + fi for f in html html-single; do - python googlecode_upload.py -u "dongsheng.song" -w "$1" \ - -p "i18n-zh" -l "Type-Docs,hgbook" \ - -s "Distributed revision control with Mercurial - ${l} - ${f}" \ - hgbook-${l}-${f}-${rev_id}.tar.gz + if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then + python googlecode_upload.py -u "dongsheng.song" -w "$1" \ + -p "i18n-zh" -l "Type-Docs,hgbook" \ + -s "Distributed revision control with Mercurial - ${l} - ${f}" \ + hgbook-${l}-${f}-${rev_id}.tar.gz + fi done done )