Bug 759823 - Review Request: libkdtree++ - C++ template container implementation of kd-tree sorting
Summary: Review Request: libkdtree++ - C++ template container implementation of kd-tre...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Rich Mattes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-04 02:08 UTC by Eric Smith
Modified: 2012-12-20 15:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-20 15:00:14 UTC
Type: ---
Embargoed:
richmattes: fedora-review+
gwync: fedora-cvs+


Attachments (Terms of Use)
Enable debuginfo generation (1.23 KB, patch)
2012-10-13 16:53 UTC, Rich Mattes
no flags Details | Diff

Description Eric Smith 2011-12-04 02:08:05 UTC
Spec URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++.spec
SRPM URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++-0.7.0-1.fc14.src.rpm
Description:
libkdtree++ is a C++ template container implementation of
k-dimensional space sorting, using a kd-tree.


NOTE: I am packaging libkdtree++ as a prerequisite to packaging OpenNERO.

Comment 1 Rich Mattes 2012-01-24 04:28:26 UTC
A couple of comments:

1. It looks like there are some python bindings, have you considered building and installing them?

2. Have you thought about configuring and including the pkg-config file?  It would probably help with other projects that want to build against libkdtree++

Comment 2 Eric Smith 2012-01-24 07:12:10 UTC
Thanks for the comments.  I'll update it to include the pkg-config file. I'll look into packaging the Python bindings; I didn't do it previously only because OpenNERO doesn't need them, and I've never packaged Python bindings before.

Comment 3 Michael Schwendt 2012-02-06 13:15:03 UTC
> %build
> # There isn't really any "build" necessary, as the library consists
> # only of C++ templates in header files.

Which effectively makes it a static-only package that requires special
handling:
https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries_2

Comment 4 Eric Smith 2012-02-06 20:11:20 UTC
That doesn't make it a static library.  Since there is no linked output, it is neither a static library nor a dynamic library.  It is just a set of headers.  I have packaged it similarly to other Fedora packages that are C++ headers only.

I still need to package the python bindings and pkg-config file as requested by Rich Mattes.

Comment 5 Rich Mattes 2012-04-27 23:11:48 UTC
Any updates here?

Comment 6 Michael Schwendt 2012-04-28 09:57:45 UTC
Compiling C++ template headers results in binary code that is built into the target program. The same applies to inline functions defined in C headers. If the headers change due to a fix for a bug or for a security vulnerability, you need to recompile every program that uses the headers.

In case other -devel packages in the Fedora Package Collection also include only C++ templates, they would also need to be handled appropriately. Also, there may be some -devel library packages, where the included headers *also* define a few inline functions or template classes, and this is a little bit of a grey area, because again, important code changes in those parts require rebuilds of dependencies. Just as with a static library.

[...]

I've mailed the FPC list about this topic...

Comment 7 Eric Smith 2012-06-22 22:03:23 UTC
It doesn't appear to me that there was any consensus reached nor action taken regarding Michael's inquiry to the Fedora-Packaging list.

I can't imagine any practical manner to treat C++ templates in -devel package other than simply allowing them.  C++ templates, like Ada generics, *must* be compiled into an executable to be used.  There is no way to turn them into a shared library.  If this is considered to run afoul of Fedora's library packaging requirements, then Fedora will have to drop the C++ Standard Template Library (which would make Fedora non-compliant with the C++ standard), Boost, and many other packages.

Given that the STL, Boost, and other C++ templates are in fact in Fedora, the only conclusion I can reach is that templates in C++ headers are allowed in -devel packages.

Comment 8 Eric Smith 2012-06-22 23:55:44 UTC
Spec URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++.spec
SRPM URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++-0.7.0-1.fc14.src.rpm
Koji scratch build for rawhide: http://koji.fedoraproject.org/koji/taskinfo?taskID=4189561

Updated based on Rich's comments.
Added check section to spec
includes pkg-config file
includes Python bindings

Comment 9 Rich Mattes 2012-09-25 00:24:26 UTC
I don't think the issue was that c++ template header libraries aren't allowed, I think the contention is just that you should add a Provides: libkdtree++-static to the -devel package.  We do the same thing with eigen2, eigen3, etc.  That way dependent packages can Require: libkdtree++-static, which implies that any dependent packages will need to be rebuilt when libkdtree++ is upgraded.

That being said, I'll go ahead and take this review on.


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

Key:
- = N/A
x = Pass
! = Fail
? = Not evaluated



==== C/C++ ====
[x]: MUST Package does not contain any libtool archives (.la)
[x]: MUST Package does not contain kernel modules.
[x]: MUST Package contains no static executables.
[x]: MUST Rpath absent or only used for internal libs.
[-]: MUST Development (unversioned) .so files in -devel subpackage, if
     present.
     Note: Unversioned so-files in non-devel package (fix or
     explain):libkdtree++-python-0.7.0-2.fc17.x86_64.rpm :
     /usr/lib64/python2.7/site-packages/_kdtree.so


==== Generic ====
[x]: EXTRA Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: EXTRA Spec file according to URL is the same as in SRPM.
[x]: MUST Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
     -- Artistic 2.0 OK
[x]: MUST Package successfully compiles and builds into binary rpms on at
     least one supported primary architecture.
[!]: MUST %build honors applicable compiler flags or justifies otherwise.
     
[x]: MUST All build dependencies are listed in BuildRequires, except for any
     that are listed in the exceptions section of Packaging Guidelines.
[x]: MUST Package contains no bundled libraries.
[x]: MUST Changelog in prescribed format.
[x]: MUST Sources contain only permissible code or content.
[x]: MUST Each %files section contains %defattr if rpm < 4.4
     Note: Note: defattr macros not found. They would be needed for EPEL5
[x]: MUST Macros in Summary, %description expandable at SRPM build time.
[-]: MUST Package contains desktop file if it is a GUI application.
[x]: MUST Development files must be in a -devel package
[-]: MUST Package requires other packages for directories it uses.
[x]: MUST Package uses nothing in %doc for runtime.
[x]: MUST Package is not known to require ExcludeArch.
[x]: MUST Permissions on files are set properly.
[x]: MUST Package does not contain duplicates in %files.
[x]: MUST Fully versioned dependency in subpackages, if present.
[x]: MUST Package complies to the Packaging Guidelines
[x]: MUST Spec file lacks Packager, Vendor, PreReq tags.
[x]: MUST Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
     Note: rm -rf would be needed if support for EPEL5 is required
[-]: MUST Large documentation files are in a -doc subpackage, if required.
[x]: MUST 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 %doc.
[x]: MUST License field in the package spec file matches the actual license.
[!]: MUST License file installed when any subpackage combination is installed.
[x]: MUST Package consistently uses macro is (instead of hard-coded directory
     names).
[x]: MUST Package is named using only allowed ascii characters.
[x]: MUST Package is named according to the Package Naming Guidelines.
[x]: MUST Package does not generate any conflict.
     Note: Package contains no Conflicts: tag(s)
[x]: MUST Package obeys FHS, except libexecdir and /usr/target.
[-]: MUST If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: MUST Package must own all directories that it creates.
[x]: MUST Package does not own files or directories owned by other packages.
[x]: MUST Package installs properly.
[x]: MUST Package is not relocatable.
[!]: MUST Package requires pkgconfig, if .pc files are present. (EPEL5)
     Note: Only applicable for EL-5
[!]: MUST Requires correct, justified where necessary.
[x]: MUST Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: MUST Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: MUST Spec file is legible and written in American English.
[x]: MUST Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[-]: MUST Package contains systemd file(s) if in need.
[x]: MUST File names are valid UTF-8.
[!]: MUST Useful -debuginfo package or justification otherwise.
[x]: SHOULD Reviewer should test that the package builds in mock.
[x]: SHOULD Buildroot is not present
     Note: Unless packager wants to package for EPEL5 this is fine
[x]: SHOULD Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
     Note: Clean would be needed if support for EPEL5 is required
[-]: SHOULD 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]: SHOULD Dist tag is present.
[x]: SHOULD No file requires outside of /etc, /bin, /sbin, /usr/bin,
     /usr/sbin.
[!]: SHOULD Final provides and requires are sane (rpm -q --provides and rpm -q
     --requires).
[x]: SHOULD Package functions as described.
[x]: SHOULD Latest version is packaged.
[x]: SHOULD Package does not include license text files separate from
     upstream.
[x]: SHOULD Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[x]: SHOULD The placement of pkgconfig(.pc) files are correct.
[x]: SHOULD SourceX tarball generation or download is documented.
[x]: SHOULD SourceX / PatchY prefixed with %{name}.
[x]: SHOULD SourceX is a working URL.
[-]: SHOULD Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: SHOULD Package should compile and build into binary rpms on all supported
     architectures.
[x]: SHOULD %check is present and all tests pass.
[x]: SHOULD Packages should try to preserve timestamps of original installed
     files.
[x]: SHOULD Spec use %global instead of %define.

Rpmlint
-------
Checking: libkdtree++-devel-0.7.0-2.fc17.x86_64.rpm
          libkdtree++-examples-0.7.0-2.fc17.x86_64.rpm
          libkdtree++-0.7.0-2.fc17.src.rpm
          libkdtree++-python-0.7.0-2.fc17.x86_64.rpm
libkdtree++-devel.x86_64: W: spelling-error Summary(en_US) kd -> ks, k, d
libkdtree++-devel.x86_64: W: spelling-error %description -l en_US kd -> ks, k, d
libkdtree++-examples.x86_64: W: spelling-error Summary(en_US) libkdtree -> treelike
libkdtree++-examples.x86_64: W: spelling-error %description -l en_US libkdtree -> treelike
libkdtree++.src: W: spelling-error Summary(en_US) kd -> ks, k, d
libkdtree++.src: W: spelling-error %description -l en_US kd -> ks, k, d
libkdtree++.src:16: W: macro-in-comment %{optflags}
libkdtree++-python.x86_64: W: spelling-error Summary(en_US) libkdtree -> treelike
libkdtree++-python.x86_64: W: spelling-error %description -l en_US libkdtree -> treelike
libkdtree++-python.x86_64: W: unstripped-binary-or-object /usr/lib64/python2.7/site-packages/_kdtree.so
libkdtree++-python.x86_64: W: no-documentation
4 packages and 0 specfiles checked; 0 errors, 11 warnings.


Rpmlint (installed packages)
----------------------------
# rpmlint libkdtree++-examples
libkdtree++-examples.x86_64: W: spelling-error Summary(en_US) libkdtree -> treelike
libkdtree++-examples.x86_64: W: spelling-error %description -l en_US libkdtree -> treelike
1 packages and 0 specfiles checked; 0 errors, 2 warnings.
# echo 'rpmlint-done:'

Requires
--------
libkdtree++-devel-0.7.0-2.fc17.x86_64.rpm (rpmlib, GLIBC filtered):
    
    /usr/bin/pkg-config  

libkdtree++-examples-0.7.0-2.fc17.x86_64.rpm (rpmlib, GLIBC filtered):
    

libkdtree++-python-0.7.0-2.fc17.x86_64.rpm (rpmlib, GLIBC filtered):
    
    python(abi) = 2.7

Provides
--------
libkdtree++-devel-0.7.0-2.fc17.x86_64.rpm:
    
    libkdtree++-devel = 0.7.0-2.fc17
    libkdtree++-devel(x86-64) = 0.7.0-2.fc17
    pkgconfig(libkdtree++) = 0.7.0

libkdtree++-examples-0.7.0-2.fc17.x86_64.rpm:
    
    libkdtree++-examples = 0.7.0-2.fc17
    libkdtree++-examples(x86-64) = 0.7.0-2.fc17

libkdtree++-python-0.7.0-2.fc17.x86_64.rpm:
    
    libkdtree++-python = 0.7.0-2.fc17
    libkdtree++-python(x86-64) = 0.7.0-2.fc17

MD5-sum check
-------------
http://alioth.debian.org/frs/download.php/2702/libkdtree++-0.7.0.tar.bz2 :
  CHECKSUM(SHA256) this package     : b8c4dfd42a418f62558564f0f7798d3a0db86ee7d034210db27864705351a3e7
  CHECKSUM(SHA256) upstream package : b8c4dfd42a418f62558564f0f7798d3a0db86ee7d034210db27864705351a3e7


Generated by fedora-review 0.2.2 (9f8c0e5) last change: 2012-08-09
Command line :/usr/bin/fedora-review -n libkdtree++
External plugins:

==================

So the package mostly checks out.  Action items are:
MUST: All packages must either contian COPYING, or depend on a package that provides COPYING.  You should have libkdtree++-examples depend on libkdtree++-devel, and perhaps include COPYING as %doc in libkdtree++-python
Ref: http://fedoraproject.org/wiki/Packaging:LicensingGuidelines#Subpackage_Licensing

MUST: Package requires pkgconfig, if .pc files are present. (EPEL5)  If you don't want to support epel5, don't worry about this.

MUST: The python library is being installed with 0644 permissions instead of 0755 permissions.  That's why it's not getting stripped by rpmbuild; you should install executables and shared libraries with 755 permissions.  When you fix this, you'll probably start getting rpmlint errors about provides outside of libdir, you can fix it with the directions at https://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering#Preventing_files.2Fdirectories_from_being_scanned_for_provides_.28pre-scan_filtering.29

SHOULD: The -devel and -examples folders aren't architecture dependent, you should probably add BuildArch: noarch to both subpackages, and move libdir/pkgconfig to datadir/pkgconfig (the -noarch pkgconfig installation destiation)

SHOULD: Patches should be submitted upstream where applicable, and a note should appear in the comments above the patch in the specfile.  In particular, the gcc 4.7 patch and pkgconfig patch may be of interest to upstream.

SHOULD: Provide libkdtree++-static

Comment 10 Eric Smith 2012-09-29 06:16:40 UTC
Thanks for reviewing this. I really appreciate the recommendations as to how to fix the problems. I've taken most but not all of the advice, as further explained below. Here are the updated files:

Spec URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++.spec
SRPM URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++-0.7.0-3.fc17.src.rpm

I don't intend to support EL5 unless someone requests it, so for now I'm not adding the requires for pkgconfig.

If examples depends on devel, rpmlint gives the errors "E: devel-dependency" and "E: explicit-lib-dependency libkdtree++-devel". While these conditions are basically self-explanatory, it's not obvious to me why they are considered to be errors, and I don't see an explanation of them on the "Common rpmlint issues" wiki page.

I'm not convinced about installing kdtree.py with 755 permissions, as it isn't intended to be executed directly. If it's 755, rpmlint gives the error "E: script-without-shebang". All of the other .py files in my /usr/lib/python2.7/site-packages directory (from various other Fedora RPM files) are 644, and only of of them has a shebang.  The RPMs providing these .py files with 644 perms are:

abrt-addon-python-2.0.13-1.fc17.x86_64
dbus-python-0.83.0-9.fc17.x86_64
python-decorator-3.3.3-1.fc17.noarch
python-setuptools-0.6.27-2.fc17.noarch
python-GnuPGInterface-0.3.2-9.fc17.noarch
sssd-1.8.4-14.fc17.x86_64
python-IPy-0.75-2.fc17.noarch
python-magic-5.11-2.fc17.x86_64
python-setuptools-0.6.27-2.fc17.noarch
sssd-1.8.4-14.fc17.x86_64

Also, installing it with 755 does not seem to eliminate the unstripped-binary-or-object warning, even with a "%filter_provides_in %{python_sitearch}/.*\.so$", and I still get an empty-debuginfo-package unless I keep the macro to disable automatic debuginfo processing.

I'm unclear on whether the Python packaging standard requires 755 in a case like this, but given that the actual practice is clearly to use 644, for now I'm keeping 644.

Comment 11 Rich Mattes 2012-10-13 16:53:55 UTC
Created attachment 626598 [details]
Enable debuginfo generation

Comment 12 Rich Mattes 2012-10-13 16:54:45 UTC
Sorry, when I said "python library" I meant the share library _kdtree.so.  find-debuginfo.sh looks for executable files to strip, so if the library isn't marked as executable it won't get stripped into the debuginfo package.  You're right, the .py files should be 0644.

If you enable the debuginfo package, install _kdtree.so as 755, and include the filter_setup block, then the -debuginfo package will be generated and you won't have any information about providing a shared library without a soname.  I've attached a patch against the current .spec that handles it.

Comment 13 Eric Smith 2012-10-15 02:53:06 UTC
Thanks for the clarification and the patch.  Here's the updated package:

Spec URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++.spec
SRPM URL: http://fedorapeople.org/~brouhaha/libkdtree++/libkdtree++-0.7.0-4.fc17.src.rpm

Comment 14 Rich Mattes 2012-10-16 03:54:05 UTC
Everything looks good now, this package is APPROVED.

Comment 15 Eric Smith 2012-10-16 04:27:43 UTC
New Package SCM Request
=======================
Package Name: libkdtree++
Short Description: C++ template container implementation of kd-tree sorting
Owners: brouhaha
Branches: f17 f18 el6
InitialCC:

Comment 16 Gwyn Ciesla 2012-10-16 11:54:51 UTC
Git done (by process-git-requests).

Comment 17 Fedora Update System 2012-10-17 07:47:14 UTC
libkdtree++-0.7.0-4.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/libkdtree++-0.7.0-4.fc18

Comment 18 Fedora Update System 2012-10-17 07:57:35 UTC
libkdtree++-0.7.0-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/libkdtree++-0.7.0-4.fc17

Comment 19 Fedora Update System 2012-10-17 17:33:44 UTC
libkdtree++-0.7.0-4.fc18 has been pushed to the Fedora 18 testing repository.

Comment 20 Fedora Update System 2012-12-20 15:00:22 UTC
libkdtree++-0.7.0-4.fc18 has been pushed to the Fedora 18 stable repository.


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