Bug 1654689 - Review Request: yubihsm-shell - Tools to interact with YubiHSM 2
Summary: Review Request: yubihsm-shell - Tools to interact with YubiHSM 2
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Robert-André Mauchin 🐧
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-29 12:25 UTC by Jakub Jelen
Modified: 2018-12-21 19:39 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-12-21 19:39:21 UTC
Type: ---
Embargoed:
zebob.m: fedora-review+


Attachments (Terms of Use)

Description Jakub Jelen 2018-11-29 12:25:49 UTC
Spec URL: https://jjelen.fedorapeople.org/yubihsm-shell.spec
SRPM URL: https://jjelen.fedorapeople.org/yubihsm-shell-2.0.0-1.fc30.src.rpm
Description: This package contains most of the components used to interact with the YubiHSM 2 at both a user-facing and programmatic level.
Fedora Account System Username: jjelen


https://copr.fedorainfracloud.org/coprs/jjelen/yubihsm-shell/

Comment 1 Jakub Jelen 2018-11-29 12:30:08 UTC
This application will need also the yubihsm-connector, which is written in Go (I don't have any experience packaging Go) so further help would be appreciated.

https://github.com/Yubico/yubihsm-connector

Comment 2 Robert-André Mauchin 🐧 2018-11-30 22:28:13 UTC
 - Not needed anymore:

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

 - Globbing the major soname version of libraries is now forbidden to avoid unintentional soname bump, be more precise instead:

%{_libdir}/libyubihsm.so.*
%{_libdir}/libyubihsm_http.so.*
%{_libdir}/libyubihsm_usb.so.*

 - Use a glob instead of .gz for man pages as the compression might change in the future:

%{_mandir}/man1/yubihsm-shell.1.*
%{_mandir}/man1/yubihsm-wrap.1.*



For the go packaging, usually you start with:

sudo gofed repo2spec --detect https://github.com/pathtotherepo

Then fill in the blanks.

Your package is a bit different since it's a binary and not a library. You'll have to find the deps too:

=============================
# Run tests in check section
%bcond_without check

# https://github.com/Yubico/yubihsm-connector
%global goipath         github.com/Yubico/yubihsm-connector
Version:                2.0.0

%global common_description %{expand:
YubiHSM connector.}

%gometa

Name:           yubihsm-connector
Release:        1%{?dist}
Summary:        YubiHSM connector
# Detected licences
# - *No copyright* Apache License (v2.0) at 'LICENSE'
License:        ASL 2.0
URL:            %{gourl}
Source0:        %{gourl}/archive/%{version}/%{name}-%{version}.tar.gz

%{?systemd_requires}
Requires(pre): shadow-utils
BuildRequires: systemd-rpm-macros
BuildRequires: golang(github.com/kardianos/service)
BuildRequires: golang(github.com/thorduri/go-libusb/usb)
BuildRequires: golang(github.com/sirupsen/logrus)
BuildRequires: golang(github.com/sirupsen/logrus/hooks/syslog)
BuildRequires: golang(github.com/spf13/cobra)
BuildRequires: golang(github.com/spf13/viper)
BuildRequires: golang(gopkg.in/yaml.v2)


%description
%{common_description}


%package devel
Summary:       %{summary}
BuildArch:     noarch

%description devel
%{common_description}

This package contains library source intended for
building other packages which use import path with
%{goipath} prefix.


%prep
%forgeautosetup

rm -rf vendor/


%build
%gobuildroot
pushd src/yubihsm-connector/
go generate
popd
%gobuild -o _bin/yubihsm-connector %{goipath}/src/yubihsm-connector/


%install
install -Dpm 0755 _bin/yubihsm-connector %{buildroot}%{_bindir}/yubihsm-connector
install -Dpm 0644  deb/yubihsm-connector.yaml %{buildroot}%{_sysconfdir}/yubihsm-connector.yaml
install -Dpm 0644  deb/yubihsm-connector.service %{buildroot}%{_unitdir}/yubihsm-connector.service
install -Dpm 0644  deb/70-yubihsm-connector.rules %{buildroot}%{_udevrulesdir}/70-yubihsm-connector.rules


%if %{with check}
%check
%gochecks
%endif


%pre
getent group yubihsm-connector >/dev/null || groupadd -r yubihsm-connector
getent passwd yubihsm-connector >/dev/null || \
    useradd -r -g yubihsm-connector -M -s /sbin/nologin \
    -c "YubiHSM connector account" yubihsm-connector \
    --system
exit 0


%post
%systemd_post yubihsm-connector.service


%preun
%systemd_preun yubihsm-connector.service


%postun
%systemd_postun_with_restart yubihsm-connector.service


%files
%license LICENSE
%{_bindir}/yubihsm-connector
%config(noreplace) %{_sysconfdir}/yubihsm-connector.yaml
%{_unitdir}/yubihsm-connector.service
%{_udevrulesdir}/70-yubihsm-connector.rules


%changelog
* Fri Nov 30 2018 Jakub Jelen <jjelen> - 2.0.0-1
- First package for Fedora
==============================


You'll heed to package github.com/thorduri/go-libusb which is not available in Fedora. It should look like this:

============================
# Run tests in check section
# Requires a usb device
%bcond_with check

# https://github.com/thorduri/go-libusb
%global goipath         github.com/thorduri/go-libusb
%global commit          bbed4ca2a465660f336e1e5a4b2fe549667a2ca1


%global common_description %{expand:
The gousb package is an attempt at wrapping the libusb library into a 
Go-like binding.}

%gometa

Name:           %{goname}
Version:        0
Release:        0.1%{?dist}
Summary:        Idiomatic Go bindings for libusb-1.0 
# Detected licences
# - *No copyright* Apache License (v2.0) at 'LICENSE'
License:        ASL 2.0
URL:            %{gourl}
Source0:        %{gosource}

BuildRequires:  pkgconfig(libusb)

%description
%{common_description}


%package devel
Summary:       %{summary}
BuildArch:     noarch
Requires:      pkgconfig(libusb)

%description devel
%{common_description}

This package contains library source intended for
building other packages which use import path with
%{goipath} prefix.


%prep
%forgeautosetup


%install
%goinstall


%if %{with check}
%check
%gochecks
%endif


%files devel -f devel.file-list
%license LICENSE
%doc README.md


%changelog
* Fri Nov 30 2018 Jakub Jelen <jjelen> - 0-0.1.20181130gitbbed4ca
- First package for Fedora
==========================


You can check the builds here: https://copr.fedorainfracloud.org/coprs/eclipseo/golangtest/builds/

Comment 3 Jakub Jelen 2018-12-03 09:37:49 UTC
Thank you for the comments and improvements. I will submit updated package soon. Can you point me where the specific requirements are listed? I was not able to find a note about (even though I agree that this requirement makes sense):

>  - Globbing the major soname version of libraries is now forbidden to avoid unintentional soname bump, be more precise instead

Also the fedora-review still complains if the ldconfig snippet is missing [1]

I might have a look into the related go packages later.

The updated spec files, srpms and copr repo are available below:

Spec URL: https://jjelen.fedorapeople.org/yubihsm-shell.spec
SRPM URL: https://jjelen.fedorapeople.org/yubihsm-shell-2.0.0-2.fc30.src.rpm

https://copr.fedorainfracloud.org/coprs/jjelen/yubihsm-shell/

[1] https://pagure.io/FedoraReview/pull-request/315

Comment 4 Robert-André Mauchin 🐧 2018-12-06 18:37:04 UTC
(In reply to Jakub Jelen from comment #3)
> Thank you for the comments and improvements. I will submit updated package
> soon. Can you point me where the specific requirements are listed? I was not
> able to find a note about (even though I agree that this requirement makes
> sense):
> 
> >  - Globbing the major soname version of libraries is now forbidden to avoid unintentional soname bump, be more precise instead
> 
You can find info here:

https://pagure.io/packaging-committee/issue/784

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

Comment 5 Robert-André Mauchin 🐧 2018-12-06 18:46:59 UTC
Package approved.


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

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



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

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

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "*No copyright* Apache License (v2.0)", "OpenSSL License",
     "Unknown or generated", "Apache License (v2.0)". 32 files have unknown
     license. Detailed output of licensecheck in /home/bob/packaging/review
     /yubihsm-shell/review-yubihsm-shell/licensecheck.txt
[x]: License file installed when any subpackage combination is installed.
[x]: Package does not own files or directories owned by other packages.
     Note: Dirs in package are owned also by: /usr/lib64/pkcs11(opensc, p11
     -kit-trust, coolkey)
[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.
[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 uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 0 bytes in 0 files.
[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).
[x]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in yubihsm-
     shell-devel , yubihsm-shell-debuginfo , yubihsm-shell-debugsource
[-]: 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.
[-]: 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]: 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]: The placement of pkgconfig(.pc) files are correct.
[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: yubihsm-shell-2.0.0-2.fc30.x86_64.rpm
          yubihsm-shell-devel-2.0.0-2.fc30.x86_64.rpm
          yubihsm-shell-debuginfo-2.0.0-2.fc30.x86_64.rpm
          yubihsm-shell-debugsource-2.0.0-2.fc30.x86_64.rpm
          yubihsm-shell-2.0.0-2.fc30.src.rpm
yubihsm-shell-devel.x86_64: W: no-documentation
5 packages and 0 specfiles checked; 0 errors, 1 warnings.

Comment 6 Jakub Jelen 2018-12-10 11:34:42 UTC
Thank you. Let me know if you will need some review in exchange.

Comment 7 Igor Raits 2018-12-10 11:51:51 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/yubihsm-shell

Comment 8 Fedora Update System 2018-12-11 09:42:10 UTC
yubihsm-shell-2.0.0-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-b4c1b1dcad

Comment 9 Fedora Update System 2018-12-12 03:33:23 UTC
yubihsm-shell-2.0.0-2.fc29 has been pushed to the Fedora 29 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-2018-b4c1b1dcad

Comment 10 Fedora Update System 2018-12-21 19:39:21 UTC
yubihsm-shell-2.0.0-2.fc29 has been pushed to the Fedora 29 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.