[oe] [PATCH] lib/oe/unpack.py: fix uncompressing .gz .bz2 or .xz
Eric Bénard
eric at eukrea.com
Mon Sep 6 21:00:25 UTC 2010
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 at 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
More information about the Openembedded-devel
mailing list