summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2009-01-16 22:32:05 +1000
committerAllan McRae <allan@archlinux.org>2009-01-16 22:32:05 +1000
commite946ee7745a839c0cd9244a3d9b50a3ea15143f9 (patch)
treec9f5b0039d2842fbb82139c2c80555d46dcb170c /scripts/makepkg.sh.in
parent21b8a5418dc4e4f0b0ebc95b20126c07b3714ca6 (diff)
downloadpacman-e946ee7745a839c0cd9244a3d9b50a3ea15143f9.tar.xz
makepkg: implement creation of split packages
Adds the ability to create multiple packages from one PKGBUILD Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in63
1 files changed, 47 insertions, 16 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 13cd98fc..1e990de3 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -67,6 +67,7 @@ LOGGING=0
SOURCEONLY=0
IGNOREARCH=0
HOLDVER=0
+SPLITPKG=0
# Forces the pkgver of the current PKGBUILD. Used by the fakeroot call
# when dealing with svn/cvs/etc PKGBUILDs.
@@ -1565,6 +1566,10 @@ if [ "$GENINTEG" = "1" ]; then
exit 0 # $E_OK
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"
@@ -1653,17 +1658,29 @@ fi
# Run the bare minimum in fakeroot
if [ "$INFAKEROOT" = "1" ]; then
- if [ "$REPKG" = "0" ]; then
- if [ "$(type -t package)" != "function" ]; then
- run_build
- else
- run_package
+ if [ "$SPLITPKG" = "0" ]; then
+ if [ "$REPKG" = "0" ]; then
+ if [ "$(type -t package)" != "function" ]; then
+ run_build
+ else
+ run_package
+ fi
+ tidy_install
fi
- tidy_install
+ create_package
+ else
+ for pkg in ${pkgname[@]}; do
+ pkgdir="$pkgdir/$pkg"
+ mkdir -p "$pkgdir"
+ backup_package_variables
+ run_package $pkg
+ tidy_install
+ create_package $pkg
+ restore_package_variables
+ pkgdir="${pkgdir%/*}"
+ done
fi
- create_package
-
msg "$(gettext "Leaving fakeroot environment.")"
exit 0 # $E_OK
fi
@@ -1747,18 +1764,32 @@ else
# if we are root or if fakeroot is not enabled, then we don't use it
if [ "$(check_buildenv fakeroot)" != "y" -o $EUID -eq 0 ]; then
- if [ "$REPKG" = "0" ]; then
+ if [ "$SPLITPKG" = "0" ]; then
+ if [ "$REPKG" = "0" ]; then
+ devel_update
+ run_build
+ if [ "$(type -t package)" == "function" ]; then
+ run_package
+ fi
+ tidy_install
+ fi
+ create_package
+ else
devel_update
run_build
- if [ "$(type -t package)" == "function" ]; then
- run_package
- fi
- tidy_install
+ for pkg in ${pkgname[@]}; do
+ pkgdir="$pkgdir/$pkg"
+ mkdir -p "$pkgdir"
+ backup_package_variables
+ run_package $pkg
+ tidy_install
+ create_package $pkg
+ restore_package_variables
+ pkgdir="${pkgdir%/*}"
+ done
fi
-
- create_package
else
- if [ "$(type -t package)" == "function" ]; then
+ if [ "$(type -t package)" == "function" -o "$SPLITPKG" = "1" ]; then
devel_update
run_build
cd "$startdir"