Github messages for voidlinux
 help / color / mirror / Atom feed
From: Chocimier <Chocimier@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] xbps-src: depuplicate output of setup_pkg_depends
Date: Thu, 30 Apr 2020 21:54:32 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-21493@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is a new pull request by Chocimier against master on the void-packages repository

https://github.com/Chocimier/void-packages-org deduplicate-depends
https://github.com/void-linux/void-packages/pull/21493

xbps-src: depuplicate output of setup_pkg_depends
Issue #21044 raised problem of setup_pkg_depends returning duplicate results after depends of subpackages were included. Specifically, problem was performance and triggering failures of xbps-fbulk.

I was unable to reproduce fbulk's misbehavior, as show_pkg_build_depends deduplicates its output. Yet I don't see reason for listing duplicates here.

Please merge if you find it good.

A patch file from https://github.com/void-linux/void-packages/pull/21493.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-deduplicate-depends-21493.patch --]
[-- Type: text/x-diff, Size: 2405 bytes --]

From 2006142d5b6a4c957ebad731261ec8e2aa34b6b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Thu, 30 Apr 2020 21:40:02 +0200
Subject: [PATCH] xbps-src: depuplicate output of setup_pkg_depends

---
 common/xbps-src/shutils/build_dependencies.sh | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/common/xbps-src/shutils/build_dependencies.sh b/common/xbps-src/shutils/build_dependencies.sh
index ebf5a0bc131..6ac86857173 100644
--- a/common/xbps-src/shutils/build_dependencies.sh
+++ b/common/xbps-src/shutils/build_dependencies.sh
@@ -1,7 +1,8 @@
 # vim: set ts=4 sw=4 et:
 #
 setup_pkg_depends() {
-    local pkg="$1" out="$2" with_subpkgs="$3" j _rpkgname _depname _pkgname foo _deps collected
+    local pkg="$1" out="$2" with_subpkgs="$3" j _rpkgname _depname _pkgname foo dep
+    local -A collected
 
     if [[ $pkg ]]; then
         # subpkg
@@ -9,15 +10,20 @@ setup_pkg_depends() {
             ${pkg}_package
         fi
     elif [[ $with_subpkgs ]]; then
-        collected="${depends}"
+        for dep in $depends; do
+            collected["${dep}"]="${dep}"
+        done
         for pkg in $subpackages; do
             [[ $pkg ]] || continue
             ${pkg}_package
-            collected+=" ${depends}"
+            for dep in $depends; do
+                collected["${dep}"]="${dep}"
+            done
         done
-        depends="${collected}"
+        depends="${collected[@]}"
     fi
 
+    collected=()
     for j in ${depends}; do
         _rpkgname="${j%\?*}"
         _depname="${j#*\?}"
@@ -32,19 +38,19 @@ setup_pkg_depends() {
             if [ -z "$foo" ]; then
                 msg_error "$pkgver: failed to resolve virtual dependency for '$j' (missing from etc/virtual)\n"
             fi
-            _deps+="$foo "
+            collected["$foo"]="$foo"
         else
             foo="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
             if [ -z "$foo" ]; then
                 foo="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
                 [ -z "$foo" ] && foo="${_depname}"
             fi
-            _deps+="$foo "
+            collected["$foo"]="$foo"
         fi
         run_depends+="${_depname} "
     done
 
-    [[ $out && $_deps ]] && echo "$_deps"
+    [[ $out && "${collected[@]}" ]] && echo "${collected[@]}"
     return 0
 }
 

             reply	other threads:[~2020-04-30 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 19:54 Chocimier [this message]
2020-11-22  5:18 ` the-maldridge
2020-12-20  2:04 ` ericonr
2021-02-16  5:47 ` ericonr
2022-04-16  2:02 ` github-actions
2022-05-01  2:13 ` [PR PATCH] [Closed]: " github-actions
2022-05-01 19:07 ` ericonr
2022-05-07 17:46 ` Chocimier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-21493@inbox.vuxu.org \
    --to=chocimier@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).