]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | #!/usr/bin/env bash |
7c673cae FG |
2 | # |
3 | # Copyright (C) 2015 Red Hat <contact@redhat.com> | |
4 | # | |
5 | # Author: Loic Dachary <loic@dachary.org> | |
6 | # | |
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) | |
10 | # any later version. | |
11 | # | |
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. | |
16 | # | |
17 | set -xe | |
18 | ||
19 | base=${1:-/tmp/release} | |
20 | codename=$(lsb_release -sc) | |
21 | releasedir=$base/$(lsb_release -si)/WORKDIR | |
11fdf7f2 | 22 | rm -fr $(dirname $releasedir) |
7c673cae FG |
23 | mkdir -p $releasedir |
24 | # | |
25 | # remove all files not under git so they are not | |
26 | # included in the distribution. | |
27 | # | |
28 | git clean -dxf | |
29 | # | |
30 | # git describe provides a version that is | |
31 | # a) human readable | |
32 | # b) is unique for each commit | |
33 | # c) compares higher than any previous commit | |
34 | # d) contains the short hash of the commit | |
35 | # | |
36 | vers=$(git describe --match "v*" | sed s/^v//) | |
37 | ./make-dist $vers | |
38 | # | |
39 | # rename the tarbal to match debian conventions and extract it | |
40 | # | |
41 | mv ceph-$vers.tar.bz2 $releasedir/ceph_$vers.orig.tar.bz2 | |
42 | tar -C $releasedir -jxf $releasedir/ceph_$vers.orig.tar.bz2 | |
43 | # | |
44 | # copy the debian directory over and remove -dbg packages | |
45 | # because they are large and take time to build | |
46 | # | |
47 | cp -a debian $releasedir/ceph-$vers/debian | |
48 | cd $releasedir | |
49 | perl -ni -e 'print if(!(/^Package: .*-dbg$/../^$/))' ceph-$vers/debian/control | |
50 | perl -pi -e 's/--dbg-package.*//' ceph-$vers/debian/rules | |
51 | # | |
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. | |
55 | # | |
56 | dvers="$vers-1" | |
57 | # | |
58 | # update the changelog to match the desired version | |
59 | # | |
60 | cd ceph-$vers | |
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" | |
64 | fi | |
65 | # | |
66 | # create the packages | |
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 | |
70 | # | |
71 | : ${NPROC:=$(($(nproc) / 2))} | |
72 | if test $NPROC -gt 1 ; then | |
73 | j=-j${NPROC} | |
74 | fi | |
75 | PATH=/usr/lib/ccache:$PATH dpkg-buildpackage $j -uc -us | |
76 | cd ../.. | |
77 | mkdir -p $codename/conf | |
78 | cat > $codename/conf/distributions <<EOF | |
79 | Codename: $codename | |
80 | Suite: stable | |
81 | Components: main | |
11fdf7f2 | 82 | Architectures: $(dpkg --print-architecture) source |
7c673cae FG |
83 | EOF |
84 | if [ ! -e conf ]; then | |
85 | ln -s $codename/conf conf | |
86 | fi | |
87 | reprepro --basedir $(pwd) include $codename WORKDIR/*.changes | |
88 | # | |
89 | # teuthology needs the version in the version file | |
90 | # | |
91 | echo $dvers > $codename/version |