diff mbox series

[meta-swupdate] classes/swupdate-common.bbclass: Add SRC_URI exclusions

Message ID 20230719180811.3229999-1-JPEWhacker@gmail.com
State Accepted
Delegated to: Stefano Babic
Headers show
Series [meta-swupdate] classes/swupdate-common.bbclass: Add SRC_URI exclusions | expand

Commit Message

Joshua Watt July 19, 2023, 6:08 p.m. UTC
Adds a variable which can be used to exclude specific files in SRC_URI
from being placed in the CPIO archive. This can be useful if a recipe
has extra actions it takes based on SRC_URI files, but doesn't want to
have those files in the CPIO archive (e.g. expanding a sw-description
using Jinja2 templates).

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 classes-recipe/swupdate-common.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefano Babic July 20, 2023, 11:46 a.m. UTC | #1
On 19.07.23 20:08, Joshua Watt wrote:
> Adds a variable which can be used to exclude specific files in SRC_URI
> from being placed in the CPIO archive. This can be useful if a recipe
> has extra actions it takes based on SRC_URI files, but doesn't want to
> have those files in the CPIO archive (e.g. expanding a sw-description
> using Jinja2 templates).
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   classes-recipe/swupdate-common.bbclass | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
> index d7139a3..0ededad 100644
> --- a/classes-recipe/swupdate-common.bbclass
> +++ b/classes-recipe/swupdate-common.bbclass
> @@ -215,6 +215,7 @@ def swupdate_add_src_uri(d, list_for_cpio):
>       import shutil
>   
>       s = d.getVar('S', True)
> +    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
>   
>       fetch = bb.fetch2.Fetch([], d)
>   
> @@ -222,6 +223,8 @@ def swupdate_add_src_uri(d, list_for_cpio):
>       for url in fetch.urls:
>           local = fetch.localpath(url)
>           filename = os.path.basename(local)
> +        if filename in exclude:
> +            continue
>           aes_file = d.getVar('SWUPDATE_AES_FILE', True)
>           if aes_file:
>               key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))


Applied to -master, -mickledore, thanks !

Best regards,
Stefano Babic
Stefano Babic July 20, 2023, 11:47 a.m. UTC | #2
On 19.07.23 20:08, Joshua Watt wrote:
> Adds a variable which can be used to exclude specific files in SRC_URI
> from being placed in the CPIO archive. This can be useful if a recipe
> has extra actions it takes based on SRC_URI files, but doesn't want to
> have those files in the CPIO archive (e.g. expanding a sw-description
> using Jinja2 templates).
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>   classes-recipe/swupdate-common.bbclass | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
> index d7139a3..0ededad 100644
> --- a/classes-recipe/swupdate-common.bbclass
> +++ b/classes-recipe/swupdate-common.bbclass
> @@ -215,6 +215,7 @@ def swupdate_add_src_uri(d, list_for_cpio):
>       import shutil
>   
>       s = d.getVar('S', True)
> +    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
>   
>       fetch = bb.fetch2.Fetch([], d)
>   
> @@ -222,6 +223,8 @@ def swupdate_add_src_uri(d, list_for_cpio):
>       for url in fetch.urls:
>           local = fetch.localpath(url)
>           filename = os.path.basename(local)
> +        if filename in exclude:
> +            continue
>           aes_file = d.getVar('SWUPDATE_AES_FILE', True)
>           if aes_file:
>               key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))


Applied to -master, -micledore, thanks !

Best regards,
Stefano Babic
Joshua Watt July 20, 2023, 2:15 p.m. UTC | #3
Would you mind also backporting it to the LTS branches (kirkstone and dunfell)?

Thanks

On Thu, Jul 20, 2023 at 5:47 AM Stefano Babic
<stefano.babic@swupdate.org> wrote:
>
> On 19.07.23 20:08, Joshua Watt wrote:
> > Adds a variable which can be used to exclude specific files in SRC_URI
> > from being placed in the CPIO archive. This can be useful if a recipe
> > has extra actions it takes based on SRC_URI files, but doesn't want to
> > have those files in the CPIO archive (e.g. expanding a sw-description
> > using Jinja2 templates).
> >
> > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> > ---
> >   classes-recipe/swupdate-common.bbclass | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
> > index d7139a3..0ededad 100644
> > --- a/classes-recipe/swupdate-common.bbclass
> > +++ b/classes-recipe/swupdate-common.bbclass
> > @@ -215,6 +215,7 @@ def swupdate_add_src_uri(d, list_for_cpio):
> >       import shutil
> >
> >       s = d.getVar('S', True)
> > +    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
> >
> >       fetch = bb.fetch2.Fetch([], d)
> >
> > @@ -222,6 +223,8 @@ def swupdate_add_src_uri(d, list_for_cpio):
> >       for url in fetch.urls:
> >           local = fetch.localpath(url)
> >           filename = os.path.basename(local)
> > +        if filename in exclude:
> > +            continue
> >           aes_file = d.getVar('SWUPDATE_AES_FILE', True)
> >           if aes_file:
> >               key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))
>
>
> Applied to -master, -micledore, thanks !
>
> Best regards,
> Stefano Babic
>
Stefano Babic July 20, 2023, 2:26 p.m. UTC | #4
On 20.07.23 16:15, Joshua Watt wrote:
> Would you mind also backporting it to the LTS branches (kirkstone and dunfell)?
> 

Done - just check it.

Best regards,
Stefano Babic

> Thanks
> 
> On Thu, Jul 20, 2023 at 5:47 AM Stefano Babic
> <stefano.babic@swupdate.org> wrote:
>>
>> On 19.07.23 20:08, Joshua Watt wrote:
>>> Adds a variable which can be used to exclude specific files in SRC_URI
>>> from being placed in the CPIO archive. This can be useful if a recipe
>>> has extra actions it takes based on SRC_URI files, but doesn't want to
>>> have those files in the CPIO archive (e.g. expanding a sw-description
>>> using Jinja2 templates).
>>>
>>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
>>> ---
>>>    classes-recipe/swupdate-common.bbclass | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
>>> index d7139a3..0ededad 100644
>>> --- a/classes-recipe/swupdate-common.bbclass
>>> +++ b/classes-recipe/swupdate-common.bbclass
>>> @@ -215,6 +215,7 @@ def swupdate_add_src_uri(d, list_for_cpio):
>>>        import shutil
>>>
>>>        s = d.getVar('S', True)
>>> +    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
>>>
>>>        fetch = bb.fetch2.Fetch([], d)
>>>
>>> @@ -222,6 +223,8 @@ def swupdate_add_src_uri(d, list_for_cpio):
>>>        for url in fetch.urls:
>>>            local = fetch.localpath(url)
>>>            filename = os.path.basename(local)
>>> +        if filename in exclude:
>>> +            continue
>>>            aes_file = d.getVar('SWUPDATE_AES_FILE', True)
>>>            if aes_file:
>>>                key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))
>>
>>
>> Applied to -master, -micledore, thanks !
>>
>> Best regards,
>> Stefano Babic
>>
Joshua Watt July 20, 2023, 3:04 p.m. UTC | #5
Thanks!

On Thu, Jul 20, 2023 at 8:26 AM Stefano Babic
<stefano.babic@swupdate.org> wrote:
>
> On 20.07.23 16:15, Joshua Watt wrote:
> > Would you mind also backporting it to the LTS branches (kirkstone and dunfell)?
> >
>
> Done - just check it.
>
> Best regards,
> Stefano Babic
>
> > Thanks
> >
> > On Thu, Jul 20, 2023 at 5:47 AM Stefano Babic
> > <stefano.babic@swupdate.org> wrote:
> >>
> >> On 19.07.23 20:08, Joshua Watt wrote:
> >>> Adds a variable which can be used to exclude specific files in SRC_URI
> >>> from being placed in the CPIO archive. This can be useful if a recipe
> >>> has extra actions it takes based on SRC_URI files, but doesn't want to
> >>> have those files in the CPIO archive (e.g. expanding a sw-description
> >>> using Jinja2 templates).
> >>>
> >>> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> >>> ---
> >>>    classes-recipe/swupdate-common.bbclass | 3 +++
> >>>    1 file changed, 3 insertions(+)
> >>>
> >>> diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
> >>> index d7139a3..0ededad 100644
> >>> --- a/classes-recipe/swupdate-common.bbclass
> >>> +++ b/classes-recipe/swupdate-common.bbclass
> >>> @@ -215,6 +215,7 @@ def swupdate_add_src_uri(d, list_for_cpio):
> >>>        import shutil
> >>>
> >>>        s = d.getVar('S', True)
> >>> +    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
> >>>
> >>>        fetch = bb.fetch2.Fetch([], d)
> >>>
> >>> @@ -222,6 +223,8 @@ def swupdate_add_src_uri(d, list_for_cpio):
> >>>        for url in fetch.urls:
> >>>            local = fetch.localpath(url)
> >>>            filename = os.path.basename(local)
> >>> +        if filename in exclude:
> >>> +            continue
> >>>            aes_file = d.getVar('SWUPDATE_AES_FILE', True)
> >>>            if aes_file:
> >>>                key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))
> >>
> >>
> >> Applied to -master, -micledore, thanks !
> >>
> >> Best regards,
> >> Stefano Babic
> >>
>
diff mbox series

Patch

diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
index d7139a3..0ededad 100644
--- a/classes-recipe/swupdate-common.bbclass
+++ b/classes-recipe/swupdate-common.bbclass
@@ -215,6 +215,7 @@  def swupdate_add_src_uri(d, list_for_cpio):
     import shutil
 
     s = d.getVar('S', True)
+    exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
 
     fetch = bb.fetch2.Fetch([], d)
 
@@ -222,6 +223,8 @@  def swupdate_add_src_uri(d, list_for_cpio):
     for url in fetch.urls:
         local = fetch.localpath(url)
         filename = os.path.basename(local)
+        if filename in exclude:
+            continue
         aes_file = d.getVar('SWUPDATE_AES_FILE', True)
         if aes_file:
             key,iv = swupdate_extract_keys(d.getVar('SWUPDATE_AES_FILE', True))