FS#16622 - Add a fallback package() to call package_"$pkgname" for pkgname arrays of length one
Attached to Project:
Pacman
Opened by Isaac G (IsaacG) - Tuesday, 13 October 2009, 19:03 GMT
Last edited by Allan McRae (Allan) - Tuesday, 17 November 2009, 11:30 GMT
Opened by Isaac G (IsaacG) - Tuesday, 13 October 2009, 19:03 GMT
Last edited by Allan McRae (Allan) - Tuesday, 17 November 2009, 11:30 GMT
|
Details
When pkgname is an array, makepkg calls the function
package_"$name" for each name in the array.
When pkgname is an scalar, makepkg calls the function package. bash does not differentiate arrays from scalars. Hence if I got a PKGBUILD file that has an array of pkgname's and I only want one package so I remove all but one element from the array, makepkg will attempt to call the function package which will not exist. A fix/workaround to this issue would be to add this line somewhere before the PKGBUILD file is sourced: package () { [ -n "${pkgname[0]}" ] && package_"${pkgname[0]}"; } or package () { [ -n "$pkgname" ] && package_"$pkgname"; } This way, if the PKGBUILD defines a function package, it overwrites the above definition and the above has no affect. If the PKGBUILD does not define a function package(), then you don't expect it to be called. If it is called and package_"$pkgname" exists, that is probably what you want to call. This would fix the issue mentioned in the paragraph beginning "Hence". |
This task depends upon
Closed by Allan McRae (Allan)
Tuesday, 17 November 2009, 11:30 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 9c34dfd9
Tuesday, 17 November 2009, 11:30 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 9c34dfd9
But in case of normal pkgbuild, it seems it would make sense to check for package_"$pkgname"() if package() does not exist.
Just for sake of consistency with split pkgbuild.
FS#15956and allow the selection of which packages to build from a split package.http://mailman.archlinux.org/pipermail/pacman-dev/2009-October/009916.html