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.
This commit is contained in:
parent
f83695f5e9
commit
2a569ec900
@ -873,9 +873,7 @@ extract_run() {
|
|||||||
grep -vE "${REFUSE}" ${WORKDIR}/INDEX
|
grep -vE "${REFUSE}" ${WORKDIR}/INDEX
|
||||||
else
|
else
|
||||||
cat ${WORKDIR}/INDEX
|
cat ${WORKDIR}/INDEX
|
||||||
fi | while read LINE; do
|
fi | tr '|' ' ' | while read FILE HASH; do
|
||||||
FILE=`echo ${LINE} | cut -f 1 -d '|'`
|
|
||||||
HASH=`echo ${LINE} | cut -f 2 -d '|'`
|
|
||||||
echo ${PORTSDIR}/${FILE}
|
echo ${PORTSDIR}/${FILE}
|
||||||
if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then
|
if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then
|
||||||
echo "files/${HASH}.gz not found -- snapshot corrupt."
|
echo "files/${HASH}.gz not found -- snapshot corrupt."
|
||||||
@ -883,8 +881,7 @@ extract_run() {
|
|||||||
fi
|
fi
|
||||||
case ${FILE} in
|
case ${FILE} in
|
||||||
*/)
|
*/)
|
||||||
DIR=`echo ${FILE} | sed -e 's|/$||'`
|
rm -rf ${PORTSDIR}/${FILE%/}
|
||||||
rm -rf ${PORTSDIR}/${DIR}
|
|
||||||
mkdir -p ${PORTSDIR}/${FILE}
|
mkdir -p ${PORTSDIR}/${FILE}
|
||||||
tar -xzf ${WORKDIR}/files/${HASH}.gz \
|
tar -xzf ${WORKDIR}/files/${HASH}.gz \
|
||||||
-C ${PORTSDIR}/${FILE}
|
-C ${PORTSDIR}/${FILE}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user