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:
parent
e949a508a8
commit
021b7cc11e
@ -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
|
||||
|
||||
_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
|
||||
|
||||
tmpf=$(mktemp) || exit 1
|
||||
|
||||
# Perform a topological sort of all *direct* build dependencies.
|
||||
# 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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user