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.
This commit is contained in:
q66 2019-10-21 20:18:34 +02:00 committed by Duncan Overbruck
parent e949a508a8
commit 021b7cc11e

View file

@ -1,28 +1,54 @@
# vim: set ts=4 sw=4 et: # 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() { bulk_sortdeps() {
local pkgs="$@" local _pkgs _pkg pkgs pkg found f x tmpf
local pkg _pkg
local NPROCS=$(($(nproc)*2)) _pkgs="$@"
local NRUNNING=0 # 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
tmpf=$(mktemp) || exit 1 tmpf=$(mktemp) || exit 1
# Now make the real dependency graph of all pkgs to build.
# Perform a topological sort of all *direct* build dependencies. # Perform a topological sort of all pkgs but only with build dependencies
# that are found in previous step.
for pkg in ${pkgs}; do for pkg in ${pkgs}; do
if [ $NRUNNING -eq $NPROCS ]; then _pkgs="$(./xbps-src show-build-deps $pkg 2>/dev/null)"
NRUNNING=0 found=0
wait for x in ${_pkgs}; do
fi _pkg=$(bulk_getlink $x)
NRUNNING=$((NRUNNING+1)) for f in ${pkgs}; do
( if [ "${f}" != "${_pkg}" ]; then
for _pkg in $(./xbps-src show-build-deps $pkg 2>/dev/null); do continue
echo "$pkg $_pkg" >> $tmpf fi
found=1
echo "${pkg} ${f}" >> $tmpf
done done
echo "$pkg $pkg" >> $tmpf done
) & [ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
done done
wait
tsort $tmpf|tac tsort $tmpf|tac
rm -f $tmpf rm -f $tmpf
} }