3 # Copyright (C) 2015 Red Hat <contact@redhat.com>
5 # Author: Loic Dachary <loic@dachary.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Library Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Library Public License for more details.
19 base=${1:-/tmp/release}
20 codename=$(lsb_release -sc)
21 releasedir=$base/$(lsb_release -si)/WORKDIR
25 # remove all files not under git so they are not
26 # included in the distribution.
30 # git describe provides a version that is
32 # b) is unique for each commit
33 # c) compares higher than any previous commit
34 # d) contains the short hash of the commit
36 vers=$(git describe --match "v*" | sed s/^v//)
39 # rename the tarbal to match debian conventions and extract it
41 mv ceph-$vers.tar.bz2 $releasedir/ceph_$vers.orig.tar.bz2
42 tar -C $releasedir -jxf $releasedir/ceph_$vers.orig.tar.bz2
44 # copy the debian directory over and remove -dbg packages
45 # because they are large and take time to build
47 cp -a debian $releasedir/ceph-$vers/debian
49 perl -ni -e 'print if(!(/^Package: .*-dbg$/../^$/))' ceph-$vers/debian/control
50 perl -pi -e 's/--dbg-package.*//' ceph-$vers/debian/rules
52 # always set the debian version to 1 which is ok because the debian
53 # directory is included in the sources and the upstream version will
54 # change each time it is modified.
58 # update the changelog to match the desired version
61 chvers=$(head -1 debian/changelog | perl -ne 's/.*\(//; s/\).*//; print')
62 if [ "$chvers" != "$dvers" ]; then
63 DEBEMAIL="contact@ceph.com" dch -D $codename --force-distribution -b -v "$dvers" "new version"
67 # a) with ccache to speed things up when building repeatedly
68 # b) do not sign the packages
69 # c) use half of the available processors
71 : ${NPROC:=$(($(nproc) / 2))}
72 if test $NPROC -gt 1 ; then
75 PATH=/usr/lib/ccache:$PATH dpkg-buildpackage $j -uc -us
77 mkdir -p $codename/conf
78 cat > $codename/conf/distributions <<EOF
82 Architectures: i386 amd64 source
84 if [ ! -e conf ]; then
85 ln -s $codename/conf conf
87 reprepro --basedir $(pwd) include $codename WORKDIR/*.changes
89 # teuthology needs the version in the version file
91 echo $dvers > $codename/version