Bug 1933464 - Review Request: rubygem-sugarjar - A git/github helper utility
Summary: Review Request: rubygem-sugarjar - A git/github helper utility
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Davide Cavalca
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1920112 1933462 1933471
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-28 03:23 UTC by Phil Dibowitz
Modified: 2021-03-23 00:17 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-03-17 02:18:02 UTC
Type: ---
Embargoed:
davide: fedora-review+


Attachments (Terms of Use)

Description Phil Dibowitz 2021-02-28 03:23:05 UTC
Spec URL: https://raw.githubusercontent.com/jaymzh/sugarjar/master/rubygem-sugarjar.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/1816/62821816/rubygem-sugarjar-0.0.9-1.fc35.src.rpm
Description: a git/github helper utility
Fedora Account System Username: jaymzh

This depends on rubygem-pastel (https://bugzilla.redhat.com/show_bug.cgi?id=1933462) which depends on rubygem-tty-color (https://bugzilla.redhat.com/show_bug.cgi?id=1933459).

It also depends on rubygem-mixlib-log which is in review by another developer (https://bugzilla.redhat.com/show_bug.cgi?id=1920112).

Dependencies are fun. :)

One note about this spec, there's no ri/rdoc in the ruby source, so I dropped the doc package as well as all the empty generated docs from the base package.

And one final note, I am a first-time packager (pending the aforementioned 2 packages) and thus will need a sponsor.

Comment 1 Phil Dibowitz 2021-02-28 06:09:49 UTC
Hmm hold up on this. I forgot I have a dependency on hub and will need to figure out how to package that and then update this to reflect.

Comment 2 Phil Dibowitz 2021-02-28 09:36:29 UTC
OK - dependencies updated. Also fixed binary package name.

Comment 3 Davide Cavalca 2021-03-02 05:11:44 UTC
Taking this review

Comment 4 Davide Cavalca 2021-03-02 05:17:34 UTC
I'll do a formal review once the dependencies are in, as this cannot be installed as-is. Some notes:
- use %license instead of %doc for the license
- use %global instead of %define for the constants
- spec/commands_spec.rb seems to be tripping up licensecheck
- the test suite is mandatory for ruby packages per policy

Comment 5 Phil Dibowitz 2021-03-02 06:16:56 UTC
Thanks!

- license/global will fix.
- not much I can do about buggy license check ;)
- tests will be enabled once you get rubygem-mixlib-log out, disabled them so I could test builds in the meantime.

Comment 6 Phil Dibowitz 2021-03-10 08:01:47 UTC
Spec URL: https://raw.githubusercontent.com/jaymzh/sugarjar/master/rubygem-sugarjar.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/9570/63479570/rubygem-sugarjar-0.0.9-3.fc35.src.rpm

Sorry for the delay it took a while for hub to make it through compose.

Comment 7 Davide Cavalca 2021-03-10 16:55:05 UTC
This is a review *template*. Besides handling the [ ]-marked tests you are
also supposed to fix the template before pasting into bugzilla:
- Add issues you find to the list of issues on top. If there isn't such
  a list, create one.
- Add your own remarks to the template checks.
- Add new lines marked [!] or [?] when you discover new things not
  listed by fedora-review.
- Change or remove any text in the template which is plain wrong. In this
  case you could also file a bug against fedora-review
- Remove the "[ ] Manual check required", you will not have any such lines
  in what you paste.
- Remove attachments which you deem not really useful (the rpmlint
  ones are mandatory, though)
- Remove this text



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

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


Issues:
=======
- Package contains Requires: ruby(release).


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

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". 1 files have unknown license. Detailed
     output of licensecheck in /tmp/a/1933464-rubygem-
     sugarjar/licensecheck.txt
[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.
[-]: 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.
[x]: Package contains systemd file(s) if in need.
[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 must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: 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

Ruby:
[x]: Platform dependent files must all go under %{gem_extdir_mri}, platform
     independent under %{gem_dir}.
[x]: Gem package must not define a non-gem subpackage
[x]: Macro %{gem_extdir} is deprecated.
[x]: Gem package is named rubygem-%{gem_name}
[x]: Package contains BuildRequires: rubygems-devel.
[x]: Gem package must define %{gem_name} macro.
[x]: Pure Ruby package must be built as noarch
[x]: Package does not contain Requires: ruby(abi).

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

Generic:
[!]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
     Note: %clean present but not required
[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]: SourceX tarball generation or download is documented.
     Note: Package contains tarball without URL, check comments
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[x]: 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]: 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.

Ruby:
[x]: Specfile should use macros from rubygem-devel package.
     Note: The specfile doesn't use these macros: %doc %{gem_docdir}
[x]: Gem package should exclude cached Gem.
[x]: Gem should use %gem_install macro.
[x]: gems should not require rubygems package
[x]: Test suite should not be run by rake.
[x]: Test suite of the library should be run.

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

Generic:
[!]: Spec file according to URL is the same as in SRPM.
     Note: Spec file as given by url is not the same as in SRPM (see
     attached diff).
     See: (this test has no URL)
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).


Rpmlint
-------
Checking: sugarjar-0.0.9-3.fc35.noarch.rpm
          rubygem-sugarjar-0.0.9-3.fc35.src.rpm
sugarjar.noarch: W: spelling-error Summary(en_US) github -> git hub, git-hub, GitHub
sugarjar.noarch: W: spelling-error %description -l en_US rebase -> rebate, debase, re base
sugarjar.noarch: W: spelling-error %description -l en_US workflows -> work flows, work-flows, workloads
sugarjar.noarch: W: no-manual-page-for-binary sj
rubygem-sugarjar.src: W: spelling-error Summary(en_US) github -> git hub, git-hub, GitHub
rubygem-sugarjar.src: W: spelling-error %description -l en_US rebase -> rebate, debase, re base
rubygem-sugarjar.src: W: spelling-error %description -l en_US workflows -> work flows, work-flows, workloads
rubygem-sugarjar.src: W: inconsistent-file-extension rubygem-sugarjar-0.0.9-specs.tar.gz
rubygem-sugarjar.src: W: invalid-url Source1: rubygem-sugarjar-0.0.9-specs.tar.gz
2 packages and 0 specfiles checked; 0 errors, 9 warnings.




Rpmlint (installed packages)
----------------------------
sugarjar.noarch: W: spelling-error Summary(en_US) github -> git hub, git-hub, GitHub
sugarjar.noarch: W: spelling-error %description -l en_US rebase -> rebate, debase, re base
sugarjar.noarch: W: spelling-error %description -l en_US workflows -> work flows, work-flows, workloads
sugarjar.noarch: W: no-manual-page-for-binary sj
1 packages and 0 specfiles checked; 0 errors, 4 warnings.



Source checksums
----------------
https://rubygems.org/downloads/sugarjar-0.0.9.gem :
  CHECKSUM(SHA256) this package     : f15303be359c3c407abb7d350d78167b5dc8178d65f847edf49e663bb3b01e65
  CHECKSUM(SHA256) upstream package : f15303be359c3c407abb7d350d78167b5dc8178d65f847edf49e663bb3b01e65


Requires
--------
sugarjar (rpmlib, GLIBC filtered):
    /usr/bin/ruby
    git
    hub
    ruby(rubygems)
    rubygem(mixlib-log)
    rubygem(mixlib-shellout)
    rubygem(pastel)



Provides
--------
sugarjar:
    rubygem(sugarjar)
    sugarjar



Diff spec file in url and in SRPM
---------------------------------
--- /tmp/a/1933464-rubygem-sugarjar/srpm/rubygem-sugarjar.spec	2021-03-10 08:46:52.573469876 -0800
+++ /tmp/a/1933464-rubygem-sugarjar/srpm-unpacked/rubygem-sugarjar.spec	2021-03-09 23:50:59.000000000 -0800
@@ -67,5 +67,5 @@
 
 %clean
-rm -rf %{buildroot}
+rm -rf $RPM_BUILD_ROOT
 
 %files -n sugarjar


Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -b 1933464
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Shell-api, Ruby
Disabled plugins: C/C++, Ocaml, Perl, Java, R, SugarActivity, fonts, Haskell, Python, PHP
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 8 Davide Cavalca 2021-03-10 16:57:13 UTC
- the specfile in the src.rpm doesn't match the one in the URL; the delta is

Diff spec file in url and in SRPM
---------------------------------
--- /tmp/a/1933464-rubygem-sugarjar/srpm/rubygem-sugarjar.spec	2021-03-10 08:46:52.573469876 -0800
+++ /tmp/a/1933464-rubygem-sugarjar/srpm-unpacked/rubygem-sugarjar.spec	2021-03-09 23:50:59.000000000 -0800
@@ -67,5 +67,5 @@
 
 %clean
-rm -rf %{buildroot}
+rm -rf $RPM_BUILD_ROOT
 
 %files -n sugarjar

which isn't actually important

- per fedora-review, you can actually delete the whole %clean section
- consider adding a manpage for sj (ideally upstream)

None of these are blocking, APPROVED

Comment 9 Tomas Hrcka 2021-03-10 22:54:01 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rubygem-sugarjar

Comment 10 Vít Ondruch 2021-03-11 18:21:01 UTC
(In reply to Davide Cavalca from comment #8)
> - per fedora-review, you can actually delete the whole %clean section

This is actually SHOULD. It is not needed and while ago, there was put effort into removing the `%clean` sections from all packages.

And I have several more remarks actually:

* Is this [1] any useful?
* The layout of the package is quite nonstandard. I'd expect that the package (including spec file and SRPM) is either name `sugarjar`, if it is considered application, or named `rubygem-sugarjar` otherwise. The current naming makes hard to understand the relation between `sugarjar` RPM and `rubygem-sugarjar` SRPM. There is no other package like this.
* The order of preamble also deviates from common order, which makes the package harder to navigate.
* We typically tend to use the virtual provides for specifying dependencies, e.g. `BuildRequires: rubygem(rspec)` instead of `BuildRequires: rubygem-rspec`.
* We typically tend to run the test suite under the `pushd .%{gem_instdir}`. It is of course possible to run it directly in `%{builddir}`, which is default, but there might be possibly small differences.

I'd suggest to use rubygem-gem2rpm to generate the initial boilerplate.

[1] https://src.fedoraproject.org/rpms/rubygem-sugarjar/blob/rawhide/f/rubygem-sugarjar.spec#_64

Comment 11 Phil Dibowitz 2021-03-11 18:58:55 UTC
* no, that `find` was debug, good catch thanks
* The ruby packaging guidelines are clear here, and they afaict disagree with you:

```
    Packages that contain Ruby Gems MUST be called rubygem-%{gem_name}.
```

The binary package that provides an application I don't think makes sense as rubygem- but the requirements are clear that the base package must be rubygem-

* I can poke at reordering the globals in the next build, I assume that's what you mean

* re: spec Oops, missed that one, good call

* The specs are unit tests not functional tests and do not work in the installdir, they only work in the source, which is why I did it that way.

I did originally use gem2rpm, but it went through a lot of revisions since then... 

Feedback appreciated!

Comment 12 Vít Ondruch 2021-03-12 08:47:27 UTC
(In reply to Phil Dibowitz from comment #11)
> * The ruby packaging guidelines are clear here, and they afaict disagree
> with you:
> 
> ```
>     Packages that contain Ruby Gems MUST be called rubygem-%{gem_name}.
> ```
> 
> The binary package that provides an application I don't think makes sense as
> rubygem- but the requirements are clear that the base package must be
> rubygem-

This part of guidelines applies for applications:

~~~
Application packages that mainly provide user-level tools that happen to be written in Ruby MUST follow the general Naming Guidelines instead.
~~~

I agree that the guidelines are ambiguous at this point, but I am afraid there is no clear cut. The guidelines certainly were not meant in a way to have `rubygem-foo` SRPM and while having only `foo` RPM. The good question to ask when deciding is the question if there is any other use for the package as a library. Looking on sugarjar reverse dependencies [1], nothing depends on it, therefore it is certainly good candidate for application.

And if you like down bellow on the application example, while quite old one, you would see that the deltacloud-core is distributed as a gem, but later installed into regular `%{_datadir}` structure.

The confusion comes from duality of RubyGems:

1) It is good distribution method for Ruby code while
2) It is also Ruby load path manager

But at this point, I am not sure I have not made the water just muddier ů
> * I can poke at reordering the globals in the next build, I assume that's
> what you mean

No, I meant that for example the `Source` directives are at the end of preamble. While it is certainly possible, it is uncommon. This is just minor nit of course.

> * The specs are unit tests not functional tests and do not work in the
> installdir, they only work in the source, which is why I did it that way.

This way it works:

~~~
%if %{with tests}
%check
pushd .%{gem_instdir}
cp -a %{_builddir}/spec .
rspec spec
popd
%endif
~~~

I think you could struggle with the symbolic link. I prefer to use them whenever possible, but the `cp` have to be used here instead. The issue is that the link does not play nice with `require_relative` used in the test suite.

> I did originally use gem2rpm, but it went through a lot of revisions since
> then...

I like to keep my spec files as close to the original gem2rpm output as possible, because I always use gem2rpm even for updates. This serves two purposes:

1) If there are some changes in RubyGems packaging best practices, I'll notice them and can incorporate them into the .spec file
2) It helps to notice changes in upstream, such as added/removed files, different build dependencies.

I am not saying this is the only way to do the packaging, but it works for me ;)

> Feedback appreciated!


[1] https://rubygems.org/gems/sugarjar/reverse_dependencies

Comment 13 Fedora Update System 2021-03-16 15:13:26 UTC
FEDORA-2021-4e44f94635 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-4e44f94635

Comment 14 Fedora Update System 2021-03-17 02:18:02 UTC
FEDORA-2021-4e44f94635 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2021-03-20 23:26:02 UTC
FEDORA-2021-13b2608221 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-13b2608221

Comment 16 Fedora Update System 2021-03-21 02:06:17 UTC
FEDORA-2021-13b2608221 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --advisory=FEDORA-2021-13b2608221 \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-13b2608221

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Fedora Update System 2021-03-23 00:17:48 UTC
FEDORA-2021-13b2608221 has been pushed to the Fedora 34 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.