[pacman-dev] makepkg: propagate E_REMOVE_BUILD_DEPS

Message ID 20190120221414.2133-1-alad@archlinux.org
State Accepted, archived
Headers show
Series [pacman-dev] makepkg: propagate E_REMOVE_BUILD_DEPS | expand

Commit Message

Alad Wenter Jan. 20, 2019, 10:14 p.m. UTC
remove_deps is called once, at the end of clean_up() before makepkg
exit. If remove_deps returns >0 (e.g. when pressing "n" in the resulting
prompt), the error is caught by the ERR signal handler. This in turns
sends SIGUSR1 to the process group, with resulting exit code 138.

In case remove_deps fails, this patch exits makepkg with E_REMOVE_DEPS
if there was no previous error (that is, EXIT_CODE equals E_OK).
Otherwise, makepkg exits with EXIT_CODE.
---
 scripts/makepkg.sh.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Allan McRae Oct. 7, 2019, 7:10 a.m. UTC | #1
On 21/1/19 8:14 am, Alad Wenter wrote:
> remove_deps is called once, at the end of clean_up() before makepkg
> exit. If remove_deps returns >0 (e.g. when pressing "n" in the resulting
> prompt), the error is caught by the ERR signal handler. This in turns
> sends SIGUSR1 to the process group, with resulting exit code 138.
> 
> In case remove_deps fails, this patch exits makepkg with E_REMOVE_DEPS
> if there was no previous error (that is, EXIT_CODE equals E_OK).
> Otherwise, makepkg exits with EXIT_CODE.
> ---

Applied - thanks!

A

>  scripts/makepkg.sh.in | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index c81dc801..fd459532 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -176,7 +176,11 @@ clean_up() {
>  		fi
>  	fi
>  
> -	remove_deps
> +	if ! remove_deps && (( EXIT_CODE == E_OK )); then
> +	    exit $E_REMOVE_DEPS_FAILED
> +	else
> +	    exit $EXIT_CODE
> +	fi
>  }
>  
>  enter_fakeroot() {
>

Patch

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c81dc801..fd459532 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -176,7 +176,11 @@  clean_up() {
 		fi
 	fi
 
-	remove_deps
+	if ! remove_deps && (( EXIT_CODE == E_OK )); then
+	    exit $E_REMOVE_DEPS_FAILED
+	else
+	    exit $EXIT_CODE
+	fi
 }
 
 enter_fakeroot() {