diff options
author | cperciva <cperciva@FreeBSD.org> | 2006-05-30 07:08:41 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2006-05-30 07:08:41 +0000 |
commit | 682aa440b580545d61ba36ed15f7f6bdbd91f538 (patch) | |
tree | 416a92c261f4794a3a1bb0db24892582548882b9 /usr.sbin | |
parent | 7d671abdfe9bb065257654fee44b0ab1226da953 (diff) | |
download | FreeBSD-src-682aa440b580545d61ba36ed15f7f6bdbd91f538.zip FreeBSD-src-682aa440b580545d61ba36ed15f7f6bdbd91f538.tar.gz |
Use some features of sh(1) which I didn't know about until today ("read"
can read two variables at once; and suffix pattern deletion) to make the
extract command fork fewer processes.
With the portsnap snapshot and the ports tree in swap-backed memory
disks on my 1.4GHz laptop, this reduces 178800 processes and 195/56/126
seconds of real/user/sys time to 44600 processes and 103/34/60 seconds.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/portsnap/portsnap/portsnap.sh | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index d74190f..6cecd49 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -873,9 +873,7 @@ extract_run() { grep -vE "${REFUSE}" ${WORKDIR}/INDEX else cat ${WORKDIR}/INDEX - fi | while read LINE; do - FILE=`echo ${LINE} | cut -f 1 -d '|'` - HASH=`echo ${LINE} | cut -f 2 -d '|'` + fi | tr '|' ' ' | while read FILE HASH; do echo ${PORTSDIR}/${FILE} if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." @@ -883,8 +881,7 @@ extract_run() { fi case ${FILE} in */) - DIR=`echo ${FILE} | sed -e 's|/$||'` - rm -rf ${PORTSDIR}/${DIR} + rm -rf ${PORTSDIR}/${FILE%/} mkdir -p ${PORTSDIR}/${FILE} tar -xzf ${WORKDIR}/files/${HASH}.gz \ -C ${PORTSDIR}/${FILE} |