Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#70671 - [pacman] Documentation - man 5 PKGBUILD - use of "pkgdir" variable

Attached to Project: Arch Linux
Opened by James (thx1138) - Saturday, 01 May 2021, 18:01 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 01 May 2021, 19:08 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

pacman 5.2.2-3

`man 5 PKGBUILD` states explicitly: "pkgdir ... This variable should only be used in the package() function."

In fact, that is not what happens in practice. Either the documentation is wrong, or Arch developers routinely violate their own rules, which makes both documentation and rules rather useless.

See, for instance, PKGBUILD for the linux kernel, which uses non-standard naming for the split package functions, `_package_foo()`, instead of `package_foo()`, and where then these functions create various package install directories, which were not created in the prepare() function.

Either fix the PKGBUILD documentation, or fix nonconformant PKGBUILD files - or fix pacman so that people do not need to craft work-arounds, whatever the motivation was here.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Saturday, 01 May 2021, 19:08 GMT
Reason for closing:  Not a bug
Additional comments about closing:  If you find any uses of $pkgdir outside of the package function(s) (actual uses), open a bug against those packages.
Comment by Morten Linderud (Foxboron) - Saturday, 01 May 2021, 18:14 GMT
It says "should" not "must" or a stronger indication of "this *needs* to be done".

Regardless, whatever the pacman developers write in their man page is not indicative of what is accepted/unaccepted in terms of packaging guidelines for the distro as a whole. They are separate concerns.
Comment by Jonas Witschel (diabonas) - Saturday, 01 May 2021, 18:22 GMT
$pkgdir should only be used in the package() function because this is where the assembly of all files that should end up in the created package should happen. In fact, $pkgdir is not even created by makepkg before package() is called. The PKGBUILD for the linux package is no exception to this: even though it uses a somewhat unusual structure (and is therefore not necessarily a prime example of standard packaging practices), the custom _package_*() functions are only called from within the standard package_*() functions. Therefore I see no reason to change the pacman documentation, which correctly warns you that attempting to create files inside $pkgdir in pkgver(), prepare(), build() or check() will fail since the directory doesn't even exist yet.
Comment by Morten Linderud (Foxboron) - Saturday, 01 May 2021, 18:23 GMT
Also, this issue seems to be some weird semantics argument because of general unhappiness with  FS#69869 
Comment by James (thx1138) - Saturday, 01 May 2021, 18:39 GMT
> the custom _package_*() functions are only called from within the standard package_*() functions.

There is no such `package_*()` function defined in the linux package PKGBUILD.

> Also, this issue seems to be some weird semantics argument because of general unhappiness with  FS#69869 

Quite. We all enjoy deciphering other people's work when the documentation is misleading, right?

Whatever. The counter argument I am hearing is along the lines of "*I* already know how makepkg *really* works, so there is no reason to change the documentation."

Hey, let's all be 31ite H4ck0rs!
Comment by Jonas Witschel (diabonas) - Saturday, 01 May 2021, 18:45 GMT
> There is no such `package_*()` function defined in the linux package PKGBUILD.

Every PKGBUILD must have a package() function, the linux package is no exception to this: since it is a split PKGBUILD, it has multiple package_$pkgname() functions, which are dynamically generated (cf. https://github.com/archlinux/svntogit-packages/blob/80030bba2d263553345ea30e9c31491e03985dd5/trunk/PKGBUILD#L192-L195), which I agree doesn't improve the readability of the PKGBUILD unfortunately. So this is really not about improving the pacman documentation since the PKGBUILD in question already follows the sentence that you quoted, but rather about the readability of the linux PKGBUILD, which is a totally separate issue.

Loading...