Mercurial > hgbook
annotate contrib/hg-package @ 746:d0160b0b1a9e
Merge with http://hg.serpentine.com/mercurial/book
author | Dongsheng Song <dongsheng.song@gmail.com> |
---|---|
date | Wed, 18 Mar 2009 20:32:37 +0800 |
parents | 1de6cbdcc619 |
children | 605af0a90e3e |
rev | line source |
---|---|
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
2 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
3 build_dir=`dirname "$0"`/../build |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
4 rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'` |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
5 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
6 for l in en zh; do |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
7 ( |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
8 if [ ! -d "${build_dir}/${l}" ] ; then |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
9 continue |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
10 fi |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
11 |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
12 cd ${build_dir}/${l}; |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
13 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
14 f='html' |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
15 if [ -f "${f}/index.html" ] ; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
16 d=hgbook-${l}-${f} |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
17 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d} |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
18 fi |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
19 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
20 f='html-single' |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
21 if [ -f "${f}/hgbook.html" ] ; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
22 d=hgbook-${l}-${f} |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
23 rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d} |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
24 fi |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
25 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
26 if [ -f "pdf/hgbook.pdf" ] ; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
27 cp pdf/hgbook.pdf ../hgbook-${l}-${rev_id}.pdf |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
28 gzip -f9 ../hgbook-${l}-${rev_id}.pdf |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
29 fi |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
30 ) |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
31 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
32 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
33 upload_pass=$1 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
34 upload_user=$2 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
35 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
36 if [ "${upload_user}x" == "x" ]; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
37 upload_user="dongsheng.song" |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
38 fi |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
39 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
40 if [ "${upload_pass}x" != "x" ]; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
41 ( |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
42 cd ${build_dir} |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
43 curl -s -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
44 if [[ "0" != $? ]]; then |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
45 exit 1 |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
46 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
47 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
48 for l in en zh; do |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
49 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
50 python googlecode_upload.py -u "dongsheng.song" -w "$1" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
51 -p "i18n-zh" -l "Type-Docs,hgbook" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
52 -s "Distributed revision control with Mercurial - ${l} - pdf" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
53 hgbook-${l}-${rev_id}.pdf.gz |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
54 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
55 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
56 for f in html html-single; do |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
57 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
58 python googlecode_upload.py -u "dongsheng.song" -w "$1" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
59 -p "i18n-zh" -l "Type-Docs,hgbook" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
60 -s "Distributed revision control with Mercurial - ${l} - ${f}" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
61 hgbook-${l}-${f}-${rev_id}.tar.gz |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
62 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
63 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
64 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
65 ) |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
66 fi |