Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: [PR PATCH] xbps-src: revert to previous bulk_sortdeps code
Date: Mon, 21 Oct 2019 21:42:12 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-15678@inbox.vuxu.org> (raw)

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

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

https://github.com/void-ppc/void-packages sortdeps
https://github.com/void-linux/void-packages/pull/15678

xbps-src: revert to previous bulk_sortdeps code
This should restore sort-dependencies behavior back to its former behavior of not including all of the build dependencies not in the input list in its listing.

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

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

From d19ef9704c085af8ff9a4fb37bad447963dfadfc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 21 Oct 2019 20:18:34 +0200
Subject: [PATCH] xbps-src: revert to previous bulk_sortdeps code

This should restore sort-dependencies behavior back to its former
behavior of not including all of the build dependencies not in
the input list in its listing.
---
 common/xbps-src/shutils/bulk.sh | 60 +++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 17 deletions(-)

diff --git a/common/xbps-src/shutils/bulk.sh b/common/xbps-src/shutils/bulk.sh
index ed5c4ce192d..e5f3443c010 100644
--- a/common/xbps-src/shutils/bulk.sh
+++ b/common/xbps-src/shutils/bulk.sh
@@ -1,28 +1,54 @@
 # vim: set ts=4 sw=4 et:
 
+bulk_getlink() {
+    local p="${1##*/}"
+    local target="$(readlink $XBPS_SRCPKGDIR/$p)"
+
+    if [ $? -eq 0 -a -n "$target" ]; then
+        p=$target
+    fi
+    echo $p
+}
+
 bulk_sortdeps() {
-    local pkgs="$@"
-    local pkg _pkg
-    local NPROCS=$(($(nproc)*2))
-    local NRUNNING=0
+    local _pkgs _pkg pkgs pkg found f x tmpf
 
-    tmpf=$(mktemp) || exit 1
+    _pkgs="$@"
+    # Iterate over the list and make sure that only real pkgs are
+    # added to our pkglist.
+    for pkg in ${_pkgs}; do
+        found=0
+        f=$(bulk_getlink $pkg)
+        for x in ${pkgs}; do
+            if [ "$x" = "${f}" ]; then
+                found=1
+                break
+            fi
+        done
+        if [ $found -eq 0 ]; then
+            pkgs+="${f} "
+        fi
+    done
 
-    # Perform a topological sort of all *direct* build dependencies.
+    tmpf=$(mktemp) || exit 1
+    # Now make the real dependency graph of all pkgs to build.
+    # Perform a topological sort of all pkgs but only with build dependencies
+    # that are found in previous step.
     for pkg in ${pkgs}; do
-        if [ $NRUNNING -eq $NPROCS ]; then
-            NRUNNING=0
-            wait
-        fi
-        NRUNNING=$((NRUNNING+1))
-        (
-            for _pkg in $(./xbps-src show-build-deps $pkg 2>/dev/null); do
-                echo "$pkg $_pkg" >> $tmpf
+        _pkgs="$(./xbps-src show-build-deps $pkg 2>/dev/null)"
+        found=0
+        for x in ${_pkgs}; do
+            _pkg=$(bulk_getlink $x)
+            for f in ${pkgs}; do
+                if [ "${f}" != "${_pkg}" ]; then
+                    continue
+                fi
+                found=1
+                echo "${pkg} ${f}" >> $tmpf
             done
-            echo "$pkg $pkg" >> $tmpf
-        ) &
+        done
+        [ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
     done
-    wait
     tsort $tmpf|tac
     rm -f $tmpf
 }

                 reply	other threads:[~2019-10-21 19:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-15678@inbox.vuxu.org \
    --to=voidlinux-github@inbox.vuxu.org \
    --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).