Search code examples
yoctobitbakeyocto-recipe

Yocto recipe not extract archive


I'm trying to unpack .tar.gz file to my root during the building system, but it doesn't work because of an unclear reason for me. I did it in the same way as other recipes in my meta (which works fine), but in this case, I have an empty directory in the target system root. The recipe has the same name as tar.gz.

Based on Yocto Project Documentation and my other experience it should work fine. I tried to remove manually tmp, sstate-cache directories and rebuild system, but it doesn't change anything. The recipe is building, but the /my-app is empty. Can I force extract my archive?

Tree file:

├── meta-my
│   └── recipe-my-app-files
│       └── my-app
|           └── my-app.bb
│           └── files
│               ├── my-app.tar.gz
....

my-app.bb

DESCRIPTION = "My Application package preinstall"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
RDEPENDS_my-app="bash qtdeclarative qtbase"
DEPENDS = "bash"

FILES_${PN} += "/my-app"

SRC_URI = "file://my-app.tar.gz"

BB_STRICT_CHECKSUM = "0"

S = "${WORKDIR}"

do_install() {
        # Create directories
        install -d ${D}/my-app
}


Solution

  • As mentionned in the link you provided that:

    The unpack call automatically decompresses and extracts files with ".Z", ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm", ".deb" and ".bz2" extensions as well as various combinations of tarball extensions.

    it extracts .gz automatically into ${WORKDIR}.

    The issue with your recipe is that you are creating /my-app but not filling it with any content.

    Keep in mind that the compressed file is unpacked under ${WORKDIR}, so install it into ${D}/my-app:

    do_install(){
         # Create directories
         install -d ${D}/my-app
    
         # Install unpacked application
         # install -m 0755 app ${D}/my-app
         # ...
    }
    

    I do not know the content of your application, so change that according to it.