/
build
149 lines (118 loc) · 3.93 KB
/
build
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
#!/bin/bash -ex
cd $WORKSPACE/ceph-build/ansible/ceph
HOST=$(hostname --short)
echo "Building on ${HOST}"
echo " DIST=${DIST}"
echo " BPTAG=${BPTAG}"
echo " WS=$WORKSPACE"
echo " PWD=$(pwd)"
echo " BRANCH=$BRANCH"
echo " SHA1=$(git rev-parse HEAD)"
if [ -x "$BRANCH" ] ; then
echo "No git branch was supplied"
exit 1
fi
echo "Building version $(git describe --abbrev=8) Branch $BRANCH"
rm -rf dist
rm -rf release
# fix version/release. Hack needed only for the spec
# file for rc candidates.
#export force=force
#sed -i 's/^Version:.*/Version: 0.80/' ceph.spec.in
#sed -i 's/^Release:.*/Release: rc1%{?dist}/' ceph.spec.in
#sed -i 's/^Source0:.*/Source0: http:\/\/ceph.com\/download\/%{name}-%{version}-rc1.tar.bz2/' ceph.spec.in
#sed -i 's/^%setup.*/%setup -q -n %{name}-%{version}-rc1/' ceph.spec.in
# run submodule updates regardless
echo "Running submodule update ..."
git submodule update --init
CEPH_EXTRA_RPMBUILD_ARGS="--with tcmalloc"
CEPH_EXTRA_CMAKE_ARGS="$CEPH_EXTRA_CMAKE_ARGS -DALLOCATOR=tcmalloc"
# When using autotools/autoconf it is possible to see output from `git diff`
# since some macros can be copied over to the ceph source, triggering this
# check. This is why this check now is done just before running autogen.sh
# which calls `aclocal -I m4 --install` that copies a system version of
# ltsugar.m4 that can be different from the one included in the ceph source
# tree.
if git diff --quiet; then
echo repository is clean
else
echo
echo "**** REPOSITORY IS DIRTY ****"
echo
git diff
if [ "$force" != "force" ]; then
echo "add 'force' argument if you really want to continue."
exit 1
fi
echo "forcing."
fi
mkdir -p release
# Contents below used to come from /srv/release_tarball.sh and
# was called like::
#
# $bindir/release_tarball.sh release release/version
releasedir='release'
versionfile='release/version'
cephver=`git describe --abbrev=8 --match "v*" | sed s/^v//`
echo current version $cephver
srcdir=`pwd`
if [ -d "$releasedir/$cephver" ]; then
echo "$releasedir/$cephver already exists; reuse that release tarball"
else
echo building tarball
rm ceph-*.tar.gz || true
rm ceph-*.tar.bz2 || true
./make-dist $cephver
vers=`ls ceph-*.tar.bz2 | cut -c 6- | sed 's/.tar.bz2//'`
extension="tar.bz2"
extract_flags="jxf"
compress_flags="jcf"
echo tarball vers $vers
echo extracting
mkdir -p $releasedir/$cephver/rpm
cp rpm/*.patch $releasedir/$cephver/rpm || true
cd $releasedir/$cephver
tar $extract_flags $srcdir/ceph-$vers.$extension
[ "$vers" != "$cephver" ] && mv ceph-$vers ceph-$cephver
tar zcf ceph_$cephver.orig.tar.gz ceph-$cephver
cp -a ceph_$cephver.orig.tar.gz ceph-$cephver.tar.gz
tar jcf ceph-$cephver.tar.bz2 ceph-$cephver
# copy debian dir, too. Prevent errors with `true` when using cmake
cp -a $srcdir/debian debian || true
cd $srcdir
# copy in spec file, too. If using cmake, the spec file
# will already exist.
cp ceph.spec $releasedir/$cephver || true
fi
if [ -n "$versionfile" ]; then
echo $cephver > $versionfile
echo "wrote $cephver to $versionfile"
fi
vers=`cat release/version`
(
cd release/$vers
mkdir -p ceph-$vers/debian
cp -r debian/* ceph-$vers/debian/
dpkg-source -b ceph-$vers
)
mkdir -p dist
# Debian Source Files
mv release/$vers/*.dsc dist/.
mv release/$vers/*.diff.gz dist/.
mv release/$vers/*.orig.tar.gz dist/.
# RPM Source Files
mkdir -p dist/rpm/
mv release/$vers/rpm/*.patch dist/rpm/ || true
mv release/$vers/ceph.spec dist/.
mv release/$vers/*.tar.* dist/.
# Parameters
mv release/version dist/.
cat > dist/sha1 << EOF
SHA1=$(git rev-parse HEAD)
EOF
# CEPH_EXTRA_{CONFIGURE,RPMBUILD}_ARGS are consumed by ceph-build before
# the switch to cmake; CEPH_EXTRA_CMAKE_ARGS is for after cmake
cat > dist/other_envvars << EOF
CEPH_EXTRA_RPMBUILD_ARGS=${CEPH_EXTRA_RPMBUILD_ARGS}
CEPH_EXTRA_CMAKE_ARGS=${CEPH_EXTRA_CMAKE_ARGS}
EOF