diff mbox series

[meta-swupdate] swupdate-common: Modify sha256 placeholder regex

Message ID 20210922180023.15911-1-colin.mcallister@garmin.com
State Accepted
Headers show
Series [meta-swupdate] swupdate-common: Modify sha256 placeholder regex | expand

Commit Message

McAllister, Colin Sept. 22, 2021, 6 p.m. UTC
From: Colin McAllister <colin.mcallister@garmin.com>

For images that do not have a version, but could use the
install-if-different flag, the sha256 sum could be used instead.  A
previous regex would allow this because the '@filname' was replaced
with the sha256, no matter what key the value was associated with.

The current regex is updated to support using the placeholder for both
the sha256 and version keys.

Signed-off-by: Colin McAllister <colin.mcallister@garmin.com>
---
 classes/swupdate-common.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

McAllister, Colin Sept. 22, 2021, 6:04 p.m. UTC | #1
I didn't realize the same header would add this new patch to the same 
thread.  For the record this is a separate patch from the first.

I can create another patch with a different header if desired.  I would 
also like this patch to be applied to the same branches as the previous 
patch :)

Best regards,
Colin

On Wednesday, September 22, 2021 at 1:00:42 PM UTC-5 Colin McAllister wrote:

> From: Colin McAllister <colin.mc...@garmin.com>
>
> For images that do not have a version, but could use the
> install-if-different flag, the sha256 sum could be used instead. A
> previous regex would allow this because the '@filname' was replaced
> with the sha256, no matter what key the value was associated with.
>
> The current regex is updated to support using the placeholder for both
> the sha256 and version keys.
>
> Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
> ---
> 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 a4dcf84..f483398 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -80,7 +80,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.+[=:].*(?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)
> -- 
> 2.25.1
>
>
Stefano Babic Sept. 24, 2021, 7:06 a.m. UTC | #2
Hi Colin,

commit message must be corrected:

On 22.09.21 20:00, colin.mcallister via swupdate wrote:
> From: Colin McAllister <colin.mcallister@garmin.com>
> 
> For images that do not have a version, but could use the
> install-if-different flag, the sha256 sum could be used instead.  A
> previous regex would allow this because the '@filname' was replaced
> with the sha256, no matter what key the value was associated with.
> 
> The current regex is updated to support using the placeholder for both
> the sha256 and version keys.
> 
> Signed-off-by: Colin McAllister <colin.mcallister@garmin.com>
> ---
>   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 a4dcf84..f483398 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -80,7 +80,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.+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
> +          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)

I do not understand here. This function is to set automatically the 
hash. With your change, version attribute is set as well to sha256, but 
this does not make sense for me. There is already an "autoversion" 
feature that set "version" to the package version. Setting to sha256 
seems wrong: some packages are rather not reproducible because they 
still link the timestamp at compile time, causing a different hash even 
if the version was not changed.

>             if m:
>                 filename = m.group('filename')
>                 hash = swupdate_get_sha256(s, filename)
> 

Best regards,
Stefano Babic
Stefano Babic Sept. 24, 2021, 8 p.m. UTC | #3
Hi Colin,

please do not drop the ML in your replies:

On 24.09.21 17:42, Colin wrote:
>  > some packages are rather not reproducible because they
>  > still link the timestamp at compile time, causing a different hash even
>  > if the version was not changed.
> 
> This is true for some cases, but we have some images we install that can 
> be hash equivalent,

The point is if this can be generalized. Let me say that in case the 
package is not reproducible, debugging why the behavior is not as 
expected becomes a challenge. And this does not match with OE's way to 
set up the version. Version for a package is bound with PV variable, 
independently from the hash of the resulting package.

> so we would like the option to use the hash as a 
> version.   Adding this functionality should not cause any problems 
> because the file hash placeholder format is not the same as 
> autoversions, so either could be used without problems.

The thing is if we have to have more methods for the same feature, 
specially when one is (autoversion) is already working and is not 
suffering of the limitation of using the artifact's hash as version.

>  Additionally, 
> this functionality was previously supported,

Anyway, it was a side-effect and undocumented feature. Why do not want 
to switch to autoversion, that seems to provide the same feature 
(automatic provision of version) ?

> even if unintended, when 
> the regex was less strict.
> 

Best regards,
Stefano Babic

> On Friday, September 24, 2021 at 2:06:05 AM UTC-5 Stefano Babic wrote:
> 
>     Hi Colin,
> 
>     commit message must be corrected:
> 
>     On 22.09.21 20:00, colin.mcallister via swupdate wrote:
>      > From: Colin McAllister <colin.mc...@garmin.com>
>      >
>      > For images that do not have a version, but could use the
>      > install-if-different flag, the sha256 sum could be used instead. A
>      > previous regex would allow this because the '@filname' was replaced
>      > with the sha256, no matter what key the value was associated with.
>      >
>      > The current regex is updated to support using the placeholder for
>     both
>      > the sha256 and version keys.
>      >
>      > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
>      > ---
>      > 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 a4dcf84..f483398 100644
>      > --- a/classes/swupdate-common.bbclass
>      > +++ b/classes/swupdate-common.bbclass
>      > @@ -80,7 +80,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.+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
>     line)
>      > + m =
>     re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
>     line)
> 
>     I do not understand here. This function is to set automatically the
>     hash. With your change, version attribute is set as well to sha256, but
>     this does not make sense for me. There is already an "autoversion"
>     feature that set "version" to the package version. Setting to sha256
>     seems wrong: some packages are rather not reproducible because they
>     still link the timestamp at compile time, causing a different hash even
>     if the version was not changed.
> 
>      > if m:
>      > filename = m.group('filename')
>      > hash = swupdate_get_sha256(s, filename)
>      >
> 
>     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 <tel:+49%208142%206698953> Fax:
>     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>     =====================================================================
>
Joshua Watt Sept. 27, 2021, 4 p.m. UTC | #4
On Fri, Sep 24, 2021 at 3:00 PM Stefano Babic <sbabic@denx.de> wrote:
>
> Hi Colin,
>
> please do not drop the ML in your replies:
>
> On 24.09.21 17:42, Colin wrote:
> >  > some packages are rather not reproducible because they
> >  > still link the timestamp at compile time, causing a different hash even
> >  > if the version was not changed.
> >
> > This is true for some cases, but we have some images we install that can
> > be hash equivalent,
>
> The point is if this can be generalized. Let me say that in case the
> package is not reproducible, debugging why the behavior is not as
> expected becomes a challenge. And this does not match with OE's way to
> set up the version. Version for a package is bound with PV variable,
> independently from the hash of the resulting package.

(Full disclosure: I work with Colin)

This is perhaps true, but I don't think it's quite the full story. We
want swupdate to always updates to what is provided in the swupdate
package, unless that exact item is already installed, regardless of
the actual version number. This does mean that 2 builds of the same OE
code might be considered "different" updates, but this seems a safer
side to err on than requiring users to bump version numbers
(especially for local builds). Basically, what we are saying is that
we don't care about versions (and I don't think we should have to); we
want to install whatever was just built.

If we *really* wanted 2 builds to be the same, we can (and are working
toward) making builds fully reproducible.

>
> > so we would like the option to use the hash as a
> > version.   Adding this functionality should not cause any problems
> > because the file hash placeholder format is not the same as
> > autoversions, so either could be used without problems.
>
> The thing is if we have to have more methods for the same feature,
> specially when one is (autoversion) is already working and is not
> suffering of the limitation of using the artifact's hash as version.

I don't consider using the hash as a limitation, given our
requirements; I also do see a whole lot of harm in supporting the SHA1
as the version? Is there some long term repercussions I'm missing
here?

I really don't want to use PV for versions; it just a bad experience
for local developers; hashes work *so* much better in that case.

>
> >  Additionally,
> > this functionality was previously supported,
>
> Anyway, it was a side-effect and undocumented feature. Why do not want
> to switch to autoversion, that seems to provide the same feature
> (automatic provision of version) ?

Undocmented or not, it breaks our requirements and makes it much
harder for use to use swupdate :/

>
> > even if unintended, when
> > the regex was less strict.
> >
>
> Best regards,
> Stefano Babic
>
> > On Friday, September 24, 2021 at 2:06:05 AM UTC-5 Stefano Babic wrote:
> >
> >     Hi Colin,
> >
> >     commit message must be corrected:
> >
> >     On 22.09.21 20:00, colin.mcallister via swupdate wrote:
> >      > From: Colin McAllister <colin.mc...@garmin.com>
> >      >
> >      > For images that do not have a version, but could use the
> >      > install-if-different flag, the sha256 sum could be used instead. A
> >      > previous regex would allow this because the '@filname' was replaced
> >      > with the sha256, no matter what key the value was associated with.
> >      >
> >      > The current regex is updated to support using the placeholder for
> >     both
> >      > the sha256 and version keys.
> >      >
> >      > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
> >      > ---
> >      > 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 a4dcf84..f483398 100644
> >      > --- a/classes/swupdate-common.bbclass
> >      > +++ b/classes/swupdate-common.bbclass
> >      > @@ -80,7 +80,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.+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
> >     line)
> >      > + m =
> >     re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
> >     line)
> >
> >     I do not understand here. This function is to set automatically the
> >     hash. With your change, version attribute is set as well to sha256, but
> >     this does not make sense for me. There is already an "autoversion"
> >     feature that set "version" to the package version. Setting to sha256
> >     seems wrong: some packages are rather not reproducible because they
> >     still link the timestamp at compile time, causing a different hash even
> >     if the version was not changed.
> >
> >      > if m:
> >      > filename = m.group('filename')
> >      > hash = swupdate_get_sha256(s, filename)
> >      >
> >
> >     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 <tel:+49%208142%206698953> Fax:
> >     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
> >     =====================================================================
> >
>
> --
> =====================================================================
> 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
> =====================================================================
>
> --
> You received this message because you are subscribed to the Google Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/swupdate/08761e28-0272-6090-278c-3404c0b4e1e0%40denx.de.
Stefano Babic Sept. 27, 2021, 4:24 p.m. UTC | #5
Hi Joshua,

On 27.09.21 18:00, Joshua Watt wrote:
> On Fri, Sep 24, 2021 at 3:00 PM Stefano Babic <sbabic@denx.de> wrote:
>>
>> Hi Colin,
>>
>> please do not drop the ML in your replies:
>>
>> On 24.09.21 17:42, Colin wrote:
>>>   > some packages are rather not reproducible because they
>>>   > still link the timestamp at compile time, causing a different hash even
>>>   > if the version was not changed.
>>>
>>> This is true for some cases, but we have some images we install that can
>>> be hash equivalent,
>>
>> The point is if this can be generalized. Let me say that in case the
>> package is not reproducible, debugging why the behavior is not as
>> expected becomes a challenge. And this does not match with OE's way to
>> set up the version. Version for a package is bound with PV variable,
>> independently from the hash of the resulting package.
> 
> (Full disclosure: I work with Colin)
> 

Ok

> This is perhaps true, but I don't think it's quite the full story. We
> want swupdate to always updates to what is provided in the swupdate
> package, unless that exact item is already installed, regardless of
> the actual version number. This does mean that 2 builds of the same OE
> code might be considered "different" updates, but this seems a safer
> side to err on than requiring users to bump version numbers
> (especially for local builds).

Nevertheless, you are forcing sha256 to be the version number. Legitime, 
but undocumented (my main issue).

> Basically, what we are saying is that
> we don't care about versions

I understand this, and I understand how you set up.

> (and I don't think we should have to); we
> want to install whatever was just built.
> 
> If we *really* wanted 2 builds to be the same, we can (and are working
> toward) making builds fully reproducible.
> 
>>
>>> so we would like the option to use the hash as a
>>> version.   Adding this functionality should not cause any problems
>>> because the file hash placeholder format is not the same as
>>> autoversions, so either could be used without problems.
>>
>> The thing is if we have to have more methods for the same feature,
>> specially when one is (autoversion) is already working and is not
>> suffering of the limitation of using the artifact's hash as version.
> 
> I don't consider using the hash as a limitation, given our
> requirements;

It is another way to do and you hit an undocumented even if smart way to 
do. What I really like to accept this patch is that it does not remain 
undocumented, but a suitable explanation how to use it will be added as 
well to doc/source/building-with-yocto.rst.

Nobody except you and Colin will remember this after patch will be 
integrated, I do not want this will be lost. Please add a chapter after 
"Automatic version..." and explain the use case.

> I also do see a whole lot of harm in supporting the SHA1
> as the version? Is there some long term repercussions I'm missing
> here?
> 
> I really don't want to use PV for versions; it just a bad experience
> for local developers; hashes work *so* much better in that case.

Sure it is another way to do, and it is not wrong, full agree.

> 
>>
>>>   Additionally,
>>> this functionality was previously supported,
>>
>> Anyway, it was a side-effect and undocumented feature. Why do not want
>> to switch to autoversion, that seems to provide the same feature
>> (automatic provision of version) ?
> 
> Undocmented or not, it breaks our requirements and makes it much
> harder for use to use swupdate :/

If it becomes "documented", it will be clear to most users. Just post a 
second patch for the documentation.

Best regards,
Stefano

> 
>>
>>> even if unintended, when
>>> the regex was less strict.
>>>
>>
>> Best regards,
>> Stefano Babic
>>
>>> On Friday, September 24, 2021 at 2:06:05 AM UTC-5 Stefano Babic wrote:
>>>
>>>      Hi Colin,
>>>
>>>      commit message must be corrected:
>>>
>>>      On 22.09.21 20:00, colin.mcallister via swupdate wrote:
>>>       > From: Colin McAllister <colin.mc...@garmin.com>
>>>       >
>>>       > For images that do not have a version, but could use the
>>>       > install-if-different flag, the sha256 sum could be used instead. A
>>>       > previous regex would allow this because the '@filname' was replaced
>>>       > with the sha256, no matter what key the value was associated with.
>>>       >
>>>       > The current regex is updated to support using the placeholder for
>>>      both
>>>       > the sha256 and version keys.
>>>       >
>>>       > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
>>>       > ---
>>>       > 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 a4dcf84..f483398 100644
>>>       > --- a/classes/swupdate-common.bbclass
>>>       > +++ b/classes/swupdate-common.bbclass
>>>       > @@ -80,7 +80,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.+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
>>>      line)
>>>       > + m =
>>>      re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)",
>>>      line)
>>>
>>>      I do not understand here. This function is to set automatically the
>>>      hash. With your change, version attribute is set as well to sha256, but
>>>      this does not make sense for me. There is already an "autoversion"
>>>      feature that set "version" to the package version. Setting to sha256
>>>      seems wrong: some packages are rather not reproducible because they
>>>      still link the timestamp at compile time, causing a different hash even
>>>      if the version was not changed.
>>>
>>>       > if m:
>>>       > filename = m.group('filename')
>>>       > hash = swupdate_get_sha256(s, filename)
>>>       >
>>>
>>>      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 <tel:+49%208142%206698953> Fax:
>>>      +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>>>      =====================================================================
>>>
>>
>> --
>> =====================================================================
>> 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
>> =====================================================================
>>
>> --
>> You received this message because you are subscribed to the Google Groups "swupdate" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+unsubscribe@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/swupdate/08761e28-0272-6090-278c-3404c0b4e1e0%40denx.de.
Stefano Babic Sept. 30, 2021, 7:21 a.m. UTC | #6
On 22.09.21 20:00, colin.mcallister via swupdate wrote:
> From: Colin McAllister <colin.mcallister@garmin.com>
> 
> For images that do not have a version, but could use the
> install-if-different flag, the sha256 sum could be used instead.  A
> previous regex would allow this because the '@filname' was replaced
> with the sha256, no matter what key the value was associated with.
> 
> The current regex is updated to support using the placeholder for both
> the sha256 and version keys.
> 
> Signed-off-by: Colin McAllister <colin.mcallister@garmin.com>
> ---
>   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 a4dcf84..f483398 100644
> --- a/classes/swupdate-common.bbclass
> +++ b/classes/swupdate-common.bbclass
> @@ -80,7 +80,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.+[=:].*(?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 (after modifying commit subject), thanks !

Best regards,
Stefano Babic
Colin Sept. 30, 2021, 12:43 p.m. UTC | #7
Stefano,

Can this also be applied to hardknott and dunfell?

Thanks,
Colin

On Thursday, September 30, 2021 at 2:21:25 AM UTC-5 Stefano Babic wrote:

> On 22.09.21 20:00, colin.mcallister via swupdate wrote:
> > From: Colin McAllister <colin.mc...@garmin.com>
> > 
> > For images that do not have a version, but could use the
> > install-if-different flag, the sha256 sum could be used instead. A
> > previous regex would allow this because the '@filname' was replaced
> > with the sha256, no matter what key the value was associated with.
> > 
> > The current regex is updated to support using the placeholder for both
> > the sha256 and version keys.
> > 
> > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
> > ---
> > 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 a4dcf84..f483398 100644
> > --- a/classes/swupdate-common.bbclass
> > +++ b/classes/swupdate-common.bbclass
> > @@ -80,7 +80,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.+[=:].*(?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 (after modifying commit subject), thanks !
>
> 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 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
Stefano Babic Sept. 30, 2021, 1:34 p.m. UTC | #8
On 30.09.21 14:43, Colin wrote:
> Stefano,
> 
> Can this also be applied to hardknott and dunfell?

I *have* already applied to all these branches - do you see something 
wrong ? I am sure I have already pushed to server.

Regards,
Stefano

> 
> Thanks,
> Colin
> 
> On Thursday, September 30, 2021 at 2:21:25 AM UTC-5 Stefano Babic wrote:
> 
>     On 22.09.21 20:00, colin.mcallister via swupdate wrote:
>      > From: Colin McAllister <colin.mc...@garmin.com>
>      >
>      > For images that do not have a version, but could use the
>      > install-if-different flag, the sha256 sum could be used instead. A
>      > previous regex would allow this because the '@filname' was replaced
>      > with the sha256, no matter what key the value was associated with.
>      >
>      > The current regex is updated to support using the placeholder for
>     both
>      > the sha256 and version keys.
>      >
>      > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
>      > ---
>      > 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 a4dcf84..f483398 100644
>      > --- a/classes/swupdate-common.bbclass
>      > +++ b/classes/swupdate-common.bbclass
>      > @@ -80,7 +80,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.+[=:].*(?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 (after modifying commit subject), thanks !
> 
>     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 <tel:+49%208142%206698953> Fax:
>     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>     =====================================================================
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to swupdate+unsubscribe@googlegroups.com 
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/swupdate/178f03af-5fd5-401d-8091-570e70cf6df1n%40googlegroups.com 
> <https://groups.google.com/d/msgid/swupdate/178f03af-5fd5-401d-8091-570e70cf6df1n%40googlegroups.com?utm_medium=email&utm_source=footer>.
McAllister, Colin Sept. 30, 2021, 2:05 p.m. UTC | #9
Stefano,

Apologies, I just read the message you posted above and didn't actually 
check the repo.  All looks good to me.

Thanks,
Colin


On Thursday, September 30, 2021 at 8:35:00 AM UTC-5 Stefano Babic wrote:

> On 30.09.21 14:43, Colin wrote:
> > Stefano,
> > 
> > Can this also be applied to hardknott and dunfell?
>
> I *have* already applied to all these branches - do you see something 
> wrong ? I am sure I have already pushed to server.
>
> Regards,
> Stefano
>
> > 
> > Thanks,
> > Colin
> > 
> > On Thursday, September 30, 2021 at 2:21:25 AM UTC-5 Stefano Babic wrote:
> > 
> > On 22.09.21 20:00, colin.mcallister via swupdate wrote:
> > > From: Colin McAllister <colin.mc...@garmin.com>
> > >
> > > For images that do not have a version, but could use the
> > > install-if-different flag, the sha256 sum could be used instead. A
> > > previous regex would allow this because the '@filname' was replaced
> > > with the sha256, no matter what key the value was associated with.
> > >
> > > The current regex is updated to support using the placeholder for
> > both
> > > the sha256 and version keys.
> > >
> > > Signed-off-by: Colin McAllister <colin.mc...@garmin.com>
> > > ---
> > > 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 a4dcf84..f483398 100644
> > > --- a/classes/swupdate-common.bbclass
> > > +++ b/classes/swupdate-common.bbclass
> > > @@ -80,7 +80,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.+[=:].*(?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 (after modifying commit subject), thanks !
> > 
> > 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 <+49%208142%206698953> 
> <tel:+49%208142%206698953> Fax:
> > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
> Email: sba...@denx.de
> > =====================================================================
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "swupdate" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to swupdate+u...@googlegroups.com 
> > <mailto:swupdate+u...@googlegroups.com>.
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/swupdate/178f03af-5fd5-401d-8091-570e70cf6df1n%40googlegroups.com 
> > <
> https://groups.google.com/d/msgid/swupdate/178f03af-5fd5-401d-8091-570e70cf6df1n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
diff mbox series

Patch

diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass
index a4dcf84..f483398 100644
--- a/classes/swupdate-common.bbclass
+++ b/classes/swupdate-common.bbclass
@@ -80,7 +80,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.+[=:].*(?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)