Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2009-01-16 22:26:52 +1000
committerAllan McRae <allan@archlinux.org>2009-01-16 22:26:52 +1000
commit21b8a5418dc4e4f0b0ebc95b20126c07b3714ca6 (patch)
tree0afc799d4ec156dc280cdbd65b0c786cc9364cfc /scripts/makepkg.sh.in
parent708ce1480f83e01af7a6aba2db04e7982c313673 (diff)
makepkg: Optional argument for run_package and create_package
Generalize run_package to allow the passing of a package name directing the use of an alternative package function. A similar adjustment to create_package to prepare split packages. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in26
1 files changed, 20 insertions, 6 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f2c9b363..13cd98fc 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -714,12 +714,20 @@ run_build() {
}
run_package() {
+ if [ -z "$1" ]; then
+ pkgfunc="package"
+ nameofpkg="$pkgname"
+ else
+ pkgfunc="package_$1"
+ nameofpkg="$1"
+ fi
+
# clear user-specified makeflags if requested
if [ "$(check_option makeflags)" = "n" ]; then
MAKEFLAGS=""
fi
- msg "$(gettext "Starting package()...")"
+ msg "$(gettext "Starting %s()...")" "$pkgfunc"
cd "$srcdir"
# ensure all necessary build variables are exported
@@ -727,7 +735,7 @@ run_package() {
local ret=0
if [ "$LOGGING" = "1" ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-package.log"
+ BUILDLOG="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${CARCH}-package.log"
if [ -f "$BUILDLOG" ]; then
local i=1
while true; do
@@ -746,12 +754,12 @@ run_package() {
exec 3>&1
tee "$BUILDLOG" < "$logpipe" &
exec 1>"$logpipe" 2>"$logpipe"
- package 2>&1 || ret=$?
+ $pkgfunc 2>&1 || ret=$?
sync
exec 1>&3 2>&3 3>&-
rm "$logpipe"
else
- package 2>&1 || ret=$?
+ $pkgfunc 2>&1 || ret=$?
fi
if [ $ret -gt 0 ]; then
@@ -845,6 +853,12 @@ tidy_install() {
}
create_package() {
+ if [ -z "$1" ]; then
+ nameofpkg="$pkgname"
+ else
+ nameofpkg="$1"
+ fi
+
if [ ! -d "$pkgdir" ]; then
error "$(gettext "Missing pkg/ directory.")"
plain "$(gettext "Aborting...")"
@@ -869,7 +883,7 @@ create_package() {
echo "# using $(fakeroot -v)" >>.PKGINFO
fi
echo "# $(LC_ALL=C date -u)" >>.PKGINFO
- echo "pkgname = $pkgname" >>.PKGINFO
+ echo "pkgname = $nameofpkg" >>.PKGINFO
echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
echo "pkgdesc = $pkgdesc" >>.PKGINFO
echo "url = $url" >>.PKGINFO
@@ -953,7 +967,7 @@ create_package() {
"$PKGEXT" ;;
esac
- local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself