diff options
author | Dave Woodfall <dave@slackbuilds.org> | 2021-04-05 04:27:18 +0000 |
---|---|---|
committer | Dave Woodfall <dave@slackbuilds.org> | 2021-04-05 04:51:38 +0000 |
commit | 60d88c7c28998ce88fe1f71d73dde228cf94912b (patch) | |
tree | beb578f17843d339144e399d9b01f04c26cb70b3 | |
parent | 9cd55c9ae2e6c15b2557749ba9f5099606f6ed56 (diff) | |
download | slackpkg-60d88c7c28998ce88fe1f71d73dde228cf94912b.tar.xz |
Optimisations with loops when running update.experimental
Use printf's formatting instead of for loops, and tee instead of cp.
Use --fast with gzip.
The biggest slowdowns are the bunzip2s on MANIFEST files, but not much
can be done about those.
The changes together shave roughly 3 seconds off here, but it's all
going to be relative to the local system.
-rw-r--r-- | files/core-functions.sh | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/files/core-functions.sh b/files/core-functions.sh index 1f4faf3..0eedef9 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -1180,17 +1180,13 @@ Please check your mirror and try again." # echo -e "\tFormatting lists to slackpkg style..." echo -e "\t\tPackage List: using $( basename $FILELIST ) as source" - grep "\.t[blxg]z$" $FILELIST| \ - awk -f /usr/libexec/slackpkg/pkglist.awk |\ - sed -e 's/^M//g' > ${TMPDIR}/pkglist - cp ${TMPDIR}/pkglist ${WORKDIR}/pkglist + grep "\.t[blxg]z$" $FILELIST | + awk -f /usr/libexec/slackpkg/pkglist.awk | + sed -e 's/^M//g' | tee ${WORKDIR}/pkglist > ${TMPDIR}/pkglist # Create the slackware tree under TEMP directory - for i in $( cut -f7 -d\ ${WORKDIR}/pkglist | sort -u ) ; do - if ! [ -d ${ROOT}/${TEMP}/${i} ]; then - mkdir -p ${ROOT}/${TEMP}/${i} - fi - done + mkdir -p $( printf "${ROOT}/${TEMP}/%s " $( + cut -f7 -d\ ${WORKDIR}/pkglist | sort -u ) ) # Format MANIFEST # @@ -1199,8 +1195,9 @@ Please check your mirror and try again." # MANFILES="" for i in $DIRS; do - bunzip2 -c $TMPDIR/${i}-MANIFEST.bz2 | awk -f /usr/libexec/slackpkg/filelist.awk | \ - gzip > ${TMPDIR}/${i}-filelist.gz + bunzip2 -c $TMPDIR/${i}-MANIFEST.bz2 | + awk -f /usr/libexec/slackpkg/filelist.awk | + gzip --fast > ${TMPDIR}/${i}-filelist.gz done cp ${TMPDIR}/*-filelist.gz ${WORKDIR}/ |