You are not logged in.

#1 2013-07-09 12:30:41

wdirksen
Member
From: New Zealand
Registered: 2012-02-23
Posts: 105

Can an "or" type of conditional be used for depends() in PKGBUILD?

I maintain a few AUR packages and one of them has a dependancy on kernel headers. linux-headers is now a dependancy for this. No problem. Yet I personally use linux-ck quite a bit. It would be nice to define a condition where the depends requirement would be that at least one of the packages in a string would have to be met?

In my example: depends() would be defined as: linux-headers OR linux-ck-headers

Is this possible and simple?

Last edited by wdirksen (2013-07-09 16:33:07)


Research | Trial | Make Mistakes | Ask questions | Learn | Repeat

Offline

#2 2013-07-09 12:35:09

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

The problem is solved for you by

provides=("linux-ck-headers=${pkgver}" "linux-headers=${pkgver}")

in the linux-ck-headers PKGBUILD

So you can just put linux-headers to depends=().

I think provides=() is intended to just solve this sort of situation.

Last edited by lolilolicon (2013-07-09 12:36:39)


This silver ladybug at line 28...

Offline

#3 2013-07-09 13:37:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

Offline

#4 2013-07-09 13:49:31

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

lolilolicon wrote:

The problem is solved for you by

provides=("linux-ck-headers=${pkgver}" "linux-headers=${pkgver}")

in the linux-ck-headers PKGBUILD

So you can just put linux-headers to depends=().

I think provides=() is intended to just solve this sort of situation.

Except that this is entirely wrong. linux-ck-headers cannot possibly provide linux-headers.

Offline

#5 2013-07-09 14:44:14

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

falconindy wrote:

Except that this is entirely wrong. linux-ck-headers cannot possibly provide linux-headers.

Of course.
*mentally slaps the imperfect PKGBUILD*


This silver ladybug at line 28...

Offline

#6 2013-07-10 13:50:59

wdirksen
Member
From: New Zealand
Registered: 2012-02-23
Posts: 105

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

OK, I guess no simple oneliner solution here.
I realize now that except for different kernel flavors, that there would probably never be another situation for this

Last edited by wdirksen (2013-07-10 13:51:51)


Research | Trial | Make Mistakes | Ask questions | Learn | Repeat

Offline

#7 2013-07-10 14:01:54

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

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

This may be a silly question - but how does your build mechanism (makefile, etc) know which headers to use?

If the kernel headers aren't actually required for building properly, then you might be able to get away with listing them as opt deps.  If they are required for building, how does the build know which set to use if the user has both installed (I do).

I assume there must be some sort of use of `uname` to get the proper path to the kernel headers.  Could a similar evaluation be used in the depends array?


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

Offline

#8 2013-07-10 14:38:57

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

Trilby wrote:

This may be a silly question - but how does your build mechanism (makefile, etc) know which headers to use?

If the kernel headers aren't actually required for building properly, then you might be able to get away with listing them as opt deps.  If they are required for building, how does the build know which set to use if the user has both installed (I do).

/lib/modules/$kernver/build is a symlink to the kernel "source" (headers). It's simply the standard convention.

Trilby wrote:

I assume there must be some sort of use of `uname` to get the proper path to the kernel headers.  Could a similar evaluation be used in the depends array?

Works fine until you want to build a module for 3.10-foo when you've booted with 3.10-bar.

Offline

#9 2013-07-10 15:11:09

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

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

Thanks, I'm still unsure about this part though:

falconindy wrote:

/lib/modules/$kernver/build is a symlink to the kernel "source" (headers). It's simply the standard convention.

Works fine until you want to build a module for 3.10-foo when you've booted with 3.10-bar.

How is $kernver set/interpreted?  Would that also depend on which kernel the user is currently booted into?


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

Offline

#10 2013-07-10 15:27:17

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

It's a variable I made up just now. The general convention seems to be that unless otherwise explicitly set (to whatever the Makefile calls this variable), it simply defaults to whatever $(uname -r) would return.

Offline

#11 2013-07-10 15:50:10

wdirksen
Member
From: New Zealand
Registered: 2012-02-23
Posts: 105

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

Trilby wrote:

This may be a silly question - but how does your build mechanism (makefile, etc) know which headers to use?

If the kernel headers aren't actually required for building properly, then you might be able to get away with listing them as opt deps.  If they are required for building, how does the build know which set to use if the user has both installed (I do).

I assume there must be some sort of use of `uname` to get the proper path to the kernel headers.  Could a similar evaluation be used in the depends array?

The package is this one:  https://aur.archlinux.org/packages/open-sasc-ng/

Matching headers to the kernel are definately required to build as there is a virtual loopback DVB adaptor being created by this package. I personally comment out the depends() as I know that the proper headers are already installed and remain updated with the kernel updates. It's not that big of a deal because most users will be using the standard arch-linux kernel. I just thought that the AUR package could be a bit slicker if you could specify for other commonly used archlinux kernels, such as linux-ck.

I like the input here, so thanks!

Last edited by wdirksen (2013-07-10 15:52:59)


Research | Trial | Make Mistakes | Ask questions | Learn | Repeat

Offline

#12 2013-07-10 17:33:55

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

falconindy wrote:
lolilolicon wrote:

The problem is solved for you by

provides=("linux-ck-headers=${pkgver}" "linux-headers=${pkgver}")

in the linux-ck-headers PKGBUILD

So you can just put linux-headers to depends=().

I think provides=() is intended to just solve this sort of situation.

Except that this is entirely wrong. linux-ck-headers cannot possibly provide linux-headers.

I always assumed what lollicon said:

➜  ~/ pacman -Si  linux-ck-headers
...
Provides       : linux-ck-headers=3.9.9  linux-headers=3.9.9    <----
...

The PKGBUILD might require graysky's [repo-ck] to be enabled in /etc/pacman.conf though.

Offline

#13 2013-07-11 09:10:39

wdirksen
Member
From: New Zealand
Registered: 2012-02-23
Posts: 105

Re: Can an "or" type of conditional be used for depends() in PKGBUILD?

ANOKNUSA wrote:
falconindy wrote:
lolilolicon wrote:

The problem is solved for you by

provides=("linux-ck-headers=${pkgver}" "linux-headers=${pkgver}")

in the linux-ck-headers PKGBUILD

So you can just put linux-headers to depends=().

I think provides=() is intended to just solve this sort of situation.

Except that this is entirely wrong. linux-ck-headers cannot possibly provide linux-headers.

I always assumed what lollicon said:

➜  ~/ pacman -Si  linux-ck-headers
...
Provides       : linux-ck-headers=3.9.9  linux-headers=3.9.9    <----
...

The PKGBUILD might require graysky's [repo-ck] to be enabled in /etc/pacman.conf though.

For my educational benefit then, is it so that? . . .

I could setup depends without arguments, "depends()" in this case, because regardless of the type of ArchLinux based kernel, if it is packaged as stated above, the proper header package would natively be "pre-provided"?

I'm gonna uninstall some header packages and give this a go. This is fun.

Last edited by wdirksen (2013-07-11 09:19:16)


Research | Trial | Make Mistakes | Ask questions | Learn | Repeat

Offline

Board footer

Powered by FluxBB