diff mbox series

[meta-swupdate,1/2] Fix error message in automatic versions

Message ID 20210617154346.23097-1-thomas.haemmerle@leica-geosystems.com
State Accepted
Headers show
Series [meta-swupdate,1/2] Fix error message in automatic versions | expand

Commit Message

Thomas Haemmerle June 17, 2021, 3:43 p.m. UTC
Assign variable before checking and print a more useful error message if
none of the files in `list_for_cpio` can be found in group.

Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
---
 classes/swupdate-common.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stefano Babic June 18, 2021, 12:10 p.m. UTC | #1
Hi Thomas,

On 17.06.21 17:43, 'Thomas Haemmerle' via swupdate wrote:
> Assign variable before checking and print a more useful error message if
> none of the files in `list_for_cpio` can be found in group.
> 
> Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
> ---
>   classes/swupdate-common.bbclass | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
> index f41abb7..eb3ebd6 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -98,6 +98,8 @@ def swupdate_expand_auto_versions(d, s, list_for_cpio):
>           data = f.read()
>   
>       def get_package_name(group, file_list):
> +        package = None
> +
>           m = re.search(r"%s:(?P<package>.+?(?=\"))" % (AUTOVERSION_REGEXP), group)
>           if m:
>               package = m.group('package')
> @@ -108,7 +110,7 @@ def swupdate_expand_auto_versions(d, s, list_for_cpio):
>                   package = filename
>   
>           if not package:
> -            bb.fatal("Failed to find %s in group with \"%s\"" % (filename, AUTO_VERSION_TAG))
> +            bb.fatal("Failed to find file in group %s" % (group))
>   
>           return (package, False)
>   
> 

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

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
index f41abb7..eb3ebd6 100644
--- a/classes/swupdate-common.bbclass
+++ b/classes/swupdate-common.bbclass
@@ -98,6 +98,8 @@  def swupdate_expand_auto_versions(d, s, list_for_cpio):
         data = f.read()
 
     def get_package_name(group, file_list):
+        package = None
+
         m = re.search(r"%s:(?P<package>.+?(?=\"))" % (AUTOVERSION_REGEXP), group)
         if m:
             package = m.group('package')
@@ -108,7 +110,7 @@  def swupdate_expand_auto_versions(d, s, list_for_cpio):
                 package = filename
 
         if not package:
-            bb.fatal("Failed to find %s in group with \"%s\"" % (filename, AUTO_VERSION_TAG))
+            bb.fatal("Failed to find file in group %s" % (group))
 
         return (package, False)