blob: 9911da5f67e9c2d08c509f259d3d42429b3054e8 (
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
#!/bin/bash
usage()
{
echo "
This script requires debhelper, pbuilder, dput:
$ sudo apt-get install debhelper pbuilder dput subversion
The following options are supported:
--no-export : Ask the script to no do an SVN export (do a copy instead)
--ppa=<your ppa in dput.cf>
-t, --tag : svnsrc=<dir>, version=<version> (without 'xbmc-')
-u : srcdir=<dir> version=<version> revision=<rev> minor=<minor>
-nsg : svnsrc=<dir> revision=<rev>
-prev : revision=<rev>
urgency=(low|medium|high)
"
exit 0
}
alias echo='echo -e'
BUILDALL=1
FULLDEBUILDOPTS="-S -sa"
DEBUILDOPTS="-S -sd"
MINOR=1
XBMCPPA=xbmc-svn
# Information about versioning
# SVN before releasing version NN is: NN~svnXXXX
# SVN after releasing version NN is: NN+svnXXXX
SVN_RELEASE_SEP="~"
HVERSION=10.08
# Packagers should have these two vars in their environment
# export DEBFULLNAME="Ouattara Oumar Aziz (alias wattazoum)"
# export DEBEMAIL="wattazoum@gmail.com"
parse_options()
{
echo "Parse options: $@"
for I in "$@"
do
OPT=${I%=*}
PAR=${I#*=}
case $OPT in
--local|-l)
LOCAL=1
;;
--pbuilder|-p)
echo "-p ==> PBUILDER"
PBUILDER=1
LOCAL=1
;;
hardy|intrepid|jaunty|karmic|lucid)
BUILDALL=0
DIST="$OPT"
DEBUILDOPTS=$FULLDEBUILDOPTS
echo "DIST ==> $DIST"
;;
--noclean|-nc)
NOCLEAN=1
;;
--no-src-gen|-nsg)
NO_SRC_GEN=1
;;
--update|-u)
UPDPPA=1
FULLDEBUILDOPTS=$DEBUILDOPTS
;;
--tag|-t)
BUILD_TAG=1
;;
-prev)
EXPORT_PREV_REV=1
;;
--ppa)
XBMCPPA=$PAR
;;
--no-export)
NO_EXPORT=1
;;
--help|-h)
usage
;;
*)
echo "Setting $OPT=$PAR"
export $OPT=$PAR
;;
esac
done
}
getrootright()
{
if [[ $PBUILDER ]]; then
echo "Give me the admin rights ... "
sudo echo "Thank you !"
fi
}
preparesrc()
{
echo "Exporting the sources at revision $REVISION ... "
if [[ -z $NO_EXPORT ]]; then
if [[ -z $HEAD_REVISION ]]; then
# The revision given might not be the head one
svn export -r $REVISION $SVNSRC $DESTSRC 2>&1
else
svn cleanup $SVNSRC
svn export $SVNSRC $DESTSRC
fi
else
cp $SVNSRC $DESTSRC -Rf
fi
cd $DESTSRC
./bootstrap
curl -Ls --output lib/addons/script.module.pil/Imaging-1.1.7.tar.gz http://www.effbot.org/downloads/Imaging-1.1.7.tar.gz
curl -Ls --output lib/addons/script.module.pysqlite/pysqlite-2.5.6.tar.gz http://pysqlite.googlecode.com/files/pysqlite-2.5.6.tar.gz
cd $OLDPWD
if [ -z $UPDPPA ]; then
echo "Copying to .orig folder"
cp -a $DESTSRC $DESTSRC.orig
fi
}
builddeb()
{
echo "Build $1 deb package"
echo "Copy the debian folder to the root"
cp -a $DESTSRC/tools/Linux/packaging/debian $DESTSRC/debian
if [[ -z $CHNLG ]]; then
CHNLG="Build of $VERSION"
fi
echo "Changelog : $CHNLG"
cd $DESTSRC
if [[ -z $urgency ]]; then
urgency=low
fi
if [ $UPDPPA ]; then
PKG_VERSION=1:${HVERSION}-$1$REVISION
else
PKG_VERSION=1:${VERSION}-$1${MINOR}
fi
dch --force-distribution -b -v $PKG_VERSION -D $1 -u $urgency "$CHNLG" 2>&1
echo "$REVISION" > debian/svnrevision
echo "Building the $1 debian package"
echo "move the format spec to 1.0 (Ubuntu PPA doesn't support format 3.0 quilt) "
echo "1.0" > debian/source/format
if [[ $BUILT_ONCE ]]; then
debuild $DEBUILDOPTS 2>&1
else
debuild $FULLDEBUILDOPTS 2>&1
BUILT_ONCE=1
fi
cd $OLDPWD
if [[ $PBUILDER ]]; then
echo "'pbuilder' is set. Trying into pbuilder"
$SCRIPTDIR/pbuilder-dist $1 build xbmc_${VERSION}-$1${MINOR}.dsc 2>&1 | tee -a $BUILD_LOG
rm -rf $DESTSRC/debian
fi
if [[ -z $LOCAL ]]; then
echo "'--local' is not set. Uploading to PPA"
dput $XBMCPPA xbmc_${VERSION}-$1${MINOR}_source.changes 2>&1
rm -rf $DESTSRC/debian
fi
}
clean()
{
if [[ -z $NOCLEAN ]] && [[ -z $LOCAL ]] ; then
echo "Cleaning ... "
find . -depth -maxdepth 1 -regex "\./xbmc[-_].+-.+" -not -name "*.orig.tar.gz" -exec rm -rf {} \;
if [[ -z $UPDPPA ]] && [[ -z $NO_SRC_GEN ]] ; then
rm -rf xbmc-$VERSION xbmc_$VERSION.orig.tar.gz
fi
fi
}
preparevars()
{
echo "Nothing" > test.txt
gpg -s test.txt
rm test.txt test.txt.gpg
echo "Preparing Vars ..."
echo "Build directory: $BUILD_DIR"
if [[ -z $SVNSRC ]]; then
SVNSRC=$(readlink -f ../../../)
fi
if [[ $UPDPPA ]]; then
DESTSRC=$srcdir
if [[ $revision ]]; then
REVISION=$revision
VERSION=${HVERSION}${SVN_RELEASE_SEP}svn$REVISION
fi
if [[ -z $VERSION ]] && [[ $version ]]; then
VERSION=$version
fi
if [ $minor ]; then
MINOR=$minor
fi
BUILT_ONCE=1
fi
if [[ $NO_SRC_GEN ]]; then
DESTSRC=$srcdir
if [[ $revision ]]; then
REVISION=$revision
VERSION=${HVERSION}${SVN_RELEASE_SEP}svn$REVISION
fi
if [[ -z $VERSION ]] && [[ $version ]]; then
VERSION=$version
fi
fi
if [[ $BUILD_TAG ]]; then
VERSION=$version
fi
if [[ $EXPORT_PREV_REV ]]; then
echo "Revision to export: $rev"
REVISION=$rev
fi
echo "Setting SVN Sources: $SVNSRC"
# If the version is not yet set it
if [[ -z $REVISION ]]; then
svn update $SVNSRC
HEAD_REVISION=$(eval LANG=POSIX svn info $SVNSRC | grep -E "Last Changed Rev: [0-9]+" | grep -o -E "[0-9]+")
REVISION=$HEAD_REVISION
fi
if [[ -z $VERSION ]]; then
VERSION=${HVERSION}${SVN_RELEASE_SEP}svn$REVISION
fi
echo "XBMC version: $VERSION"
echo "XBMC revision: $REVISION"
# Set Destination folder if not set
if [[ -z $DESTSRC ]]; then
DESTSRC=xbmc-$VERSION
fi
echo "XBMC Destination folder: $DESTSRC"
echo "Package minor version: $MINOR"
}
# = = = = = = = = = = = = = =
SCRIPTDIR=`pwd`
if [[ -z $BUILD_DIR ]] ; then
BUILD_DIR=$(eval readlink -f ../../../../)
fi
BUILD_LOG=$BUILD_DIR/debuilder_`date +%F_%T`.log
parse_options $@
getrootright
preparevars
# We are in the source tree. Go out
cd $BUILD_DIR
if [[ -z $NO_SRC_GEN ]] ; then
preparesrc
fi
for distro in hardy jaunty karmic lucid ; do
if [[ $BUILDALL -eq 1 ]] || [[ $DIST == $distro ]]; then
builddeb $distro
fi
done
clean
exit 0
|