Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: revert to previous bulk_sortdeps code
@ 2019-10-21 19:42 voidlinux-github
  0 siblings, 0 replies; only message in thread
From: voidlinux-github @ 2019-10-21 19:42 UTC (permalink / raw)
  To: ml

[-- 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
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-21 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 19:42 [PR PATCH] xbps-src: revert to previous bulk_sortdeps code voidlinux-github

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).