src_unpack

Function src_unpack
Purpose Extract source packages and do any necessary patching or fixes.
Sandbox Enabled
Privilege user
Called for ebuild

Default src_unpack

src_unpack() {
    if [ "${A}" != "" ]; then
        unpack ${A}
    fi
}

Sample src_unpack

src_unpack() {
    unpack ${A}
    cd "${S}"

    epatch "${FILESDIR}/${PV}/${P}-fix-bogosity.patch"
    use pam && epatch "${FILESDIR}/${PV}/${P}-pam.patch"

    sed -i -e 's/"ispell"/"aspell"/' src/defaults.h || die "Sed failed!"
}

Unpacking Tarballs

The unpack function should be used to unpack tarballs, compressed files and so on. Do not use tar, gunzip etc. manually.

The ${A} variable contains all of the SRC_URI components, except for any which are excluded by USE-based conditionals inside SRC_URI itself. If multiple archives require unpacking in a particular order it is usually simpler to avoid working with ${A}.

src_unpack Actions

The following subsections cover different topics which often occur when writing src_unpack functions.