Bug 4915

Summary: poky/scripts/rpm2cpio.sh breaks when file utility missing
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Krzysztof Sywula <Krzysztof.M.Sywula>
Component: configurationAssignee: Mark Hatle <mark.hatle>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Low CC: bluelightning, sgw
Version: 1.4.1   
Target Milestone: Future   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

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.