[pacman-dev] [PATCH] makepkg: exit on error during build() or package()
Set the ERR trap to abort upon encountering an error during the execution
of a build or package function.
Activate set -E, which lets functions inherit the ERR trap.
Signed-off-by: Henning Garus
Henning Garus wrote:
Set the ERR trap to abort upon encountering an error during the execution of a build or package function.
Activate set -E, which lets functions inherit the ERR trap.
<snip> Just a quick query... does this work with split packages and variables defined in the package_foo() functions, especially when using the -L flag? I am too busy to test at the moment, but that has been the main issue in getting this working in the past. Allan
On Sun, Aug 23, 2009 at 12:56 PM, Allan McRae
Henning Garus wrote:
Set the ERR trap to abort upon encountering an error during the execution of a build or package function.
Activate set -E, which lets functions inherit the ERR trap.
<snip>
Just a quick query... does this work with split packages and variables defined in the package_foo() functions, especially when using the -L flag? I am too busy to test at the moment, but that has been the main issue in getting this working in the past.
If I understood correctly, all the problems came from the piping. Actually that's why you had to find an alternative to " | tee " in run_package. This patch does not introduce any piping so it should be fine on this side. I tested it now and it seems to work fine. A comment I had when looking at the patch : it seems like run_build and run_package are widely duplicated. I believe it is possible to refactor the biggest part of them in a run_function $function. What do you think?
Xavier wrote:
On Sun, Aug 23, 2009 at 12:56 PM, Allan McRae
wrote: Henning Garus wrote:
Set the ERR trap to abort upon encountering an error during the execution of a build or package function.
Activate set -E, which lets functions inherit the ERR trap.
<snip>
Just a quick query... does this work with split packages and variables defined in the package_foo() functions, especially when using the -L flag? I am too busy to test at the moment, but that has been the main issue in getting this working in the past.
If I understood correctly, all the problems came from the piping. Actually that's why you had to find an alternative to " | tee " in run_package. This patch does not introduce any piping so it should be fine on this side.
I tested it now and it seems to work fine.
Great
A comment I had when looking at the patch : it seems like run_build and run_package are widely duplicated. I believe it is possible to refactor the biggest part of them in a run_function $function. What do you think?
Yeah... I also want to add a check() function to optionally run a packages test suite. That would look much the same too, so I intended to refactor this at some stage. Allan
On Sun, Aug 23, 2009 at 02:17:25PM +0200, Xavier wrote:
On Sun, Aug 23, 2009 at 12:56 PM, Allan McRae
wrote: Henning Garus wrote:
Set the ERR trap to abort upon encountering an error during the execution of a build or package function.
Activate set -E, which lets functions inherit the ERR trap.
<snip>
Just a quick query... does this work with split packages and variables defined in the package_foo() functions, especially when using the -L flag? I am too busy to test at the moment, but that has been the main issue in getting this working in the past.
If I understood correctly, all the problems came from the piping. Actually that's why you had to find an alternative to " | tee " in run_package. This patch does not introduce any piping so it should be fine on this side.
You are right, commands in a pipeline are executed in a subshell, so we don't get the changed variables back when running the package functions. I also had to treat the build function with logging differently because of this.
I tested it now and it seems to work fine.
I tested again and found one minor issue: I forgot to delete the named pipe on error. I will send a new patch.
participants (3)
-
Allan McRae
-
Henning Garus
-
Xavier