Hey Allan, I really like the idea, although I might have spotted some gotchas. On Sun, 12 Dec 2021 at 10:54, Allan McRae <allan@archlinux.org> wrote:
This patch series replaces the old libdepends/libprovides system into something akin to that used by APK. In short, makepkg.conf will have a variable like:
LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
Considering your examples (below) also handle "cmd" and "pc" the LIB_DIRS name is misleading. Alas no better suggestion comes to mind ATM.
At the end of package building, makepkg will look in the library directories and add a provide. E.g. for pacman:
provide = lib:libalpm.so.13
If I understand correctly, we create a mapping pretty-name:actual-path in the makepkg.conf and use the pretty-name in PKGBUILD. Do we add the pretty-name or actual-path in .PKGINFO? Does pacman print these autodeps ... even if only for informational purposes? What is expected to happen if someone typos the existing mappings - say "lib32:usr/lib23"? Or re-defines the standard ones "lib:my/special/path"? Are we going to continue or error out - is the error message going to be meaningful or rather cryptic?
Note the prefix matches the prefix given to the relevant directory in LIB_DIRS. Similarly, makepkg can add dependencies on libraries. E.g. pacman may have:
depends = lib:libgpgme.so.11
Note, to help with bootstrapping this system, or if packages just do not want to add libprovides, the depends entries are only added if a package actually provides them.
This is different to the APK system for libraries which uses "so" as the prefix and is not configurable. But Alpine used musl, which has no concept of multilib, so we need to be a bit more flexible.
I think the above questions might be the reason why Alpine chose to keep them hard-coded. In particular, while this approach provides flexibility, it leaves things open to various mistakes and misuse. Off the top of my head, we can enhance makepkg to catch most of those issues. For example - we can use the actual-path in .PKGINFO, explicitly check for mistakes/changes in the default mappings - lib, lib32... Although at this point one might as well have the defaults hardcoded in makepkg?
The dependency/provides addotions can all be disabled in pacman.conf with the '!autodeps' option.
s/addotions/additions/;s/pacman.conf/makepkg.conf/ typos? At a glance we can disable autodeps in the PKGBUILD itself, right? HTH Emil