-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuilddeb.sh
64 lines (58 loc) · 1.6 KB
/
builddeb.sh
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
#!/bin/bash
set -e
# This script assumes it's being run inside of a checkout of the packaging
# for a project
PROJECT=`grep Source: debian/control | awk '{print $2}'`
VERSIONDIR=$HOME/versions
PKGRECORDFILE=$VERSIONDIR/pkgversions
PPAS=${PPAS:-ppa:$PROJECT-core/trunk}
PACKAGING_REVNO=${PACKAGING_REVNO:--1}
series=${series:-lucid}
if [ ! -d "$VERSIONDIR" ]
then
bzr co bzr://jenkins.openstack.org/ "$VERSIONDIR"
else
( cd $VERSIONDIR ; bzr up )
fi
tarball="$(echo $PROJECT*.tar.gz)"
version="${tarball%.tar.gz}"
version="${version#*$PROJECT-}"
base_version=$version
if [ -n "${EXTRAVERSION}" ]
then
version="${version%~*}${EXTRAVERSION}~${version#*~}"
fi
if [ -d .git ]
then
PACKAGING_REVNO="$(git log --oneline | wc -l)"
else
PACKAGING_REVNO="$(bzr revno --tree)"
fi
buildno=1
while true
do
pkgversion="${version}-0ubuntu0ppa1~${series}${buildno}"
if grep "$PROJECT $pkgversion" "$PKGRECORDFILE"
then
echo "We've already built a $pkgversion of $PROJECT. Incrementing build number."
buildno=$(($buildno + 1))
else
echo "$PROJECT $pkgversion" >> "$PKGRECORDFILE"
sort "$PKGRECORDFILE" > "$PKGRECORDFILE".tmp
mv "$PKGRECORDFILE".tmp "$PKGRECORDFILE"
( cd $VERSIONDIR ;
bzr up ;
bzr commit -m"Added $PROJECT $snapshotversion" )
break
fi
done
dch -b --force-distribution --v "${pkgversion}" "Automated PPA build. Packaging revision: ${PACKAGING_REVNO}." -D $series
debcommit
bzr bd -S --builder='debuild -S -sa -rfakeroot' --build-dir=build
if ! [ "$DO_UPLOAD" = "no" ]
then
for ppa in $PPAS
do
dput --force $ppa "../${PROJECT}_${pkgversion}_source.changes"
done
fi