Bug 2028270 - Review Request: termcolor - Header-only C++ library for printing colored messages to the terminal
Summary: Review Request: termcolor - Header-only C++ library for printing colored mess...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2028272
TreeView+ depends on / blocked
 
Reported: 2021-12-01 20:49 UTC by Mikel Olasagasti Uranga
Modified: 2021-12-09 23:05 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-12-09 23:05:36 UTC
Type: ---
Embargoed:
code: fedora-review+


Attachments (Terms of Use)

Description Mikel Olasagasti Uranga 2021-12-01 20:49:34 UTC
Spec URL: https://mikel.olasagasti.info/tmp/fedora/termcolor.spec
SRPM URL: https://mikel.olasagasti.info/tmp/fedora/termcolor-2.0.0-1.fc35.src.rpm
Description: Termcolor is a header-only C++ library for printing colored messages to the terminal. Written just for fun with a help of the Force.

Termcolor uses ANSI color formatting, so you can use it on every system that is used such terminals (most *nix systems, including Linux and Mac OS).

Fedora Account System Username: mikelo2

Comment 1 Mikel Olasagasti Uranga 2021-12-01 20:53:09 UTC
.spec has the following path:

> %{_prefix}/lib/cmake/%{name}/

As the package is a header-only package it's built with noarch, so I think hardcoding it to /usr/lib makes sense because of non 64bit archs.

rpmlint will complain about it, so the following rpmlintrc will be included:

https://mikel.olasagasti.info/tmp/fedora/termcolor.rpmlintrc

Comment 2 Petr Menšík 2021-12-07 09:52:42 UTC
Note even header-only package should not be packaged as noarch. Read guidelines, especially [1]. In order to test the package on all platforms, it should build even header-only package as platform dependent packages.

1. https://docs.fedoraproject.org/en-US/packaging-guidelines/#_packaging_header_only_libraries

Comment 3 Mikel Olasagasti Uranga 2021-12-07 10:31:32 UTC
Thanks for reviewing Petr. I'll change the spec asap.

I used `elfio`[1] as base to create this one, that uses noarch, but was not happy with the result spec.

I was going to ask in devel if it was correct, as the library install path is /usr/lib and rpmlint complains about it. I even created a patch upstream[2] to have per arch install dirs, but was not sure how to fit this with noarch.

[1] https://src.fedoraproject.org/rpms/elfio
[2] https://github.com/ikalnytskyi/termcolor/pull/63

Comment 4 Mikel Olasagasti Uranga 2021-12-07 11:05:43 UTC
Spec URL: https://mikel.olasagasti.info/tmp/fedora/termcolor.spec
SRPM URL: https://mikel.olasagasti.info/tmp/fedora/termcolor-2.0.0-1.fc35.src.rpm

- Remove noarch
- Apply patch to use GNUInstallDirs

Comment 5 Ben Beasley 2021-12-09 12:21:39 UTC
Package Review
==============

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


Issues:
=======
- Dist tag is present.

  OK (rpmautospec)

- The -devel package should Require: cmake-filesystem for ownership of the
  %{_libdir}/cmake directory.

- There is a test that can be enabled with -DTERMCOLOR_TESTS:BOOL=ON, but since
  it is only a “visual” test for human inspection, there is probably no value
  in running the test executable in %check.

  However, I think it would be worth enabling it as a “does it even compile”
  test.

Notes (no change required):
===========================

- If you wanted, you could save repeating the description with something like:

    %global common_description %{expand:
    Termcolor is a header-only C++ library for printing colored messages to the
    terminal. Written just for fun with a help of the Force.
    
    Termcolor uses ANSI color formatting, so you can use it on every system that is
    used such terminals (most *nix systems, including Linux and Mac OS).}
    
    %description %{common_description}

    […]
    
    %description devel %{common_description}

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

C/C++:
[x]: Package does not contain kernel modules.
[x]: 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]: 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", "BSD 3-Clause License". 18 files have
     unknown license. Detailed output of licensecheck in
     /home/reviewer/2028270-termcolor/licensecheck.txt
[x]: %build honors applicable compiler flags or justifies otherwise.

     Nothing is compiled when tests are disabled.

[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.
[!]: Requires correct, justified where necessary.

     devel package should Require cmake-filesystem

[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[-]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 10240 bytes in 1 files.
[-]: Package complies to the Packaging Guidelines

     (except as noted)

[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]: 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.
[x]: Final provides and requires are sane (see attachments).

     (except cmake-filesystem)

[x]: Package functions as described.

     Manually inspected output of test program when enabled

[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.
[-]: 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.
[-]: %check is present and all tests pass.

     No *automated* upstream tests exist.

[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 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
-------
Cannot parse rpmlint output:


Rpmlint (installed packages)
----------------------------
Cannot parse rpmlint output:


Source checksums
----------------
https://github.com/ikalnytskyi/termcolor/archive/refs/tags/v2.0.0.tar.gz :
  CHECKSUM(SHA256) this package     : 4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20
  CHECKSUM(SHA256) upstream package : 4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20


Requires
--------
termcolor-devel (rpmlib, GLIBC filtered):
    cmake-filesystem(x86-64)



Provides
--------
termcolor-devel:
    cmake(termcolor)
    termcolor-devel
    termcolor-devel(x86-64)
    termcolor-static



Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -b 2028270
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, C/C++, Shell-api
Disabled plugins: Python, Ocaml, SugarActivity, PHP, R, fonts, Haskell, Perl, Java
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH
============================ rpmlint session starts ============================
rpmlint: 2.1.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 2

termcolor-devel.x86_64: W: only-non-binary-in-usr-lib
termcolor.spec:53: W: macro-in-%changelog %autochangelog
 2 packages and 0 specfiles checked; 0 errors, 2 warnings, 0 badness; has taken 0.1 s

Comment 6 Ben Beasley 2021-12-09 12:30:56 UTC
In my opinion, what elfio does (arched base package with noarch -devel subpackage) should be allowed for header-only libraries, because it addresses the stated reasons for requiring them to be arched:

- The tests still run on all architectures, because the base package is arched.
- Koji can already detect the situation where an allegedly-noarch subpackage is actually different across architectures (https://docs.pagure.org/koji/misc/#how-noarch-sub-packages-are-built).

However, Petr Menšík is correct that the guidelines don’t currently allow this.

I should probably bring this up on the packaging list and see if there is support for revising the guidelines to allow the technique used in elfio.

Comment 8 Petr Menšík 2021-12-09 15:02:33 UTC
I would say [!]: %check is present and all tests pass.

There is a test which should be enabled and built. At least it ensures the code compiles. I admit those nice colors would not be verified similar way to human, but it would ensure at least minimal test. But that is only SHOULD, not required. Maybe the test could be part of base package. I think testing different terminal capabilities might be useful, it can display common colors in a compact way.

I have missed unowned %{_libdir}/cmake though, that is mandatory change.

Comment 9 Mikel Olasagasti Uranga 2021-12-09 16:06:36 UTC
Spec URL: https://mikel.olasagasti.info/tmp/fedora/termcolor.spec
SRPM URL: https://mikel.olasagasti.info/tmp/fedora/termcolor-2.0.0-1.fc35.src.rpm

- Added Require on cmake-filesystem
- Enabled test at build time
- Run %check by running built binary, but shell mock's shell doesn't show colors.
- Adopt `%global common_description`

Comment 10 Mikel Olasagasti Uranga 2021-12-09 16:11:46 UTC
I think elfio's noarch works fine because it's installing cmake's definitions in /usr/share/elfio/cmake/ that is architecture agnostic.

termcolor was installing them in /usr/lib by default. If elfio was using %{_libdir} rather than %{_datadir} it coulnd't use noarch.

Comment 11 Ben Beasley 2021-12-09 16:34:30 UTC
Could you please adjust the path to the test executable?

Change:

  %{_builddir}/%{name}-%{version}/redhat-linux-build/test_termcolor

to

  %{_vpath_builddir}/test_termcolor

See:

https://docs.fedoraproject.org/en-US/packaging-guidelines/vpath/
https://docs.fedoraproject.org/en-US/packaging-guidelines/CMake/#_available_macros

The definition of _vpath_builddir has changed in the past and may well change again.

----

> I think elfio's noarch works fine because it's installing cmake's definitions in /usr/share/elfio/cmake/ that is architecture agnostic.

This came up on the packaging mailing list in the thread I linked in a previous comment. Independent of packaging policy, you’re certainly correct that installing anything in %{_libdir} precludes using noarch for the (sub)package in question.

Comment 12 Mikel Olasagasti Uranga 2021-12-09 16:44:33 UTC
Spec URL: https://mikel.olasagasti.info/tmp/fedora/termcolor.spec
SRPM URL: https://mikel.olasagasti.info/tmp/fedora/termcolor-2.0.0-1.fc35.src.rpm

- Use %{_vpath_builddir} for test executable

Comment 13 Ben Beasley 2021-12-09 22:07:12 UTC
Thanks. Package is APPROVED.

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

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


Issues:
=======
- Dist tag is present.

  OK (rpmautospec)


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

C/C++:
[x]: Package does not contain kernel modules.
[x]: 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]: 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", "BSD 3-Clause License". 18 files have
     unknown license. Detailed output of licensecheck in
     /home/reviewer/2028270-termcolor/20211209-2/2028270-termcolor/licensecheck.txt
[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 10240 bytes in 1 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 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]: 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:
[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.
[-]: 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 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
-------
Cannot parse rpmlint output:


Rpmlint (installed packages)
----------------------------
Cannot parse rpmlint output:


Source checksums
----------------
https://github.com/ikalnytskyi/termcolor/archive/refs/tags/v2.0.0.tar.gz :
  CHECKSUM(SHA256) this package     : 4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20
  CHECKSUM(SHA256) upstream package : 4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20


Requires
--------
termcolor-devel (rpmlib, GLIBC filtered):
    cmake-filesystem
    cmake-filesystem(x86-64)



Provides
--------
termcolor-devel:
    cmake(termcolor)
    termcolor-devel
    termcolor-devel(x86-64)
    termcolor-static



Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -b 2028270
Buildroot used: fedora-rawhide-x86_64
Active plugins: Shell-api, C/C++, Generic
Disabled plugins: PHP, Java, Ocaml, Python, Perl, R, Haskell, SugarActivity, fonts
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH
============================ rpmlint session starts ============================
rpmlint: 2.1.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 2

termcolor-devel.x86_64: W: only-non-binary-in-usr-lib
termcolor.spec:56: W: macro-in-%changelog %autochangelog
 2 packages and 0 specfiles checked; 0 errors, 2 warnings, 0 badness; has taken 0.1 s

Comment 14 Gwyn Ciesla 2021-12-09 22:45:33 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/termcolor

Comment 15 Fedora Update System 2021-12-09 23:02:36 UTC
FEDORA-2021-bdb6075e22 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2021-bdb6075e22

Comment 16 Fedora Update System 2021-12-09 23:05:36 UTC
FEDORA-2021-bdb6075e22 has been pushed to the Fedora 36 stable repository.
If problem still persists, 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.