[pacman-dev] [PATCH] makepkg.sh.in is now building splitted packages

silvio at port1024.net silvio at port1024.net
Mon Jun 16 15:03:02 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 |   58 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5bdc5bc..3c0c6f7 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,57 @@ if [ "$INFAKEROOT" = "1" ]; then
 		tidy_install
 	fi
 
-	create_package
+	if [ "$splitinstall" != "" ] ; then
+		backup_o=$backup
+		conflicts_o=$conflicts
+		depends_o=$depends
+		groups_o=$groups
+		install_o=$install
+		license_o=$license
+		pkgdesc_o=$pkgdesc
+		pkgname_o=$pkgname
+		pkgver_o=$pkgver
+		provides_o=$provides
+		replaces_o=$replaces
+		url_o=$url
+		create_package
+		for it in "${splitinstall[@]}" ; do
+			if [ -d "$pkgdir" ]; then
+				msg "Removing existing pkg/ directory..."
+				rm -rf "$pkgdir"
+			fi
+			mkdir -p "$pkgdir"
+			msg "Building split package using function: $it"
+
+			if [ "$LOGGING" = "1" ]; then
+				[ "x$BUILDLOG" == "x" ] && BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+				echo >> "$BUILDLOG"
+				echo >> "$BUILDLOG"
+				echo "--- Logging for $it ------------" >> "$BUILDLOG"
+
+				$it 2>&1 | tee -a "$BUILDLOG"
+			else
+				$it 2>&1
+			fi
+
+			create_package
+			[ "$backup_o" != "" ]    && backup=$backup_o       || unset backup
+			[ "$conflicts_o" != "" ] && conflicts=$conflicts_o || unset conflicts
+			[ "$depends_o" != "" ]   && depends=$depends_o     || unset depends
+			[ "$groups_o" != "" ]    && groups=$groups_o       || unset groups
+			[ "$install_o" != "" ]   && install=$install_o     || unset install
+			[ "$license_o" != "" ]   && license=$license_o     || unset license
+			[ "$pkgdesc_o" != "" ]   && pkgdesc=$pkgdesc_o     || unset pkgdesc
+			[ "$pkgname_o" != "" ]   && pkgname=$pkgname_o     || unset pkgname
+			[ "$pkgver_o" != "" ]    && pkgver=$pkgver_o       || unset pkgver
+			[ "$provides_o" != "" ]  && provides=$provides_o   || unset provides
+			[ "$replaces_o" != "" ]  && replaces=$replaces_o   || unset replaces
+			[ "$url_o" != "" ]       && url=$url_o             || unset url
+		done
+		msg "All split packages built!"
+	else
+		create_package
+	fi
 
 	msg "$(gettext "Leaving fakeroot environment.")"
 	exit 0 # $E_OK
@@ -1459,6 +1511,10 @@ 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
+		error "$(gettext "Repacking with splittet Packages are not supported")"
+		plain "$(gettext "Aborting...")"
+		exit 1
 	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...")"
-- 
1.5.5.3





More information about the pacman-dev mailing list