[pacman-dev] [PATCH] makepkg.sh.in is now building splitted packages
silvio at port1024.net
silvio at port1024.net
Mon Jun 16 15:06:53 EDT 2008
From: Silvio fricke <silvio at port1024.net>
* it builds the packages in different directories
* repackaging works now
To activate this feature you only need a hook-variable "splitinstall" with all
function-names in it.
After performing of build(), it runs all functions in succession.
Signed-off-by: Silvio fricke <silvio at port1024.net>
---
scripts/makepkg.sh.in | 57 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5bdc5bc..c96b9fb 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -675,6 +675,8 @@ run_build() {
mv "$BUILDLOG" "$BUILDLOG.$i"
fi
+ export BUILDLOG
+
build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
else
build 2>&1 || ret=$?
@@ -1389,7 +1391,38 @@ if [ "$INFAKEROOT" = "1" ]; then
tidy_install
fi
- create_package
+ if [ "$splitinstall" != "" ] ; then
+ for varname in "pkgname" "pkgver" "pkgrel" "pkgdesc" "arch" "url" "license" "groups" "depends" "makedepends" "provides" "conflicts" "replaces" "backup" "options" "install" "pkgdir"; do
+ temp_var_name="${varname}_o"
+ eval "${temp_var_name}=\"${!varname}\""
+ done
+
+ create_package
+ for it in "${splitinstall[@]}" ; do
+ pkgdir="$startdir/pkg_${it}"
+ [ ! -d "$pkgdir" ] && mkdir -p "$pkgdir"
+ msg "$(gettext "Building split package using function: %s")" "$it"
+
+ if [ "$LOGGING" = "1" ]; then
+ [ "x$BUILDLOG" == "x" ] && BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+ echo "\n\n--- Logging for $it ------------" >> "$BUILDLOG"
+
+ $it 2>&1 | tee -a "$BUILDLOG"
+ else
+ $it 2>&1
+ fi
+
+ create_package
+
+ for varname in "pkgname" "pkgver" "pkgrel" "pkgdesc" "arch" "url" "license" "groups" "depends" "makedepends" "provides" "conflicts" "replaces" "backup" "options" "install" "pkgdir"; do
+ temp_var_name="${varname}_o"
+ [ "${!temp_var_name}" != "" ] && eval "${varname}=\"${!temp_var_name}\"" || unset ${varname}
+ done
+ done
+ msg "$(gettext "All split packages built!")"
+ else
+ create_package
+ fi
msg "$(gettext "Leaving fakeroot environment.")"
exit 0 # $E_OK
@@ -1459,6 +1492,20 @@ if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
error "$(gettext "The source directory is empty, there is nothing to build!")"
plain "$(gettext "Aborting...")"
exit 1
+ elif [ "$splitinstall" != "" ]; then
+ for fun in "${splitinstall[@]}"; do
+ pkgdir_fun="$startdir/pkg_${fun}"
+ exit_now=0
+ if [ ! -d "$pkgdir_fun" -o "$(ls "$pkgdir_fun" 2>/dev/null)" = "" ]; then
+ warning "$(gettext "The subpackage directory %s is empty, there is nothing to repackage!")" "$pkgdir_fun"
+ pwd
+ exit_now=1
+ fi
+ if [ $exit_now -eq 1 ]; then
+ error "$(gettext "Aborting...")"
+ exit 1
+ fi
+ done
elif [ "$REPKG" = "1" -a \( ! -d "$pkgdir" -o "$(ls "$pkgdir" 2>/dev/null)" = "" \) ]; then
error "$(gettext "The package directory is empty, there is nothing to repackage!")"
plain "$(gettext "Aborting...")"
@@ -1475,9 +1522,15 @@ if [ "$NOBUILD" = "1" ]; then
exit 0 #E_OK
else
# check for existing pkg directory; don't remove if we are repackaging
- if [ -d "$pkgdir" -a "$REPKG" = "0" ]; then
+ if [ -d "$pkgdir" -a "$REPKG" = "0" -a "$splitinstall" == "" ]; then
msg "$(gettext "Removing existing pkg/ directory...")"
rm -rf "$pkgdir"
+ elif [ "$splitinstall" != "" -a "$REPKG" = "0" ]; then
+ for fun in "${splitinstall[@]}"; do
+ pkgdir_fun="$startdir/pkg_${fun}"
+ msg "$(gettext "Removing existing %s directory...")" "$pkgdir_fun"
+ rm -rf "$pkgdir_fun"
+ done
fi
mkdir -p "$pkgdir"
cd "$startdir"
--
1.5.5.3
More information about the pacman-dev
mailing list