summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorCedric Staniewski <cedric@gmx.ca>2009-10-27 12:56:13 +0100
committerDan McGee <dan@archlinux.org>2009-11-15 19:33:03 -0600
commit4d2ec3751c6e7ee47cdb784ed5cab0992f03c9dc (patch)
treee11f5e44815a23e022391a460a570221da7f6d24 /scripts/makepkg.sh.in
parent564352c4a2d12050d7b4c386e972976a24f1f993 (diff)
downloadpacman-4d2ec3751c6e7ee47cdb784ed5cab0992f03c9dc.tar.xz
makepkg: allow the use of only a package() function
For some packages, generally the 'any' arch ones, a build step is not required and therefore can be skipped. In these cases, a package() function without a build() one is sufficient. As a side effect, this commit makes meta packages without any function at all in the PKGBUILD possible. Fixes FS#15147. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7161096e..8398b457 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -70,6 +70,7 @@ LOGGING=0
SOURCEONLY=0
IGNOREARCH=0
HOLDVER=0
+BUILDFUNC=0
PKGFUNC=0
SPLITPKG=0
@@ -137,7 +138,9 @@ clean_up() {
rm -rf "$pkgdir" "$srcdir"
if [[ -n $pkgbase ]]; then
# Can't do this unless the BUILDSCRIPT has been sourced.
- rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
+ if (( BUILDFUNC )); then
+ rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
+ fi
if (( PKGFUNC )); then
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package.log"*
elif (( SPLITPKG )); then
@@ -1709,6 +1712,12 @@ if (( ${#pkgname[@]} > 1 )); then
SPLITPKG=1
fi
+# test for available PKGBUILD functions
+# The exclamation mark is required here to avoid triggering the ERR trap when
+# a tested function does not exist.
+if [[ $(! type -t build) = "function" ]]; then
+ BUILDFUNC=1
+fi
if [ "$(type -t package)" = "function" ]; then
PKGFUNC=1
elif [ $SPLITPKG -eq 0 -a "$(type -t package_${pkgname})" = "function" ]; then
@@ -1764,7 +1773,7 @@ fi
if (( INFAKEROOT )); then
if (( ! SPLITPKG )); then
if (( ! PKGFUNC )); then
- if (( ! REPKG )); then
+ if (( BUILDFUNC && ! REPKG )); then
run_build
tidy_install
fi
@@ -1874,7 +1883,7 @@ else
if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then
if (( ! REPKG )); then
devel_update
- run_build
+ (( BUILDFUNC )) && run_build
fi
if (( ! SPLITPKG )); then
if (( PKGFUNC )); then
@@ -1899,7 +1908,7 @@ else
else
if (( ! REPKG && ( PKGFUNC || SPLITPKG ) )); then
devel_update
- run_build
+ (( BUILDFUNC )) && run_build
cd "$startdir"
fi