annotate scripts/makerelease.sh @ 4870:56af01cd5a5c

Eliminate a double free (bug #30)
author John Lindgren <john.lindgren@tds.net>
date Sat, 25 Apr 2009 21:32:54 -0400
parents 05ed0e49cf47
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3482
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 #!/bin/sh
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 # mkrelease.sh: Creates a release suitable for distfiles.atheme.org.
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 #
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 # Copyright (c) 2007 atheme.org
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 #
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 # Permission to use, copy, modify, and/or distribute this software for
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 # any purpose with or without fee is hereby granted, provided that the above
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 # copyright notice and this permission notice appear in all copies.
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 #
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 #
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 if [ "x$1" = "x" ]; then
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 echo "usage: $0 releasename [--automatic]"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 exit
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 else
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 RELEASENAME="$1"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 if [ "x$2" = "x--automatic" ]; then
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 AUTOMATIC="yes"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 TIP=`hg tip --template "#rev#:#node|short#"`
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 WRKDIR=`pwd`
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 if [ -d $RELEASENAME ]; then
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 echo "Deleting previous release named $RELEASENAME."
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 rm -rf $WRKDIR/$RELEASENAME/
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 echo "Making release named $RELEASENAME (tip $TIP)"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 echo
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 echo "Building root: $RELEASENAME/"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 hg archive $RELEASENAME
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 cd $RELEASENAME
3484
7b5353d0ae50 Run autogen.sh
William Pitcock <nenolod@atheme.org>
parents: 3482
diff changeset
48 sh autogen.sh
3482
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 rm -rf autogen.sh autom4te.cache
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 # Run application specific instructions here.
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52 if [ -x "$WRKDIR/application.sh" ]; then
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 source $WRKDIR/application.sh
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 cd ..
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 echo "Building $RELEASENAME.tgz from $RELEASENAME/"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 tar zcf $RELEASENAME.tgz $RELEASENAME/
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 echo "Building $RELEASENAME.tbz2 from $RELEASENAME/"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 tar jcf $RELEASENAME.tbz2 $RELEASENAME/
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 PUBLISH="yes"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 ok="0"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 if [ "x$AUTOMATIC" != "xyes" ]; then
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 echo
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69 echo "Would you like to publish these releases now?"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70 while [ $ok -eq 0 ]; do
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 echo -n "[$PUBLISH] "
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 read INPUT
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74 case $INPUT in
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 [Yy]*)
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 PUBLISH="yes"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77 ok=1
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78 ;;
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 [Nn]*)
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 PUBLISH="no"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 ok=1
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 ;;
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 esac
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 done
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 if [ "x$PUBLISH" = "xyes" ]; then
3767
William Pitcock <nenolod@atheme.org>
parents: 3766
diff changeset
88 scp $RELEASENAME.tgz distfiles-master.atheme.org:/srv/distfiles
William Pitcock <nenolod@atheme.org>
parents: 3766
diff changeset
89 scp $RELEASENAME.tbz2 distfiles-master.atheme.org:/srv/distfiles
3482
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 echo
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92 echo "The releases have been published, and will be available to the entire"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 echo "distribution network within 15 minutes."
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 fi
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96 echo
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 echo "Done. If you have any bugs to report, report them against"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 echo "the distfiles.atheme.org component at http://bugzilla.atheme.org"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99 echo "Thanks!"
54d6336163fe Add release building scripts.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 echo