You are not logged in.

#1 2015-11-25 18:15:04

incertia
Member
Registered: 2014-10-25
Posts: 29

[SOLVED] Depend on either A or B in makedepends in PKGBUILD.

Hello, I am not quite sure how to do this in a PKGBUILD. Suppose a build script will check for two programs and use one of the two (e.g. lynx or elinks) to perform some action and User A already has one of these dependencies installed (let's call it a), but the PKGBUILD uses the other package in makedepends (let's call it b). makepkg will (with my current knowledge of PKGBUILDs), seeing that b is not installed, force the installation of b despite it being unnecessary and slightly complicate the build process.

Is there a way around this, or are we just stuck being forced to install whatever package the maintainer of the PKGBUILD decides?

Last edited by incertia (2015-11-25 20:49:08)

Offline

#2 2015-11-25 18:16:47

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

Re: [SOLVED] Depend on either A or B in makedepends in PKGBUILD.

You must pick one.  A PKGBUILD should build the same package regardless of what machine it is built on - and it definitely should be able to work in a clean chroot.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2015-11-25 19:49:00

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: [SOLVED] Depend on either A or B in makedepends in PKGBUILD.

Alternate dependencies can only be done if both of the alternate dependencies provide a common package you can use.  For example, both jre7-openjdk and jre8-openjdk provide java-runtime.  Otherwise you have to pick one as Trilby said; just leave a comment in the PKGBUILD that another package can be used to satisfy the dependency.

Offline

#4 2015-11-25 20:48:47

incertia
Member
Registered: 2014-10-25
Posts: 29

Re: [SOLVED] Depend on either A or B in makedepends in PKGBUILD.

Thanks!

Offline

#5 2015-11-26 18:57:30

MoSal
Member
Registered: 2015-09-23
Posts: 32

Re: [SOLVED] Depend on either A or B in makedepends in PKGBUILD.

apg wrote:

Alternate dependencies can only be done if both of the alternate dependencies provide a common package you can use.  For example, both jre7-openjdk and jre8-openjdk provide java-runtime.  Otherwise you have to pick one as Trilby said; just leave a comment in the PKGBUILD that another package can be used to satisfy the dependency.

Actually, you don't "have to" pick. You can do this indirectly with meta packages.

DependerProvider1 --> depends on 'alt1' , provides 'alt'
DependerProvider2 --> depends on 'alt2' , provides 'alt'

And now you can use 'alt' as a dependency.

Offline

#6 2015-11-26 22:50:12

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

Re: [SOLVED] Depend on either A or B in makedepends in PKGBUILD.

MoSal, that would work, but would needlessly clutter the AUR and make things harder for users.  They'd need to install elinks, cli-browser-meta, and the intended package that requires cli-browser-meta.

It would be far better just to create two versions of the intended package: package-elinks and package-lynx.

Then there are only two new AUR packages rather than four, and users only need to install new package, not three.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB