diff mbox series

[RFC,04/30] lib: bb: fetch2: add support to unpack .crate files

Message ID 20250211150034.18696-5-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series Add vendor support for go, npm and rust | expand

Commit Message

Stefan Herbrechtsmeier Feb. 11, 2025, 3 p.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Feb. 11, 2025, 9:22 p.m. UTC | #1
On Tue, 2025-02-11 at 16:00 +0100, Stefan Herbrechtsmeier via lists.openembedded.org wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
> 
>  bitbake/lib/bb/fetch2/__init__.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index de36f06bfc..e4c489d059 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -1533,7 +1533,7 @@ class FetchMethod(object):
>                  tar_cmd += ' --strip-components=%s' %  urldata.parm['striplevel']
>              if file.endswith('.tar'):
>                  cmd = '%s -f %s' % (tar_cmd, file)
> -            elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
> +            elif any(file.endswith(ext) for ext in {'.tgz', '.tar.gz', '.tar.Z', '.crate'}):
>                  cmd = '%s -z -f %s' % (tar_cmd, file)
>              elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'):
>                  cmd = 'bzip2 -dc %s | %s -f -' % (file, tar_cmd)

I think you can just do:

file.endswith(('.tgz', '.tar.gz', '.tar.Z', '.crate'))

Cheers,

Richard
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index de36f06bfc..e4c489d059 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1533,7 +1533,7 @@  class FetchMethod(object):
                 tar_cmd += ' --strip-components=%s' %  urldata.parm['striplevel']
             if file.endswith('.tar'):
                 cmd = '%s -f %s' % (tar_cmd, file)
-            elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
+            elif any(file.endswith(ext) for ext in {'.tgz', '.tar.gz', '.tar.Z', '.crate'}):
                 cmd = '%s -z -f %s' % (tar_cmd, file)
             elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'):
                 cmd = 'bzip2 -dc %s | %s -f -' % (file, tar_cmd)