xbps-src: multiple performance improvements

- use xbps-checkvers(1) to resolve dependencies.
- all dependencies are installed at once for the host and target.
- the show-build-deps target is now much faster.
- the update-bulk/show-repo-updates targets are now much faster.
- the update-sys/show-sys-updates targets are now much faster.
- the bootstrap target now works on musl hosts.
- simplified some loops.
- use cut(1) rather than awk(1) where applicable.
- multiple random changes to improve performance.

Based on work started by @Duncaen on #12433

Close #12433
Close #11282
This commit is contained in:
Juan RP 2019-07-10 19:48:54 +02:00
parent 529a019a3f
commit e4984d01ea
15 changed files with 469 additions and 617 deletions

View file

@ -5,7 +5,7 @@
# - Generates shlib-requires file for xbps-create(1)
add_rundep() {
local dep="$1" i= rpkgdep= _depname= _rdeps= found=
local dep="$1" i= rpkgdep= _depname= found=
_depname="$($XBPS_UHELPER_CMD getpkgdepname ${dep} 2>/dev/null)"
if [ -z "${_depname}" ]; then
@ -68,26 +68,19 @@ hook() {
exec < $depsftmp
while read f; do
lf=${f#${PKGDESTDIR}}
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
msg_normal "Skipping dependency scan for ${lf}\n"
continue
fi
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
msg_normal "Skipping dependency scan for ${lf}\n"
continue
fi
case "$(file -bi "$f")" in
application/x-*executable*|application/x-sharedlib*)
for nlib in $($OBJDUMP -p "$f"|grep NEEDED|awk '{print $2}'); do
if [ -z "$verify_deps" ]; then
verify_deps="$nlib"
continue
fi
[ -z "$verify_deps" ] && verify_deps="$nlib" && continue
found=0
for j in ${verify_deps}; do
[ "$j" != "$nlib" ] && continue
found_dup=1
break
[[ $j == $nlib ]] && found=1 && break
done
if [ -z "$found_dup" ]; then
verify_deps="$verify_deps $nlib"
fi
unset found_dup
[[ $found -eq 0 ]] && verify_deps="$verify_deps $nlib"
done
;;
esac
@ -97,13 +90,13 @@ hook() {
#
# Add required run time packages by using required shlibs resolved
# above, the mapping is done thru the mapping_shlib_binpkg.txt file.
# above, the mapping is done thru the common/shlibs file.
#
for f in ${verify_deps}; do
unset _f j rdep _rdep rdepcnt soname _pkgname _rdepver found
_f=$(echo "$f"|sed -E 's|\+|\\+|g')
rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|awk '{print $2}')"
rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|awk '{print $2}'|wc -l)"
rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2)"
rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2|wc -l)"
if [ -z "$rdep" ]; then
# Ignore libs by current pkg
soname=$(find ${PKGDESTDIR} -name "$f")
@ -121,15 +114,9 @@ hook() {
_pkgname=$($XBPS_UHELPER_CMD getpkgname "$j")
# if there's a SONAME matching pkgname, use it.
for x in ${pkgname} ${subpackages}; do
if [ "${_pkgname}" = "${x}" ]; then
found=1
break
fi
[[ $_pkgname == $x ]] && found=1 && break
done
if [ -n "$found" ]; then
_rdep=$j
break
fi
[[ $found ]] && _rdep=$j && break
done
if [ -z "${_rdep}" ]; then
# otherwise pick up the first one.