aboutsummaryrefslogtreecommitdiffstats
path: root/main/abuild/0001-abuild-fix-runpart.patch
blob: 6f6c3eae22ff569a38c7fde805ec379ba0af219d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From 3b61bfb6445a71208e218828296b8ca3bb65932e Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 21 Mar 2017 08:05:44 +0000
Subject: [PATCH] abuild: fix runpart

we need to run the function for runpart in the same shell, otherwise we
will lose the global variables set in the split functions.
---
 abuild.in | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/abuild.in b/abuild.in
index 1eede20..903da3a 100644
--- a/abuild.in
+++ b/abuild.in
@@ -566,9 +566,9 @@ update_config_guess() {
 runpart() {
 	local part=$1
 	[ -n "$DEBUG" ] && msg "$part"
-	abuild_function=$part "$abuild_path" \
-		$color_opt $nodeps $force $forceroot $keep $quiet \
-		$install_deps $recursive $upgrade || die "$part failed"
+	trap "die '$part failed'" EXIT
+	$part
+	trap - EXIT
 }
 
 # override those in your build script
@@ -2340,22 +2340,15 @@ controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname}
 
 trap 'die "Aborted by user"' INT
 
-if [ "$abuild_function" ]; then
-	_function=$abuild_function
-	abuild_function=
-	$_function
+[ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname"
 
-else
-	[ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname"
-
-	if [ -z "$1" ]; then
-		set all
-	fi
-
-	while [ $# -gt 0 ]; do
-		runpart $1
-		shift
-	done
+if [ -z "$1" ]; then
+	set all
 fi
 
+while [ $# -gt 0 ]; do
+	runpart $1
+	shift
+done
+
 cleanup
-- 
2.11.1