From: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>

Add striplevel support to unpack tar archives into specified sub
directories. The node package manager (npm) need this feature to unpack
packages into its node_modules directory.

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

 bitbake/lib/bb/fetch2/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bitbake/lib/bb/fetch2/__init__.py 
b/bitbake/lib/bb/fetch2/__init__.py
index ded3106173..05b2d2e924 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1462,6 +1462,9 @@ class FetchMethod(object):
                 cmd = 'tar x --no-same-owner -f %s' % file
             elif file.endswith('.tgz') or file.endswith('.tar.gz') or 
file.endswith('.tar.Z'):
                 cmd = 'tar xz --no-same-owner -f %s' % file
+                striplevel = urldata.parm.get('striplevel')
+                if striplevel:
+                    cmd += ' --strip-components=%s' % striplevel
             elif file.endswith('.tbz') or file.endswith('.tbz2') or 
file.endswith('.tar.bz2'):
                 cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
             elif file.endswith('.gz') or file.endswith('.Z') or 
file.endswith('.z'):
-- 
2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158703): 
https://lists.openembedded.org/g/openembedded-core/message/158703
Mute This Topic: https://lists.openembedded.org/mt/87282281/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to