diff mbox series

[3/5] parser: Add support for Lua hook script to script artifacts

Message ID 1516715761-3043-3-git-send-email-stefan@herbrechtsmeier.net
State Accepted
Headers show
Series [1/5] parser: Check image version after parsing to remove skipped images | expand

Commit Message

Stefan Herbrechtsmeier Jan. 23, 2018, 1:55 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 parser/parser.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Stefano Babic Jan. 24, 2018, 9:28 a.m. UTC | #1
On 23/01/2018 14:55, stefan@herbrechtsmeier.net wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
> 
>  parser/parser.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/parser/parser.c b/parser/parser.c
> index e07ed8e..6add999 100644
> --- a/parser/parser.c
> +++ b/parser/parser.c
> @@ -330,7 +330,7 @@ static int parse_partitions(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  	return 0;
>  }
>  
> -static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
> +static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_State *L)
>  {
>  	void *setting, *elem;
>  	int count, i;
> @@ -377,6 +377,13 @@ static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  		}
>  		script->is_script = 1;
>  
> +		add_properties(p, elem, script);
> +
> +		if (run_embscript(p, elem, script, L, swcfg->embscript)) {
> +			free_image(script);
> +			return -1;
> +		}
> +
>  		LIST_INSERT_HEAD(&swcfg->scripts, script, next);
>  
>  		TRACE("Found Script: %s\n",
> @@ -619,7 +626,7 @@ static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  	ret = parse_hw_compatibility(p, cfg, swcfg) ||
>  		parse_files(p, cfg, swcfg, L) ||
>  		parse_images(p, cfg, swcfg, L) ||
> -		parse_scripts(p, cfg, swcfg) ||
> +		parse_scripts(p, cfg, swcfg, L) ||
>  		parse_bootloader(p, cfg, swcfg);
>  
>  	/*
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Stefano Babic Jan. 26, 2018, 9:27 a.m. UTC | #2
On 23/01/2018 14:55, stefan@herbrechtsmeier.net wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
> 
>  parser/parser.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/parser/parser.c b/parser/parser.c
> index e07ed8e..6add999 100644
> --- a/parser/parser.c
> +++ b/parser/parser.c
> @@ -330,7 +330,7 @@ static int parse_partitions(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  	return 0;
>  }
>  
> -static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
> +static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_State *L)
>  {
>  	void *setting, *elem;
>  	int count, i;
> @@ -377,6 +377,13 @@ static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  		}
>  		script->is_script = 1;
>  
> +		add_properties(p, elem, script);
> +
> +		if (run_embscript(p, elem, script, L, swcfg->embscript)) {
> +			free_image(script);
> +			return -1;
> +		}
> +
>  		LIST_INSERT_HEAD(&swcfg->scripts, script, next);
>  
>  		TRACE("Found Script: %s\n",
> @@ -619,7 +626,7 @@ static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
>  	ret = parse_hw_compatibility(p, cfg, swcfg) ||
>  		parse_files(p, cfg, swcfg, L) ||
>  		parse_images(p, cfg, swcfg, L) ||
> -		parse_scripts(p, cfg, swcfg) ||
> +		parse_scripts(p, cfg, swcfg, L) ||
>  		parse_bootloader(p, cfg, swcfg);
>  
>  	/*
> 
Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/parser/parser.c b/parser/parser.c
index e07ed8e..6add999 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -330,7 +330,7 @@  static int parse_partitions(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
 	return 0;
 }
 
-static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
+static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_State *L)
 {
 	void *setting, *elem;
 	int count, i;
@@ -377,6 +377,13 @@  static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
 		}
 		script->is_script = 1;
 
+		add_properties(p, elem, script);
+
+		if (run_embscript(p, elem, script, L, swcfg->embscript)) {
+			free_image(script);
+			return -1;
+		}
+
 		LIST_INSERT_HEAD(&swcfg->scripts, script, next);
 
 		TRACE("Found Script: %s\n",
@@ -619,7 +626,7 @@  static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
 	ret = parse_hw_compatibility(p, cfg, swcfg) ||
 		parse_files(p, cfg, swcfg, L) ||
 		parse_images(p, cfg, swcfg, L) ||
-		parse_scripts(p, cfg, swcfg) ||
+		parse_scripts(p, cfg, swcfg, L) ||
 		parse_bootloader(p, cfg, swcfg);
 
 	/*