Add --numeric-owner to tar extract operations in portsnap.

This is done to speed up extraction significantly (both for portsnap
extract and update) in the case of slow NSS modules (like nss_ldap) as
it avoids having to look up uid and gid for root / wheel.

The reason this is a bigger problem for portsnap than for many other
system operations, is that portsnap executes tar(1) once for each port
so the internal uid/gid caching in tar(1) only helps a bit, resulting
in many user lookup calls.

Discussed with:	cperciva
This commit is contained in:
Simon L. B. Nielsen 2010-12-19 23:09:42 +00:00
parent da86244d0d
commit 52e3f1458b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216575

View File

@ -632,7 +632,7 @@ fetch_snapshot() {
fetch -r http://${SERVERNAME}/s/${SNAPSHOTHASH}.tgz || return 1
echo -n "Extracting snapshot... "
tar -xzf ${SNAPSHOTHASH}.tgz snap/ || return 1
tar -xz --numeric-owner -f ${SNAPSHOTHASH}.tgz snap/ || return 1
rm ${SNAPSHOTHASH}.tgz
echo "done."
@ -896,12 +896,12 @@ extract_run() {
*/)
rm -rf ${PORTSDIR}/${FILE%/}
mkdir -p ${PORTSDIR}/${FILE}
tar -xzf ${WORKDIR}/files/${HASH}.gz \
tar -xz --numeric-owner -f ${WORKDIR}/files/${HASH}.gz \
-C ${PORTSDIR}/${FILE}
;;
*)
rm -f ${PORTSDIR}/${FILE}
tar -xzf ${WORKDIR}/files/${HASH}.gz \
tar -xz --numeric-owner -f ${WORKDIR}/files/${HASH}.gz \
-C ${PORTSDIR} ${FILE}
;;
esac
@ -966,11 +966,11 @@ update_run() {
case ${FILE} in
*/)
mkdir -p ${PORTSDIR}/${FILE}
tar -xzf ${WORKDIR}/files/${HASH}.gz \
tar -xz --numeric-owner -f ${WORKDIR}/files/${HASH}.gz \
-C ${PORTSDIR}/${FILE}
;;
*)
tar -xzf ${WORKDIR}/files/${HASH}.gz \
tar -xz --numeric-owner -f ${WORKDIR}/files/${HASH}.gz \
-C ${PORTSDIR} ${FILE}
;;
esac