All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH v2] lib/oe/unpack.py: fix uncompressing .gz .bz2 or .xz
Date: Mon,  6 Sep 2010 22:57:32 +0200	[thread overview]
Message-ID: <1283806652-8619-1-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <AANLkTinZzUuqZTPN_-XfqYPrQXgVcjPCQh34c2F9D0kX@mail.gmail.com>

* Actually, the uncompressed file is written into the source
path instead of the destination path.
* By also removing the source path, this patch should fix this problem.
* An other fix could be to not uncompress to stdout but let gunzip|bunzip2|
xz uncompress directly to the file.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
---
v2:
	python part reworked as per Chris Larson's suggestion
	commit message rephrased to clarify it.

 lib/oe/unpack.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/oe/unpack.py b/lib/oe/unpack.py
index 34569aa..6d24c5e 100644
--- a/lib/oe/unpack.py
+++ b/lib/oe/unpack.py
@@ -63,16 +63,16 @@ def unpack_file(file, destdir, dos=False, env=None):
     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'):
-        base, ext = os.path.splitext(file)
-        cmd = 'gzip -dc %s > %s' % (file, base)
+        root, ext = os.path.splitext(file)
+        cmd = 'gzip -dc %s > %s' % (file, os.path.basename(root))
     elif file.endswith('.bz2'):
-        base, ext = os.path.splitext(file)
-        cmd = 'bzip2 -dc %s > %s' % (file, base)
+        root, ext = os.path.splitext(file)
+        cmd = 'bzip2 -dc %s > %s' % (file, os.path.basename(root))
     elif file.endswith('.tar.xz'):
         cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file
     elif file.endswith('.xz'):
-        base, ext = os.path.splitext(file)
-        cmd = 'xz -dc %s > %s' % (file, base)
+        root, ext = os.path.splitext(file)
+        cmd = 'xz -dc %s > %s' % (file, os.path.basename(root))
     elif file.endswith('.zip') or file.endswith('.jar'):
         cmd = 'unzip -q -o'
         if dos:
-- 
1.6.3.3




  reply	other threads:[~2010-09-06 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-06 18:48 [PATCH] lib/oe/unpack.py: fix uncompressing .gz .bz2 or .xz Eric Bénard
2010-09-06 19:50 ` Chris Larson
2010-09-06 20:57   ` Eric Bénard [this message]
2010-09-06 21:06     ` [PATCH v2] " Chris Larson
2010-09-06 21:00   ` [PATCH] " Eric Bénard
2010-09-06 21:02   ` [PATCH] asterisk: replace termcap by tinfo Eric Bénard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283806652-8619-1-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.