• [gentoo-dev] [PATCH 0/2] unpacker.eclass: avoid duplicate unpacker_src_

    From Sam James@21:1/5 to All on Mon Jan 16 18:50:01 2023
    I've diffed metadata before/after and everything looks as expected. The only notable cases really were games-arcade/rocksndiamonds, games-arcade/rocksndiamonds,
    sys-apps/ed, sys-fs/bcachefs-tools and only sys-apps/ed had a problematic || ( ...)
    dep, apparently, because of its SRC_URI (verify-sig + mirror listed).

    Sam James (2):
    unpacker.eclass: flatten unpacker_src_uri_depends dependencies
    sys-apps/ed: use unpacker_src_uri_depends again

    eclass/unpacker.eclass | 29 ++++++++++++++---------------
    sys-apps/ed/ed-1.19-r1.ebuild | 7 +------
    2 files changed, 15 insertions(+), 21 deletions(-)

    --
    2.39.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to All on Mon Jan 16 18:50:01 2023
    Populate an associative array as we iterate over SRC_URI to collect needed dependencies to avoid recording the same dependencies twice.

    This still doesn't handle USE flags, but it's significantly better than before, as we won't repeatedly emit the same dependency if there's more than one distfile
    in SRC_URI with the same suffix.

    Closes: https://bugs.gentoo.org/891133
    Thanks-to: Ionen Wolkens <ionen@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>
    ---
    eclass/unpacker.eclass | 29 ++++++++++++++---------------
    1 file changed, 14 insertions(+), 15 deletions(-)

    diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
    index 326b2fa675249..44ff2af5acf39 100644
    --- a/eclass/unpacker.eclass
    +++ b/eclass/unpacker.eclass
    @@ -596,7 +596,8 @@ unpacker_src_unpack() {
    #
    # Note: USE flags are not yet handled.
    unpacker_src_uri_depends() {
    - local uri deps d
    + local uri
    + local -A deps

    if [[ $# -eq 0 ]] ; then
    # Disable path expansion for USE conditionals. #654960
    @@ -606,20 +607,19 @@ unpacker_src_uri_depends() {
    fi

    for uri in "$@" ; do
    - local m=${uri,,}
    - case ${m} in
    + case ${uri,,} in
    *.cpio.*|*.cpio)
    - d="app-arch/cpio" ;;
    + deps[cpio]="app-arch/cpio" ;;
    *.rar)
    - d="app-arch/unrar" ;;
    + deps[rar]="app-arch/unrar" ;;
    *.7z)
    - d="app-arch/p7zip" ;;
    + deps[7z]="app-arch/p7zip" ;;
    *.xz)
    - d="app-arch/xz-utils" ;;
    + deps[xz]="app-arch/xz-utils" ;;
    *.zip)
    - d="app-arch/unzip"