summaryrefslogtreecommitdiff
path: root/misc/make_release.sh
blob: b1c63aa720c3c58bcc844f5b8a767874dc07a498 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/sh
#
# make_release.sh - make and upload a new xine-lib release


this=misc/make_release.sh
tmpfile=/tmp/make_release.$$.tmp

# first of all: check directory structure
#########################################

case "$0" in 
   /*)
      location="$0"
      ;;
   *)
    location=`pwd`/"$0"
    ;;
esac
    
location=`echo "$location"|sed -e 's|//|/|g' -e 's|/./|/|g'`

if test -r "$location"; then
    topdir=`echo "$location"|sed -e 's|/'$this'$||'`
else
    echo 'Help! Unable to find myself.'
    echo 1
fi

cd "$topdir"

if test -r CVS/Root; then
    cvsroot=`cat CVS/Root`
    case "$cvsroot" in
      *cvs.xine.sf.net:/cvsroot/xine*) ;;
      *cvs.xine.sourceforge.net:/cvsroot/xine*) ;;
      *)
        echo "This doesn't look like a xine CVS checkout. aborting..."
	exit 1
	;;
    esac
else
    echo "This must be called from a CVS checkout."
    exit 1
fi

#if [ `basename $topdir` = xine-lib ]; then
#    echo "good, this seems to be a xine-lib CVS checkout."
#else
#    echo "This script is intended to be called from xine-lib CVS trees only."
#    exit 1
#fi

superdir=`dirname "$topdir"`
if test -d "$superdir/xine_www"; then
  echo "okay, found xine_www module. Let's check that..."
  www_dir="$superdir/xine_www"
  cd "$www_dir"
  if test -r CVS/Root && grep cvsroot/xine CVS/Root >/dev/null 2>&1; then
    echo "okay, looks like a xine_www CVS checkout."
  else
    echo "this doesn't seem to be a xine_www CVS checkout. Aborting."
    echo "please retry after checking out like this:"
    echo "cd $superdir; cvs -d cvs.xine.sf.net:/cvsroot/xine co xine_www"
    exit 1
  fi
else
  echo "Unable to find a xine_www checkout in $superdir"
  exit 1
fi


# utility function definitions
###############################
yesno() {
  echo "$* (y/n)?"
  read answer
  case "$answer" in
    y*)
	true;;
    n*)
	false;;
    *)
	echo "'pardon?? neither yes nor no? assuming no..."
 	false;;
  esac
}

cvs_up_check(){
cvs up -dP >$tmpfile 2>&1
merged="`grep ^M\  $tmpfile`"
patched="`grep ^P\  $tmpfile`"
conflict="`grep ^C\  $tmpfile`"
unknown="`grep -v ^M\  $tmpfile|grep -v ^\?\ |grep -v ^cvs\ server:|grep -v ^P\ |grep -v ^C\ `"

if test -n "$conflict"; then
  echo "The following files have had local changes (conflicts) that could"
  echo "NOT be merged by CVS:"
  echo "$conflict"
  echo "This means your local tree is in an inconsistent state."
  echo "Releasing this doesn't make sense, please try again after resolving"
  echo "the conflicts! Stopping here."  
  exit 1
fi

if test -n "$patched"; then
  echo "The following files have been updated by CVS:"
  echo "$patched"
  echo "This means your local tree hasn't been up to date before this update."
  echo -n "Do you want to continue anyway"
  if yesno; then
    echo "Okay, I will continue on your request."
  else
    echo "Okay, stopping here."
    exit 1
  fi
fi

if test -n "$merged"; then
  echo "The following files have had local changes that could be merged by CVS:"
  echo "$merged"
  echo "This probably means your local tree hasn't been commited to CVS yet."
  echo -n "Do you want to continue anyway"
  if yesno; then
    echo "Okay, I will continue on your request."
  else
    echo "Okay, stopping here."
    exit 1
  fi
fi

if test -n "$unknown"; then
  echo "Ooops, CVS said something that I didn't understand:"
  echo "$unknown"
  echo "I have no clue what this means, so you have to decide:"
  echo -n "Do you want to continue anyway"
  if yesno; then
    echo "Okay, I will continue on your request."
  else
    echo "Okay, stopping here."
    exit 1
  fi
fi
}


# the actual work starts here
##############################

echo "updating xine_www from CVS..."
cd "$www_dir"
cvs_up_check
echo "fetching download page from xine's web site..."
rm -f $tmpfile
if wget -nv -O $tmpfile http://xine.sf.net/download.html; then
  echo "diffing against CVS checkout:"
  if diff download.html $tmpfile; then
    echo "Okay, they are the same."
  else
    echo "The CVS version is different from that on the web server!"
    echo "Please fix that and try again!"
    exit 1
  fi
else
  echo "Unable to fetch the download file from http://xine.sf.net; aborting."
  exit 1
fi

lastver=`grep 'href="files/xine-lib-' download.html \
          |sed -e 's|^.*href="files/xine-lib-||' -e 's|\.tar\.gz.*$||g' \
          |head -1`

echo "The last release has been $lastver."
old_major=`echo $lastver|awk -F. '{print $1}'`
old_minor=`echo $lastver|awk -F. '{print $2}'`
old_sub=`echo $lastver|awk -F. '{print $3}'`

cd "$topdir"
echo "updating xine-lib from CVS..."
cvs_up_check

new_major=`awk -F= '/XINE_MAJOR=/ {print $2}' <configure.in`
new_minor=`awk -F= '/XINE_MINOR=/ {print $2}' <configure.in`
new_sub=`awk -F= '/XINE_SUB=/ {print $2}' <configure.in`
new_ver="$new_major.$new_minor.$new_sub"

if [ "$new_ver" = "$lastver" ]; then
  echo "According to configure.in, the new release is $new_ver, which is"
  echo "exactly the same as the last release."
  echo "Please update version info (XINE_{MAJOR,MINOR,SUB} as well as the"
  echo "libtool version info (LT_{CURRENT,REVISION,AGE}) and try again!"
  exit 1
fi

echo "preparing the release tarball..."
rm -f .cvsversion
./cvscompile.sh
echo "making release tarball..."
tarball=xine-lib-${new_ver}.tar.gz
if make distcheck; then
  echo "Please test $tarball now: unpack, configure and make it,"
  echo "run some tests with the resulting installation, and if you think"
  echo "it's okay: type \"exit\" to get back to the release script!"
  ${SHELL:-bash}
else
  echo "make distcheck failed, I'm unable to make a dist tarball."
  echo "Sorry, can't help you any more..."
  exit 1
fi

echo "Is that $tarball okay"
if yesno; then
  echo "good. let's start the upload!"
  echo "adding entry to download page..."
  cd "$www_dir"
  while IFS="" read line; do
    if echo " $line" | grep 'href="files/xine-lib-'$lastver &>/dev/null; then
        echo "        <a href=\"files/$tarball\">$tarball</a><br>"
    fi
    echo "$line"
  done <download.html >download.html.new \
  && mv download.html.new download.html
  
  echo "committing download file to xine_www CVS"
  cvs commit -m "added $tarball" download.html

  cd "$topdir"
  echo "copying the tarball to xine.sf.net..."
  scp "$tarball" xine.sf.net:/home/groups/x/xi/xine/htdocs/files
  
  cd "$www_dir"
  echo "copying download page to xine.sf.net..."
  scp download.html xine.sf.net:/home/groups/x/xi/xine/htdocs
else
  echo "Sorry. Please try again after fixing it!"
  exit 1
fi

cd "$topdir"
echo "press return to clean up (make maintainer-clean; cvs up)..."
read line
make maintainer-clean
cvs up -dP
tag=xine-${new_major}_${new_minor}_${new_sub}-release
echo -n "set CVS tag $tag" 
if yesno; then
  cvs tag $tag
else
  echo "Okay, but you should probably do something like"
  echo "cvs tag $tag"
fi

echo "Well, that's it. xine-lib $new_ver is officially released"
echo "You should probably announce it on xine-announce."

rm $tmpfile