[pacman-dev] [patch] add support for scriptlets functions embedded in $BUILDSCRIPT
Alessio 'mOLOk' Bolognino
themolok.ml at gmail.com
Sat Jul 21 00:28:43 EDT 2007
Hi,
I think there isn't a real need to split PKGBUILD and
$pkgname.install, this patch allows you to put the scriptlets functions
into the PKGBUILD. This IMHO follows the KISS philosophy.
If at least a {post,pre}_{install,upgrade,remove} function is found in
the PKGBUILD, then the install file (if it exists) is ignored;
otherwise, if there isn't any scriptlet function in the PKGBUILD the
install file is included, as usually.
Enjoy:
From e206a96ebe1e9a11f85de1502fc46e75321ba192 Mon Sep 17 00:00:00 2001
From: Alessio 'mOLOk' Bolognino <themolok at gmail.com>
Date: Sat, 21 Jul 2007 06:15:34 +0200
Subject: [PATCH] Added support for scriptlets functions embedded in $BUILDSCRIPT
---
scripts/makepkg.sh.in | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index a3e4d9c..fb931a7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -831,9 +831,18 @@ create_package() {
local comp_files=".PKGINFO .FILELIST"
- # check for an install script
+ # check for scriptlets fuctions or an install script
# TODO: should we include ${pkgname}.install if it exists and $install is unset?
- if [ "$install" != "" ]; then
+ scriptlet=$(declare -f {post,pre}_{install,remove,upgrade} || return 0)
+ if [ "$scriptlet" != "" ]; then
+ msg2 "$(gettext "Adding scriptlet functions (install script will be ignored)...")"
+ ( echo "$scriptlet"
+ echo 'op=$1'
+ echo 'shift'
+ echo '[ "$(type -t "$op")" = "function" ] && $op "$@"'
+ ) > .INSTALL
+ comp_files="$comp_files .INSTALL"
+ elif [ "$install" != "" ]; then
msg2 "$(gettext "Adding install script...")"
cp "$startdir/$install" .INSTALL
comp_files="$comp_files .INSTALL"
@@ -1175,6 +1184,7 @@ fi
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
unset replaces depends conflicts backup source install build makedepends
unset options noextract
+unset {post,pre}_{install,remove,upgrade}
if [ ! -f "$BUILDSCRIPT" ]; then
error "$(gettext "%s does not exist.")" "$BUILDSCRIPT"
--
1.5.2.4
--
Alessio 'mOLOk' Bolognino
Arch Linux Trusted User
Please send personal email to themolok at gmail.com
Public Key http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xFE0270FB
GPG Key ID = 1024D / FE0270FB 2007-04-11
Key Fingerprint = 9AF8 9011 F271 450D 59CF 2D7D 96C9 8F2A FE02 70FB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070721/03322fa5/attachment.pgp>
More information about the pacman-dev
mailing list