Mercurial > hgbook
annotate contrib/hg-package @ 799:7107b79427a3
Propagate 4e23c220d1b0
Update chapter 2
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 18 Jun 2009 19:11:36 +0900 |
parents | 605af0a90e3e |
children |
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 |
762 | 30 |
31 if [ -f "epub/hgbook.epub" ] ; then | |
32 cp epub/hgbook.epub ../hgbook-${l}-${rev_id}.epub | |
33 fi | |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
34 ) |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
35 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
36 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
37 upload_pass=$1 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
38 upload_user=$2 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
39 |
762 | 40 # echo "upload_pass: ${upload_pass}" |
41 # echo "upload_user: ${upload_user}" | |
42 | |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
43 if [ "${upload_user}x" == "x" ]; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
44 upload_user="dongsheng.song" |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
45 fi |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
46 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
47 if [ "${upload_pass}x" != "x" ]; then |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
48 ( |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
49 cd ${build_dir} |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
50 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
|
51 if [[ "0" != $? ]]; then |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
52 exit 1 |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
53 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
54 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
55 for l in en zh; do |
762 | 56 if [ -f "hgbook-${l}-${rev_id}.epub" ] ; then |
57 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \ | |
58 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial,ebook" \ | |
59 -s "Distributed revision control with Mercurial - ${l} - ePub" \ | |
60 hgbook-${l}-${rev_id}.epub | |
61 fi | |
62 | |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
63 if [ -f "hgbook-${l}-${rev_id}.pdf.gz" ] ; then |
762 | 64 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \ |
65 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial" \ | |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
66 -s "Distributed revision control with Mercurial - ${l} - pdf" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
67 hgbook-${l}-${rev_id}.pdf.gz |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
68 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
69 |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
70 for f in html html-single; do |
762 | 71 if [ -f "hgbook-${l}-${f}-${rev_id}.tar.gz" ] ; then |
72 python googlecode_upload.py --user="${upload_user}" --password="${upload_pass}" \ | |
73 -p "i18n-zh" -l "Type-Docs,book,hgbook,hg,mercurial" \ | |
736
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
74 -s "Distributed revision control with Mercurial - ${l} - ${f}" \ |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
75 hgbook-${l}-${f}-${rev_id}.tar.gz |
1de6cbdcc619
Add some sanity checks
Dongsheng Song <dongsheng.song@gmail.com>
parents:
733
diff
changeset
|
76 fi |
733
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
77 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
78 done |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
79 ) |
d1a6ed326f87
Add package and upload script
Dongsheng Song <dongsheng.song@gmail.com>
parents:
diff
changeset
|
80 fi |