diff options
author | Juan RP <xtraeme@gmail.com> | 2019-07-10 17:48:54 +0000 |
---|---|---|
committer | Juan RP <xtraeme@gmail.com> | 2019-07-10 18:28:46 +0000 |
commit | e4984d01ea049e7cde260fc1a05d61fbdd403180 (patch) | |
tree | 122237833152e1dfe3e1c2afa531925871c90c09 /common/hooks/pre-pkg | |
parent | 529a019a3f29df09936cbb12179c2eb31bcc2e27 (diff) | |
download | void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar.gz void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar.bz2 void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar.lz void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar.xz void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.tar.zst void-packages-e4984d01ea049e7cde260fc1a05d61fbdd403180.zip |
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
Diffstat (limited to 'common/hooks/pre-pkg')
-rw-r--r-- | common/hooks/pre-pkg/04-generate-runtime-deps.sh | 41 | ||||
-rw-r--r-- | common/hooks/pre-pkg/99-pkglint.sh | 4 |
2 files changed, 16 insertions, 29 deletions
diff --git a/common/hooks/pre-pkg/04-generate-runtime-deps.sh b/common/hooks/pre-pkg/04-generate-runtime-deps.sh index 62077022711..6e45b7dd3c3 100644 --- a/common/hooks/pre-pkg/04-generate-runtime-deps.sh +++ b/common/hooks/pre-pkg/04-generate-runtime-deps.sh @@ -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. diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index 7ae183ae8e8..ab2b215508e 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -119,7 +119,7 @@ hook() { msg_red "${pkgver}: SONAME bump detected: ${libname}.so.${conflictRev} -> ${libname}.so.${rev}\n" msg_red "${pkgver}: please update common/shlibs with this line: \"${libname}.so.${rev} ${pkgver}\"\n" msg_red "${pkgver}: all reverse dependencies should also be revbumped to be rebuilt against ${libname}.so.${rev}:\n" - _revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|awk '{print $1}') + _revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|cut -d ' ' -f1) for x in ${_revdeps}; do msg_red " ${x%:}\n" done @@ -128,7 +128,7 @@ hook() { # Try to match provided shlibs in virtual packages. for f in ${provides}; do _vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)" - _spkgname="$(grep "^${filename}" $mapshlibs | awk '{print $2}')" + _spkgname="$(grep "^${filename}" $mapshlibs | cut -d ' ' -f2)" _libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)" if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then continue |