Subject: [alpine-devel] abuild and depends in subpackages

From: Natanael Copa <[email-masked]>
Date: Fri, 5 Apr 2019 15:43:33 +0200

Hi,

I tried to fix a problem in abuild with subpackages and depends, a
problem that has been there for a long time.

The problem is that depends is not unset for subpackages so for
example, lets say we have a package named "foo" that is a tool, and a
library. The tool has some dependencies that the library does not:

pkgname="foo"
depends="tooldep"
subpackages="foo-libs"

libs() {
	...
	mv "$pkgdir"/usr/lib/libfoo "$subpkgdir"/usr/lib/
}

The problem is that all the subpackages will currently inherit the
depends from main package, so unless you explicitly unset it in your
split function, the subpackage will inherit those.

This affect packages which may have various subcomponents for which we
may want package as separate subbackages, but we want let main package
the the "install-all-subcomponents-in-one-go". For those we do:

pkname=mainpkg
depends="sub1 sub2"

If we don't explicitly unset depends in the sub1 and sub2 we will end up
with circular dependencies. sub1 will depend on itself + sub2. This
happened with samba.

In other words: you need to explicitly unset depends in subpackages
unless you intentionally want to inherit those.

The obvious fix for this is to unset depends before calling the split
function. This is what I did in
https://git.alpinelinux.org/abuild/commit/?id=8fbbffd201a28a06804c7f6d3a2b5cd948c6ce07

It turns out that there are various packages that depends on the previous behavior, which does

subpkg() {
	depends="$depends foo bar"
	...
}

I did a quick grep and found that there are potentially 109 packages in
main and ~86 in community, and I don't have the time right now to review
all those, so I had to revert to the previous behavior. :-(

It seems that this affects py-* packages in particular.

This means that everything that was built with abuild-3.4.0_rc1-r0 may
have broken deps in subpackages.

But we need to decide what behavior we want long term: Do we want
explicitly (always) unset depends or avoid doing depends="$depends ..."
in split functions?

I would prefer avoid depends="$depends ..."

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---