6 . $bindir/reset-modules.sh
8 DISTS=`cat ../../dists`
9 TARGET="$(cat ../../rsync-target)"
10 TARGET="$(basename $TARGET)"
11 REV="$(git rev-parse HEAD)"
14 # Reformat version if needed to match RPM version and release
15 desc=$(git describe --always | sed 's/^v//')
16 if expr index $desc '-' > /dev/null ; then
17 RPM_VER=$(echo $desc | cut -d'-' -f1)
18 RPM_REL=$(echo $desc | cut -d- -f2- | tr '-' '.')
23 VER=${RPM_VER}-${RPM_REL}
25 # Try to determine branch name
26 BRANCH=$(../branches.sh -v | grep $REV | awk '{print $2}') || BRANCH="unknown"
27 BRANCH=$(basename $BRANCH)
28 echo "Building branch=$BRANCH, sha1=$REV, version=$VER"
30 # set up key for signing RPMs
31 export GNUPGHOME=/srv/gnupg
33 if ! gpg --list-keys 2>&1 | grep $KEYID > /dev/null
35 echo "Can not find RPM signing key" 1>&2
40 # clear out any $@ potentially passed in
43 # enable ccache if it is installed
44 export CCACHE_DIR="$PWD/../../ccache"
45 if command -v ccache >/dev/null; then
46 if [ ! -e "$CCACHE_DIR" ]; then
47 echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2
49 set -- CC='ccache gcc' CXX='ccache g++'
52 echo "$0: no ccache found, compiles will be slower." 1>&2
55 echo --START-IGNORE-WARNINGS
56 [ ! -x install-deps.sh ] || ./install-deps.sh
58 # we only need to use autogen here if we need a dist tarball
59 if [ -x make-dist ]; then
60 echo --STOP-IGNORE-WARNINGS
63 [ ! -x autogen.sh ] || ./autogen.sh || exit 1
65 echo --STOP-IGNORE-WARNINGS
67 [ -z "$CEPH_EXTRA_CONFIGURE_ARGS" ] && CEPH_EXTRA_CONFIGURE_ARGS=--with-tcmalloc
68 [ ! -x configure ] || ./configure --with-debug --with-radosgw --with-fuse --with-libatomic-ops --with-gtk2 --with-nss $CEPH_EXTRA_CONFIGURE_ARGS || exit 2
70 if [ ! -e Makefile ]; then
71 echo "$0: no Makefile, aborting." 1>&2
76 # Build Source tarball. We do this after runing autogen/configure so that
77 # ceph.spec has the correct version number filled in.
78 echo "**** Building Tarball ***"
84 mkdir -p ${BUILDAREA}/SOURCES
85 mkdir -p ${BUILDAREA}/SRPMS
86 mkdir -p ${BUILDAREA}/SPECS
87 mkdir -p ${BUILDAREA}/RPMS
88 mkdir -p ${BUILDAREA}/BUILD
89 cp -a ceph-*.tar.bz2 ${BUILDAREA}/SOURCES/.
90 cp -a rpm/*.patch ${BUILDAREA}/SOURCES || true
92 # If this is a release candidate, identified by having -rc[0-9] appended to
93 # the version number, then fix up the generated rpm spec file by moving the
94 # the rc tag from the version field to the release field. '-' is an illegal
95 # char in the rpm version number.
96 rpm_version=`grep ^Version: ceph.spec | awk '{print $2}'`
97 if [[ "$rpm_version" =~ .*-rc[1-9]$ ]] ; then
98 rpm_rc=$(echo $rpm_version | cut -d- -f2)
99 rpm_version=$(echo $rpm_version | cut -d- -f1)
100 rpm_release=`grep ^Release: ceph.spec | awk '{print $2}'`
102 sed -i "s/^Version:.*/Version: $rpm_version/" ceph.spec
103 if [[ ! $rpm_release =~ rc[1-9].* ]] ; then
104 sed -i "s/^Release:.*/Release: $rpm_rc.$rpm_release/" ceph.spec
106 sed -i "s/^Source0:.*/Source0: http:\/\/ceph.com\/download\/%{name}-%{version}-$rpm_rc.tar.bz2/" ceph.spec
107 sed -i "s/^%setup.*/%setup -q -n %{name}-%{version}-$rpm_rc/" ceph.spec
109 # fix up spec file for non-rc builds too
110 sed -i "s/^Version:.*/Version: $RPM_VER/" ceph.spec
111 sed -i "s/^Release:.*/Release: $RPM_REL/" ceph.spec
113 cp ceph.spec /tmp/ceph.spec
116 BUILDAREA=`readlink -fn ${BUILDAREA}` ### rpm wants absolute path
117 rpmbuild -ba --define "_topdir ${BUILDAREA}" ceph.spec
119 # Create and build an RPM for the repository
121 cat <<EOF > ${BUILDAREA}/SPECS/ceph-release.spec
125 Summary: Ceph repository configuration
126 Group: System Environment/Base
128 URL: http://gitbuilder.ceph.com/$dist
130 #Source0: RPM-GPG-KEY-CEPH
132 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
136 This package contains the Ceph repository GPG key as well as configuration
142 install -pm 644 %{SOURCE0} .
143 #install -pm 644 %{SOURCE1} .
149 #install -Dpm 644 %{SOURCE0} \
150 # %{buildroot}/%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CEPH
151 %if 0%{defined suse_version}
152 install -dm 755 %{buildroot}/%{_sysconfdir}/zypp
153 install -dm 755 %{buildroot}/%{_sysconfdir}/zypp/repos.d
154 install -pm 644 %{SOURCE0} \
155 %{buildroot}/%{_sysconfdir}/zypp/repos.d
157 install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
158 install -pm 644 %{SOURCE0} \
159 %{buildroot}/%{_sysconfdir}/yum.repos.d
170 %defattr(-,root,root,-)
172 %if 0%{defined suse_version}
180 * Sun Mar 10 2013 Gary Lowell <glowell@inktank.com> 1-1
181 - Handle both yum and zypper
182 - Use URL to ceph git repo for key
183 - remove config attribute from repo file
184 * Mon Aug 27 2012 Gary Lowell <glowell@inktank.com> 1-0
187 # End of ceph-release.spec file.
190 #gpg --export --armor $keyid > ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
191 #chmod 644 ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
193 # Install ceph.repo file
194 cat <<EOF > $BUILDAREA/SOURCES/ceph.repo
196 name=Ceph packages for \$basearch
197 baseurl=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/\$basearch
201 gpgkey=https://download.ceph.com/keys/autobuild.asc
204 name=Ceph noarch packages
205 baseurl=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/noarch
209 gpgkey=https://download.ceph.com/keys/autobuild.asc
212 name=Ceph source packages
213 baseurl=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/SRPMS
217 gpgkey=https://download.ceph.com/keys/autobuild.asc
219 # End of ceph.repo file
221 rpmbuild -bb --define "_topdir ${BUILDAREA}" ${BUILDAREA}/SPECS/ceph-release.spec
227 cp -avf /srv/deps/* ${BUILDAREA}/RPMS/x86_64/
231 export GNUPGHOME=/srv/gnupg
232 echo "Signing RPMS ..."
233 for file in `find ${BUILDAREA} -name "*.rpm"`
235 /srv/autobuild-ceph/rpm-autosign.exp --define "_gpg_name $KEYID" $file
238 # Create repo index for yum/zypper
239 for dir in ${BUILDAREA}/SRPMS ${BUILDAREA}/RPMS/*
242 gpg --detach-sign --armor -u $KEYID ${dir}/repodata/repomd.xml
245 #REV="$(git rev-parse HEAD)"
246 OUTDIR="../out/output/sha1/$REV"
247 OUTDIR_TMP="${OUTDIR}.tmp"
248 install -d -m0755 -- "$OUTDIR_TMP"
249 printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
250 printf '%s\n' "$VER" >"$OUTDIR_TMP/version"
251 printf '%s\n' "ceph" >"$OUTDIR_TMP/name"
252 #mkdir -p $OUTDIR_TMP/conf
254 # Copy RPMS to output repo
255 for dir in ${BUILDAREA}/SRPMS ${BUILDAREA}/RPMS/*
257 cp -a ${dir} $OUTDIR_TMP
260 rm -rf -- "$BUILDAREA"
262 # put our temp files inside .git/ so ls-files doesn't see them
263 git ls-files --modified >.git/modified-files
264 if [ -s .git/modified-files ]; then
266 echo "error: Modified files:" 1>&2
267 cat .git/modified-files 1>&2
271 git ls-files --exclude-standard --others >.git/added-files
272 if [ -s .git/added-files ]; then
274 echo "error: Added files:" 1>&2
275 cat .git/added-files 1>&2
279 # we're successful, the files are ok to be published; try to be as
280 # atomic as possible about replacing potentially existing OUTDIR
281 if [ -e "$OUTDIR" ]; then
282 rm -rf -- "$OUTDIR.old"
283 mv -- "$OUTDIR" "$OUTDIR.old"
285 mv -- "$OUTDIR_TMP" "$OUTDIR"
286 rm -rf -- "$OUTDIR.old"