Skip to content

Commit

Permalink
update fedora spec file and tarball generation script (#1770)
Browse files Browse the repository at this point in the history
* update fedora spec file and tarball generation script

The offical fedora rpm depends on the url source tarball.
Split tarball generation out so it is easier to generate.

Generalize the naming of the tarball to follow the convention
of -.tar.gz.

Fix opae.spec to use the new source loction opae-/

Generalize the tarball excludes all hidden files

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* add create tarball script

 - Fix code review comments

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* fix  codeing style

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* fix code review comments

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* fix spec file and create rpm review comments

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* Fix sphinx doc in tarball script

Signed-off-by: lab <lab@psera2-dell21.ra.intel.com>

* fix opae spec review comments

* fix fedora spec file python dependency generator

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* Remove change log from create rpm

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* remove rpmbuild directory after successful build

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* fix rpmlint errors in spec file

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* fix rpmbuild python version error

* fix rpmlint python errors

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>

* Move libfpgad-api.so to devel

Fixes an rpmlint issue

Signed-off-by: Tom Rix <trix@redhat.com>

* Stage the opae tarball with the rpms

Though the tarball can be extracted from the source rpm,
it is convient to have it already have it with the rpms.
This will make posting the tarball in the offical release easier.

Signed-off-by: Tom Rix <trix@redhat.com>

* Exclude jsonscheme_suite from the rpm

This file is part of the jsonscheme internal testsuite, so it is
not needed.  Resolves an rpmlint issue with devel rpm.

Signed-off-by: Tom Rix <trix@redhat.com>

Co-authored-by: lab <lab@psera2-dell21.ra.intel.com>
Co-authored-by: Tom Rix <trix@redhat.com>
  • Loading branch information
3 people committed Jan 26, 2021
1 parent 03a6f3c commit 83b71b5
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 117 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Expand Up @@ -62,9 +62,14 @@ opae_add_subdirectory(opae-libs)
opae_add_subdirectory(external)
opae_add_subdirectory(platforms)
opae_add_subdirectory(tools)
opae_add_subdirectory(samples)
opae_add_subdirectory(python)

option(OPAE_BUILD_SAMPLES "Enable building of OPAE samples" ON)
mark_as_advanced(OPAE_BUILD_SAMPLES)
if(OPAE_BUILD_SAMPLES)
opae_add_subdirectory(samples)
endif()

if(OPAE_BUILD_TESTS)
enable_testing()
opae_add_subdirectory(tests)
Expand Down Expand Up @@ -100,7 +105,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${OPAE_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${OPAE_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${OPAE_VERSION_REVISION}")
set(CPACK_PACKAGE_VERSION ${OPAE_VERSION})
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_RELEASE 2)
set(CPACK_PACKAGE_CONTACT "opae@lists.01.org")
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Hashing the package components
Expand Down
4 changes: 2 additions & 2 deletions opae-libs/plugins/xfpga/common_int.h
Expand Up @@ -73,12 +73,12 @@
#define MAP_1G_HUGEPAGE (0x1e << MAP_HUGE_SHIFT) /* 2 ^ 0x1e = 1G */

#ifdef __ia64__
#define ADDR (void *)(0x8000000000000000UL)
#define ADDR ((void *)(0x8000000000000000UL))
#define FLAGS_4K (MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED)
#define FLAGS_2M (FLAGS_4K | MAP_2M_HUGEPAGE | MAP_HUGETLB)
#define FLAGS_1G (FLAGS_4K | MAP_1G_HUGEPAGE | MAP_HUGETLB)
#else
#define ADDR (void *)(0x0UL)
#define ADDR ((void *)(0x0UL))
#define FLAGS_4K (MAP_PRIVATE | MAP_ANONYMOUS)
#define FLAGS_2M (FLAGS_4K | MAP_2M_HUGEPAGE | MAP_HUGETLB)
#define FLAGS_1G (FLAGS_4K | MAP_1G_HUGEPAGE | MAP_HUGETLB)
Expand Down
101 changes: 45 additions & 56 deletions opae.spec
@@ -1,15 +1,17 @@
Summary: Open Programmable Acceleration Engine (OPAE) SDK
Name: opae
Version: 2.0.0
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
ExclusiveArch: x86_64

Group: Development/Libraries
Vendor: Intel Corporation
Requires: uuid, json-c, python3
URL: https://github.com/OPAE/%{name}-sdk
Source0: https://github.com/OPAE/opae-sdk/releases/download/%{version}-1/%{name}.tar.gz
Source0: https://github.com/OPAE/opae-sdk/releases/download/%{version}-%{Release}/%{name}-%{version}.tar.gz



BuildRequires: gcc, gcc-c++
BuildRequires: cmake
Expand All @@ -20,7 +22,6 @@ BuildRequires: rpm-build
BuildRequires: hwloc-devel
BuildRequires: python3-sphinx
BuildRequires: doxygen
BuildRequires: systemd-rpm-macros
BuildRequires: systemd
BuildRequires: pybind11-devel
BuildRequires: python3-setuptools
Expand Down Expand Up @@ -55,46 +56,22 @@ Requires: libuuid-devel, %{name}%{?_isa} = %{version}-%{release}
OPAE headers, tools, sample source, and documentation


%{?python_disable_dependency_generator}


%prep
%setup -q -n %{name}
%setup -q -n %{name}-%{version}

%build
rm -rf _build
mkdir _build
cd _build

%cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DOPAE_PRESERVE_REPOS=ON -DOPAE_BUILD_LEGACY=ON -B $PWD

%make_build opae-c \
bitstream \
xfpga \
modbmc \
opae-cxx-core \
hello_cxxcore \
board_a10gx \
board_n3000 \
board_d5005 \
fpgaconf \
fpgametrics \
fpgainfo \
userclk \
object_api \
hello_fpga \
hello_events \
bist_app\
fpga_dma_N3000_test\
fpga_dma_test\
opae-c++-utils\
opae-c++-nlb\
nlb0\
nlb3\
nlb7\
mmlink\
fpgad\
fpgad-api\
fpgad-vc\
%cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DOPAE_PRESERVE_REPOS=ON -DOPAE_BUILD_LEGACY=ON -DOPAE_BUILD_SAMPLES=ON -B $PWD

%make_build




%install
Expand All @@ -121,6 +98,7 @@ for s in FindHwloc.cmake \
OPAEPackaging.cmake
do
cp "opae-libs/cmake/modules/${s}" %{buildroot}%{_usr}/src/opae/opae-libs/cmake/modules
chmod a+x %{buildroot}%{_usr}/src/opae/opae-libs/cmake/modules/$s
done

mkdir -p %{buildroot}%{_usr}/src/opae/samples
Expand Down Expand Up @@ -166,26 +144,24 @@ DESTDIR=%{buildroot} cmake -DCOMPONENT=toolfpgad_api -P cmake_install.cmake
DESTDIR=%{buildroot} cmake -DCOMPONENT=toolfpgad_vc -P cmake_install.cmake

prev=$PWD
pushd %{_topdir}/BUILD/opae/python/opae.admin/
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} --record=$prev/INSTALLED_OPAE_ADMIN_FILES
pushd %{_topdir}/BUILD/%{name}-%{version}/python/opae.admin/
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot}
popd

pushd %{_topdir}/BUILD/opae/python/pacsign
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} --record=$prev/INSTALLED_PACSIGN_FILES
pushd %{_topdir}/BUILD/%{name}-%{version}/python/pacsign
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot}
popd

pushd %{_topdir}/BUILD/opae/scripts
pushd %{_topdir}/BUILD/%{name}-%{version}/scripts
install -m 755 eth_group_mdev.sh %{buildroot}/usr/bin/eth_group_mdev.sh
popd

%post
%systemd_post fpgad.service

%preun
%systemd_preun fpgad.service

%postun
%systemd_postun_with_restart fpgad.service
for file in %{buildroot}%{python3_sitelib}/opae/admin/tools/{fpgaflash,fpgaotsu,fpgaport,fpgasupdate,ihex2ipmi,rsu,super_rsu,bitstream_info}.py; do
chmod a+x $file
done


%files
%dir %{_datadir}/opae
Expand All @@ -203,6 +179,15 @@ popd
%{_libdir}/libopae-c++-utils.so.2
%{_libdir}/libopae-c++-nlb.so.%{version}
%{_libdir}/libopae-c++-nlb.so.2
%{_libdir}/libfpgad-api.so.%{version}
%{_libdir}/libfpgad-api.so.2


%post devel
%systemd_post fpgad.service

%preun devel
%systemd_preun fpgad.service


%files devel
Expand All @@ -223,9 +208,11 @@ popd
%{_libdir}/libopae-c++-utils.so
%{_libdir}/libopae-c.so
%{_libdir}/libbitstream.so
%{_libdir}/libfpgad-api.so
%{_libdir}/opae/libxfpga.so*
%{_libdir}/opae/libmodbmc.so*
%{_bindir}/bist_app*
%{_bindir}/dummy_afu
%{_bindir}/bist_common.py*
%{_bindir}/bist_dma.py*
%{_bindir}/bist_def.py*
Expand Down Expand Up @@ -262,24 +249,26 @@ popd
%{_bindir}/fpgametrics
%{_bindir}/fpga_dma_N3000_test
%{_bindir}/fpga_dma_test
%{_bindir}/PACSign
%{_bindir}/PACSign*
%{_bindir}/fpgad
/etc/opae/fpgad.cfg
/etc/sysconfig/fpgad.conf
%{_libdir}/libfpgad-api.so*
%config(noreplace) %{_sysconfdir}/opae/fpgad.cfg*
%config(noreplace) %{_sysconfdir}/sysconfig/fpgad.conf*
%{_unitdir}/fpgad.service
%{_libdir}/opae/libfpgad-vc.so*
/usr/lib/systemd/system/fpgad.service
%{_bindir}/eth_group_mdev.sh


%{_usr}/share/opae/*
/usr/lib/python*
%{_datadir}/doc/opae.admin/LICENSE


%{python3_sitelib}/opae*
%{python3_sitelib}/pacsign*
# part of the jsonschema testsuite, do not deliver
%exclude /usr/share/opae/python/jsonschema-2.3.0/json/bin/jsonschema_suite

%changelog
* Thu Sep 17 2020 Ananda Ravuri <ananda.ravuri@intel.com> 2.0.0-1
* Mon Dec 14 2020 The OPAE Dev Team <opae@lists.01.org> - 2.0.0-2
- Update OPAE spec file and tarball generation script
- Fix build errors

* Thu Sep 17 2020 Ananda Ravuri <ananda.ravuri@intel.com> 2.0.0-1
- Various Static code scan bug fixes
- Added support to FPGA Linux kernel Device Feature List (DFL) driver.
- Added support to PAC card N3000 series.
Expand Down
2 changes: 2 additions & 0 deletions packaging/opae/rpm/clean
Expand Up @@ -31,5 +31,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
RPMBUILD_DIR="${SCRIPT_DIR}/rpmbuild"

rm -rf "${RPMBUILD_DIR}"
rm -f "${SCRIPT_DIR}"/opae-*.tar.gz
rm -f "${SCRIPT_DIR}"/opae-*.src.rpm
rm -f "${SCRIPT_DIR}"/opae-*.x86_64.rpm
rm -f "${SCRIPT_DIR}"/opae.spec
110 changes: 55 additions & 55 deletions packaging/opae/rpm/create
Expand Up @@ -31,31 +31,63 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source "${SCRIPT_DIR}/../version"

version=$PROJECT_VERSION
echo "version:$version"

release=$PROJECT_RELEASE
echo "release:$release"



RPMBUILD_DIR="${SCRIPT_DIR}/rpmbuild"
SDK_DIR="$(cd "${SCRIPT_DIR}/../../../" && pwd)"

# Check for prerequisite packages.
for pkg in 'make' \
'cmake' \
'git' \
'gcc' \
'gcc-c++' \
'doxygen' \
'hwloc-devel' \
'json-c-devel' \
'libuuid-devel' \
'python3-sphinx' \
'python3-devel' \
'rpm-build' \
'hwloc-devel' \
'json-c-devel' \
'libuuid-devel' \
'python3-sphinx' \
'python3-devel' \
'pybind11-devel' \
'python3-pip' \
'rpm-build' \
'python3-virtualenv' \
'python3-pip' \
'systemd' \
'systemd-rpm-macros' \
'rpmdevtools'
do
yum list installed "${pkg}" >/dev/null 2>&1
dnf list installed "${pkg}" >/dev/null 2>&1
if [ $? -ne 0 ]; then
printf "${pkg} package not found.. exiting\n"
exit 1
fi
done

rm -rf "${RPMBUILD_DIR}"
mkdir -p "${RPMBUILD_DIR}"

# clone opae legancy and tests

CMAKE_BUILD_DIR="${SDK_DIR}/_build"
rm -rf ${CMAKE_BUILD_DIR}
mkdir ${CMAKE_BUILD_DIR}

cmake -S ${SDK_DIR} -B ${CMAKE_BUILD_DIR} -DOPAE_BUILD_LEGACY=ON -DOPAE_BUILD_TESTS=ON


# Create source tarball.
cd "${SCRIPT_DIR}"

./create-tarball.sh opae-${version}

# Create rpm build folder
mkdir -p "${RPMBUILD_DIR}"
for d in 'SOURCES' \
'BUILD' \
'RPMS' \
Expand All @@ -66,57 +98,21 @@ do
mkdir -p "${RPMBUILD_DIR}/$d"
done

# Create source tarball.
cd "${SDK_DIR}/.."
tar --transform='s/opae-sdk/opae/' \
--exclude=.git \
--exclude=.gitignore \
--exclude=.github \
--exclude=.travis.yml \
--exclude=opae.spec.in \
--exclude=opae.spec \
--exclude=opae-libs/external \
--exclude=opae-libs/tests \
--exclude=opae-libs/plugins/ase \
--exclude=opae-libs/cmake/config/libopae-all.spec.in \
--exclude=opae-libs/cmake/config/run_coverage_test.sh.in \
--exclude=opae-libs/cmake/config/run_coverage_test_local.sh.in\
--exclude=external \
--exclude=platforms \
--exclude=samples/base \
--exclude=samples/hello_afu \
--exclude=samples/hello_mpf_afu \
--exclude=samples/intg_xeon_nlb \
--exclude=samples/base \
--exclude=scripts \
--exclude=tests \
--exclude=tools/fpgametrics \
--exclude=tools/libboard/board_dc \
--exclude=tools/extra/ras \
--exclude=tools/extra/fpgabist \
--exclude=tools/extra/pac_hssi_config \
--exclude=tools/extra/fpgadiag \
--exclude=tools/extra/c++utils \
--exclude=tools/extra/pyfpgadiag \
--exclude=tools/extra/pypackager \
--exclude=tools/utilities \
--exclude=opae-libs/include/opae/cxx/.clang-format \
--exclude=opae-libs/libopaecxx/.clang-format \
--exclude=opae-libs/pyopae/.clang-format \
--exclude=opae-libs/.clang-format \
--exclude=opae-libs/.clang-format \
-z -c -f opae.tar.gz opae-sdk

mv opae.tar.gz "${RPMBUILD_DIR}/SOURCES"
# Move tarball to where the rpms will be created
mv ${SDK_DIR}/../opae-${version}.tar.gz .
# Copy the tarball to the rpm SOURCES dir
cp opae-${version}.tar.gz "${RPMBUILD_DIR}/SOURCES"

cp "${SDK_DIR}/opae.spec" ${SCRIPT_DIR}

cd "${SCRIPT_DIR}"





cp ./opae.spec "${RPMBUILD_DIR}/SPECS"

${SDK_DIR}/packaging/changelog.py rpm \
--git-dir="${SDK_DIR}/.git" \
--project="opae" \
--project-version="${PROJECT_VERSION}" \
>> "${RPMBUILD_DIR}/SPECS/opae.spec"

# Create RPMS.
cd "${RPMBUILD_DIR}/SPECS"
Expand All @@ -137,3 +133,7 @@ fi
cd "${SCRIPT_DIR}"
mv "${RPMBUILD_DIR}"/RPMS/x86_64/opae-* "${SCRIPT_DIR}"
mv "${RPMBUILD_DIR}"/SRPMS/opae-*.src.rpm "${SCRIPT_DIR}"

# delete rpmbuild directory
rm -rf $RPMBUILD_DIR
rm -rf opae.spec

0 comments on commit 83b71b5

Please sign in to comment.