Bug 1421041 (deepin-gettext-tools) - Review Request: deepin-gettext-tools - Deepin Gettext Tools
Summary: Review Request: deepin-gettext-tools - Deepin Gettext Tools
Keywords:
Status: CLOSED RAWHIDE
Alias: deepin-gettext-tools
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: perl-XML-LibXML-PrettyPrint
Blocks: DeepinDEPackageReview
TreeView+ depends on / blocked
 
Reported: 2017-02-10 08:34 UTC by sensor.wen
Modified: 2018-01-01 01:45 UTC (History)
3 users (show)

Fixed In Version: deepin-gettext-tools-1.0.6-1.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-04 14:31:04 UTC
Type: ---
zbyszek: fedora-review+


Attachments (Terms of Use)

Comment 1 Felix Yan 2017-07-12 05:03:35 UTC
> %global __requires_exclude ^perl
The perl dependencies are actually used in /usr/bin/deepin-desktop-ts-convert. Without the tool some .desktop files in the related packages won't be generated. For example, /usr/share/applications/deepin-toggle-desktop.desktop won't be generated and the functionality will be missing from deepin-session-ui.

> # fix python version
Note that since version 1.0.6 Python 3.x is supported and the hack is no longer needed. The dependencies can be adjusted as wel.

Others looks good at the moment.


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

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


Issues:
=======
- Package contains BR: python2-devel or python3-devel


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

C/C++:
[ ]: Package does not contain kernel modules.
[ ]: Package contains no static executables.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.

Generic:
[ ]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[ ]: 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.
[ ]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "BSD (3 clause)", "GPL (v2.1) LGPL (v2.1)", "GPL (v3 or
     later)", "Unknown or generated", "*No copyright* GPL". 128 files have
     unknown license. Detailed output of licensecheck in
     /home/felix/projects/fedora/fedora-staging/deepin-gettext-tools
     /review-deepin-gettext-tools/licensecheck.txt
[ ]: Package requires other packages for directories it uses.
     Note: No known owner of /usr/lib/deepin-gettext-tools
[ ]: Package must own all directories that it creates.
     Note: Directories without known owners: /usr/lib/deepin-gettext-tools
[ ]: %build honors applicable compiler flags or justifies otherwise.
[ ]: Package contains no bundled libraries without FPC exception.
[ ]: Changelog in prescribed format.
[ ]: 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
[ ]: Package uses nothing in %doc for runtime.
[ ]: Package consistently uses macros (instead of hard-coded directory
     names).
[ ]: Package is named according to the Package Naming Guidelines.
[ ]: Package does not generate any conflict.
[ ]: 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.
[ ]: Spec file is legible and written in American English.
[ ]: Package contains systemd file(s) if in need.
[ ]: Useful -debuginfo package or justification otherwise.
[ ]: Package is not known to require an ExcludeArch tag.
[ ]: 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]: 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]: 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

Perl:
[ ]: Package contains the mandatory BuildRequires and Requires:.
     Note: Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`";
     echo $version)) missing?

Python:
[ ]: Python eggs must not download any dependencies during the build
     process.
[ ]: A package which is used by another package via an egg interface should
     provide egg info.
[ ]: Package meets the Packaging Guidelines::Python
[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.
[ ]: Final provides and requires are sane (see attachments).
[ ]: Package functions as described.
[ ]: Latest version is packaged.
[ ]: 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.
[ ]: Package should compile and build into binary rpms on all supported
     architectures.
[ ]: %check is present and all tests pass.
[ ]: 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
-------
Checking: deepin-gettext-tools-1.0.4-1.git4303c4a.fc27.x86_64.rpm
          deepin-gettext-tools-1.0.4-1.git4303c4a.fc27.src.rpm
deepin-gettext-tools.x86_64: E: no-binary
deepin-gettext-tools.x86_64: W: only-non-binary-in-usr-lib
deepin-gettext-tools.x86_64: W: no-documentation
deepin-gettext-tools.x86_64: E: zero-length /usr/lib/deepin-gettext-tools/blank.py
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/desktop_ts/desktop_ts_convert.pl /usr/bin/env perl
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/generate_mo.py /usr/bin/env python2
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/update_pot.py /usr/bin/env python2
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-desktop-ts-convert
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-generate-mo
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-update-pot
deepin-gettext-tools.src:38: E: hardcoded-library-path in %{_prefix}/lib/%{name}/*
2 packages and 0 specfiles checked; 6 errors, 5 warnings.




Rpmlint (installed packages)
----------------------------
deepin-gettext-tools.x86_64: E: no-binary
deepin-gettext-tools.x86_64: W: only-non-binary-in-usr-lib
deepin-gettext-tools.x86_64: W: no-documentation
deepin-gettext-tools.x86_64: E: zero-length /usr/lib/deepin-gettext-tools/blank.py
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/desktop_ts/desktop_ts_convert.pl /usr/bin/env perl
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/generate_mo.py /usr/bin/env python2
deepin-gettext-tools.x86_64: E: wrong-script-interpreter /usr/lib/deepin-gettext-tools/update_pot.py /usr/bin/env python2
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-desktop-ts-convert
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-generate-mo
deepin-gettext-tools.x86_64: W: no-manual-page-for-binary deepin-update-pot
1 packages and 0 specfiles checked; 5 errors, 5 warnings.



Requires
--------
deepin-gettext-tools (rpmlib, GLIBC filtered):
    /usr/bin/env
    gettext
    python



Provides
--------
deepin-gettext-tools:
    deepin-gettext-tools
    deepin-gettext-tools(x86-64)



Source checksums
----------------
https://github.com/linuxdeepin/deepin-gettext-tools/archive/4303c4a4f2b4eed0744d16576fb2c0d09f54aa88/deepin-gettext-tools-4303c4a.tar.gz :
  CHECKSUM(SHA256) this package     : 3f382400bcf7024426f421f1e4cf73ad133188b28cf5aec227ff5e07ccb05145
  CHECKSUM(SHA256) upstream package : 3f382400bcf7024426f421f1e4cf73ad133188b28cf5aec227ff5e07ccb05145


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

Comment 2 Zbigniew Jędrzejewski-Szmek 2017-07-13 04:07:04 UTC
When linking to the spec file and srpm, link directly to the raw version (https://raw.githubusercontent.com/FZUG/repo/master/rpms/deepin_project/deepin-gettext-tools.spec). Otherwise fedora-review gets confused.

Why do you prefix your macros with "_"? Sometimes macros provided by rpm are prefixed with "__" to avoid conflicts with user-defined macros. That's even more reason not to prefix your macros like that.

I'm assuming that this is an effort to get the whole package set into Fedora, not EPEL. If you are planning to use the same spec file also for EPEL, some things will be more complicated. My comments below assume that this is for Fedora only.

> %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig 

This shouldn't be necessary, %python2_sitelib is always defined when the python2-devel is present.

>  - Package contains BR: python2-devel or python3-devel
@Felix: it's better to link to the relevant guidelines more often than not. In this case: https://fedoraproject.org/wiki/Packaging:Python#Dependencies.

> BuildRequires: python-devel
... this should be either python2-devel or python3-devel.

Felix writes that Python3 is now supported. The guidelines say that Python3 is preferred, so the package should be switched to it if possible.

> Requires: python
Normally that's not needed, because the dependency is generated automatically.

%description is too sparse. What does this package do? For "low level" packages it's OK to just write on or two terse sentences, but just repeating %summary is not enough, unless it's obvious (and in this case it's not obvious).

OK, so Requires are not generated properly, because the shebang lines use #!/usr/bin/env. They should be changed to use #!/usr/bin/perl, #!%{__python2} or #!%{__python3}. Then rpm will generate proper Requires automatically.

--

So... please update to the latest version, switch over to python3 if possible, expand %description, fix shebang lines, and let rpm generate Requires automatically.

Comment 3 sensor.wen 2017-07-18 17:34:28 UTC
Hi Zbigniew Jędrzejewski-Szmek

thank you for your package review. It's very useful for me.
About "_", i will delete them for a while.
Some other problems, i have fixed and submitted it to github. It looks okey. 

https://raw.githubusercontent.com/FZUG/repo/master/rpms/deepin_project/deepin-gettext-tools.spec

Comment 4 Zbigniew Jędrzejewski-Szmek 2017-07-18 23:15:15 UTC
So now the requires are:
/usr/bin/perl
/usr/bin/python3
gettext
perl(Config::Tiny)
perl(Exporter::Tiny)
perl(XML::LibXML)
perl(XML::LibXML::PrettyPrint)
qt5-linguist
Looks good.

> /bin/perl desktop_ts/src/desktop_ts_convert.pl --help
> /bin/python3 src/generate_mo.py --help
> /bin/python3 src/update_pot.py --help

No need to use the full path. We assume that the tools like perl and python3 are in $PATH.

rpmlint:
deepin-gettext-tools.noarch: W: spelling-error %description -l en_US msgid -> MSG
deepin-gettext-tools.noarch: W: spelling-error %description -l en_US ini -> uni, in, ii
deepin-gettext-tools.noarch: W: spelling-error %description -l en_US po -> PO, pew, op
deepin-gettext-tools.src: W: spelling-error %description -l en_US msgid -> MSG
deepin-gettext-tools.src: W: spelling-error %description -l en_US ini -> uni, in, ii
deepin-gettext-tools.src: W: spelling-error %description -l en_US po -> PO, pew, op
Bogus warnings.

deepin-gettext-tools.noarch: W: no-manual-page-for-binary deepin-desktop-ts-convert
deepin-gettext-tools.noarch: W: no-manual-page-for-binary deepin-generate-mo
deepin-gettext-tools.noarch: W: no-manual-page-for-binary deepin-policy-ts-convert
deepin-gettext-tools.noarch: W: no-manual-page-for-binary deepin-update-pot
That's OK. It's nice to have man pages, but it's certainly not required.

2 packages and 0 specfiles checked; 0 errors, 10 warnings.

+ package name is OK
+ latest version
+ license is acceptable for Fedora (GPLv3)
+ license is specified correctly
+ builds and installs OOK
+ Provides/Requires/BuildRequires appear correct
+ no scriptlets are needed
+ %check is present and passes.

Package is APPROVED.

Comment 5 sensor.wen 2017-07-21 09:07:30 UTC
I think full path is important. The $PATH environment variable is easy to change. It's not safe. For example:

$ vi test.spec
....
%post
python3 -c 'print("Hello")'
...

$ vi /usr/local/bin/python3
#!/bin/bash
echo "bad things."
/bin/python3 $@

# rpm -ivh -D"_install_script_path /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" test-0.1-1.fc25.x86_64.rpm
 1:test-0.1-1.fc25                  ################################# [100%]
bad things.
Hello

Comment 6 Zbigniew Jędrzejewski-Szmek 2017-07-21 09:52:33 UTC
Using full paths for some specific executables is neither necessary nor sufficient. Why not sufficient? You are calling many different programs, either directly from the spec file (find, sed, install, perl, python3) or *indirectly* (e.g. %setup macro uses tar, gzip, patch). In this particular spec file there's no build, but normally when a Makefile is used, it contains references to tens of other programs (gcc, ld, ar, strip, …). So for this to be useful in any way, you'd have to make sure that *each and every one* of those programs is prefixed by path, which is of course impossible for programs called from build scripts or as helpers by macros or other programs. Instead, $PATH is set to some proper value. If somebody managed to insert rogue programs into any of the locations in $PATH, the game is over. And once $PATH is set properly, there is really no reason to use a full path to any executable in it.

The reason that people use stuff like %__sed is because rpm used to provide it for some strange reason, and a cargo cult emerged. It makes no sense.

(There is an exception though: %__python3 *can* be useful for example on EPEL where there is more than one python3 available, and you want to pick one of them. So sometimes %__python3 will evaluate to /usr/bin/python34 and other times to /usr/bin/python35 or whatever. But that is a different case, because we're looking for a different executable name, not ignoring $PATH. On Fedora there's just one python3, so either "python3" or "%__python3" can be used.)

Comment 7 sensor.wen 2017-07-21 14:30:37 UTC
By default, we think the compilation environment is safe, it does not need to use the prefix. ('%check' does not need prefix, you are right.)

However, the %pre %post %postun is the script that runs when the client is installed, and the client is ”not safe“, so we need the GPG key and need to ensure that the %post script is executed correctly. In the client, we need absolute path.

Comment 8 Zbigniew Jędrzejewski-Szmek 2017-07-21 14:42:47 UTC
The GPG key is for the user to know that they can trust the package origin, not for the rpm package to trust anything.

%pre %post %postun are run with a fixed path (see "rpmbuild --eval %_install_script_path"), and they don't need to use full paths for executables in that path. (I know it's traditional to e.g. use /sbin/ldconfig and such, but there's no consistency, and use just the binary name would work just as well.)

Comment 9 Gwyn Ciesla 2017-07-31 12:15:49 UTC
Package request has been approved: https://admin.fedoraproject.org/pkgdb/package/rpms/deepin-gettext-tools


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