From 83b71b57e80f13b0e1d188d4eedcae5d044e13f2 Mon Sep 17 00:00:00 2001 From: Ananda Ravuri <33236856+anandaravuri@users.noreply.github.com> Date: Tue, 26 Jan 2021 15:55:43 -0800 Subject: [PATCH] update fedora spec file and tarball generation script (#1770) * 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 * add create tarball script - Fix code review comments Signed-off-by: anandaravuri * fix codeing style Signed-off-by: anandaravuri * fix code review comments Signed-off-by: anandaravuri * fix spec file and create rpm review comments Signed-off-by: anandaravuri * Fix sphinx doc in tarball script Signed-off-by: lab * fix opae spec review comments * fix fedora spec file python dependency generator Signed-off-by: anandaravuri * Remove change log from create rpm Signed-off-by: anandaravuri * remove rpmbuild directory after successful build Signed-off-by: anandaravuri * fix rpmlint errors in spec file Signed-off-by: anandaravuri * fix rpmbuild python version error * fix rpmlint python errors Signed-off-by: anandaravuri * Move libfpgad-api.so to devel Fixes an rpmlint issue Signed-off-by: Tom Rix * 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 * 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 Co-authored-by: lab Co-authored-by: Tom Rix --- CMakeLists.txt | 9 ++- opae-libs/plugins/xfpga/common_int.h | 4 +- opae.spec | 101 +++++++++++------------- packaging/opae/rpm/clean | 2 + packaging/opae/rpm/create | 110 +++++++++++++-------------- packaging/opae/rpm/create-tarball.sh | 35 +++++++++ packaging/opae/version | 4 +- 7 files changed, 148 insertions(+), 117 deletions(-) create mode 100755 packaging/opae/rpm/create-tarball.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index c23f902f1bdf..23551e69ae79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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 diff --git a/opae-libs/plugins/xfpga/common_int.h b/opae-libs/plugins/xfpga/common_int.h index 12e817b280c0..f9eb4b9bebd2 100644 --- a/opae-libs/plugins/xfpga/common_int.h +++ b/opae-libs/plugins/xfpga/common_int.h @@ -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) diff --git a/opae.spec b/opae.spec index a0f01aab18c5..9dfe655a35b9 100644 --- a/opae.spec +++ b/opae.spec @@ -1,7 +1,7 @@ Summary: Open Programmable Acceleration Engine (OPAE) SDK Name: opae Version: 2.0.0 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD ExclusiveArch: x86_64 @@ -9,7 +9,9 @@ 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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* @@ -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 2.0.0-1 +* Mon Dec 14 2020 The OPAE Dev Team - 2.0.0-2 +- Update OPAE spec file and tarball generation script +- Fix build errors + +* Thu Sep 17 2020 Ananda Ravuri 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. diff --git a/packaging/opae/rpm/clean b/packaging/opae/rpm/clean index 8a087c43923f..f15b85cf09b1 100755 --- a/packaging/opae/rpm/clean +++ b/packaging/opae/rpm/clean @@ -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 diff --git a/packaging/opae/rpm/create b/packaging/opae/rpm/create index 74d43d59ac3f..779e5a4a177e 100755 --- a/packaging/opae/rpm/create +++ b/packaging/opae/rpm/create @@ -31,22 +31,39 @@ 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 @@ -54,8 +71,23 @@ do 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' \ @@ -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" @@ -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 diff --git a/packaging/opae/rpm/create-tarball.sh b/packaging/opae/rpm/create-tarball.sh new file mode 100755 index 000000000000..6970c1fdab8d --- /dev/null +++ b/packaging/opae/rpm/create-tarball.sh @@ -0,0 +1,35 @@ +#!/bin/sh + + +SCRIPT_DIR=`dirname $0` +SCRIPT_DIR=`realpath $SCRIPT_DIR` +TOP_DIR=`realpath ${SCRIPT_DIR}/../../..` + +# Input is the name of the directory the tarball will +# be unpacked to. +opae_dir=${1:-opae} +trans="s/opae-sdk/${opae_dir}/" + +echo $opae_dir + +echo ${TOP_DIR} + +cd ${TOP_DIR}/.. +tar --transform=$trans \ + --exclude=_build \ + --exclude=.* \ + --exclude=*~ \ + --exclude=doc/sphinx \ + --exclude=opae-libs/plugins/ase \ + --exclude=external/opae-legacy/tests \ + --exclude=external/opae-legacy/scripts \ + --exclude=external/opae-legacy/tools/coreidle \ + --exclude=external/opae-legacy/tools/hssi \ + --exclude=tools/extra/pyfpgadiag \ + --exclude=tools/extra/pypackager \ + --exclude=packaging/opae/rpm/create-tarball.sh \ + --exclude=packaging/opae/rpm/create \ + --exclude=packaging/opae/rpm/opae.spec \ + --exclude=packaging/opae/rpm/clean \ + -z -c -f ${opae_dir}.tar.gz opae-sdk + diff --git a/packaging/opae/version b/packaging/opae/version index 572afe45c436..54a2143d518f 100755 --- a/packaging/opae/version +++ b/packaging/opae/version @@ -24,5 +24,5 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -PROJECT_VERSION='1.4.0' -PROJECT_RELEASE='1' +PROJECT_VERSION='2.0.0' +PROJECT_RELEASE='2'