The pkgbase variable is added to improve informational output and
source package naming when using split packages. Defaults to
${pkgname[0]} if not set.
Also:
- move splitpkg detection to after pkgname presence is verified
- add "cd" line to package_foo() functions in splitpkg proto
Signed-off-by: Allan McRae <allan@archlinux.org>
---
Note that pkgbase is not documented as it is intended for split packages
only and that is not documented yet...
+ cd "$srcdir/$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg2
}
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d2cf52e..2ff98f1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -687,7 +687,7 @@ run_build() {
local ret=0
if [ "$LOGGING" -eq 1 ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-build.log"
+ BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"
if [ -f "$BUILDLOG" ]; then
local i=1
while true; do
@@ -995,15 +995,15 @@ create_srcpackage() {
fi
msg "$(gettext "Creating source package...")"
local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)"
- mkdir "${srclinks}"/${pkgname}
+ mkdir "${srclinks}"/${pkgbase}
- local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}${SRCEXT}"
+ local pkg_file="$PKGDEST/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"
# tar it up
msg2 "$(gettext "Compressing source package...")"
cd "${srclinks}"
- if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgname}; then
+ if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgbase}; then
error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code
fi
@@ -1471,9 +1471,9 @@ if [ "$ASROOT" -eq 0
fi
fi
if [ ! -f "$BUILDSCRIPT" ]; then
if [ -t 0 ]; then
@@ -1505,10 +1505,6 @@ if [ "$(type -t package)" = "function" ]; then
PKGFUNC=1
fi
-if [ "${#pkgname[@]}" -gt "1" ]; then
- SPLITPKG=1
-fi
-
# check for no-no's in the build script
if [ -z "$pkgname" ]; then
error "$(gettext "%s is not allowed to be empty.")" "pkgname"
@@ -1535,9 +1531,11 @@ if [ "$arch" = 'any' ]; then
CARCH='any'
fi
+pkgbase=${pkgbase:-${pkgname[0]}}
+
if ! in_array $CARCH ${arch[@]}; then
if [ "$IGNOREARCH" -eq 0 ]; then
- error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgname" "$CARCH"
+ error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
plain "$(gettext "such as arch=('%s').")" "$CARCH"
exit 1
@@ -1583,6 +1581,10 @@ unset valid_options opt known kopt
devel_check
devel_update
+if [ "${#pkgname[@]}" -gt "1" ]; then
+ SPLITPKG=1
+fi
+
if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
-a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
if [ "$INSTALL" -eq 1 ]; then
@@ -1624,17 +1626,17 @@ if [ "$INFAKEROOT" -eq 1 ]; then
exit 0 # $E_OK
fi
# if we are creating a source-only package, go no further
if [ "$SOURCEONLY" -ne 0 ]; then
- if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}${SRCEXT}"
+ if [ -f "$PKGDEST/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"
-a "$FORCE" -eq 0 ]; then
error "$(gettext "A package has already been built. (use -f to overwrite)")"
exit 1
fi
create_srcpackage
- msg "$(gettext "Source package created: %s")" "$pkgname ($(date))"
+ msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
exit 0
fi