Bug 1961309 (xcfun) - Review Request: xcfun - A library of approximate exchange-correlation functionals
Summary: Review Request: xcfun - A library of approximate exchange-correlation functio...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: xcfun
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Robert-André Mauchin 🐧
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-17 16:44 UTC by Susi Lehtola
Modified: 2023-05-07 08:11 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-05-07 08:11:26 UTC
Type: ---
Embargoed:
eclipseo: fedora-review+


Attachments (Terms of Use)

Description Susi Lehtola 2021-05-17 16:44:12 UTC
Spec URL: https://jussilehtola.fedorapeople.org/xcfun.spec
SRPM URL: https://jussilehtola.fedorapeople.org/xcfun-2.1.1-1.fc34.src.rpm
Fedora Account System Username: jussilehtola

Description:
XCFun is a library of approximate exchange-correlation functionals,
used in the Density Functional Theory description of electronic
structure. Because XCFun is based on automatic differentiation the
library can provide arbitrary order derivatives of all supported
functionals. Only the exchange-correlation energy expression needs to
be implemented, which is a huge gain in productivity (and also
efficiency). For this reason the library is very well suited for high
order time dependent DFT or for the development of new functionals.

[This is an optional dependence to python-pyscf that hasn't been packaged yet.]

Comment 1 Robert-André Mauchin 🐧 2021-05-21 16:52:12 UTC
  - %cmake already defines -B with the new %cmake macro out or tree builds. See https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds and https://docs.fedoraproject.org/en-US/packaging-guidelines/CMake/

 - Similarly %cmake_build and %cmake_install have been introduced:

%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIB=%{_lib} -DXCFUN_PYTHON_INTERFACE=ON -DPYMOD_INSTALL_LIBDIR=../../%{python3_sitearch}

%cmake_build

%install
%cmake_install

 - and %ctest is now a thing:

%check
%ctest


 - A test is failing:

+ cd x86_64-koji-linux-gnu
+ ctest .
Test project /builddir/build/BUILD/xcfun-2.1.1/x86_64-koji-linux-gnu
    Start 1: testall
1/2 Test #1: testall ..........................   Passed    0.00 sec
    Start 2: python-interface
2/2 Test #2: python-interface .................***Failed    0.02 sec
50% tests passed, 1 tests failed out of 2
Total Test time (real) =   0.03 sec
The following tests FAILED:
	  2 - python-interface (Failed)
Errors while running CTest
Output from these tests are in: /builddir/build/BUILD/xcfun-2.1.1/x86_64-koji-linux-gnu/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.


With the change to %ctest you can actually see the error:

+ /usr/bin/ctest --output-on-failure --force-new-ctest-process -j16
Test project /builddir/build/BUILD/xcfun-2.1.1/x86_64-redhat-linux-gnu
    Start 1: testall
    Start 2: python-interface
1/2 Test #1: testall ..........................   Passed    0.00 sec
2/2 Test #2: python-interface .................***Failed    0.04 sec
/usr/bin/python3: No module named pytest
50% tests passed, 1 tests failed out of 2
Total Test time (real) =   0.05 sec
The following tests FAILED:
	  2 - python-interface (Failed)
Errors while running CTest

So you need to BR pytest

Then numpy:

E   ModuleNotFoundError: No module named 'numpy'


BuildRequires: python3-pytest
BuildRequires: python3-numpy



 - Either fix these permissions or do not ship tests/

python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/__pycache__/test_xcfun.cpython-39.opt-1.pyc 640
python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/__pycache__/test_xcfun.cpython-39.pyc 640
python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/test_xcfun.py 640


 In any case the python bytecode for tests must not be shipped. It is usually handled by our own %pytest macros (PYTHONDONTWRITEBYTECODE=1)




Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: Development (unversioned) .so files in -devel subpackage, if present.
     Note: Unversioned so-files in private %_libdir subdirectory (see
     attachment). Verify they are not in ld path.
[x]: If your application is a C or C++ application you must list a
     BuildRequires against gcc, gcc-c++ or clang.
[x]: Header files in -devel subpackage, if present.
[x]: ldconfig not called in %post and %postun for Fedora 28 and later.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "[generated file]", "*No copyright*
     Mozilla Public License 2.0", "Mozilla Public License 2.0", "*No
     copyright* BSD 3-clause "New" or "Revised" License", "*No copyright*
     [generated file]", "Expat License", "*No copyright* GNU Lesser General
     Public License". 85 files have unknown license. Detailed output of
     licensecheck in /home/bob/packaging/review/xcfun/review-
     xcfun/licensecheck.txt
[x]: License file installed when any subpackage combination is installed.
[x]: %build honors applicable compiler flags or justifies otherwise.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 20480 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[x]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in xcfun-
     devel , python3-xcfun
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on debuginfo package(s).
     Note: No rpmlint messages.
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: xcfun-2.1.1-1.fc35.x86_64.rpm
          xcfun-devel-2.1.1-1.fc35.x86_64.rpm
          python3-xcfun-2.1.1-1.fc35.x86_64.rpm
          xcfun-debuginfo-2.1.1-1.fc35.x86_64.rpm
          xcfun-debugsource-2.1.1-1.fc35.x86_64.rpm
          xcfun-2.1.1-1.fc35.src.rpm
xcfun.x86_64: W: spelling-error Summary(en_US) functionals -> functional, functional s, functionary
xcfun.x86_64: W: spelling-error %description -l en_US functionals -> functional, functional s, functionary
xcfun.x86_64: W: shared-lib-calls-exit /usr/lib64/libxcfun.so.2 exit.5
xcfun-devel.x86_64: W: no-documentation
python3-xcfun.x86_64: W: spelling-error %description -l en_US functionals -> functional, functional s, functionary
python3-xcfun.x86_64: W: no-documentation
python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/__pycache__/test_xcfun.cpython-39.opt-1.pyc 640
python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/__pycache__/test_xcfun.cpython-39.pyc 640
python3-xcfun.x86_64: E: non-readable /usr/lib64/python3.9/site-packages/xcfun/tests/test_xcfun.py 640
xcfun.src: W: spelling-error Summary(en_US) functionals -> functional, functional s, functionary
xcfun.src: W: spelling-error %description -l en_US functionals -> functional, functional s, functionary
6 packages and 0 specfiles checked; 3 errors, 8 warnings.

Comment 2 Susi Lehtola 2021-05-22 17:43:12 UTC
Yes, I know that the newest Fedoras have dedicated cmake macros. However, they are not available on older distros and EPEL. There is nothing wrong in using %make_build and %make_install; the spec also correctly uses an out-of-root build directory.

I've added the missing BRs; the package now builds in mock. I have fixed the installed tests' permissions.

> In any case the python bytecode for tests must not be shipped

Please point me to the section of https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ that states that Python bytecode must not be shipped.

Comment 4 Robert-André Mauchin 🐧 2021-05-22 18:03:01 UTC
(In reply to Susi Lehtola from comment #2)
> Yes, I know that the newest Fedoras have dedicated cmake macros. However,
> they are not available on older distros and EPEL. There is nothing wrong in
> using %make_build and %make_install; the spec also correctly uses an
> out-of-root build directory.
> 

The new macros works even on EPEL7, you just have to use

%undefine __cmake3_in_source_build

to force out-of-tree builds.

And if you target EPEL7, you should use cmake3 instead of cmake:

BuildRequires: cmake3

[…]

%build
%cmake3 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIB=%{_lib} -DXCFUN_PYTHON_INTERFACE=ON -DPYMOD_INSTALL_LIBDIR=../../%{python3_sitearch}
%cmake3_build

%install
%cmake3_install

(it's compatible in Fedora)

> I've added the missing BRs; the package now builds in mock. I have fixed the
> installed tests' permissions.
> 
Ok

> > In any case the python bytecode for tests must not be shipped
> 
> Please point me to the section of
> https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ that
> states that Python bytecode must not be shipped.

I don't know about the guidelines but that's what we do in the macros:

rpm --eval %pytest
\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\
  PATH="/home/bob/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin:$PATH"\
  PYTHONPATH="${PYTHONPATH:-/home/bob/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib64/python3.9/site-packages:/home/bob/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib/python3.9/site-packages}"\
  PYTHONDONTWRITEBYTECODE=1\
  /usr/bin/pytest



I won't block your package for any of this, but please consider it first.

Comment 5 Susi Lehtola 2021-05-22 18:38:05 UTC
The difference is that pytest just runs the tests, and doesn't install anything per se.

Note also that no bytecode gets installed by CMake; it is rpm itself which compiles the bytecode for all the Python libraries.

Comment 6 Robert-André Mauchin 🐧 2021-05-22 18:43:23 UTC
Ok.

Still use cmake3 for EPEL7, even if you don,t choose to use the new macros.

Package approved.

Comment 7 Susi Lehtola 2021-05-23 16:47:18 UTC
Thanks for the review!

Comment 8 Gwyn Ciesla 2021-05-24 13:57:29 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/xcfun

Comment 9 Package Review 2023-05-07 08:11:26 UTC
Package is now in repositories, closing review.


Note You need to log in before you can comment on or make changes to this bug.