• [gentoo-dev] [PATCH 00/15] unpacker.eclass: Tests, bugfixes and GPKG su

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Sep 25 20:30:02 2022
    Hi,

    Here's a patch series for unpacker.eclass that does the following:

    - add tests for unpacking various file formats
    - fix handling broken/invalid `.zst` and `.7z` files
    - use lowercase suffixes everywhere consistently
    - add support for `.lz4` and `.lzo`
    - add support for on-the-fly unpacking of the image archive from `.gpkg.tar`
    - use parallel xz decompression (by @thesamesam)
    - support lbzip2 if available
    - fix handling `.deb` that use GNU ar format
    - unpack `.deb` on-the-fly (i.e. without temporary files)

    Also available as PR: https://github.com/gentoo/gentoo/pull/27431

    Please review.


    Michał Górny (14):
    eclass/tests: Add tests for unpacker.eclass
    unpacker.eclass: Remove `-f` from zstd arguments
    unpacker.eclass: Fix unpack_7z to respect the exit status
    unpacker.eclass: Remove support for EAPI 5
    unpacker.eclass: Use bash substitution instead of tr for lowercase
    unpacker.eclass: Use lowercase in unpacker_src_uri_depends
    unpacker.eclass: Remove uppercase RAR/LHA variants
    unpacker.eclass: Move decompressor recognition into a function
    unpacker.eclass: Add support for .lz4 and .lzo compression
    unpacker.eclass: Add on-the-fly .gpkg.tar unpacking support
    sys-kernel/gentoo-kernel-bin: Use unpacker.eclass for .gpkg.tar
    unpacker.eclass: Support lbzip2 as parallel bz2 decompressor
    unpacker.eclass: Fix handling GNU ar archives in hand-weaved impl
    unpacker.eclass: Unpack .deb packages on-the-fly as well

    Sam James (1):
    unpacker.eclass: decompress xz in parallel

    eclass/tests/tests-common.sh | 7 +
    eclass/tests/unpacker.sh | 291 ++++++++++++++++++
    eclass/unpacker.eclass | 179 +++++++----
    .../gentoo-kernel-bin-5.19.11.ebuild | 17 +-
    4 files changed, 428 insertions(+), 66 deletions(-)
    create mode 100755 eclass/tests/unpacker.sh

    --
    2.37.3

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Sep 25 20:30:02 2022
    Remove the uppercase variants of RAR/LHA that were copied from Portage implementation. The functions always convert filenames to lowercase,
    so accounting for them is redundant.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/unpacker.eclass | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
    index e07c25d0ffa9..ca6761488100 100644
    --- a/eclass/unpacker.eclass
    +++ b/eclass/unpacker.eclass
    @@ -444,9 +444,9 @@ _unpacker() {
    case ${m} in
    *.7z)
    arch="unpack_7z" ;;
    - *.rar|*.RAR)
    + *.rar)
    arch="unpack_rar" ;;
    - *.LHA|*.LHa|*.lha|*.lzh)
    + *.lha|*.lzh)
    arch="unpack_lha" ;;
    esac
    fi
    @@ -513,7 +513,7 @@ unpacker_src_uri_depends() {
    case ${m} in
    *.cpio.*|*.cpio)
    d="app-arch/cpio" ;;
    - *.rar|*.RAR)
    + *.rar)
    d="app-arch/unrar" ;;
    *.7z)
    d="app-arch/p7zip" ;;
    @@ -525,7 +525,7 @@ unpacker_src_uri_depends() {
    d="|| ( app-arch/plzip app-arch/pdlzip app-arch/lzip )" ;;
    *.zst)
    d="app-arch/zstd" ;;
    - *.LHA|*.LHa|*.lha|*.lzh)
    + *.lha|*.lzh)
    d="app-arch/lha" ;;
    esac
    deps+=" ${d}"
    --
    2.37.3

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Sep 25 20:30:02 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    .../gentoo-kernel-bin-5.19.11.ebuild | 17 ++++++-----------
    1 file changed, 6 insertions(+), 11 deletions(-)

    diff --git a/sys-kernel/gentoo-kernel-bin/gentoo-kernel-bin-5.19.11.ebuild b/sys-kernel/gentoo-kernel-bin/gentoo-kernel-bin-5.19.11.ebuild
    index 966fadbe839a..0ba336c5c1aa 100644
    --- a/sys-kernel/gentoo-kernel-bin/gentoo-kernel-bin-5.19.11.ebuild
    +++ b/sys-kernel/gentoo-kernel-bin/gentoo-kernel-bin-5.19.11.ebuild
    @@ -3,7 +3,7 @@

    EAPI=8

    -inherit kernel-install toolchain-funcs
    +inherit kernel-install toolchain-funcs unpacker

    MY_P=linux-${PV%.*}
    GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 2 ))
    @@ -55,11 +55,6 @@ QA_PREBUILT='*'
    KV_LOCALVERSION='-gentoo-dist'
    KPV=${PV}${KV_LOCALVERSION}

    -src_unpack() {
    - default
    - unpack "${BINPKG}"/image.tar.xz
    -}
    -
    src_prepare() {
    local PATCHES=(
    # meh, genpatches have no directory
    @@ -102,22 +97,22 @@ src_configure() {
    )

    mkdir modprep || die
    - cp "image/usr/src/linux-${KPV}/.config" modprep/ ||
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Sep 25 20:30:02 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/tests/unpacker.sh | 47 ++++++++++++++++++++++++++++++++++++++++
    eclass/unpacker.eclass | 38 ++++++++++++++++++++++++++++++++
    2 files changed, 85 insertions(+)

    diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh
    index 60b651759a52..bbbfa32623ab 100755
    --- a/eclass/tests/unpacker.sh
    +++ b/eclass/tests/unpacker.sh
    @@ -136,6 +136,43 @@ test_deb() {
    "create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}"
    }

    +create_gpkg() {
    + local suffix=${1}
    + local tool=${2}
    + local archive=${3}
    + local infile=${4}
    + local gpkg_dir=${archive%.gpkg.tar}
    +
    + mkdir image metadata "${gpkg_dir}" || die
    + cp "${infile}" image/ || die
    + tar -c metadata | ${tool} > "${gpkg_dir}/metadata.tar${suffix}"
    + assert "packing metadata.tar${suffix} failed"
    + : > "${gpkg_dir}/metadata.tar${suffix}.sig" || die
    + tar -c image | ${tool} > "${gpkg_dir}/image.tar${suffix}"
    + assert "packing image.tar${suffix} failed"
    + : > "${gpkg_dir}/image.tar${suffix}.sig" || die
    + : > "${gpkg_d