Bug 4915 - poky/scripts/rpm2cpio.sh breaks when file utility missing
Summary: poky/scripts/rpm2cpio.sh breaks when file utility missing
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: 1.4.1
Hardware: All Multiple
: Low normal
Target Milestone: Future
Assignee: Mark Hatle
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-07-25 13:20 UTC by Krzysztof Sywula
Modified: 2017-07-20 15:18 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Sywula 2013-07-25 13:20:37 UTC
Host OS: Debian Wheezy, fresh install
Poky version: tag dylan-9.0.1

This script uses file utility to determine type of compression. When file fails (non-zero return status) assumption is that compression is LZMA. It does not cover simple use case when file is just missing - not installed on host OS.

COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null`
if echo $COMPRESSION |grep -iq gzip; then
        DECOMPRESSOR=gunzip
elif echo $COMPRESSION |grep -iq bzip2; then
        DECOMPRESSOR=bunzip2
elif echo $COMPRESSION |grep -iq xz; then
        DECOMPRESSOR=unxz
elif echo $COMPRESSION |grep -iq cpio; then
        DECOMPRESSOR=cat
else
        # Most versions of file don't support LZMA, therefore we assume
        # anything not detected is LZMA
        DECOMPRESSOR=`which unlzma 2>/dev/null`

In my case this script tried to unlzma rpmXYZ.tar.gz and failed saying something like 'unlzma: unknown format'. 
After installing file problem went away.

There is another script:
poky/meta/recipes-devtools/rpm/rpm/rpm2cpio
which does not use file, but awk to determine type of compression.

The solution would be either:
- add file as Yocto dependency to be installed on host OS
- change the script not to use file
Comment 1 Paul Eggleton 2017-07-20 15:18:14 UTC
This got fixed with http://git.yoctoproject.org/cgit.cgi/poky/commit/scripts/rpm2cpio.sh?id=aa17362d339164e8d6c9fcc9d0c24862a191af29 (included in pyro/2.3) - there is no longer a dependency on file in the current script.