Skip to content

Commit 6ec2158

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
container: more granular controls of build script behavior
Signed-off-by: John Mulligan <[email protected]>
1 parent 2b58841 commit 6ec2158

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/container/build.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ set -e
44

55
python=python3
66
url="https://github.com/samba-in-kubernetes/sambacc"
7-
bdir="/var/tmp/build/sambacc"
7+
bdir="${SAMBACC_BUILD_DIR:-/var/tmp/build/sambacc}"
88
distname="${SAMBACC_DISTNAME}"
99
# use SAMBACC_BUILD_TASKS to limit build tasks if needed
1010
tasks="${SAMBACC_BUILD_TASKS:-task_test_tox task_py_build task_rpm_build task_gen_sums}"
11+
dist_prefix="${SAMBACC_DIST_PREFIX:-/srv/dist}"
1112

1213
info() {
1314
echo "[[sambacc/build]] $*"
@@ -51,7 +52,7 @@ chk() {
5152
get_distdir() {
5253
dname="$1"
5354
if [ "${dname}" ]; then
54-
ddir="/srv/dist/$dname"
55+
ddir="${dist_prefix}/$dname"
5556
else
5657
ddir="/var/tmp/scratch_dist"
5758
fi
@@ -167,7 +168,11 @@ task_rpm_build() {
167168
fi
168169

169170
distdir="$(get_distdir "$distname")"
170-
info "using dist dir: $distdir"
171+
local rpmbuild_stage="-ba"
172+
if [ "${SAMBACC_SRPM_ONLY}" ]; then
173+
rpmbuild_stage="-bs"
174+
fi
175+
info "using dist dir: $distdir; using stage: ${rpmbuild_stage}"
171176
for spkg in "$distdir/sambacc"-*.tar.gz; do
172177
info "RPM build for: ${spkg}"
173178
ver="$(basename "${spkg}" | sed -e 's/^sambacc-//' -e 's/.tar.gz$//')"
@@ -184,7 +189,7 @@ task_rpm_build() {
184189
tar -xf "$spkg" -O \
185190
"sambacc-${ver}/extras/python-sambacc.spec"
186191
) > "${tdir}/python-sambacc.spec"
187-
rpmbuild -ba \
192+
rpmbuild "${rpmbuild_stage}" \
188193
-D "_rpmdir ${distdir}/RPMS" \
189194
-D "_srcrpmdir ${distdir}/SRPMS" \
190195
-D "_sourcedir $(dirname "${spkg}")" \

0 commit comments

Comments
 (0)