autopackage: Add test for building rpm from generated .spec

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I220efe860e12338da14534267a77c6521f3ce91d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8391
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Michal Berger 2021-06-16 13:23:48 +02:00 committed by Tomasz Zawadzki
parent f3b3c5bd84
commit 3450f93517

View File

@ -21,7 +21,7 @@ function build_rpms() (
unset -v LD_LIBRARY_PATH
install_uninstall_rpms() {
rpms=("$builddir/rpm/x86_64/"*.rpm)
rpms=("${1:-$builddir/rpm/}/x86_64/"*.rpm)
sudo rpm -i "${rpms[@]}"
# Check if we can find one of the apps in the PATH now and verify if it doesn't miss
@ -45,11 +45,37 @@ function build_rpms() (
build_rpm --with-shared --with-dpdk
}
build_rpm_from_gen_spec() {
GEN_SPEC=yes \
USE_DEFAULT_DIRS=yes \
MAKEFLAGS="$MAKEFLAGS" \
SPDK_VERSION="$version" \
DEPS=no \
"$rootdir/rpmbuild/rpm.sh" --with-shared > "$builddir/gen-spdk.spec"
# Default locations should be in use.
sourcedir=$(rpm --eval "%{_sourcedir}") rpmdir=$(rpm --eval "%{_rpmdir}")
mkdir -p "$sourcedir" "$rpmdir"
# Prepare the source at the default location - default %prep step requires
# extra dir inside the source package hence the dance with symlinking to
# the repo (after the extraction source should be under spdk-$version/) -
# make sure symlinking is done outside of the repo to avoid nasty loops.
ln -s "$rootdir" "/tmp/spdk-$version"
tar -czhf "$sourcedir/spdk-$version.tar.gz" -C /tmp "spdk-$version"
# See rpm.sh for details on the PYTHONPATH HACK
PYTHONPATH="$(python3 -c "import sys; print('%s' % ':'.join(sys.path)[1:])")" \
rpmbuild -ba "$builddir/gen-spdk.spec"
install_uninstall_rpms "$rpmdir"
}
version="test_shared"
builddir=$SPDK_TEST_STORAGE/test-rpm
run_test "build_shared_rpm" build_rpm --with-shared
run_test "build_shared_rpm_with_rpmed_dpdk" build_rpm_with_rpmed_dpdk
run_test "build_rpm_from_gen_spec" build_rpm_from_gen_spec
if [[ -n $SPDK_TEST_NATIVE_DPDK ]]; then
version="test_shared_native_dpdk"