Bug 269363 - devel/py-importlib-metadata: python<3.8 - circular dependency between devel/py-importlib-metadata and devel/py-build after update to pep517
Summary: devel/py-importlib-metadata: python<3.8 - circular dependency between devel/p...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Yuri Victorovich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-06 01:36 UTC by John Hein
Modified: 2023-02-22 05:05 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2023-02-06 01:36:58 UTC
devel/py-importlib-metadata and devel.py-build have circular dependencies when building with python3.7, because of this in devel/py-build:

.if ${PYTHON_REL} < 30800
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=0.22:devel/py-importlib-metadata@${PY_FLAVOR}
.endif

Now that py-importlib-metadata has USE_PYTHON=pep517 (committed Feb 3, 2023), it now depends on py-build.
Comment 1 John Hein 2023-02-06 01:48:44 UTC
Add yuri@ (committed pep517 update).

Making USE_PYTHON conditional on PYTHON_REL (USE_PYTHON=distutils for < 3.8 and pep517 for >= 3.8) is not easy since USE_PYTHON wants to be defined before the pre-makefile parts (and PYTHON_REL is not defined until after).
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2023-02-06 02:49:18 UTC
Will fix this shortly, thanks.
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2023-02-06 02:55:03 UTC
Fix committed, thanks for the report.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-02-06 02:55:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d6583d67b69dbf690e6f102e1aec799cb7fd564a

commit d6583d67b69dbf690e6f102e1aec799cb7fd564a
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-02-06 02:52:52 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-02-06 02:54:51 +0000

    devel/py-importlib-metadata: Fix circular dependency problem

    ... introduced by USE_PYTHON=pep517.

    PR:             269363
    Reported by:    John Hein <jcfyecrayz@liamekaens.com>

 devel/py-importlib-metadata/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Comment 5 Charlie Li freebsd_committer freebsd_triage 2023-02-06 02:57:20 UTC
Note to revert this after devel/py-build drops the now-incorrect setuptools dependency.
Comment 6 John Hein 2023-02-06 16:01:11 UTC
Thanks for the quick workaround.

Another way to fix this might be to build py-importlib-metadata with a copy of py-build (and any other dependencies that are needed but cannot be installed due to any circular deps) in the py-importlib-metadata WRKDIR (instead of requiring a fully installed py-build pkg).  If that could be done without too much trouble, then py-importlib-metadata could be built with pep517 methods for py37.
Comment 7 Charlie Li freebsd_committer freebsd_triage 2023-02-06 16:03:58 UTC
(In reply to John Hein from comment #6)
Not necessary. The chief problem with Python ports in general right now is setuptools being specified as an unconditional RUN_DEPENDS. As soon as such is remedied, a whole class of issues like this one goes away.
Comment 8 John Hein 2023-02-06 17:03:05 UTC
(In reply to Charlie Li from comment #7)
Ok.  I don't see how that (removing setuptools dependency) will fix the circular dependency when py-importlib-metadata has to call 'python37 -m build ...' to build it the pep517 way.  But I certainly don't fully have a grip on the maze of complex nuance between setuptools/distutils/pep517 yet.
Comment 9 Trix Farrar 2023-02-07 03:59:26 UTC
Using poudriere, I'm still getting a circular dependency:

[00:02:26] Error: Dependency loop detected:
These packages depend on each other: py39-keyring-23.9.3_2,1 py39-importlib-metadata-6.0.0_1 py39-wheel-0.38.4
[00:02:26] Cleaning up
[00:02:26] Unmounting file systems
Comment 10 Yuri Victorovich freebsd_committer freebsd_triage 2023-02-07 04:14:12 UTC
Interesting. I can't reproduce this:


$ sudo run-one-in-poudriere-13-amd64 -C devel/py-importlib-metadata security/py-keyring devel/py-wheel
cp: /usr/ports/-C: No such file or directory
[00:00:00] Creating the reference jail... done
[00:00:00] Mounting system devices for 13amd64-local-workstation
[00:00:00] Mounting ports/packages/distfiles
[00:00:00] Stashing existing package repository
[00:00:00] Mounting packages from: /usr/local/poudriere/data/packages/13amd64-local-workstation
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/13amd64-make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/13amd64-local-workstation/ref/etc/resolv.conf
[00:00:00] Starting jail 13amd64-local-workstation
[00:00:00] Will build as nobody: (65534:65534)
[00:00:01] Logs: /usr/local/poudriere/data/logs/bulk/13amd64-local-workstation/2023-02-06_20h12m24s
[00:00:01] Loading MOVED for /usr/local/poudriere/data/.m/13amd64-local-workstation/ref/usr/ports
[00:00:03] Ports supports: FLAVORS SELECTED_OPTIONS
[00:00:03] Gathering ports metadata
[00:00:03] Calculating ports order and dependencies
[00:00:03] (-C) Cleaning specified packages to build
[00:00:03] (-C) Will delete existing package: py39-wheel-0.38.4.pkg
[00:00:03] (-C) Will delete existing package: py39-importlib-metadata-6.0.0_1.pkg
[00:00:03] (-C) Will delete existing package: py39-keyring-23.9.3_2,1.pkg
[00:00:03] (-C) Flushing package deletions
[00:00:04] Sanity checking the repository
[00:00:04] Checking packages for incremental rebuild needs
[00:00:07] Deleting stale symlinks... done
[00:00:07] Deleting empty directories... done
[00:00:07] Cleaning the build queue
[00:00:07] Sanity checking build queue
[00:00:07] Processing PRIORITY_BOOST
[00:00:07] Balancing pool
[00:00:07] Recording filesystem state for prepkg... done
[00:00:07] Building 3 packages using 3 builders
[00:00:07] Starting/Cloning builders
[00:00:07] Hit CTRL+t at any time to see build progress and stats
[00:00:07] [01] [00:00:00] Building devel/py-wheel@py39 | py39-wheel-0.38.4
[00:00:18] [01] [00:00:11] Finished devel/py-wheel@py39 | py39-wheel-0.38.4: Success
[00:00:18] [01] [00:00:00] Building devel/py-importlib-metadata@py39 | py39-importlib-metadata-6.0.0_1
[00:00:29] [01] [00:00:11] Finished devel/py-importlib-metadata@py39 | py39-importlib-metadata-6.0.0_1: Success
[00:00:29] [01] [00:00:00] Building security/py-keyring@py39 | py39-keyring-23.9.3_2,1
[00:00:43] [01] [00:00:14] Finished security/py-keyring@py39 | py39-keyring-23.9.3_2,1: Success
[00:00:43] Stopping 3 builders
13amd64-local-workstation-job-01: removed
13amd64-local-workstation-job-02: removed
13amd64-local-workstation-job-01-n: removed
13amd64-local-workstation-job-02-n: removed
13amd64-local-workstation-job-03: removed
13amd64-local-workstation-job-03-n: removed
[00:00:44] Committing packages to repository: /usr/local/poudriere/data/packages/13amd64-local-workstation/.real_1675743188 via .latest symlink
[00:00:44] Removing old packages
[00:00:44] Built ports: devel/py-wheel devel/py-importlib-metadata security/py-keyring
[13amd64-local-workstation] [2023-02-06_20h12m24s] [committing:] Queued: 3  Built: 3  Failed: 0  Skipped: 0  Ignored: 0  Tobuild: 0   Time: 00:00:43
[00:00:44] Logs: /usr/local/poudriere/data/logs/bulk/13amd64-local-workstation/2023-02-06_20h12m24s
[00:00:44] Cleaning up
13amd64-local-workstation: removed
13amd64-local-workstation-n: removed
[00:00:44] Unmounting file systems





What might be different for you?
Comment 11 Trix Farrar 2023-02-07 04:40:25 UTC
Solved it by deleting the /usr/local/poudriere.d/options/ directories for those ports.  My build is working again.  The options were very old, from python37.  Thank you for your patience, though.
Comment 12 tburns 2023-02-07 15:48:42 UTC
The the circular dependency problem with poudriere is still an issue:

[00:00:14] Error: Dependency loop detected:
These packages depend on each other: py38-importlib-metadata-6.0.0_1 py38-wheel-0.38.4 py38-keyring-23.9.3_2,1
[00:00:14] Cleaning up
[00:00:14] Unmounting file systems

[tburns@repo2 /usr/local/etc/poudriere.d/131-options]$ cat devel_py-wheel/options 
# This file is auto-generated by 'make config'.
# Options for py38-wheel-0.38.4
_OPTIONS_READ=py38-wheel-0.38.4
_FILE_COMPLETE_OPTIONS_LIST=PIP SIGNATURE
OPTIONS_FILE_UNSET+=PIP
OPTIONS_FILE_SET+=SIGNATURE

It has something to do with the signature option in py-wheel. I unset the signature option and got it to build.
Comment 13 John W. O'Brien 2023-02-14 22:37:31 UTC
I am still experiencing this circular dependency after verifying SIGNATURE=off for devel/py-wheel and rebuilding it. What other diagnostic information shall I produce?
Comment 14 Charlie Li freebsd_committer freebsd_triage 2023-02-18 18:10:55 UTC
The devel/py-typing-extensions bit should be fixed with ports e7a9ba1fecd9. For this port, since generating and executing a fake/temporary setup.py is not optimal, the best course of action is to engage upstream in switching the build backend to flit, so that flit_core can build the wheel itself.
Comment 15 John W. O'Brien 2023-02-18 23:27:24 UTC
(In reply to Charlie Li from comment #14)
Thank you, Charlie. I can confirm that I am now able to build the set of Python ports that are relevant to my needs against 3.7.

For the purposes of this bug, I harbor lingering curiosity about why a circular dependency among three ports could not be solved by any one of them.
Comment 16 John Hein 2023-02-19 20:44:38 UTC
(In reply to tburns from comment #12)
For those that are find a different circular dependency than the one originally described in this bug, please open a new bug.  The py-importlib-metadata + py-wheel + py-keyring circular dependency described in comment 12, for instance, is different.