changeset 736:1de6cbdcc619

Add some sanity checks
author Dongsheng Song <dongsheng.song@gmail.com>
date Mon, 16 Mar 2009 17:13:50 +0800
parents 17fe2fe38373
children 9038da8b2d22
files contrib/hg-package
diffstat 1 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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
   )