annotate scripts/makerelease.sh @ 3176:dca77b467ea2

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