Bug 2050889 - Review Request: python-hatchling - The build backend used by Hatch
Summary: Review Request: python-hatchling - The build backend used by Hatch
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Lumír Balhar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 2050876
Blocks: 2035978 2048296
TreeView+ depends on / blocked
 
Reported: 2022-02-04 20:59 UTC by Ben Beasley
Modified: 2022-02-20 19:17 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-20 16:32:54 UTC
Type: ---
Embargoed:
lbalhar: fedora-review+


Attachments (Terms of Use)

Description Ben Beasley 2022-02-04 20:59:39 UTC
Spec URL: https://music.fedorapeople.org/python-hatchling.spec
SRPM URL: https://music.fedorapeople.org/python-hatchling-0.10.0-1.fc35.src.rpm
Description:

This is the extensible, standards compliant build backend used by Hatch.

Fedora Account System Username: music

COPR build: https://copr.fedorainfracloud.org/coprs/music/hatchling/build/3308066/

Comment 2 Ben Beasley 2022-02-06 14:14:06 UTC
Needs an update to 0.11.2, and since it turns out there are upstream integration tests, those ought to be enabled; but I need to understand whether this will be possible[1].

[1] https://github.com/ofek/hatch/issues/120#issuecomment-1030840491

Comment 3 Ben Beasley 2022-02-06 21:16:25 UTC
Updated to 0.11.2. Not able to run the upstream tests for now, but this might eventually be possible with enough effort.

Spec URL: https://music.fedorapeople.org/20220206/python-hatchling.spec
SRPM URL: https://music.fedorapeople.org/20220206/python-hatchling-0.11.2-1.fc35.src.rpm
COPR build: https://copr.fedorainfracloud.org/coprs/music/hatchling/build/3334591/

Comment 6 Lumír Balhar 2022-02-17 20:55:26 UTC
Below are a few notes from me. I know that the package is under heavy development and I don't want to block you so

Package is APPROVED.

Notes from me:
- Could you please add a command you used to generate the manpage to the comment in the specfile? Or, might this be automated during the build so it's not an extra manual step during updates?
- You don't need to "cp -p '%{SOURCE1}' .", you can just use %{SOURCE1} in %install:
install -t '%{buildroot}/%{_mandir}/man1' -D -p -m 0644 %{SOURCE1}
- Version 0.14.0 is available upstream
- You don't need this line:
%dir %{python3_sitelib}/hatchling-%{version}.dist-info/license_files
the license file stays in the directory and the whole dist-info belongs to the package.

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

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


===== 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: "MIT License", "*No copyright* MIT License", "Unknown or
     generated". 44 files have unknown license. Detailed output of
     licensecheck in /home/lbalhar/temp/reviews/2050889-python-
     hatchling/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.
[-]: Package contains systemd file(s) if in need.
[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]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[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

Python:
[x]: 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.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[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.
[!]: 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.
[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]: Spec file according to URL is the same as in SRPM.


Source checksums
----------------
https://files.pythonhosted.org/packages/source/h/hatchling/hatchling-0.11.3.tar.gz :
  CHECKSUM(SHA256) this package     : 9ccf90fed7e305d6ac092cd50cda7aa9754d380c426f867fc7312737f8ae0e07
  CHECKSUM(SHA256) upstream package : 9ccf90fed7e305d6ac092cd50cda7aa9754d380c426f867fc7312737f8ae0e07


Requires
--------
python3-hatchling (rpmlib, GLIBC filtered):
    (python3.10dist(editables) >= 0.2 with python3.10dist(editables) < 1)
    (python3.10dist(packaging) >= 21.3 with python3.10dist(packaging) < 22)
    (python3.10dist(pathspec) >= 0.9 with python3.10dist(pathspec) < 1)
    (python3.10dist(pluggy) >= 1 with python3.10dist(pluggy) < 1.1)
    /usr/bin/python3
    python(abi)
    python3.10dist(tomli)



Provides
--------
python3-hatchling:
    python-hatchling
    python3-hatchling
    python3.10-hatchling
    python3.10dist(hatchling)
    python3dist(hatchling)



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

Comment 7 Ben Beasley 2022-02-17 21:48:05 UTC
Thank you for the review!

(In reply to Lumír Balhar from comment #6)
> Notes from me:
> - Could you please add a command you used to generate the manpage to the
> comment in the specfile? Or, might this be automated during the build so
> it's not an extra manual step during updates?

It’s *hand*-written based on package metadata and --help output. I don’t expect it to need to change too often, and it’s hard to get nice output with tools like help2man. Maybe I can make that more clear in the comment above Source1.

> - You don't need to "cp -p '%{SOURCE1}' .", you can just use %{SOURCE1} in
> %install:
> install -t '%{buildroot}/%{_mandir}/man1' -D -p -m 0644 %{SOURCE1}

True. I’ll simplify it as you have suggested.

> - Version 0.14.0 is available upstream

That was fast! I’ll review the source diff and update it promptly. Upstream release monitoring will keep me in the loop once I’ve imported the package.

> - You don't need this line:
> %dir %{python3_sitelib}/hatchling-%{version}.dist-info/license_files
> the license file stays in the directory and the whole dist-info belongs to
> the package.

I’m not sure this is true. If I remove the line, I get:

$ rpm -q --filesbypkg -p /var/lib/mock/fedora-36-x86_64/result/python3-hatchling-0.11.3-1.fc36.noarch.rpm 
python3-hatchling         /usr/bin/hatchling
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/INSTALLER
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/METADATA
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/WHEEL
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/entry_points.txt
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/license_files/LICENSE.txt
python3-hatchling         /usr/lib/python3.10/site-packages/hatchling/__about__.py
[…]

without the license_files subdirectory listed anywhere. If I check the contents of the pyproject-files file, I see:

%dir /usr/lib/python3.10/site-packages/hatchling
%dir /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info
%dir /usr/lib/python3.10/site-packages/hatchling/__pycache__
[…]
%dir /usr/lib/python3.10/site-packages/hatchling/version/source/plugin/__pycache__
/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/INSTALLER
/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/METADATA
/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/WHEEL
/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/entry_points.txt
/usr/lib/python3.10/site-packages/hatchling/__about__.py
[…]

which indicates pyproject-rpm-macros is listing directories and files explicitly, not listing the .dist-info directory recursively as one would typically do in a hand-written %files list.

Furthermore, if I remove the explicit “%license […]/license_files/LICENSE.txt”, I get:

    Installed (but unpackaged) file(s) found:
   /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/license_files/LICENSE.txt

which shows the file isn’t packaged automatically, either.

Comment 8 Lumír Balhar 2022-02-17 23:39:24 UTC
I'm not sure about the details here.

What I think is: If you have a/b/c/d.txt and RPM explicitly owns b and d.txt I believe that there is no need to specify also ownership of c. Also, without the explicit %dir line, the package still builds fine and after its uninstallation, there are no leftovers.

Comment 9 Ben Beasley 2022-02-18 13:51:20 UTC
I still don’t see how removing the %dir line doesn’t create a textbook case of an unowned directory[1].

> $ mock fedora-36-x86_64 --clean
> $ mock -r fedora-36-x86_64 --enablerepo=local -i python3-hatchling-0.11.3-1.fc36.noarch.rpm
> $ mock -r fedora-36-x86_64 --chroot 'rpm -q --whatprovides /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/license_files'
> […]
> /usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/license_files is not owned by any package

> Also, without the explicit %dir line, the package still builds fine

Agreed. Only unowned files are RPM build errors, so the package will build fine whether the %dir line is needed or not.

> and after its uninstallation, there are no leftovers.

We must have tested this differently. In my testing, the directory was indeed left behind after uninstallation. Continuing the mock/shell session from earlier in this comment:

> $ mock -r fedora-36-x86_64 --dnf-cmd -- remove python3-hatchling
> $ find /var/lib/mock/fedora-36-x86_64/root/usr/lib/python3.10/site-packages/ -type d
> /var/lib/mock/fedora-36-x86_64/root/usr/lib/python3.10/site-packages/
> /var/lib/mock/fedora-36-x86_64/root/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info
> /var/lib/mock/fedora-36-x86_64/root/usr/lib/python3.10/site-packages/hatchling-0.11.3.dist-info/license_files

> If you have a/b/c/d.txt and RPM explicitly owns b and d.txt I believe that there is no need to specify also ownership of c.

The guidelines aren’t infallible, but isn’t that pretty much what this example[2] is about? It shows that to package

> %{_datadir}/%{name}/pixmaps/*.png

we need

> %dir %{_datadir}/%{name}
> %dir %{_datadir}/%{name}/pixmaps
> %{_datadir}/%{name}/pixmaps/*.png

not just

> %dir %{_datadir}/%{name}
> %{_datadir}/%{name}/pixmaps/*.png

[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/UnownedDirectories/
[2] https://docs.fedoraproject.org/en-US/packaging-guidelines/UnownedDirectories/#_only_including_files

Comment 10 Igor Raits 2022-02-20 08:20:07 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/python-hatchling

Comment 11 Fedora Update System 2022-02-20 16:31:16 UTC
FEDORA-2022-1a94ea3bee has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-1a94ea3bee

Comment 12 Fedora Update System 2022-02-20 16:32:54 UTC
FEDORA-2022-1a94ea3bee has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2022-02-20 19:16:44 UTC
FEDORA-2022-0e51889ee8 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-0e51889ee8

Comment 14 Fedora Update System 2022-02-20 19:17:57 UTC
FEDORA-2022-0e51889ee8 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.