-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-debs.sh
More file actions
executable file
·153 lines (145 loc) · 4.47 KB
/
Copy pathmake-debs.sh
File metadata and controls
executable file
·153 lines (145 loc) · 4.47 KB
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
#!/usr/bin/env bash
#
# Copyright (C) 2015 Red Hat <contact@redhat.com>
#
# Author: Loic Dachary <loic@dachary.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library Public License for more details.
#
set -xe
. /etc/os-release
base=${1:-/tmp/release}
releasedir=$base/$ID/WORKDIR
rm -fr $(dirname $releasedir)
# git describe provides a version that is
# a) human readable
# b) is unique for each commit
# c) compares higher than any previous commit
# d) contains the short hash of the commit
#
# CI builds compute the version at an earlier stage, via the same method. Since
# git metadata is not part of the source distribution, we take the version as
# an argument to this script.
#
if [ -z "${2}" ]; then
vers=$(git describe --match "v*" | sed s/^v//)
dvers=${vers}-1
else
vers=${2}
dvers=${vers}-1${VERSION_CODENAME}
fi
test -f "ceph-$vers.tar.bz2" || ./make-dist $vers
#
# rename the tarball to match debian conventions and extract it
#
mkdir -p $releasedir
mv ceph-$vers.tar.bz2 $releasedir/ceph_$vers.orig.tar.bz2
tar -C $releasedir --no-same-owner -jxf $releasedir/ceph_$vers.orig.tar.bz2
#
# Optionally disable -dbg package builds
# because they are large and take time to build
#
cp -a debian $releasedir/ceph-$vers/debian
cd $releasedir
if [[ -n "$SKIP_DEBUG_PACKAGES" ]]; then
perl -ni -e 'print if(!(/^Package: .*-dbg$/../^$/))' ceph-$vers/debian/control
perl -pi -e 's/--dbg-package.*//' ceph-$vers/debian/rules
fi
# For cache hit consistency, allow CI builds to use a build directory whose name
# does not contain version information
if [ "${CEPH_BUILD_NORMALIZE_PATHS}" = 'true' ]; then
mv ceph-$vers ceph
cd ceph
else
cd ceph-$vers
fi
#
# update the changelog to match the desired version
#
chvers=$(head -1 debian/changelog | perl -ne 's/.*\(//; s/\).*//; print')
if [ "$chvers" != "$dvers" ]; then
DEBEMAIL="contact@ceph.com" dch -D $VERSION_CODENAME --force-distribution -b -v "$dvers" "new version"
fi
#
# create the packages
# a) with ccache to speed things up when building repeatedly
# b) do not sign the packages
# c) use half of the available processors
#
: ${NPROC:=$(nproc)}
RAM_MB=$(vmstat --stats --unit m | grep 'total memory' | awk '{print $1}')
if test "$NPROC" -gt 50; then
MAX_JOBS=$((${RAM_MB} / 4000))
else
MAX_JOBS=$((${RAM_MB} / 3000))
fi
if test "$NPROC" -gt "$MAX_JOBS"; then
JOBS_FLAG="-j${MAX_JOBS}"
else
JOBS_FLAG="-j${NPROC}"
fi
if [ "$SCCACHE" != "true" ]; then
PATH=/usr/lib/ccache:$PATH
fi
# Crimson/seastar needs GCC >= 13 (C++20 coroutines).
# WITH_CRIMSON: off forces disable; on/unset enable when the distro is new enough
# (Ubuntu 24.04 (noble)+ or Debian 13 (trixie)+). Distro is a hard floor: setting
# WITH_CRIMSON=on on an older distro is ignored (with a warning).
distro_supports_crimson=no
case "$ID" in
ubuntu)
ubuntu_major=${VERSION_ID%%.*}
ubuntu_minor=${VERSION_ID#*.}
if [ "$ubuntu_major" -gt 24 ] ||
{ [ "$ubuntu_major" -eq 24 ] && [ "$ubuntu_minor" -ge 4 ]; }; then
distro_supports_crimson=yes
fi
;;
debian)
if [ -z "$VERSION_ID" ] || [ "$VERSION_ID" -ge 13 ] 2>/dev/null; then
distro_supports_crimson=yes
fi
;;
esac
enable_crimson=no
case "${WITH_CRIMSON:-auto}" in
OFF | off | 0 | false) ;;
ON | on | 1 | true)
if [ "$distro_supports_crimson" = yes ]; then
enable_crimson=yes
else
echo "WITH_CRIMSON=$WITH_CRIMSON ignored: $ID $VERSION_ID lacks GCC >= 13" >&2
fi
;;
auto | "")
[ "$distro_supports_crimson" = yes ] && enable_crimson=yes
;;
esac
if [ "$enable_crimson" = yes ]; then
export DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES:+$DEB_BUILD_PROFILES }pkg.ceph.crimson"
fi
PATH=$PATH dpkg-buildpackage $JOBS_FLAG -uc -us
cd ../..
mkdir -p $VERSION_CODENAME/conf
cat >$VERSION_CODENAME/conf/distributions <<EOF
Codename: $VERSION_CODENAME
Suite: stable
Components: main
Architectures: $(dpkg --print-architecture) source
EOF
if [ ! -e conf ]; then
ln -s $VERSION_CODENAME/conf conf
fi
reprepro --basedir $(pwd) include $VERSION_CODENAME WORKDIR/*.changes
#
# teuthology needs the version in the version file
#
echo $dvers >$VERSION_CODENAME/version