rpmbuild: Add routine for generating a standalone rpm .spec

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ib8e139b928fd3e8cea67ebdc3ff1e464f51598bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8389
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: <tomasz.rochumski@intel.com>
This commit is contained in:
Michal Berger 2021-06-16 11:09:59 +02:00 committed by Tomasz Zawadzki
parent f6ab6c09e3
commit 47ee30d3e3
2 changed files with 16 additions and 3 deletions

View File

@ -32,6 +32,9 @@ function build_rpms() (
} }
build_rpm() { build_rpm() {
# Separate run to see the final .spec in use
GEN_SPEC=yes BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
# Actual build
BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@" BUILDDIR=$builddir MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
install_uninstall_rpms install_uninstall_rpms
} }

View File

@ -65,8 +65,9 @@ get_version() {
echo "${version%%-*}" echo "${version%%-*}"
} }
build_rpm() ( build_macros() {
local macros=() dir local -g macros=()
local dir
macros+=(-D "configure ${configure:-"%{nil}"}") macros+=(-D "configure ${configure:-"%{nil}"}")
macros+=(-D "make $make") macros+=(-D "make $make")
@ -113,9 +114,13 @@ build_rpm() (
macros+=(-D "build_requirements 1") macros+=(-D "build_requirements 1")
macros+=(-D "build_requirements_list $build_requirements") macros+=(-D "build_requirements_list $build_requirements")
fi fi
}
cd "$rootdir" gen_spec() {
rpmspec "${macros[@]}" -P "$spec"
}
build_rpm() (
fedora_python_sys_path_workaround fedora_python_sys_path_workaround
# Despite building in-place, rpmbuild still looks under source dir as defined # Despite building in-place, rpmbuild still looks under source dir as defined
@ -139,4 +144,9 @@ version=${SPDK_VERSION:-$(get_version)}
rpmbuild_dir=${BUILDDIR:-"$HOME/rpmbuild"} rpmbuild_dir=${BUILDDIR:-"$HOME/rpmbuild"}
spec=$specdir/spdk.spec spec=$specdir/spdk.spec
build_macros
if [[ -n $GEN_SPEC ]]; then
gen_spec
exit 0
fi
build_rpm build_rpm