Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: rpm spec improvements #2815

Merged
merged 1 commit into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions utils/build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fi
LIBFABRIC_MIN_VERSION=1.4.2
NDCTL_MIN_VERSION=58.2.37

RPMBUILD_OPTS=""
RPMBUILD_OPTS=( )
PACKAGE_VERSION=$(get_version $PACKAGE_VERSION_TAG)

if [ -z "$PACKAGE_VERSION" ]
Expand Down Expand Up @@ -226,62 +226,60 @@ then
sed -i '/^#.*bugzilla.redhat/d' $RPM_SPEC_FILE
fi

# do not split on space
IFS=$'\n'

# experimental features
if [ "${EXPERIMENTAL}" = "y" ]
then
# no experimental features for now
RPMBUILD_OPTS+=""
RPMBUILD_OPTS+=( )
fi

# librpmem & rpmemd
if [ "${BUILD_RPMEM}" = "y" ]
then
RPMBUILD_OPTS+="--with rpmem "
RPMBUILD_OPTS+=(--with fabric)
else
RPMBUILD_OPTS+="--without rpmem "
RPMBUILD_OPTS+=(--without fabric)
fi

# daxio
if [ "${NDCTL_ENABLE}" = "y" ]
then
RPMBUILD_OPTS+="--with ndctl "
RPMBUILD_OPTS+=(--with ndctl)
else
RPMBUILD_OPTS+="--without ndctl "
RPMBUILD_OPTS+=(--without ndctl)
fi

# use specified testconfig file or default
if [[( -n "${TEST_CONFIG_FILE}") && ( -f "$TEST_CONFIG_FILE" ) ]]
then
echo "Test config file: $TEST_CONFIG_FILE"
TEST_CONFIG_VAL=${TEST_CONFIG_FILE}
RPMBUILD_OPTS+=(--define "_testconfig $TEST_CONFIG_FILE")
else
echo -e "Test config file $TEST_CONFIG_FILE does not exist.\n"\
"Default test config will be used."
TEST_CONFIG_VAL="default"
fi

# run make check or not
if [ "${BUILD_PACKAGE_CHECK}" = "y" ]
if [ "${BUILD_PACKAGE_CHECK}" == "n" ]
then
CHECK=1
else
CHECK=0
RPMBUILD_OPTS+=(--define "_skip_check 1")
fi

tar zcf $PACKAGE_TARBALL $PACKAGE_SOURCE

# Create directory structure for rpmbuild
mkdir -v BUILD SPECS

echo "opts: $RPMBUILD_OPTS --define _testconfig ${TEST_CONFIG_VAL} --define _check ${CHECK}"
echo "opts: ${RPMBUILD_OPTS[@]}"

rpmbuild --define "_topdir `pwd`"\
--define "_rpmdir ${OUT_DIR}"\
--define "_srcrpmdir ${OUT_DIR}"\
--define "_testconfig ${TEST_CONFIG_VAL}"\
--define "_check ${CHECK}"\
-ta $PACKAGE_TARBALL \
$RPMBUILD_OPTS
${RPMBUILD_OPTS[@]}

echo "Building rpm packages done"

Expand Down
31 changes: 15 additions & 16 deletions utils/pmdk.spec.in
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@

# rpmbuild options:
# --with | --without rpmem
# --with | --without fabric
# --with | --without ndctl
# --define "_testconfig <path to custom testconfig.sh or 'default'>"
# --define "_check <1|0>" - run make check or not
#
# --define _testconfig <path to custom testconfig.sh>
# --define _skip_check 1

# do not terminate build if files in the $RPM_BUILD_ROOT
# directory are not found in the %files (without rpmem case)
%define _unpackaged_files_terminate_build 0

# disable 'make check' on suse
%if %{defined suse_version}
%define _check 0
%define _skip_check 1
%define dist .suse%{suse_version}
%endif

# libfabric v1.4.2 is available on:
# openSUSE Tumbleweed, Leap 15.0, Leap 42.3; SLE 12 SP3, 15
# Fedora >=27; RHEL >=7.5
%if (0%{?suse_version} > 1315) || (0%{?fedora} >= 27) || (0%{?rhel} >= 7)
%bcond_without rpmem
%bcond_without fabric
%else
%bcond_with rpmem
%bcond_with fabric
%endif

# ndctl v59.2 is available on:
Expand Down Expand Up @@ -66,7 +65,7 @@ BuildRequires: ndctl-devel >= %{min_ndctl_ver}
BuildRequires: daxctl-devel >= %{min_ndctl_ver}
%endif

%if %{with rpmem}
%if %{with fabric}
BuildRequires: libfabric-devel >= %{min_libfabric_ver}
%endif

Expand Down Expand Up @@ -571,7 +570,7 @@ debug version is to set the environment variable LD_LIBRARY_PATH to
%doc ChangeLog CONTRIBUTING.md README.md


%if %{with rpmem}
%if %{with fabric}

%package -n librpmem__PKG_NAME_SUFFIX__
Summary: Remote Access to Persistent Memory library
Expand Down Expand Up @@ -648,7 +647,7 @@ and facilitates access to persistent memory over RDMA.
%{_bindir}/rpmemd
%{_mandir}/man1/rpmemd.1.gz

%endif # _with_rpmem
%endif # _with_fabric


%package -n libpmemcto__PKG_NAME_SUFFIX__
Expand Down Expand Up @@ -718,7 +717,7 @@ Requires: libpmemblk__PKG_NAME_SUFFIX__ >= %{version}-%{release}
Requires: libpmemobj__PKG_NAME_SUFFIX__ >= %{version}-%{release}
Requires: libpmempool__PKG_NAME_SUFFIX__ >= %{version}-%{release}
Requires: libpmemcto__PKG_NAME_SUFFIX__ >= %{version}-%{release}
Obsoletes: nvml-tools
Obsoletes: nvml-tools < %{version}-%{release}
%description -n pmempool
The pmempool is a standalone utility for management and off-line analysis
of Persistent Memory pools created by PMDK libraries. It provides a set
Expand Down Expand Up @@ -788,16 +787,16 @@ __MAKE_INSTALL_FDUPES__


%check
%if "%{_check}" == "1"
%if "%{_testconfig}" != "default"
%if 0%{?_skip_check} == 1
echo "Check skipped"
%else
%if %{defined _testconfig}
cp %{_testconfig} src/test/testconfig.sh
%else
echo "PMEM_FS_DIR=/tmp" > src/test/testconfig.sh
echo "PMEM_FS_DIR_FORCE_PMEM=1" >> src/test/testconfig.sh
%endif
make check
%else
echo "Check skipped"
%endif

%post -n libpmem__PKG_NAME_SUFFIX__ -p /sbin/ldconfig
Expand All @@ -817,7 +816,7 @@ __MAKE_INSTALL_FDUPES__
%post -n libpmemcto__PKG_NAME_SUFFIX__ -p /sbin/ldconfig
%postun -n libpmemcto__PKG_NAME_SUFFIX__ -p /sbin/ldconfig

%if %{with rpmem}
%if %{with fabric}
%post -n librpmem__PKG_NAME_SUFFIX__ -p /sbin/ldconfig
%postun -n librpmem__PKG_NAME_SUFFIX__ -p /sbin/ldconfig
%endif
Expand Down