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

update fedora spec file and tarball generation script #1770

Merged
merged 19 commits into from
Jan 26, 2021

Conversation

anandaravuri
Copy link
Contributor

Tom PR changes "Split tarball generation for rpm generation #1753" in incorporated
#1753

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

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>
@anandaravuri anandaravuri requested a review from a team as a code owner December 4, 2020 16:49
michelleyho
michelleyho previously approved these changes Dec 4, 2020
'python3-virtualenv' \
'python3-pip' \
'systemd' \
'systemd-rpm-macros' \
'rpmdevtools'
do
yum list installed "${pkg}" >/dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use dnf instead of yum

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

 - Fix code review comments

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
r-rojo
r-rojo previously approved these changes Dec 8, 2020
packaging/opae/rpm/create Outdated Show resolved Hide resolved
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
opae.spec Outdated
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}-1/%{name}-%{version}.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the '1' in %{version}-1 should be replaced by a variable.
Perhaps using %{release} or %{Release} could work since the release is set in line 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

opae.spec Show resolved Hide resolved
tswhison
tswhison previously approved these changes Dec 10, 2020
@gwencasey96
Copy link

gwencasey96 commented Dec 11, 2020 via email

rm -rf _build
mkdir _build
cd _build
cmake .. -DOPAE_BUILD_LEGACY=ON -DOPAE_BUILD_TESTS=ON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command is erroring out because line 88 changes directory to the parent of the codebase root directory (${SDK_DIR}).
A better way would be to not change directories and use source/build paths when calling cmake.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


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}" \
--project-version="${version}" \
>> "${RPMBUILD_DIR}/SPECS/opae.spec"
Copy link
Contributor

@r-rojo r-rojo Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appends the latest changelog commits to the the end of the opae.spec copy which violates the requirement that the changelog be in reverse descending order.
We either need to insert the changelog commits in opae.spec or use the output of the this script to insert it in the appropriate location. I would recommend we do the former (committing it in opae.spec) instead of calling it in create. Doing it this way also allows for the creation of the RPM(s) depend only on the tarball and the .spec file itself.
It would looks something like the following (note, I had to manually set the release in this text as this changelog script only uses the version):

* Mon Dec 14 2020 The OPAE Dev Team <opae@lists.01.org> - 2.0.0-2
- fix code review comments
- fix  coding style
- add create tarball script
- update fedora spec file and tarball generation script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was that there should be no changelog stored in opae.spec (the last thing in the file would be the %changelog line). This way, we don't need to maintain super long changelogs, and we're not shipping changelogs for releases where they don't apply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not fixed because this script is still appending changelog to the opae.spec copy in ${RPMBUILD_DIR}/SPECS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${RPMBUILD_DIR}/SPECS add change log specific to PR

%changelog-> Release info, highlights of this release

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a change log is required in the fedora project so when this spec file is moved there at the least the release builds will need to be tracked

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed
Remove ${RPMBUILD_DIR}/SPECS from RPM create file.
change log hard coded in opae.spec file

fpgad\
fpgad-api\
fpgad-vc\
%cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DOPAE_PRESERVE_REPOS=ON -DOPAE_BUILD_LEGACY=ON -DOPAE_BUILD_SAMPLES=ON -B $PWD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to specify python version as 3.9 as it defaults to 2.7.

-DOPAE_PYTHON_VERSION=3.9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default rpm creation process uses python version 3.9 , no need to set python version in cmake

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to tell OPAE build system which Python to look for. This default used to be 2.7 but was changed to 3.6 before it was changed to 3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the cmake infra auto detect the python version and bail when it is not supported ? I am thinking of the use case where 3.8 would also work and the user would need to know to upgrade to 3.9 and to use 3.9 in the configure step

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding -DOPAE_PYTHON_VERSION=3.9 we are essentially telling cmake to bail if the Python that is found is not 3.9.
That is why we should change it from 2.7 to 3.9. We could also omit the version from the call to find_package but I'd rather not and be explicit about the required Python version.

@r-rojo
Copy link
Contributor

r-rojo commented Dec 15, 2020

@gwencasey96,
I tried to reproduce the build errors using rawhide container image (fedroa34) and did not run into the build error you mention with eth_group.cpp. I did run into other issues using the create script and a few more with the opae.spec file which I've addressed those in this PR.
Also, the spec file uses the %make_build macro which results in calling make with multiple jobs and fails for me in my container environment (while compiling a different file hssi.cpp).
Can you provide the details on the failure with eth_group.cpp? If the failure happens but the root cause isn't obvious, try changing the opae.spec file to use make with a single job.

/usr/bin/make -O -j1 V=1 VERBOSE=1

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
--exclude=_build \
--exclude=.* \
--exclude=*~ \
--exclude=doc\sphinx \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be doc/sphinx?

fpgad\
fpgad-api\
fpgad-vc\
%cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DOPAE_PRESERVE_REPOS=ON -DOPAE_BUILD_LEGACY=ON -DOPAE_BUILD_SAMPLES=ON -B $PWD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to tell OPAE build system which Python to look for. This default used to be 2.7 but was changed to 3.6 before it was changed to 3

opae.spec Outdated
* 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
- fix code review comments
- fix codeing style
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/codeing/coding/


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}" \
--project-version="${version}" \
>> "${RPMBUILD_DIR}/SPECS/opae.spec"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not fixed because this script is still appending changelog to the opae.spec copy in ${RPMBUILD_DIR}/SPECS.

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

@r-rojo r-rojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Python files, we should either do one of the following choices:

  • remove --record in the setup call and be a little more explicit in the glob pattern for the Python files installed.
%files devel
#...
/usr/lib/python3*/site-packages/opae
/usr/lib/python3*/site-packages/pacsign
  • concatenate the two files (INSTALLED_OPAE_ADMIN_FILES, INSTALLED_PACSIGN_FILES) into a file that gets referenced in the %files devel section, like the following:
cat $prev/INSTALLED_OPAE_ADMIN_FILES >$prev/DEVEL_PYTHON_INSTALLED_FILES
cat $prev/INSTALLED_PACSIGN_FILES >>$prev/DEVEL_PYTHON_INSTALLED_FILES

%files devel -f DEVEL_PYTHON_INSTALLED_FILES

Also, pacsign has a dependency on python-pkcs11 but there doesn't seem to be an RPM that installs it.
Because of this, the dependency generator in rpmbuild will create an implicit dependency for it.
The best way to install it right now is with pip (pip install python-pkcs11) and beecause we can't express this dependency as an RPM dependency right now, it's best we tell rpmbuild to disable the dependency generator with this %{?python_disable_dependency_generator}
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_dependencies

opae.spec Outdated
@@ -166,15 +142,15 @@ 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/
pushd %{_topdir}/BUILD/%{name}-%{version}/python/opae.admin/
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} --record=$prev/INSTALLED_OPAE_ADMIN_FILES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--record is used to record the files installed but the file (INSTALLED_OPAE_ADMIN_FILES) isn't referenced

opae.spec Outdated
%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} --record=$prev/INSTALLED_OPAE_ADMIN_FILES
popd

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--record is used to record the files installed but the file (INSTALLED_PACSIGN_FILES) isn't referenced.

opae.spec Outdated
@@ -300,4 +281,4 @@ popd
- Various compiler warning fixes
- Various memory leak fixes
- Various Static code scan bug fixes
- Added new FPGA MMIO API to write 512 bits
- Added new FPGA MMIO API to write 512 bits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing EOL char

r-rojo
r-rojo previously approved these changes Dec 17, 2020
@r-rojo r-rojo dismissed their stale review December 17, 2020 01:00

I missed it was still missing this: %{?python_disable_dependency_generator}

%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} --record=$prev/INSTALLED_OPAE_ADMIN_FILES
popd

pushd %{_topdir}/BUILD/opae/python/pacsign
pushd %{_topdir}/BUILD/%{name}-%{version}/python/pacsign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still missing this macro:

%{?python_disable_dependency_generator}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

anandaravuri and others added 3 commits January 4, 2021 08:52
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
Copy link

@gwencasey96 gwencasey96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build was successful on Fedora rawhide as of yesterday and successful on Fedora 33 as of today-but you may have one extra rpmbuild directory you do not need with the tarball that create built

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
@@ -73,12 +73,12 @@
#define MAP_1G_HUGEPAGE (0x1e << MAP_HUGE_SHIFT) /* 2 ^ 0x1e = 1G */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a part of opae-libs, so it needs to be submitted to that repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anandaravuri, please be sure this file is removed from the pull request and submitted to opae-libs instead.

@trixirt
Copy link
Contributor

trixirt commented Jan 13, 2021

issues above look ok.
I ran into a what is likely a first time install issue.
rpm -i packaging/opae/rpm/opae-2.0.0-2.fc33.x86_64.rpm
Failed to preset unit: Unit file fpgad.service does not exist.

running rpmlint on opae and opae-devel show known problems.
A new problem
opae-devel.x86_64: E: non-devel-file-in-devel-package /usr/lib64/libfpgad-api.so.2.0.0
likely means this should either move to the opae package or a non system dir like /usr/lib64/opae/

@tswhison
Copy link
Contributor

Hi Tom, regarding the placement of libfpgad-api.so.2.0.0, this library is the glue between the fpgad daemon and the plugins that it loads. The remainder of the fpgad files are also packaged in opae-devel. Should we place this file elsewhere when all the other files are in opae-devel? Just trying to understand the best approach.

@trixirt
Copy link
Contributor

trixirt commented Jan 14, 2021

i think rpmlint is getting hung up with all the *.so going to -devel. I think libfpgad-api.so need to be handled like the other versioned *.so's .. I am thinking of something like this

diff --git a/opae.spec b/opae.spec
index 10bf783c..6a18fb68 100644
--- a/opae.spec
+++ b/opae.spec
@@ -183,7 +183,8 @@ 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

%files devel
%dir %{_includedir}/opae
@@ -203,6 +204,7 @@ 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*
@@ -247,7 +249,6 @@ popd
%{_bindir}/fpgad
/etc/opae/fpgad.cfg
/etc/sysconfig/fpgad.conf
-%{_libdir}/libfpgad-api.so*
%{_libdir}/opae/libfpgad-vc.so*
/usr/lib/systemd/system/fpgad.service
%{_bindir}/eth_group_mdev.sh

Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
tswhison
tswhison previously approved these changes Jan 20, 2021
anandaravuri and others added 5 commits January 22, 2021 09:49
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
Fixes an rpmlint issue

Signed-off-by: Tom Rix <trix@redhat.com>
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>
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>
@r-rojo r-rojo merged commit 83b71b5 into release/2.0.0-2 Jan 26, 2021
@r-rojo r-rojo deleted the aravuri/fix_spec branch January 26, 2021 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants