Skip to content

Commit 2b58841

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
container: generate a more robust rpm spec file
When using the container to build "binary" rpms passing the pversion and rversion vars mostly worked, but the srpm it generated was not usable. This change generates a new spec file based on the old, but with pversion and rversion predefined, based on the same setuptools_scm values, such that the srpm is usable in other environments. Signed-off-by: John Mulligan <[email protected]>
1 parent 3e31919 commit 2b58841

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/container/build.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,19 @@ task_rpm_build() {
177177
rversion="$ver"
178178
fi
179179
info "Using rpm-version=${rversion} pkg-version=${ver}"
180-
rpmbuild --nocheck -ta \
181-
-D "pversion ${ver}" \
182-
-D "rversion ${rversion}" \
180+
tdir="$(mktemp -d)"
181+
(
182+
echo "%define pversion ${ver}"
183+
echo "%define rversion ${rversion}"
184+
tar -xf "$spkg" -O \
185+
"sambacc-${ver}/extras/python-sambacc.spec"
186+
) > "${tdir}/python-sambacc.spec"
187+
rpmbuild -ba \
183188
-D "_rpmdir ${distdir}/RPMS" \
184189
-D "_srcrpmdir ${distdir}/SRPMS" \
185-
"$spkg"
190+
-D "_sourcedir $(dirname "${spkg}")" \
191+
"${tdir}/python-sambacc.spec"
192+
rm -rf "${tdir}"
186193
done
187194
}
188195

0 commit comments

Comments
 (0)