You are not logged in.

#1 2021-03-19 15:51:32

daniel_shub
Member
Registered: 2012-06-21
Posts: 81

Confused about PKGBUILD dependencies

When creating a PKGBUILD for the AUR, I never know what goes in the depends, makedepends, and checkdepends arrays. I think I actually understand the optdepends arrays. I think my confusion stems from the PKGBUILD entry (https://wiki.archlinux.org/index.php/PKGBUILD) definitions of of the *depends arrays

depends: An array of packages that must be installed for the software to build and run. Dependencies defined inside the package() function are only required to run the software.

makedepends: An array of packages that are only required to build the software. The minimum dependency version can be specified in the same format as in the depends array. The packages in the depends array are implicitly required to build the package, they should not be duplicated here.

checkdepends: An array of packages that the software depends on to run its test suite, but are not needed at runtime.

Based on these statements, I do not know what dependencies are required when.

1) I do not think most people put dependencies that are only required to run the package in the package function and I cannot find any documentation (e.g., https://wiki.archlinux.org/index.php/Cr … #package() ) that tells you how/when/why to do this.

2) I do not know if checkdepends are implicitly required in makedepends (although thanks to Eschwartz I know that they are https://bbs.archlinux.org/viewtopic.php … #p1962599)

3) I do not know if depends or makedepends are implicitly required by checkdepends

Then there is the issue of transitive dependencies. The packaging guidelines say they are bad (https://wiki.archlinux.org/index.php/Ar … pendencies) and that NAMCAP can help, but NAMCAP (https://wiki.archlinux.org/index.php/Na … pendencies) has a dependency-already-satisfied warning which is downright confusing. The PKGBUILD specification (https://wiki.archlinux.org/index.php/PKGBUILD#depends) tells us that transitive dependencies are bad in the depends array, but nothing about them in makedepends or checkdepends.

Finally, the makedepends section has this tidbit Dependencies should normally include the requirements for building all optional features of a package. which probably should be build and run and those only needed to build optional features should be in makedepends and for those for checking in checkdepends, but ...

The wiki already suggests moving some of the content that I have issues with to the packaging guidelines entry. If I understand the purpose of the wiki entry, I think this is probably the right move. It would allow https://wiki.archlinux.org/index.php/PK … pendencies to focus on the 4 dependency arrays (and their architecture subtypes). Then https://wiki.archlinux.org/index.php/Ar … pendencies could handle the best practices.

Offline

#2 2021-03-19 20:40:58

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,783
Website

Re: Confused about PKGBUILD dependencies

Mod note: Moving to AUR Issues.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2021-03-19 21:00:04

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: Confused about PKGBUILD dependencies

daniel_shub wrote:

1) I do not think most people put dependencies that are only required to run the package in the package function and I cannot find any documentation (e.g., https://wiki.archlinux.org/index.php/Cr … #package() ) that tells you how/when/why to do this.

It is not limited to split packages but that is where depends in the package function are commonly used see as an example the systemd PKGBUILD
They are equivalent to optdepends for a none split package.

daniel_shub wrote:

2) I do not know if checkdepends are implicitly required in makedepends (although thanks to Eschwartz I know that they are https://bbs.archlinux.org/viewtopic.php … #p1962599)

I thought the point Eschwartz was making is they should be listed in makedepends not in checkdepends if makepkg --nocheck will fail due to their absence.

daniel_shub wrote:

3) I do not know if depends or makedepends are implicitly required by checkdepends

Depends and makedepends will always be installed by makepkg.

namcap encourages transitive depends with its warning against explict depends that are covered by a transitive depends.
Edit:
Deleted incorrect statement.

Last edited by loqs (2021-03-22 05:25:14)

Offline

#4 2021-03-22 04:11:09

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Confused about PKGBUILD dependencies

daniel_shub wrote:

When creating a PKGBUILD for the AUR, I never know what goes in the depends, makedepends, and checkdepends arrays. I think I actually understand the optdepends arrays. I think my confusion stems from the PKGBUILD entry (https://wiki.archlinux.org/index.php/PKGBUILD) definitions of of the *depends arrays

depends: An array of packages that must be installed for the software to build and run. Dependencies defined inside the package() function are only required to run the software.

makedepends: An array of packages that are only required to build the software. The minimum dependency version can be specified in the same format as in the depends array. The packages in the depends array are implicitly required to build the package, they should not be duplicated here.

checkdepends: An array of packages that the software depends on to run its test suite, but are not needed at runtime.

Based on these statements, I do not know what dependencies are required when.

1) I do not think most people put dependencies that are only required to run the package in the package function and I cannot find any documentation (e.g., https://wiki.archlinux.org/index.php/Cr … #package() ) that tells you how/when/why to do this.

These will not be installed by makepkg -s, but will end up as mandatory dependencies for the resulting .pkg.tar* files. Essentially, runtime-only dependencies. as loqs says, they're not generally useful except for split packages.

daniel_shub wrote:

2) I do not know if checkdepends are implicitly required in makedepends (although thanks to Eschwartz I know that they are https://bbs.archlinux.org/viewtopic.php … #p1962599)

3) I do not know if depends or makedepends are implicitly required by checkdepends

It's easiest to understand these based on when makepkg tries to install them.

- global depends: required by the built pkg.tar*, required by makepkg -s
- package() depends: required by the built pkg.tar*
- makedepends: required by makepkg -s
- checkdepends: required by makepkg -s *iff* the check function is going to be run

So, the check() function / checkdepends implicitly requires running the build() function and thus also requires makedepends as a prerequisite.

Everything (makepkg, pacman) requires global depends.
Running makepkg requires makedepends.

daniel_shub wrote:

Then there is the issue of transitive dependencies. The packaging guidelines say they are bad (https://wiki.archlinux.org/index.php/Ar … pendencies) and that NAMCAP can help, but NAMCAP (https://wiki.archlinux.org/index.php/Na … pendencies) has a dependency-already-satisfied warning which is downright confusing. The PKGBUILD specification (https://wiki.archlinux.org/index.php/PKGBUILD#depends) tells us that transitive dependencies are bad in the depends array, but nothing about them in makedepends or checkdepends.

The packaging guidelines were updated by one person who believes what it now says, but without taking into account certain input from others and without a cohesive approach to the entire corpus of Arch documentation. The page is also locked from editing by most staff, such as myself, discouraging spontaneous clarification or marking parts of it as opinionated, and reducing the likelihood that any change at all will get discussed for controversial topics or requested reversions.
(The page locking is really annoying! We were supposed to get a permission model that let staff edit staff pages, years ago. But nothing ever happened with that, and in the meantime the entirety of the DeveloperWiki pages got mass-locked in preparation for a permission model that will never come. The original authors of some pages are totally unable to keep them up to date.)

The same person who added this to the wiki later published a TODO list to implement this guideline for many packages in the official repos, and then retracted it after it caused a big argument in which a bunch of people vehemently argued in favor of it, and a bunch of people vehemently argued against it, and no common ground could be found.

I would not consider the page authoritative anymore, pending concerted effort I'm not interested in championing to actually figure out what "Arch" wants/expects and when. For now, you may feel free to use your best judgment.

daniel_shub wrote:

Finally, the makedepends section has this tidbit Dependencies should normally include the requirements for building all optional features of a package. which probably should be build and run and those only needed to build optional features should be in makedepends and for those for checking in checkdepends, but ...

The wiki already suggests moving some of the content that I have issues with to the packaging guidelines entry. If I understand the purpose of the wiki entry, I think this is probably the right move. It would allow https://wiki.archlinux.org/index.php/PK … pendencies to focus on the 4 dependency arrays (and their architecture subtypes). Then https://wiki.archlinux.org/index.php/Ar … pendencies could handle the best practices.

This is contextually talking about C library dependencies, which are build and run dependencies. You can infer this by noticing that it's mentioned in conjunction with automagic dependencies, but it is not exactly obvious...

Last edited by eschwartz (2021-03-23 00:03:10)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2021-03-22 14:49:36

daniel_shub
Member
Registered: 2012-06-21
Posts: 81

Re: Confused about PKGBUILD dependencies

@loqs and @eschwartz thanks. Whenever I cannot figure out something from the wiki, you two always seem to be able to help me.

Offline

Board footer

Powered by FluxBB