Skip to content

Commit

Permalink
rpmbuild: Add routine for generating a standalone rpm .spec
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Berger <[email protected]>
Change-Id: Ib8e139b928fd3e8cea67ebdc3ff1e464f51598bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8389
Community-CI: Broadcom CI <[email protected]>
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Konrad Sztyber <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Ben Walker <[email protected]>
Reviewed-by: Pawel Piatek <[email protected]>
Reviewed-by: Karol Latecki <[email protected]>
Reviewed-by: <[email protected]>
  • Loading branch information
Michal Berger authored and tomzawadzki committed Dec 23, 2021
1 parent f6ab6c0 commit 47ee30d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions autopackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function build_rpms() (
}

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" "$@"
install_uninstall_rpms
}
Expand Down
16 changes: 13 additions & 3 deletions rpmbuild/rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ get_version() {
echo "${version%%-*}"
}

build_rpm() (
local macros=() dir
build_macros() {
local -g macros=()
local dir

macros+=(-D "configure ${configure:-"%{nil}"}")
macros+=(-D "make $make")
Expand Down Expand Up @@ -113,9 +114,13 @@ build_rpm() (
macros+=(-D "build_requirements 1")
macros+=(-D "build_requirements_list $build_requirements")
fi
}

cd "$rootdir"
gen_spec() {
rpmspec "${macros[@]}" -P "$spec"
}

build_rpm() (
fedora_python_sys_path_workaround

# Despite building in-place, rpmbuild still looks under source dir as defined
Expand All @@ -139,4 +144,9 @@ version=${SPDK_VERSION:-$(get_version)}
rpmbuild_dir=${BUILDDIR:-"$HOME/rpmbuild"}
spec=$specdir/spdk.spec

build_macros
if [[ -n $GEN_SPEC ]]; then
gen_spec
exit 0
fi
build_rpm

0 comments on commit 47ee30d

Please sign in to comment.