Bug 1401276 - Review Request: python-grako - Python grammer compiler
Summary: Review Request: python-grako - Python grammer compiler
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Iryna Shcherbina
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-04 09:10 UTC by Eric Smith
Modified: 2018-12-02 00:01 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-12-02 00:01:00 UTC
Type: ---
Embargoed:
ishcherb: fedora-review+


Attachments (Terms of Use)

Description Eric Smith 2016-12-04 09:10:24 UTC
Spec URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako.spec
SRPM URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako-3.17.0-1.fc24.src.rpm
Description: Grako (for "grammar compiler") takes a grammar in a variation of EBNF
as input, and outputs a memoizing PEG/Packrat parser in Python.
Fedora Account System Username: brouhaha

Comment 1 Iryna Shcherbina 2016-12-05 16:18:53 UTC
Hi Eric,

I have looked through the spec file and it looks good in general, but please consider the following:

* [!]: Package consistently uses macros
Please use %{modname} macro in `Name` and `URL`.

* [!]: Spec file is legible and written in American English.
Spelling error in summary: please change grammer -> grammar

* [!]: %check is present and all tests pass.
The package contains tests, so please run them in %check.

* There is no need to define `summary` macro, it is generated automatically after you set the first Summary tag. So you should just set the Summary of the main package and use %{summary} macro in your python3- subpackage. 

* It is better to avoid using wildcards in the %files section to have an idea what is installed with the package. Doing the following change will make it more safe:

%{python3_sitelib}/*

change to

%{python3_sitelib}/%{modname}
%{python3_sitelib}/%{modname}-%{version}-py?.?.egg-info

* Regarding shebang change: why would you use a `for` loop to change shebang in just one file (bootstrap.py)?

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

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

===== 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.
[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.
[!]: 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.
[!]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[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.
[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]: All build dependencies are listed in BuildRequires, except for any
     that are listed in the exceptions section of Packaging Guidelines.
[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]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Binary eggs must be removed in %prep

===== 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.
[x]: Package does not include license text files separate from upstream.
[-]: 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]: 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]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: python3-grako-3.17.0-1.fc24.noarch.rpm
          python-grako-3.17.0-1.fc24.src.rpm
python3-grako.noarch: W: spelling-error Summary(en_US) grammer -> grimmer, grammar, crammer
python3-grako.noarch: W: spelling-error %description -l en_US memoizing -> memorizing, demonizing, monetizing
python3-grako.noarch: W: no-manual-page-for-binary grako
python-grako.src: W: spelling-error Summary(en_US) grammer -> grimmer, grammar, crammer
python-grako.src: W: spelling-error %description -l en_US memoizing -> memorizing, demonizing, monetizing
2 packages and 0 specfiles checked; 0 errors, 5 warnings.




Rpmlint (installed packages)
----------------------------
sh: /usr/bin/python: No such file or directory
python3-grako.noarch: W: spelling-error Summary(en_US) grammer -> grimmer, grammar, crammer
python3-grako.noarch: W: spelling-error %description -l en_US memoizing -> memorizing, demonizing, monetizing
python3-grako.noarch: W: no-manual-page-for-binary grako
1 packages and 0 specfiles checked; 0 errors, 3 warnings.



Requires
--------
python3-grako (rpmlib, GLIBC filtered):
    /usr/bin/python3
    python(abi)



Provides
--------
python3-grako:
    python3-grako



Source checksums
----------------
https://pypi.io/packages/source/g/grako/grako-3.17.0.tar.gz :
  CHECKSUM(SHA256) this package     : 57d0e53d94e587ee9976cd45fa7f15845d4bf974024da27c9919cef06fde92f2
  CHECKSUM(SHA256) upstream package : 57d0e53d94e587ee9976cd45fa7f15845d4bf974024da27c9919cef06fde92f2


Generated by fedora-review 0.6.1 (f03e4e7) last change: 2016-05-02
Command line :/usr/bin/fedora-review -b 1401276
Buildroot used: fedora-24-x86_64
Active plugins: Python, Generic, Shell-api
Disabled plugins: Java, C/C++, fonts, SugarActivity, Ocaml, Perl, Haskell, R, PHP
Disabled flags: EXARCH, DISTTAG, EPEL5, BATCH, EPEL6

Comment 2 Eric Smith 2016-12-11 05:40:55 UTC
Spec URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako.spec
SRPM URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako-3.18.0-1.fc24.src.rpm

Updated to latest upstream, and updated spec per review comments, including %check section. Patched Makefiles to use Python 3 for %check, since package is only being built for Python 3.

Verified to build w/ koji for rawhide, F25, F24, and EPEL7.

The reason for the for loop that changes the shebang and perms for only one file:
1) copied from another spec file that works - if it ain't broke don't fix it
2) future upstream releases might have more files that need this treatment

If you feel strongly about removing the for loop, let me know and I'll take it out.

Thanks!
Eric

Comment 3 Iryna Shcherbina 2016-12-12 17:03:52 UTC
Thank you for the changes.

(In reply to Eric Smith from comment #2)
> The reason for the for loop that changes the shebang and perms for only one
> file:
> 1) copied from another spec file that works - if it ain't broke don't fix it
> 2) future upstream releases might have more files that need this treatment
> 
> If you feel strongly about removing the for loop, let me know and I'll take
> it out.

Thanks for the explanation. You can keep it as is for future use if needed.

One more thing, the documentation [0] lists a couple of optional dependencies which are handled silently if not installed. However pygraphviz seems to be required if you use a `--draw` option, as it raises an error if not installed:

# grako antlr.ebnf --draw --outfile=out.txt
Traceback (most recent call last):
  File "/usr/bin/grako", line 9, in <module>
    load_entry_point('grako==3.18.0', 'console_scripts', 'grako')()
  File "/usr/lib/python3.5/site-packages/grako/tool.py", line 182, in main
    from grako import diagrams
  File "/usr/lib/python3.5/site-packages/grako/diagrams.py", line 10, in <module>
    import pygraphviz as pgv
ImportError: No module named 'pygraphviz'

Is there a reason not to require it?

Apart from the above question, everything looks good.

[0] https://bitbucket.org/apalala/grako/annotate/411da520bac9dd730a49ce39d651a3f5c7936be1/README.md?at=default&fileviewer=file-view-default#README.md-48

Comment 4 Eric Smith 2016-12-12 23:38:49 UTC
Spec URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako.spec
SRPM URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako-3.18.0-2.fc24.src.rpm

Good catch! I've added the Requires for python3-graphviz, added a "mkdir tmp" so diagram_test passes, and added the examples directory as doc.

Your example of drawing to out.txt doesn't work; try out.pdf instead.

Comment 5 Iryna Shcherbina 2016-12-13 10:48:03 UTC
(In reply to Eric Smith from comment #4)
> Your example of drawing to out.txt doesn't work; try out.pdf instead.

You are right, thank you.

> Good catch! I've added the Requires for python3-graphviz, added a "mkdir
> tmp" so diagram_test passes, and added the examples directory as doc.

Please correct python3-graphviz to python3-pygraphviz, an move the `Requires` into the %package section.

Also, please take a look into the following rpmlint errors after adding examples.

python3-grako.noarch: E: wrong-script-interpreter /usr/share/doc/python3-grako/examples/regex/genparser.py /usr/bin/env python
python3-grako.noarch: W: file-not-utf8 /usr/share/doc/python3-grako/examples/antlr2grako/.ropeproject/globalnames
python3-grako.noarch: E: wrong-script-interpreter /usr/share/doc/python3-grako/examples/antlr2grako/antlr_parser.py /usr/bin/env python
python3-grako.noarch: E: wrong-script-interpreter /usr/share/doc/python3-grako/examples/regex/parser_base.py /usr/bin/env python
python3-grako.noarch: W: file-not-utf8 /usr/share/doc/python3-grako/examples/antlr2grako/.ropeproject/history
python3-grako.noarch: E: wrong-script-interpreter /usr/share/doc/python3-grako/examples/antlr2grako/antlr2grako.py /usr/env/bin python
python3-grako.noarch: W: hidden-file-or-dir /usr/share/doc/python3-grako/examples/antlr2grako/.ropeproject
python3-grako.noarch: W: hidden-file-or-dir /usr/share/doc/python3-grako/examples/antlr2grako/.ropeproject

Comment 6 Eric Smith 2016-12-13 21:54:59 UTC
Spec URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako.spec
SRPM URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako-3.18.0-3.fc24.src.rpm

I apologize for wasting your time! From my shell history, I see that I built 3.18.0-2 locally, but then ran rpmlint and koji with -1.  :-(

- Fix dependency on python3-pygraphviz, and move into subpackage.
- Fix shebang lines of examples.
- Clean examples after check.

Comment 7 Iryna Shcherbina 2016-12-14 14:09:03 UTC
(In reply to Eric Smith from comment #6)
> I apologize for wasting your time! From my shell history, I see that I built
> 3.18.0-2 locally, but then ran rpmlint and koji with -1.  :-(

No problem at all.

I have two more small suggestions after the changes:

1) Tests should be run after the %install procedure, so place %check after %install section.
2) You might consider using `pushd` instead of `cd`:
pushd examples/regex
...
popd

Apart from the above, everything looks good.

Comment 9 Iryna Shcherbina 2016-12-16 11:18:12 UTC
Can you please update the version to 3.18.1? It was recently released.

The shebang changing part grew considerably with all the changes and became quite difficult to read and maintain. Besides, after you moved it to %prep, you do not need to change the mode of the files there. Please take a look at the section on shebangs [0], as here it can be replaced with for example:

find -type f -exec sed -i '1s=^#!/usr\(/env\|/bin\)* python[23]\?=#!/usr/bin/python3=' {} +

[0] http://python-rpm-porting.readthedocs.io/en/latest/applications.html#fixing-shebangs

Comment 10 Eric Smith 2016-12-17 07:07:43 UTC
Spec URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako.spec
SRPM URL: https://fedorapeople.org/~brouhaha/python-grako/python-grako-3.18.1-1.fc25.src.rpm

Changed per your suggestions.
Also now using find/sed to change python to python3 in Makefiles.

Comment 11 Iryna Shcherbina 2016-12-19 12:09:40 UTC
Thank you for the changes, Eric.
Package approved.

Comment 12 Gwyn Ciesla 2016-12-19 13:58:59 UTC
Package request has been approved: https://admin.fedoraproject.org/pkgdb/package/rpms/python-grako

Comment 13 Fedora Update System 2016-12-19 23:11:48 UTC
python-grako-3.18.1-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-82db60915e

Comment 14 Fedora Update System 2016-12-20 19:20:46 UTC
python-grako-3.18.1-1.fc25 has been pushed to the Fedora 25 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-2016-82db60915e

Comment 15 Miro Hrončok 2018-12-02 00:01:00 UTC
This is long done.


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