diff mbox series

[2/6] parser: Move trace below embedded script run

Message ID 1509002299-24631-2-git-send-email-stefan@herbrechtsmeier.net
State Accepted
Headers show
Series None | expand

Commit Message

Stefan Herbrechtsmeier Oct. 26, 2017, 7:18 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---
 parser/parser.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Stefano Babic Nov. 21, 2017, 11:06 a.m. UTC | #1
On 26/10/2017 09:18, stefan@herbrechtsmeier.net wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
>  parser/parser.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/parser/parser.c b/parser/parser.c
> index a41bc24..d569c2b 100644
> --- a/parser/parser.c
> +++ b/parser/parser.c
> @@ -450,6 +450,10 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua
>  		get_field(p, elem, "install-if-different", &image->id.install_if_different);
>  		get_field(p, elem, "encrypted", &image->is_encrypted);
>  
> +		if (run_embscript(p, elem, image, L, swcfg->embscript))
> +			return -1;
> +		LIST_INSERT_HEAD(&swcfg->images, image, next);
> +
>  		TRACE("Found %sImage %s %s: %s in %s : %s for handler %s%s %s\n",
>  			image->compressed ? "compressed " : "",
>  			image->id.name,
> @@ -461,12 +465,7 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua
>  			strlen(image->type) ? image->type : "NOT FOUND",
>  			image->install_directly ? " (installed from stream)" : "",
>  			(strlen(image->id.name) && image->id.install_if_different) ?
> -					"Version must be checked" : ""
> -			);
> -
> -		if (run_embscript(p, elem, image, L, swcfg->embscript))
> -			return -1;
> -		LIST_INSERT_HEAD(&swcfg->images, image, next);
> +					"Version must be checked" : "");
>  	}
>  
>  	return 0;
> @@ -521,6 +520,10 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_
>  		get_field(p, elem, "installed-directly", &file->install_directly);
>  		get_field(p, elem, "install-if-different", &file->id.install_if_different);
>  		get_field(p, elem, "encrypted", &file->is_encrypted);
> +		if (run_embscript(p, elem, file, L, swcfg->embscript))
> +			return -1;
> +		LIST_INSERT_HEAD(&swcfg->images, file, next);
> +
>  		TRACE("Found %sFile %s %s: %s --> %s (%s) %s\n",
>  			file->compressed ? "compressed " : "",
>  			file->id.name,
> @@ -530,10 +533,6 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_
>  			strlen(file->device) ? file->device : "ROOTFS",
>  			(strlen(file->id.name) && file->id.install_if_different) ?
>  					"Version must be checked" : "");
> -
> -		if (run_embscript(p, elem, file, L, swcfg->embscript))
> -			return -1;
> -		LIST_INSERT_HEAD(&swcfg->images, file, next);
>  	}
>  
>  	return 0;
> 

Just rebase this on top of my current development branch (the series I
sent yesterday), and then I will apply it - thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/parser/parser.c b/parser/parser.c
index a41bc24..d569c2b 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -450,6 +450,10 @@  static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua
 		get_field(p, elem, "install-if-different", &image->id.install_if_different);
 		get_field(p, elem, "encrypted", &image->is_encrypted);
 
+		if (run_embscript(p, elem, image, L, swcfg->embscript))
+			return -1;
+		LIST_INSERT_HEAD(&swcfg->images, image, next);
+
 		TRACE("Found %sImage %s %s: %s in %s : %s for handler %s%s %s\n",
 			image->compressed ? "compressed " : "",
 			image->id.name,
@@ -461,12 +465,7 @@  static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua
 			strlen(image->type) ? image->type : "NOT FOUND",
 			image->install_directly ? " (installed from stream)" : "",
 			(strlen(image->id.name) && image->id.install_if_different) ?
-					"Version must be checked" : ""
-			);
-
-		if (run_embscript(p, elem, image, L, swcfg->embscript))
-			return -1;
-		LIST_INSERT_HEAD(&swcfg->images, image, next);
+					"Version must be checked" : "");
 	}
 
 	return 0;
@@ -521,6 +520,10 @@  static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_
 		get_field(p, elem, "installed-directly", &file->install_directly);
 		get_field(p, elem, "install-if-different", &file->id.install_if_different);
 		get_field(p, elem, "encrypted", &file->is_encrypted);
+		if (run_embscript(p, elem, file, L, swcfg->embscript))
+			return -1;
+		LIST_INSERT_HEAD(&swcfg->images, file, next);
+
 		TRACE("Found %sFile %s %s: %s --> %s (%s) %s\n",
 			file->compressed ? "compressed " : "",
 			file->id.name,
@@ -530,10 +533,6 @@  static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_
 			strlen(file->device) ? file->device : "ROOTFS",
 			(strlen(file->id.name) && file->id.install_if_different) ?
 					"Version must be checked" : "");
-
-		if (run_embscript(p, elem, file, L, swcfg->embscript))
-			return -1;
-		LIST_INSERT_HEAD(&swcfg->images, file, next);
 	}
 
 	return 0;