Bug 907007 - Review Request: unittest-cpp - Lightweight unit testing framework for C++
Summary: Review Request: unittest-cpp - Lightweight unit testing framework for C++
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Björn Esser (besser82)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-02 16:18 UTC by François Cami
Modified: 2013-06-15 03:12 UTC (History)
6 users (show)

Fixed In Version: unittest-cpp-1.4-10.20130509gitc42e68b.fc19
Clone Of:
Environment:
Last Closed: 2013-06-15 03:12:24 UTC
Type: ---
Embargoed:
besser82: fedora-review+


Attachments (Terms of Use)
Suggested fixes for rpm-spec (3.92 KB, patch)
2013-05-31 05:14 UTC, Björn Esser (besser82)
no flags Details | Diff

Description François Cami 2013-02-02 16:18:56 UTC
Spec URL: http://fcami.fedorapeople.org/srpms/unittest-cpp.spec
SRPM URL: http://fcami.fedorapeople.org/srpms/unittest-cpp-1.4-1.fc18.src.rpm
Description: UnitTest++ is a lightweight unit testing framework for C++.
Simplicity, portability, speed, and small footprint are all
very important aspects of UnitTest++.
Fedora Account System Username: fcami

Notes:
* scratch build: http://koji.fedoraproject.org/koji/taskinfo?taskID=4923797
* Upstream builds static-only, I have switched to a shared library but will not choose a soname in upstream's place.
* I have asked upstream to provide a shared library: https://github.com/charlesnicholson/unittest-cpp/issues/24

Comment 1 François Cami 2013-02-02 16:20:24 UTC
Please do not review yet.

Comment 2 Luke Benstead 2013-02-11 21:16:47 UTC
A couple of comments:

1. We  need to add a pkg-config file to the devel package. It should be called unittest++.pc and be installed to /usr/share/pkgconfig. I think the content should be something like this (although I'm not sure about the version) the name must be unittest++ otherwise programs won't be able to locate the library with pkg-config:

# pkg-config source file

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: unittest++
Description: unittest++ is a unit testing framework for C++
Version: 1.4.0
Requires:
Conflicts:
Libs: -L${libdir} -lUnitTest++
Cflags: -I${includedir}/unittest-cpp

2. The include directory is /usr/include/unittest-cpp rather than /usr/include/unittest++. It seems a bit odd for the library to be libUnitTest++.so and the folder to be unittest-cpp

Comment 3 François Cami 2013-02-23 22:15:08 UTC
Thank you Luke.
I've changed the package name and added a unittest++.pc file generated from a template. Please let me know what you think.

Spec URL: http://fcami.fedorapeople.org/srpms/unittest++.spec
SRPM URL:  http://fcami.fedorapeople.org/srpms/unittest++-1.4-2.fc18.src.rpm

Comment 4 Luke Benstead 2013-03-08 19:38:40 UTC
One final issue, you need to change the final line of unittest++.pc from:

Cflags: -I${includedir}/unittest-cpp

to 

Cflags: -I${includedir}/unittest++

But once that's done, everything looks perfect to me!

Comment 6 François Cami 2013-03-08 20:06:09 UTC
Thank you Luke, I believe the SRPM posted as comment 5 fixes all your concerns.

Comment 8 Luke Benstead 2013-03-11 21:31:30 UTC
Just a few things to tweak:

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

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[-]: 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. - Upstream uses static libs
[x]: Header files in -devel subpackage, if present.
[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]: %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.
[x]: Each %files section contains %defattr if rpm < 4.4
     Note: %defattr present but not needed
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[!]: Package requires other packages for directories it uses. - Need to add pkg-config
[x]: Package uses nothing in %doc for runtime.
[x]: Package is not known to require ExcludeArch.
[x]: Package complies to the 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". 1 files have unknown license. Detailed output of
     licensecheck in /home/packager/review/907007-unittest++/licensecheck.txt
[x]: License file installed when any subpackage combination is installed.
[x]: Package consistently uses macro is (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]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[!]: Requires correct, justified where necessary. - Need to add pkg-config
[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.
[-]: Large documentation must go in a -doc subpackage.
     Note: Documentation size is 30720 bytes in 4 files.
[x]: All build dependencies are listed in BuildRequires, except for any that
     are listed in the exceptions section of Packaging Guidelines.
[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]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Fully versioned dependency in subpackages, if present.
[x]: Spec file lacks Packager, Vendor, PreReq tags.
[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 %doc.
[x]: Package use %makeinstall only when make install' ' DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package do not use a name that already exist
[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
[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).

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

Generic:
[!]: Spec use %global instead of %define.
     Note: %define archivename unittest-cpp
[x]: 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]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[x]: Patches link to upstream bugs/comments/lists or are otherwise justified.
[-]: Scriptlets must be sane, if 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.
[-]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed files.
[x]: Sources can be downloaded from URI in Source: tag
[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]: Dist tag is present.
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: The placement of pkgconfig(.pc) files are correct.
[x]: SourceX tarball generation or download is documented.
[x]: SourceX is a working URL.

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

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


Rpmlint
-------
Checking: unittest++-1.4-5.fc18.x86_64.rpm
          unittest++-devel-1.4-5.fc18.x86_64.rpm
unittest++.x86_64: W: no-soname /usr/lib64/libUnitTest++.so
unittest++-devel.x86_64: W: spelling-error Summary(en_US) unittest -> unit test, unit-test, unities
unittest++-devel.x86_64: W: spelling-error Summary(en_US) cpp -> cop, pp, cps
unittest++-devel.x86_64: W: spelling-error %description -l en_US unittest -> unit test, unit-test, unities
unittest++-devel.x86_64: W: spelling-error %description -l en_US cpp -> cop, pp, cps
2 packages and 0 specfiles checked; 0 errors, 5 warnings.




Rpmlint (installed packages)
----------------------------
# rpmlint unittest++-devel unittest++
unittest++-devel.x86_64: W: spelling-error Summary(en_US) unittest -> unit test, unit-test, unities
unittest++-devel.x86_64: W: spelling-error Summary(en_US) cpp -> cop, pp, cps
unittest++-devel.x86_64: W: spelling-error %description -l en_US unittest -> unit test, unit-test, unities
unittest++-devel.x86_64: W: spelling-error %description -l en_US cpp -> cop, pp, cps
unittest++.x86_64: W: no-soname /usr/lib64/libUnitTest++.so
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so vtable for __cxxabiv1::__si_class_type_info
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so typeinfo for std::exception
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so typeinfo for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so virtual thunk to std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so virtual thunk to std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so typeinfo for std::basic_ostream<char, std::char_traits<char> >
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so virtual thunk to std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so virtual thunk to std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so vtable for __cxxabiv1::__class_type_info
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_pure_virtual
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::ios_base::Init::~Init()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so typeinfo for char const*
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so vtable for std::exception
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __gxx_personality_v0
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so operator delete(void*)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_end_catch
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_allocate_exception
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(unsigned long, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_guard_release
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ios<char, std::char_traits<char> >::~basic_ios()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >::operator<<(float)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::allocator<char>::allocator()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ios<char, std::char_traits<char> >::basic_ios()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_begin_catch
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_rethrow
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_throw
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::ios_base::Init::Init()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::exception::~exception()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so operator new(unsigned long)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_guard_abort
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::__throw_length_error(char const*)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::__throw_bad_alloc()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so std::allocator<char>::~allocator()
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_free_exception
unittest++.x86_64: W: undefined-non-weak-symbol /usr/lib64/libUnitTest++.so __cxa_guard_acquire
2 packages and 0 specfiles checked; 0 errors, 60 warnings.
# echo 'rpmlint-done:'

Requires
--------
unittest++-devel (rpmlib, GLIBC filtered):
    /usr/bin/pkg-config
    unittest++(x86-64)

unittest++ (rpmlib, GLIBC filtered):
    /sbin/ldconfig
    libc.so.6()(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    rtld(GNU_HASH)

Provides
--------
unittest++-devel:
    pkgconfig(unittest++)
    unittest++-devel
    unittest++-devel(x86-64)

unittest++:
    libUnitTest++.so()(64bit)
    unittest++
    unittest++(x86-64)

Unversioned so-files
--------------------
unittest++: /usr/lib64/libUnitTest++.so

Comment 9 François Cami 2013-03-12 09:01:58 UTC
Thank you Luke!

The following item is not needed because RPM correctly detects the dependency on pkgconfig. The following is in the output of rpmbuild -ba: 
"Requires: /usr/bin/pkg-config"

[!]: Requires correct, justified where necessary. - Need to add pkg-config

I'll fix the remaining issues shortly.

Comment 10 François Cami 2013-03-12 13:47:26 UTC
I've fixed the following:

[!]: Spec use %global instead of %define.

Spec URL: http://fcami.fedorapeople.org/srpms/unittest++.spec
SRPM URL: http://fcami.fedorapeople.org/srpms/unittest++-1.4-6.fc18.src.rpm


Regarding the following issue:

[-]: Development (unversioned) .so files in -devel subpackage, if present.

Upstream builds as static only, and while I added the possibility to build a shared library, I would rather have upstream maintain the soname field if it existed.
More importantly, I do not expect any Fedora-shipped program to link to this library, as it is used for unit testing only, so mandating a soname seems overkill. Luke, have you got any insight on this?

Comment 11 François Cami 2013-03-13 19:40:26 UTC
As Luke is not a packager yet, his review is non binding.
Lifting "NotReady" keyword.

Comment 12 Michael Schwendt 2013-03-16 23:08:09 UTC
> I do not expect any Fedora-shipped program to link to this library,
> as it is used for unit testing only, so mandating a soname seems overkill

Then building a shared lib and two packages seems overkill, too. Why don't you simply build just the static lib as upstream does it? Package unittest++-devel with a virtual unittest++-static to meet the guidelines:
https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries_2

Or build the shared lib but move _all_ files into a single unittest++-devel package together with the headers and the ldconfig calls. Instead, you treat the shared lib like a full system run-time lib in its separate run-time package. What is the benefit, if you expect no Fedora package to depend on the shared lib?


> CPPFLAGS='%{optflags}' make %{?_smp_mflags}

The source doesn't use $CPPFLAGS but $CXXFLAGS - and your patch adds $CFLAGS.

Due to that it doesn't adhere to the %optflags guidelines either:
https://fedoraproject.org/wiki/Packaging:Guidelines#Compiler_flags

To see what is being built with, you would need to make the build output less silent and e.g. patch the command invocations in the Makefile.


> %package devel
> Summary:        Object files for development using unittest-cpp

Decide on either name. Either unittest++ (like the project name) or unittest-cpp (like the upstream source zip).


* Run "rpmlint -i" on the src.rpm and all built rpms. Some of the reported warnings/errors may be dubious (false positives), however. Be aware of that.

Comment 13 Björn Esser (besser82) 2013-05-21 21:57:06 UTC
Are you still interested in getting this reviewed?

Consider applying Michaels suggestions/proposals and provide an updated spec/srpm then, please.

Comment 14 Björn Esser (besser82) 2013-05-30 10:09:41 UTC
If there won't be any response from the submitter until June 9th, I'll change status to CLOSED -> NOTABUG

Comment 15 François Cami 2013-05-30 23:02:38 UTC
Michael, thanks for the tips.
All, my apologies for taking so long to update this.

Changelog:
- Switch upstream from http://sf.net/projects/unittest-cpp
  to https://github.com/unittest-cpp/unittest-cpp
- Rebase sources to c42e68bb999d01da9ec71b67ff1a2cbd6ec1b6a6
- Use consistent naming as much as possible.
- Use autotools to build both shared and static libraries.

Updated SPEC anc SRPM:
Spec URL: http://fcami.fedorapeople.org/srpms/unittest-cpp.spec
SRPM URL: http://fcami.fedorapeople.org/srpms/unittest-cpp-1.4-8.fc18.20130530gitc42e68bb.src.rpm

Comment 16 Björn Esser (besser82) 2013-05-31 05:14:33 UTC
Created attachment 755157 [details]
Suggested fixes for rpm-spec

Hello François!

A quick view over the spec-file:

 %global         _hardened_build 1
-%global         gitversion      20130530gitc42e68bb
-%global         oldname UnitTest++
+%global         commit      c42e68bb999d01da9ec71b67ff1a2cbd6ec1b6a6
+%global         shortcommit %(c=%{commit}; echo ${c:0:7})
+%global         commitdate  20130509
+%global         gitversion  .%{commitdate}git%{shortcommit}
+%global         oldname     UnitTest++

see: http://fedoraproject.org/wiki/Packaging:SourceURL#Github

#####

 Name:           unittest-cpp
-Version:        1.4
-Release:        8%{?dist}.%{gitversion}
+Version:        1.5
+Release:        0%{gitversion}%{?dist}
 Summary:        Lightweight unit testing framework for C++
 License:        MIT
 Group:          Development/Libraries
-
-# the latest version from the old project at sf.net is 1.4
-# the new project on github has no release yet, so...
-##### creating the archive from git #####
-# git clone https://github.com/unittest-cpp/unittest-cpp.git
-# cd unittest-cpp/
-# git log
-# cd ..
-# tar cjf unittest-cpp-20130530gitc42e68bb.tbz2 unittest-cpp/
-#########################################
-
-# resulting tarball:
-Source0:        %{name}-%{gitversion}.tbz2
+URL:            https://github.com/%{name}/%{name}
+Source0:        https://github.com/%{name}/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz

see: https://fedoraproject.org/wiki/Packaging:NamingGuidelines?rd=Packaging/NamingGuidelines#Pre-Release_packages and http://fedoraproject.org/wiki/Packaging:SourceURL#Github

#####

 # documentation from 1.4 tarball: docs/UnitTest++.html
 Source2:        %{name}.html
 
-# old Url: http://sf.net/projects/unittest-cpp
-Url:            https://github.com/unittest-cpp/unittest-cpp
-
 BuildRequires:  autoconf
 BuildRequires:  libtool

just removed some obsoleted stuff...

#####

 %package static
 Summary:        Static library for %{name}
 Group:          Development/Libraries
+Requires:       %{name}%{?_isa} = %{version}-%{release}

see: https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Duplicate_Files

Or put docs in noarch-subpkg and require this, if you'd prefer...

#####

 %prep
-%setup -q -n %{name}
+%setup -q -n %{name}-%{commit}
 cp -p %SOURCE1 %SOURCE2 .
-
-%build
 # autoreconf will complain about missing NEWS and README files
 touch NEWS
-ln README.md README
+ln -f README.md README
 # autoreconf will add a GPLv3 license text in COPYING
-ln LICENSE COPYING
-autoreconf -i
+ln -f LICENSE COPYING
+autoreconf -vfi
+
+%build
 %configure

It's prefered to have autoreconf in %prep, because it prepares the sources for being build...

#####

+%check
+make check
+
 %install
 mkdir -p %{buildroot}%{_includedir}/%{name}
 mkdir -p %{buildroot}%{_libdir}
 mkdir -p %{buildroot}%{_datadir}/pkgconfig
-make DESTDIR=%{buildroot} install
+%make_install
 install -p -m 644 %{name}.pc %{buildroot}%{_datadir}/pkgconfig/
-rm -f %{buildroot}%{_libdir}/lib%{oldname}.la

%check-target is, in IMHO, mandatory, if Makefile has a check-rule, see: http://fedoraproject.org/wiki/How_to_create_an_RPM_package#.25check_section
Using %make_install-macro is prefered to make install, but not required...
la-file is needed by -static subpkg for static-linking...

#####

 %files
-%doc AUTHORS LICENSE README.md 
+%doc AUTHORS LICENSE README
 %{_libdir}/lib%{oldname}.so.*
 
 %files devel
-%doc %{name}.html LICENSE
+%doc %{name}.html
 %{_includedir}/%{oldname}
 %{_libdir}/lib%{oldname}.so
 %{_datadir}/pkgconfig/%{name}.pc
 
 %files static
-%doc LICENSE
 %{_libdir}/lib%{oldname}.a
+%{_libdir}/lib%{oldname}.la

see: https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Duplicate_Files
la-file is needed by -static subpkg for static-linking...

#####

 %changelog
+* Fri May 31 2013 François Cami <fcami> - 1.5-0.20130509gitc42e68bb
+- improvements: globals for git-tarball/version, fixed version/release,
+  la-file goes to -static, autoreconf goes to prep-target, add check-target,
+  removed double-packaged files
+
 * Thu May 30 2013 François Cami <fcami> - 1.4-8.20130530gitc42e68bb

Create some clog-entry...

#####

rpmlint shows:

Rpmlint (installed packages)
----------------------------
# rpmlint unittest-cpp-devel unittest-cpp-static unittest-cpp
unittest-cpp.x86_64: W: unused-direct-shlib-dependency /usr/lib64/libUnitTest++.so.1.4.0 /lib64/libm.so.6
3 packages and 0 specfiles checked; 0 errors, 1 warnings.

Please fix, as suggested here: https://fedoraproject.org/wiki/Common_Rpmlint_issues#unused-direct-shlib-dependency

#####

I'll take another review-run after updated spec/srpm.

Cheers,
  Björn

Comment 17 Michael S. 2013-05-31 09:46:34 UTC
The .la is not needed 

http://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries

"Libtool archives, foo.la files, should not be included" 


And if upstream didn't make a release, we shouldn't decide that it will be 1.5, maybe they will go to 1.4.1, or 2.0. So until that, this should be kept to 1.4.

Comment 18 François Cami 2013-05-31 14:31:26 UTC
Thank you Björn and Michael.

Updated SPEC and SRPM:
Spec URL: http://fcami.fedorapeople.org/srpms/unittest-cpp.spec
SRPM URL: http://fcami.fedorapeople.org/srpms/unittest-cpp-1.4-9.20130509gitc42e68b.fc18.src.rpm

Comment 19 Björn Esser (besser82) 2013-06-01 05:15:57 UTC
Just a hint on sed-usage:

    sed -e "s/some/something/"

If you want to pre/suffix some phrase with sed's search-replace, searched phrase can be substituted with & (ambersand), which will make the process less error-prone in case of possible typos:

    sed -e "s/some/&thing/"   <-- will suffix to phrase --> something

    sed -e "s/some/lone&/"    <-- will prefix to phrase --> lonesome

#####

Just a hint for el5-packaging:

If you want to package this for EPEL5, too, you should add the needed BuildRoot-tag and `rm -rf "%{buildroot}"` on top of %install and %clean targets inside the spec-file.

For further infos see: https://fedoraproject.org/wiki/Category:EPEL

#####

Package is fine. Nothing more to say, see below.

#####

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.
     static-stuff goes to -static subpkg
[x]: Header files in -devel subpackage, if present.
[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.
[x]: Static libraries in -static subpackage, if present.

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]: %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 requires other packages for directories it uses.
[x]: Package uses nothing in %doc for runtime.
[x]: Package is not known to require ExcludeArch.
[x]: Package complies to the Packaging Guidelines
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses found:
     "GPL (v2 or later)", "Unknown or generated". 72 files have unknown
     license. GPLv2+: ltmain.sh from autotools, rest is MIT
[x]: License file installed when any subpackage combination is installed.
[x]: Package consistently uses macro is (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]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[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.
[-]: Large documentation must go in a -doc subpackage.
     Note: Documentation size is 30720 bytes in 4 files.
[x]: All build dependencies are listed in BuildRequires, except for any that
     are listed in the exceptions section of Packaging Guidelines.
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Each %files section contains %defattr if rpm < 4.4
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Fully versioned dependency in subpackages, if present.
[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 %doc.
[x]: Package use %makeinstall only when make install' ' DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package do not use a name that already exist
[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
[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).

===== 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]: Package functions as described.
[x]: Latest version is packaged.
     post-release git-snapshot
[x]: Package does not include license text files separate from upstream.
[x]: Scriptlets must be sane, if 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]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[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]: Dist tag is present.
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Uses parallel make.
[x]: The placement of pkgconfig(.pc) files are correct.
[x]: SourceX tarball generation or download is documented.
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define.

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

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


Rpmlint
-------
Checking: unittest-cpp-1.4-9.20130509gitc42e68b.fc20.x86_64.rpm
          unittest-cpp-devel-1.4-9.20130509gitc42e68b.fc20.x86_64.rpm
          unittest-cpp-static-1.4-9.20130509gitc42e68b.fc20.x86_64.rpm
unittest-cpp-static.x86_64: W: no-documentation
3 packages and 0 specfiles checked; 0 errors, 1 warnings.




Rpmlint (installed packages)
----------------------------
# rpmlint unittest-cpp-devel unittest-cpp-static unittest-cpp
unittest-cpp-static.x86_64: W: no-documentation
3 packages and 0 specfiles checked; 0 errors, 1 warnings.
# echo 'rpmlint-done:'



Requires
--------
unittest-cpp-devel (rpmlib, GLIBC filtered):
    /usr/bin/pkg-config
    libUnitTest++.so.1()(64bit)
    unittest-cpp(x86-64)

unittest-cpp-static (rpmlib, GLIBC filtered):
    unittest-cpp(x86-64)

unittest-cpp (rpmlib, GLIBC filtered):
    /sbin/ldconfig
    libc.so.6()(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    libstdc++.so.6()(64bit)
    libstdc++.so.6(CXXABI_1.3)(64bit)
    rtld(GNU_HASH)



Provides
--------
unittest-cpp-devel:
    pkgconfig(unittest-cpp)
    unittest-cpp-devel
    unittest-cpp-devel(x86-64)

unittest-cpp-static:
    unittest-cpp-static
    unittest-cpp-static(x86-64)

unittest-cpp:
    libUnitTest++.so.1()(64bit)
    unittest-cpp
    unittest-cpp(x86-64)



Source checksums
----------------
https://github.com/unittest-cpp/unittest-cpp/archive/c42e68bb999d01da9ec71b67ff1a2cbd6ec1b6a6/unittest-cpp-1.4-c42e68b.tar.gz :
  CHECKSUM(SHA256) this package     : b64c492f2f600ad15bd7f4324af2b43826aaa3546e4aece9967a055dbba13691
  CHECKSUM(SHA256) upstream package : b64c492f2f600ad15bd7f4324af2b43826aaa3546e4aece9967a055dbba13691


Generated by fedora-review 0.4.1 (b2e211f) last change: 2013-04-29
Buildroot used: fedora-rawhide-x86_64
Command line :/usr/bin/fedora-review -m fedora-rawhide-x86_64 -b 907007

#####

So this one is

APPROVED!

Comment 20 François Cami 2013-06-01 08:26:38 UTC
Thank you Björn for the review. 

For the record:
[-]: If the source package does not include license text(s) as a separate file
     from upstream, the packager SHOULD query upstream to include it.
 => Upstream ships the license text in the LICENSE file, so that's a [x].

Reopening => I'll let bodhi close the bug once it is pushed for Fedora 19.

Comment 21 François Cami 2013-06-01 08:32:25 UTC
New Package SCM Request
=======================
Package Name:      unittest-cpp
Short Description: Lightweight unit testing framework for C++
Owners:            fcami
Branches:          f19 f18 el6
InitialCC:

Comment 22 Björn Esser (besser82) 2013-06-01 09:23:43 UTC
(In reply to François Cami from comment #20)
> Thank you Björn for the review. 

You're welcome!

If you don't mind, I'd welcome you to review this simple one here:

https://bugzilla.redhat.com/show_bug.cgi?id=969387

> For the record:
> [-]: If the source package does not include license text(s) as a separate
> file from upstream, the packager SHOULD query upstream to include it.
>  => Upstream ships the license text in the LICENSE file, so that's a [x].

[-] means: doesn't apply here, see legend above review-report.

So the meaning was: It does not apply here to have upstream asked for including some LICENSE/COPYING in SOURCES, since it's already there.

I don't want to put up a flame-war-style arguement here, but I think [x] and [-] do have the same comeback in this context.

Cheers,
  Björn

Comment 23 François Cami 2013-06-01 10:32:17 UTC
re license file: you're right, of course.

Comment 24 Michael Schwendt 2013-06-01 16:29:01 UTC
> %package static
> Requires:       %{name}%{?_isa} = %{version}-%{release}

The -static package does not need a dependency on the base package. If at all, it may depend on the -devel package (because without headers one would need to BuildRequires two packages, but that's no big deal).

Comment 25 Gwyn Ciesla 2013-06-03 10:32:44 UTC
SCM request complete.

Comment 26 Fedora Update System 2013-06-06 19:38:29 UTC
unittest-cpp-1.4-10.20130509gitc42e68b.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/unittest-cpp-1.4-10.20130509gitc42e68b.fc19

Comment 27 Fedora Update System 2013-06-07 15:43:44 UTC
unittest-cpp-1.4-10.20130509gitc42e68b.fc19 has been pushed to the Fedora 19 testing repository.

Comment 28 Fedora Update System 2013-06-15 03:12:24 UTC
unittest-cpp-1.4-10.20130509gitc42e68b.fc19 has been pushed to the Fedora 19 stable repository.


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