[PATCH] makepkg: Add fallback to package function

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] makepkg: Add fallback to package function

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

makepkg looks for a package() function when building a single package
but package_$pkgname() style package functions when building a split
package.  This patch allows the use of a package_$pkgname() function
when building a single package for consistency.  This is achieved by
having makepkg consider a non-split package with a package_$pkgname()
function as a split package (creating just the one package).

Fixes FS#16622.

Signed-off-by: Allan McRae <allan@...>
---
 scripts/makepkg.sh.in |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index dd5f951..a576c52 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1742,10 +1742,6 @@ if [ "$GENINTEG" -eq 1 ]; then
  exit 0 # $E_OK
 fi
 
-if [ "$(type -t package)" = "function" ]; then
- PKGFUNC=1
-fi
-
 # check the PKGBUILD for some basic requirements
 check_sanity || exit 1
 
@@ -1760,6 +1756,12 @@ if [ "${#pkgname[@]}" -gt "1" ]; then
  SPLITPKG=1
 fi
 
+if [ "$(type -t package)" = "function" ]; then
+ PKGFUNC=1
+elif [ $SPLITPKG -eq 0 -a "$(type -t package_${pkgname})" = "function" ]; then
+ SPLITPKG=1
+fi
+
 pkgbase=${pkgbase:-${pkgname[0]}}
 
 if [ -n "${PKGLIST[@]}" ]; then
--
1.6.5.1



Re: [PATCH] makepkg: Add fallback to package function

by Dan McGee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Oct 24, 2009 at 11:41 PM, Allan McRae <allan@...> wrote:

> makepkg looks for a package() function when building a single package
> but package_$pkgname() style package functions when building a split
> package.  This patch allows the use of a package_$pkgname() function
> when building a single package for consistency.  This is achieved by
> having makepkg consider a non-split package with a package_$pkgname()
> function as a split package (creating just the one package).
>
> Fixes FS#16622.
>
> Signed-off-by: Allan McRae <allan@...>
> ---

No objections to this from me; I'll wait to merge any of this stuff
until post [[ (( conversion though.

-Dan