diff mbox series

[meta-swupdate] swupdate-common: fix sha256 regex

Message ID 20220120082335.154025-1-louis.rannou@gresille.org
State Accepted
Headers show
Series [meta-swupdate] swupdate-common: fix sha256 regex | expand

Commit Message

Louis Rannou Jan. 20, 2022, 8:23 a.m. UTC
Change sha256 regex brackets to parenthesis to apply only on line with 'sha256'
and 'version'.

Signed-off-by: Louis Rannou <louis.rannou@gresille.org>
---
 classes/swupdate-common.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic Jan. 20, 2022, 2:15 p.m. UTC | #1
Hi Louis,

On 20.01.22 09:23, Louis Rannou wrote:
> Change sha256 regex brackets to parenthesis to apply only on line with 'sha256'
> and 'version'.
> 
> Signed-off-by: Louis Rannou <louis.rannou@gresille.org>
> ---
>   classes/swupdate-common.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
> index 7d06c96..c6e92fe 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -81,7 +81,7 @@ def swupdate_write_sha256(s):
>          for line in f:
>             shastr = r"sha256.+=.+@(.+\")"
>             #m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<filename>\w+)", line)
> -          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
> +          m = re.match(r"^(?P<before_placeholder>.+)(sha256|version).+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
>             if m:
>                 filename = m.group('filename')
>                 hash = swupdate_get_sha256(s, filename)
> 

This duplicates Sam's:

https://patchwork.ozlabs.org/project/swupdate/patch/20211222140401.780-1-sam.van.den.berge@gmail.com/

but I asked some changes in the commit message - if Sam has nothing 
against, I will apply Lous' patch to meta-swupdate.

Best regards,
Stefano Babic
Sam Van Den Berge Jan. 25, 2022, 11:32 a.m. UTC | #2
On Thu, Jan 20, 2022 at 03:15:51PM +0100, Stefano Babic wrote:
> Hi Louis,
> 
> On 20.01.22 09:23, Louis Rannou wrote:
> > Change sha256 regex brackets to parenthesis to apply only on line with 'sha256'
> > and 'version'.
> > 
> > Signed-off-by: Louis Rannou <louis.rannou@gresille.org>
> > ---
> >   classes/swupdate-common.bbclass | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
> > index 7d06c96..c6e92fe 100644
> > --- a/classes/swupdate-common.bbclass
> > +++ b/classes/swupdate-common.bbclass
> > @@ -81,7 +81,7 @@ def swupdate_write_sha256(s):
> >          for line in f:
> >             shastr = r"sha256.+=.+@(.+\")"
> >             #m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<filename>\w+)", line)
> > -          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
> > +          m = re.match(r"^(?P<before_placeholder>.+)(sha256|version).+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
> >             if m:
> >                 filename = m.group('filename')
> >                 hash = swupdate_get_sha256(s, filename)
> > 
> 
> This duplicates Sam's:
> 
> https://patchwork.ozlabs.org/project/swupdate/patch/20211222140401.780-1-sam.van.den.berge@gmail.com/
> 
> but I asked some changes in the commit message - if Sam has nothing against,
> I will apply Lous' patch to meta-swupdate.

I don't have anything against so you can apply this one from Louis.

> 
> Best regards,
> Stefano Babic
> 
> -- 
> =====================================================================
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
> =====================================================================
Stefano Babic Jan. 26, 2022, 12:11 p.m. UTC | #3
On 20.01.22 09:23, Louis Rannou wrote:
> Change sha256 regex brackets to parenthesis to apply only on line with 'sha256'
> and 'version'.
> 
> Signed-off-by: Louis Rannou <louis.rannou@gresille.org>
> ---
>   classes/swupdate-common.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
> index 7d06c96..c6e92fe 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -81,7 +81,7 @@ def swupdate_write_sha256(s):
>          for line in f:
>             shastr = r"sha256.+=.+@(.+\")"
>             #m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<filename>\w+)", line)
> -          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
> +          m = re.match(r"^(?P<before_placeholder>.+)(sha256|version).+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
>             if m:
>                 filename = m.group('filename')
>                 hash = swupdate_get_sha256(s, filename)


Applied to -master, -honister, -hardknott, -dunfell, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
index 7d06c96..c6e92fe 100644
--- a/classes/swupdate-common.bbclass
+++ b/classes/swupdate-common.bbclass
@@ -81,7 +81,7 @@  def swupdate_write_sha256(s):
        for line in f:
           shastr = r"sha256.+=.+@(.+\")"
           #m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<filename>\w+)", line)
-          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
+          m = re.match(r"^(?P<before_placeholder>.+)(sha256|version).+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
           if m:
               filename = m.group('filename')
               hash = swupdate_get_sha256(s, filename)