You are not logged in.

#1 2024-09-14 20:29:59

maksverver
Member
Registered: 2009-07-20
Posts: 6

How to deal with dependency cycles in PKGBUILDs?

I noticed many AUR packages have cyclic build dependencies. For example, pypy3-build both requires and is required by pypy3-installer.

I don't have these packages installed on my system. How can I build either of them?

This problem also applies to the official packages (like python-build and python-installer) but there you can bootstrap by installing the official binary packages before rebuilding from source. What is the solution for AUR packages, which do not necessarily have binary packages?

Offline

#2 2024-09-14 20:37:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: How to deal with dependency cycles in PKGBUILDs?

You may want to specify that this is about makedepends as that's what makes it difficult.  Some users get stumped with cyclical run time dependencies not realizing the packages can each be built, then installed in one transaction.  But that's not the solution you need.  Unfortunately, I can't help much as it seems to me that bootstrapping it by "lying" about the version of one of the makedependencies might be needed (this could be followed by a second "honest" rebuild).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2024-09-14 21:48:05

loqs
Member
Registered: 2014-03-06
Posts: 18,123

Re: How to deal with dependency cycles in PKGBUILDs?

git diff of PKGBUILD pypy3-installer to allow bootstrapping:

diff --git a/PKGBUILD b/PKGBUILD
index c6a327d..2354cb9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,12 +8,16 @@ arch=(any)
 url="https://${_base}.pypa.io"
 license=(MIT)
 depends=(pypy3)
-makedepends=(pypy3-build pypy3-flit-core)
+#makedepends=(pypy3-build pypy3-flit-core)
 source=(${_base}-${pkgver}.tar.gz::https://github.com/pypa/${_base}/archive/${pkgver}.tar.gz)
 sha512sums=('a509c6ea9d88b8527cce0428ca6109077820cb9aa352967a389012bac40f8ec04039ab73710f4fb32b32ed20affd520ce0ba16ba18d9d380ce0af1f51fe8e2c6')
 
 build() {
   cd ${_base}-${pkgver}
+  pypy3 -m venv venv
+  source venv/bin/activate
+  pypy3 -m ensurepip
+  pypy3 -m pip install build flit-core
   pypy3 -m build --wheel --skip-dependency-check --no-isolation
 }
 

Offline

#4 2024-09-14 22:28:49

maksverver
Member
Registered: 2009-07-20
Posts: 6

Re: How to deal with dependency cycles in PKGBUILDs?

loqs: Thanks for the suggestion but that doesn't seem like a drop-in replacement. It creates a package with paths like:

home/maks/build/pypy3-installer/src/installer-0.7.0/venv/lib/pypy3.10/site-packages/installer/

i.e., it doesn't actually install in the pypy3 site-packages directory.

Offline

#5 2024-09-14 22:49:18

loqs
Member
Registered: 2014-03-06
Posts: 18,123

Re: How to deal with dependency cycles in PKGBUILDs?

I forgot to limit the venv's activation to build() only:

diff --git a/PKGBUILD b/PKGBUILD
index c6a327d..42bcc2f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,13 +8,19 @@ arch=(any)
 url="https://${_base}.pypa.io"
 license=(MIT)
 depends=(pypy3)
-makedepends=(pypy3-build pypy3-flit-core)
+#makedepends=(pypy3-build pypy3-flit-core)
 source=(${_base}-${pkgver}.tar.gz::https://github.com/pypa/${_base}/archive/${pkgver}.tar.gz)
 sha512sums=('a509c6ea9d88b8527cce0428ca6109077820cb9aa352967a389012bac40f8ec04039ab73710f4fb32b32ed20affd520ce0ba16ba18d9d380ce0af1f51fe8e2c6')
 
 build() {
   cd ${_base}-${pkgver}
+  (
+  pypy3 -m venv venv
+  source venv/bin/activate
+  pypy3 -m ensurepip
+  pypy3 -m pip install build flit-core
   pypy3 -m build --wheel --skip-dependency-check --no-isolation
+  )
 }
 
 package() {

Offline

#6 2024-09-19 17:25:30

maksverver
Member
Registered: 2009-07-20
Posts: 6

Re: How to deal with dependency cycles in PKGBUILDs?

The maintainer of pypy3-flit-core emailed me with the suggestion of using binary packages from the arch4edu repository to bootstrap this. (Just wanted to share this in case someone else finds this thread via Google.)

Offline

#7 2024-09-19 18:29:41

loqs
Member
Registered: 2014-03-06
Posts: 18,123

Re: How to deal with dependency cycles in PKGBUILDs?

Did my suggestion post #5 not work for you? Did you resolve the issue using binary packages from arch4edu?

Offline

#8 2024-09-19 19:19:26

maksverver
Member
Registered: 2009-07-20
Posts: 6

Re: How to deal with dependency cycles in PKGBUILDs?

loqs wrote:

Did my suggestion post #5 not work for you? Did you resolve the issue using binary packages from arch4edu?

Ah yes, I forgot to mention it explicitly, but your latest suggestion also worked, and actually that's what I used to build these packages on my system. But bootstrapping from binary packages might be easier in the future, since they don't require editing a bunch of PKGBUILDs manually (there were like six packages in total: build, installer, flit-core, packagin, pyproject-hooks, pyprojects-metadata). In any case, thanks for your help!

Last edited by maksverver (2024-09-19 19:20:11)

Offline

Board footer

Powered by FluxBB