Skip to content

Commit d9e0d87

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
container: always run rpm build as part of a normal build
Previously, we only executed the rpm build if the `distname` was given, meaning we expected to output the rpms to a "distribution" location. But this meant that the rpms were typically only built when samba containers are being built and never as part of a CI run. This change updates the build script to always build the RPMs, even if distname is not supplied by using a "scratch" dist dir. Now, the rpm build should be executed as part of a typical CI run. Signed-off-by: John Mulligan <[email protected]>
1 parent 2f6d49d commit d9e0d87

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

tests/container/build.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ chk() {
5050

5151
get_distdir() {
5252
dname="$1"
53-
ddir="/srv/dist/$dname"
53+
if [ "${dname}" ]; then
54+
ddir="/srv/dist/$dname"
55+
else
56+
ddir="/var/tmp/scratch_dist"
57+
fi
5458
mkdir -p "$ddir" >/dev/null
5559
echo "$ddir"
5660
}
@@ -142,22 +146,15 @@ task_test_tox() {
142146
task_py_build() {
143147
info "building python package(s)"
144148
pip -qq install build
145-
if [ "$distname" ]; then
146-
# building for a given "distribution name" - meaning this could be
147-
# consumed externally
148-
distdir="$(get_distdir "$distname")"
149-
info "using dist dir: $distdir"
150-
$python -m build --outdir "$distdir"
151-
else
152-
# just run the build as a test to make sure it succeeds
153-
$python -m build
154-
fi
149+
# if distname is set, then we are building for external consumption
150+
# if distname is not set then we're building for internal consumption
151+
# only
152+
distdir="$(get_distdir "$distname")"
153+
info "using dist dir: $distdir"
154+
$python -m build --outdir "$distdir"
155155
}
156156

157157
task_rpm_build() {
158-
if ! [ "$distname" ]; then
159-
return
160-
fi
161158
if ! command -v rpmbuild ; then
162159
info "rpmbuild not found ... skipping"
163160
return
@@ -193,6 +190,12 @@ task_gen_sums() {
193190
fi
194191
}
195192

193+
cleanup() {
194+
if [ -z "${distname}" ]; then
195+
info "cleaning scratch dist dir"
196+
rm -rf "$(get_distdir "$distname")"
197+
fi
198+
}
196199

197200
# Allow the tests to use customized passwd file contents in order
198201
# to test samba passdb support. It's a bit strange, but should work.
@@ -218,6 +221,7 @@ if ! command -v git &>/dev/null ; then
218221
tasks="$tasks task_sys_deps"
219222
fi
220223

224+
trap cleanup EXIT
221225

222226
chk task_sys_deps
223227
setup_fetch "$2"

0 commit comments

Comments
 (0)