diff options
author | Sam James <sam@gentoo.org> | 2023-01-16 17:24:37 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-01-16 20:55:05 +0000 |
commit | ea08b1a398b28d8e03fee32787c70b227f763b02 (patch) | |
tree | 150d227df6f6fcb80493ae7cc741a8b3a73e401a /eclass | |
parent | dev-python/yamlpath: Bump to 3.7.0 (diff) | |
download | gentoo-ea08b1a398b28d8e03fee32787c70b227f763b02.tar.gz gentoo-ea08b1a398b28d8e03fee32787c70b227f763b02.tar.bz2 gentoo-ea08b1a398b28d8e03fee32787c70b227f763b02.zip |
unpacker.eclass: flatten unpacker_src_uri_depends dependencies
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>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/unpacker.eclass | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass index 326b2fa67524..44ff2af5acf3 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" ;; + deps[zip]="app-arch/unzip" ;; *.lz) - d=" + deps[lz]=" || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip @@ -629,18 +629,17 @@ unpacker_src_uri_depends() { " ;; *.zst) - d="app-arch/zstd" ;; + deps[zst]="app-arch/zstd" ;; *.lha|*.lzh) - d="app-arch/lha" ;; + deps[lhah]="app-arch/lha" ;; *.lz4) - d="app-arch/lz4" ;; + deps[lz4]="app-arch/lz4" ;; *.lzo) - d="app-arch/lzop" ;; + deps[lzo]="app-arch/lzop" ;; esac - deps+=" ${d}" done - echo "${deps}" + echo "${deps[*]}" } EXPORT_FUNCTIONS src_unpack |