From: "Eric Bénard" <eric@eukrea.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH] lib/oe/unpack.py: fix uncompressing .gz .bz2 or .xz
Date: Mon, 06 Sep 2010 23:00:25 +0200 [thread overview]
Message-ID: <4C855669.8050905@eukrea.com> (raw)
In-Reply-To: <AANLkTinZzUuqZTPN_-XfqYPrQXgVcjPCQh34c2F9D0kX@mail.gmail.com>
Hi Chris,
Le 06/09/2010 21:50, Chris Larson a écrit :
> On Mon, Sep 6, 2010 at 11:48 AM, Eric Bénard<eric@eukrea.com> wrote:
>
>> * Actually, the destination file has the full path (ie it's uncompressed
>> in the download directory) as only the extension is removed.
>> * By also removing the path, this patch should fix this problem.
>> * An other fix could be to no uncompress to stdout but let gunzip|bunzip2|
>> xz uncompress directly to the file.
>>
>
> Thanks for looking into this. I appreciate your putting together a fix.
> See code comments below.
>
> Please improve the wording of the commit message here. "has the full path"
> is unclear. I'd suggest referring to the fact that it's currently writing
> into the *source* path rather than the *destination* path, to clarify a bit.
>
> elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
>> base, ext = os.path.splitext(file)
>> + ext, base = os.path.split(base)
>>
>
> This variable naming is wrong and misleading. The leading portion of the
> split is not an extension, so 'ext' is not correct. Also, you just throw
> away the leading portion anyway, so there's no need to use os.path.split at
> all. Instead, I'd suggest changing this:
>
> base, ext = os.path.splitext(file)
> cmd = 'bzip2 -dc %s> %s' % (file, base)
>
> to this:
>
> root, ext = os.path.splitext(file)
> cmd = 'bzip2 -dc %s> %s' % (file, os.path.basename(root))
>
thanks for the review. I've updated the patch following your comments.
Eric
next prev parent reply other threads:[~2010-09-06 21:01 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 ` [PATCH v2] " Eric Bénard
2010-09-06 21:06 ` Chris Larson
2010-09-06 21:00 ` Eric Bénard [this message]
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=4C855669.8050905@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox