Bug 1753837 - Review Request: primecount - Fast prime counting function implementation
Summary: Review Request: primecount - Fast prime counting function implementation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michal Schorm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1753084
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-20 03:38 UTC by Jerry James
Modified: 2019-10-04 20:04 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-10-04 20:04:32 UTC
Type: ---
Embargoed:
mschorm: fedora-review+


Attachments (Terms of Use)

Description Jerry James 2019-09-20 03:38:23 UTC
Spec URL: https://jjames.fedorapeople.org/primecount/primecount.spec
SRPM URL: https://jjames.fedorapeople.org/primecount/primecount-5.1-1.fc32.src.rpm
Fedora Account System Username: jjames
Description: Primecount is a command-line program and C++ library that counts the primes below an integer x<=10**31 using highly optimized implementations of the combinatorial prime counting algorithms.

Primecount includes implementations of all important combinatorial prime counting algorithms known up to this date all of which have been parallelized using OpenMP.  Primecount contains the first ever open source implementations of the Deleglise-Rivat algorithm and Xavier Gourdon's algorithm (that works).  Primecount also features a novel load balancer that is shared amongst all implementations and that scales up to hundreds of CPU cores.  Primecount has already been used to compute several world records e.g. pi(10**27) (http://www.mersenneforum.org/showthread.php?t=20473) and nth_prime(10**24) (https://oeis.org/A006988).

Comment 1 Michal Schorm 2019-09-20 08:16:17 UTC
Hello, I'm a Fedora packager and I'm going to review this package for you.

Comment 2 Michal Schorm 2019-09-20 10:16:02 UTC
The package requires a libdivide package, which is being reviewed by now: https://bugzilla.redhat.com/show_bug.cgi?id=1753084

-----

Here are the steps I took to build the primecount package, test it and run fedora-review tool:

1) Create a workspace
$ mkdir /tmp/primecount_package_review && cd /tmp/primecount_package_review

2) Get the required package, build it with Rawhide mock config
$ wget https://jjames.fedorapeople.org/libdivide/libdivide-2.0-1.fc32.src.rpm && mock -r fedora-rawhide-x86_64 --rebuild libdivide-2.0-1.fc32.src.rpm

3) Create a local repository with the required package
$ mkdir libdivide_repo && cp /var/lib/mock/fedora-rawhide-x86_64/result/libdivide-devel-2.0-1.fc32.noarch.rpm libdivide_repo && createrepo_c libdivide_repo

4) [as root] Fork mock configuration; remove the last line; add custom configuration; append the last line
# cd /etc/mock && cp -p fedora-rawhide-x86_64.cfg fedora-rawhide-x86_64_with_libdivide.cfg
# sed -i '$ d' fedora-rawhide-x86_64_with_libdivide.cfg
# echo '
[local-libdivide]
name=local-libdivide
baseurl=file:///tmp/primecount_package_review/libdivide_repo
enabled=1
skip_if_unavailable=False
"""
' >> fedora-rawhide-x86_64_with_libdivide.cfg

5) Get the current package and rebuild it with the edited mock config
$ wget https://jjames.fedorapeople.org/primecount/primecount-5.1-1.fc32.src.rpm && mock -r fedora-rawhide-x86_64_with_libdivide --rebuild primecount-5.1-1.fc32.src.rpm

6) Download the SPECfile and run fedora-review with the edited mock config
$ wget https://jjames.fedorapeople.org/primecount/primecount.spec && fedora-review -n primecount -m fedora-rawhide-x86_64_with_libdivide

7) Test is mock
$ cd review-primecount/results/
$ mock --init -r fedora-rawhide-x86_64_with_libdivide
$ mock -i ./*4.rpm
$ mock --shell bash
/]# primecount 1000000
78498

-----

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

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

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

C/C++:
[ ]: Package does not contain kernel modules.
[ ]: Package contains no static executables.
[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.
[x]: Development (unversioned) .so files in -devel subpackage, if present.

Generic:
[ ]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[ ]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "BSD 2-clause "Simplified" License",
     "BSD (unspecified)". 145 files have unknown license. Detailed output
     of licensecheck in /tmp/primecount_package_review/review-
     primecount/licensecheck.txt
[ ]: License file installed when any subpackage combination is installed.
[ ]: %build honors applicable compiler flags or justifies otherwise.
[ ]: Package contains no bundled libraries without FPC exception.
[ ]: Changelog in prescribed format.
[ ]: Sources contain only permissible code or content.
[ ]: Package contains desktop file if it is a GUI application.
[ ]: Development files must be in a -devel package
[ ]: Package uses nothing in %doc for runtime.
[ ]: Package consistently uses macros (instead of hard-coded directory
     names).
[ ]: Package is named according to the Package Naming Guidelines.
[ ]: Package does not generate any conflict.
[ ]: Package obeys FHS, except libexecdir and /usr/target.
[ ]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[ ]: Requires correct, justified where necessary.
[ ]: Spec file is legible and written in American English.
[ ]: Package contains systemd file(s) if in need.
[ ]: Useful -debuginfo package or justification otherwise.
[ ]: 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 153600 bytes in 7 files.
[ ]: 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 must own all directories that it creates.
[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 must not depend on deprecated() packages.
[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

===== 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.
[ ]: Final provides and requires are sane (see attachments).
[ ]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in
     primecount , primecount-libs , primecount-devel
[ ]: Package functions as described.
[ ]: Latest version is packaged.
[ ]: Package does not include license text files separate from upstream.
[ ]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[ ]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[ ]: Package should compile and build into binary rpms on all supported
     architectures.
[ ]: %check is present and all tests pass.
[ ]: 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: primecount-5.1-1.fc32.x86_64.rpm
          primecount-libs-5.1-1.fc32.x86_64.rpm
          primecount-devel-5.1-1.fc32.x86_64.rpm
          primecount-debuginfo-5.1-1.fc32.x86_64.rpm
          primecount-debugsource-5.1-1.fc32.x86_64.rpm
          primecount-5.1-1.fc32.src.rpm
primecount.x86_64: W: spelling-error %description -l en_US combinatorial -> combination
primecount.x86_64: W: spelling-error %description -l en_US parallelized -> paralleled, palatalized, pluralized
primecount.x86_64: W: spelling-error %description -l en_US balancer -> balance, balances, balanced
primecount.x86_64: W: spelling-error %description -l en_US amongst -> among st, among-st, among
primecount.x86_64: W: no-documentation
primecount.x86_64: W: no-manual-page-for-binary primecount
primecount-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libprimecount.so.5.1 exit.5
primecount-devel.x86_64: W: spelling-error Summary(en_US) libprimecount -> counterclaim
primecount-devel.x86_64: W: spelling-error %description -l en_US libprimecount -> counterclaim
primecount.src: W: spelling-error %description -l en_US combinatorial -> combination
primecount.src: W: spelling-error %description -l en_US parallelized -> paralleled, palatalized, pluralized
primecount.src: W: spelling-error %description -l en_US balancer -> balance, balances, balanced
primecount.src: W: spelling-error %description -l en_US amongst -> among st, among-st, among
6 packages and 0 specfiles checked; 0 errors, 13 warnings.



Rpmlint (debuginfo)
-------------------
Checking: primecount-debuginfo-5.1-1.fc32.x86_64.rpm
          primecount-libs-debuginfo-5.1-1.fc32.x86_64.rpm
2 packages and 0 specfiles checked; 0 errors, 0 warnings.



Rpmlint (installed packages)
----------------------------
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "C.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "C.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
primecount.x86_64: W: spelling-error %description -l en_US combinatorial -> combination
primecount.x86_64: W: spelling-error %description -l en_US parallelized -> paralleled, palatalized, pluralized
primecount.x86_64: W: spelling-error %description -l en_US balancer -> balance, balances, balanced
primecount.x86_64: W: spelling-error %description -l en_US amongst -> among st, among-st, among
primecount.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
primecount.x86_64: W: no-documentation
primecount.x86_64: W: no-manual-page-for-binary primecount
primecount-debuginfo.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
primecount-libs.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
primecount-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libprimecount.so.5.1 exit.5
primecount-libs-debuginfo.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
primecount-devel.x86_64: W: spelling-error Summary(en_US) libprimecount -> counterclaim
primecount-devel.x86_64: W: spelling-error %description -l en_US libprimecount -> counterclaim
primecount-devel.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
primecount-debugsource.x86_64: W: invalid-url URL: https://github.com/kimwalisch/primecount/ <urlopen error [Errno -2] Name or service not known>
6 packages and 0 specfiles checked; 0 errors, 15 warnings.



Source checksums
----------------
https://github.com/kimwalisch/primecount//archive/v5.1/primecount-5.1.tar.gz :
  CHECKSUM(SHA256) this package     : a69636ddc03788dec1b82a15e39a3bf0cd1ff38c05467471b6c61c4896c0823f
  CHECKSUM(SHA256) upstream package : a69636ddc03788dec1b82a15e39a3bf0cd1ff38c05467471b6c61c4896c0823f


Requires
--------
primecount (rpmlib, GLIBC filtered):
    libc.so.6()(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    libm.so.6()(64bit)
    libprimecount.so.5()(64bit)
    libprimesieve.so.9()(64bit)
    libstdc++.so.6()(64bit)
    libstdc++.so.6(CXXABI_1.3)(64bit)
    primecount-libs(x86-64)
    rtld(GNU_HASH)

primecount-libs (rpmlib, GLIBC filtered):
    libc.so.6()(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    libgcc_s.so.1(GCC_3.4)(64bit)
    libgcc_s.so.1(GCC_4.2.0)(64bit)
    libgcc_s.so.1(GCC_7.0.0)(64bit)
    libgomp.so.1()(64bit)
    libgomp.so.1(GOMP_1.0)(64bit)
    libgomp.so.1(GOMP_4.0)(64bit)
    libgomp.so.1(GOMP_4.5)(64bit)
    libgomp.so.1(OMP_1.0)(64bit)
    libgomp.so.1(OMP_3.0)(64bit)
    libm.so.6()(64bit)
    libprimesieve.so.9()(64bit)
    libstdc++.so.6()(64bit)
    libstdc++.so.6(CXXABI_1.3)(64bit)
    rtld(GNU_HASH)

primecount-devel (rpmlib, GLIBC filtered):
    cmake-filesystem(x86-64)
    libprimecount.so.5()(64bit)
    primecount-libs(x86-64)

primecount-debuginfo (rpmlib, GLIBC filtered):

primecount-debugsource (rpmlib, GLIBC filtered):



Provides
--------
primecount:
    primecount
    primecount(x86-64)

primecount-libs:
    libprimecount.so.5()(64bit)
    primecount-libs
    primecount-libs(x86-64)

primecount-devel:
    primecount-devel
    primecount-devel(x86-64)

primecount-debuginfo:
    debuginfo(build-id)
    primecount-debuginfo
    primecount-debuginfo(x86-64)

primecount-debugsource:
    primecount-debugsource
    primecount-debugsource(x86-64)



Generated by fedora-review 0.7.2 (65d36bb) last change: 2019-04-09
Command line :/usr/bin/fedora-review -n primecount -m fedora-rawhide-x86_64_with_libdivide
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, C/C++, Shell-api
Disabled plugins: Ocaml, Haskell, R, Python, fonts, PHP, SugarActivity, Java, Perl
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

-----

So from the first fast glimpse, ti looks fine.
The package builds, runs and the fedora-review tool haven't reported any severe issues.

Now I'll begin with going through the report step by step by hand to confirm the results are correct and check what the tool couldn't.

Comment 3 Michal Schorm 2019-09-20 12:13:56 UTC
I went through the results and here are my observations:

1) The require on line 20 isn't IMHO needed at all.
If the binary links with the library, the RPM build will automatically generate dependency to that library.

So if you remove the line, it will look like this:
|# dnf install ./primecount-5.1-1.fc32.x86_64.rpm
| Problem: conflicting requests
|  - nothing provides libprimecount.so.5()(64bit) needed by primecount-5.1-1.fc32.x86_64

2) It's better to use the %{set_build_flags}, instead of just %{optflags}. As you can see e.g. here:
https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-connector-c.spec#_78

3) Personally, I prefer to write short patch justification as a comment in the SPECfile and a verbose justification at the beginning of the patch (file).

4) You can also fix some of the RPMLint errors by whitelisting them with a justification.
Take a glimpse at my package, how it looks: https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-connector-c.rpmlintrc

5) I haven't tested it builds and works on all supported architectures, since the requirement is not yet in Fedora.
I marked this BZ as "Depends On: 1753084"

-----

Other than (1), (2) and (5), I don't have any objections and I feel the package is ready for Fedora, after we solve those three findings.

Comment 4 Jerry James 2019-09-21 04:11:42 UTC
Thank you for the review, Michal!  I did indeed forget to mark this review as needing the libdivide review done first, so thank you for taking care of that.

(In reply to Michal Schorm from comment #3)
> 1) The require on line 20 isn't IMHO needed at all.
> If the binary links with the library, the RPM build will automatically
> generate dependency to that library.

You are correct that the library Requires is automatically generated.  However, my reading of https://docs.fedoraproject.org/en-US/packaging-guidelines/#_requiring_base_package is that when there are dependencies between subpackages and the main package, they must be fully specified with %{version}-%{release}.

> 2) It's better to use the %{set_build_flags}, instead of just %{optflags}.
> As you can see e.g. here:
> https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-
> connector-c.spec#_78

I don't see how that can be used in this case.  The whole point is to add -DLIBDIVIDE_SSE2 to the build flags when an x86 architecture is in use.  Otherwise, we let the %cmake macro set the build flags.  Am I missing something?

> 3) Personally, I prefer to write short patch justification as a comment in
> the SPECfile and a verbose justification at the beginning of the patch
> (file).

That's good practice.  I have added justifications to the beginning of the patch files.

> 4) You can also fix some of the RPMLint errors by whitelisting them with a
> justification.
> Take a glimpse at my package, how it looks:
> https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-
> connector-c.rpmlintrc

Thank you for the example.  I've done something similar.

> 5) I haven't tested it builds and works on all supported architectures,
> since the requirement is not yet in Fedora.
> I marked this BZ as "Depends On: 1753084"

Right, no scratch build is possible unless libdivide is bundled.

New URLs:
Spec URL: https://jjames.fedorapeople.org/primecount/primecount.spec
SRPM URL: https://jjames.fedorapeople.org/primecount/primecount-5.1-2.fc32.src.rpm
RPMLINTRC URL: https://jjames.fedorapeople.org/primecount/primecount.rpmlintrc

Comment 5 Michal Schorm 2019-09-23 21:32:40 UTC
(In reply to Jerry James from comment #4)
> > 2) It's better to use the %{set_build_flags}, instead of just %{optflags}.
> > As you can see e.g. here:
> > https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-
> > connector-c.spec#_78
> 
> I don't see how that can be used in this case.  The whole point is to add
> -DLIBDIVIDE_SSE2 to the build flags when an x86 architecture is in use. 
> Otherwise, we let the %cmake macro set the build flags.  Am I missing
> something?

Let me explain:
The code you use now:
 | %build
 | %ifarch %{ix86} x86_64
 | export CFLAGS="%{optflags} -DLIBDIVIDE_SSE2"
 | export CXXFLAGS="$CFLAGS"
 | %endif

If the IF-CLAUSE fail (other than x86 arch), it will result in a situation, when you don't have set any flags.
 | CFLAGS:  
 | CXXFLAGS:  
 | LDFLAGS:  
 | FCFLAGS:  

If the IF-CLAUSE succeed (it is x86 arch), it will set only some of the flags.
 | CFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 |         -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 |         -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DLIBDIVIDE_SSE2 
 | CXXFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 |           -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 |           -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DLIBDIVIDE_SSE2 
 | LDFLAGS:  
 | FCFLAGS:

And if you would use the %{set_build_flags} macro, it would *first* set all of the Fedora common build flags:
 | CFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 |         -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 |         -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
 | CXXFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 |           -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 |           -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
 | LDFLAGS: -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
 | FCFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
 |          -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 |          -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules
and than, you would change / append some on the arches you want.

So there are generally 3 things I believe you missed:
1) You don't use propper flags on non x86 arches
2) You don't use propper flags on all arches (e.g. LDFLAGS) (thus you build binaries e.g. less secure than what Fedora project aims for)
3) As far as I know, the %{set_build_flags} is 'The right way' to set the flags.

The point is that some bunch of wise folks agreed upon a set of flags; so they are IMHO expected to be used.
The %{optflags} is just a subset of them.
Even though, I haven't found the %{set_build_flags} to be required to use; it surely is an added value you can bring to Fedora with minimal effort, making it (both Fedora and your binaries) more stable, secure, and tuned.

Comment 6 Jerry James 2019-09-23 22:05:42 UTC
(In reply to Michal Schorm from comment #5)
> Let me explain:
> The code you use now:
>  | %build
>  | %ifarch %{ix86} x86_64
>  | export CFLAGS="%{optflags} -DLIBDIVIDE_SSE2"
>  | export CXXFLAGS="$CFLAGS"
>  | %endif
> 
> If the IF-CLAUSE fail (other than x86 arch), it will result in a situation,
> when you don't have set any flags.

No, it won't.  The %cmake macro does the equivalent of %set_build_flags, so this simply results in adding one flag on x86 arches, and using the defaults on all other arches.  The libdivide review has completed, so it is now possible to do a scratch build of primecount.  Take a look:

https://koji.fedoraproject.org/koji/taskinfo?taskID=37829514

The proper flags are used on all architectures.

Comment 7 Michal Schorm 2019-09-24 23:06:26 UTC
Alright, I'll take a look at it later.

For now, I don't have any more objections for this package to become a part of Fedora.

If I find anything new, I'll report it as a bug against the package and start a new discussion there.
However there's no blocker at this time, so the review can be finished.

Comment 8 Jerry James 2019-09-25 00:58:40 UTC
Thank you, Michal.  I appreciate the review.

Comment 9 Michal Schorm 2019-09-25 11:45:33 UTC
You were correct with the %cmake setting the flags.

/usr/lib/rpm/macros.d/macros.cmake:
| %cmake \
|  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
|  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
|  ...

That's clever - using Bash way of assingning default value, if the variable is not set.

I didn't knew neither that %cmake macro does this, nor that Bash offers this great functionality.
I'm happy I learned something new :)

Comment 10 Fedora Update System 2019-09-25 15:07:10 UTC
FEDORA-2019-603c8cdce9 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-603c8cdce9

Comment 11 Fedora Update System 2019-09-26 02:56:04 UTC
primecount-5.1-2.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-603c8cdce9

Comment 12 Michal Schorm 2019-09-30 12:21:50 UTC
Wrong BZ, sorry :)

Comment 13 Fedora Update System 2019-10-04 20:04:32 UTC
primecount-5.1-2.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.


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