/
README
153 lines (114 loc) · 4.25 KB
/
README
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
DEB (Debian, Ubuntu, etc.)
==========================
Prerequisites
-------------
apt-get install build-essential fakeroot devscripts dpkg-dev gnupg \
debhelper cowbuilder
Download ubuntu archive keyring
wget http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg
cp ubuntu-archive-keyring.gpg /usr/share/keyrings/
Configure chroot environment for each supported version and platform
MIRROR=http://ftp.byfly.by/ubuntu
init_ubuntu () {
dist=$1
arch=$2
cowbuilder --create \
--distribution $dist \
--components "main universe" \
--basepath /var/cache/pbuilder/$dist-$arch.cow \
--mirror $MIRROR \
--debootstrapopts --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
cowbuilder --execute --save \
--basepath /var/cache/pbuilder/$dist-$arch.cow -- \
/tmp/install-dependencies
}
cat <<'EOF' >/tmp/install-dependencies
#!/bin/sh
set -x
set -e
apt-get update
apt-get -y install libevent-dev libev-dev debhelper autotools-dev
EOF
chmod a+rx /tmp/install-dependencies
for DIST in lucid oneiric precise; do
for ARCH in i386 amd64; do
init_ubuntu $DIST $ARCH
done
done
Build Packages
--------------
Source package can be built on any debian-like system. This system
should have installed fresh autotools.
git clone git://github.com/couchbase/libcouchbase.git
cd libcouchbase
./config/autorun.sh && ./configure --disable-tests --disable-couchbasemock --disable-plugins
make dist
VERSION=$(git describe | sed 's/-/_/g')
DEB_VERSION=$(git describe | sed 's/-\([0-9]\+\)-g\([0-9a-z]\+\)/+\1~\2/')
WORKSPACE=$PWD/build
PKGDIR=$WORKSPACE/libcouchbase-$VERSION
if [ "x$BUILDNO" = "x" ]; then BUILDNO=1; fi
mkdir -p $PKGDIR
cp -r packaging/deb $PKGDIR/debian
cp libcouchbase-$VERSION.tar.gz $WORKSPACE/libcouchbase_$DEB_VERSION.orig.tar.gz
(
cd $WORKSPACE;
tar zxf libcouchbase_$DEB_VERSION.orig.tar.gz
)
(
cd $PKGDIR;
dch --no-auto-nmu --newversion "$DEB_VERSION-$BUILDNO" "Release package for libcouchbase $DEB_VERSION"
debian/rules clean
dpkg-source -b .
)
mv $WORKSPACE/*.{dsc,tar.gz} $PWD
rm -rf $WORKSPACE
Now binary packages could be built using cowbuilder
for DIST in lucid oneiric precise; do
for ARCH in i386 amd64; do
export BUILDRESULT=$HOME/input/$DIST
cowbuilder --build --basepath /var/cache/pbuilder/$DIST-$ARCH.cow libcouchbase_$DEB_VERSION-$BUILDNO.dsc
done
done
All build artifacts will be stored in `BUILDRESULT` directory.
To debug failing builds in manual mode, one could use pbuilder hooks like this
mkdir $HOME/pb-hooks
cp /usr/share/doc/pbuilder/examples/C10shell $HOME/pb-hooks
cowbuilder --hookdir $HOME/pb-hook ...
RPM (CentOS, RHEL, SUSE, etc.)
==============================
Prerequisites
-------------
* Install mock
yum install mock
* Add user to 'mock' group
usermod -a -G mock [User name] && newgrp mock
* Setup configurations
cp packaging/rpm/mock/* /etc/mock
* Initialize chroot.
for CONFIG in centos-5-i386 centos-5-x86_64 centos-6-i386 centos-6-x86_64; do
mock -r $CONFIG --init
done
Build Packages
--------------
* Generate
VERSION=$(git describe | awk -F- '{ print $1 }')
RELEASE=$(git describe | awk -F- '{ print $2"_"$3 }')
if [ "$RELEASE" = "_"]
then
RELEASE = 1;
TARNAME="%{name}-%{version}"
else
TARNAME="%{name}-%{version}_%{release}"
fi
sed "s/@VERSION@/${VERSION}/g;s/@RELEASE@/${RELEASE}/g;s/@TARREDAS@/${TARNAME}/g" < packaging/rpm/libcouchbase.spec.in > libcouchbase.spec
rpmbuild -bs --nodeps \
--define "_source_filedigest_algorithm md5" \
--define "_binary_filedigest_algorithm md5" \
--define "_topdir ${PWD}" \
--define "_sourcedir ${PWD}" \
--define "_srcrpmdir ${PWD}" libcouchbase.spec
* Run the build
for CONFIG in centos-5-i386 centos-5-x86_64 centos-6-i386 centos-6-x86_64; do
mock -r $CONFIG --rebuild --resultdir=$HOME/input/$CONFIG libcouchbase-$VERSION-$RELEASE.src.rpm
done