Changes to the handling of PKGBUILD variables in split packages
The body of articles related to packaging guidelines and creating, maintaining, and reviewing packages includes very little about split packages, specifically how they differ from their non-split counterparts and what guidelines or conventions should be reflected in PKGBUILDs for split packages. There are some inconsistencies between what's documented on ArchWiki and what is implemented in pacman/makepkg. (I'll try to re-find the inconsistencies I've encountered.)
#pkgbase documents, "Everything, except #makedepends, #Sources, and #Integrity variables can be overridden within each split package's
package() function", while the actual code of makepkg seems to allow overrides for a subset of those variables as defined in the following:
splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' 'backup' 'options' 'install' 'changelog')
Specifically, #Version and #checkdepends variables are not part of that overrides' array but are not mentioned in #pkgbase. Is makepkg missing the ability to process overrides for these variables or is the documentation inaccurate in not listing these variables as not subject to overrides?
- All options and directives for the split packages default to the global values given in
- the PKGBUILD. Nevertheless, the following ones can be overridden within each split
- package’s packaging function: pkgdesc, arch, url, license, groups, depends, optdepends,
- provides, conflicts, replaces, backup, options, install, and changelog.
- Just realised this post is two years old. Maybe the man page was not clear at the time.
- It's certainly clear now though so I think it's safe to change it.
- Morganamilo (talk) 21:09, 9 June 2018 (UTC)
Undo "Remove incorrect warning"
package()is only useful for split packaging. You should not do this for single packages, even if you know the dependencies are run time only.
I believe this warning is valid. Sure makepkg will allow you to override the depends on a singular package. But I don't think this is recommended at all and is a needless complication.
Without the warning, clarifying that depends inside of
package() are run time only might give readers that this should be done any time they have run time only depends but that is not the case.
Morganamilo (talk) 21:40, 9 June 2018 (UTC)
- It is also perfectly acceptable when repackaging pre-built binaries. Putting this restriction in here has no basis in fact and is just plain wrong.
- Scimmia (talk) 21:45, 9 June 2018 (UTC)
- Alright if that's the case I guess the warning was overkill. I still would like to see at least a note of some sort saying that you don't need to go separating the make only and run only dependencies. It is perfectly acceptable to put run time deps in the global depends.
Package name restructuring
Also in order to solve the related comment in Talk:Arch User Repository#Current: Creating a new package, I propose to restructure PKGBUILD#Package name as shown in #Draft and described below (you can paste the draft in the article to preview the diff):
- Put PKGBUILD#pkgname above PKGBUILD#pkgbase (swap places);
- Better define when pkgname should be a simple string vs an array (some excerpts taken from PKGBUILD(5));
- Add a link to the definition of package splitting;
- Clarify the relation between pkgbase and pkgname.
- I don't have a problem with the text specifically, but I don't like switching them around. I much prefer pkgbase to be the first thing in a PKGBUILD, as that is the most important thing in many respects. Changing it here implies that it should be changed in PKGBUILDs, as the intro says. Scimmia (talk) 22:20, 7 December 2018 (UTC)
Either the name of the package, e.g.
pkgname='foo', or, for split packages, an array of names, e.g.
pkgname=('foo' 'bar'). Package names should only consist of lowercase alphanumerics and the following characters:
@._+- (at symbol, dot, underscore, plus, hyphen). Names are not allowed to start with hyphens or dots. For the sake of consistency,
pkgname should match the name of the source tarball of the software: for instance, if the software is in
pkgname=foobar. The name of the directory containing the PKGBUILD should also match the
When building regular packages, this variable should not be explicitly declared in the PKGBUILD, and its value will default to that of
When building a split package, this variable can be used to explicitly specify the name to be used to refer to the group of packages in the output of makepkg and in the naming of source-only tarballs. The value is not allowed to begin with a hyphen. If not specified, the value will default to the first element in the
All options and directives for split packages default to the global values given in the PKGBUILD. Nevertheless, the following ones can be overridden within each split package’s packaging function: #pkgdesc, #arch, #url, #license, #groups, #depends, #optdepends, #provides, #conflicts, #replaces, #backup, #options, #install, and #changelog.