From 8573cb38b6690b8c41035d4c163e613c2d93683b Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Thu, 11 Aug 2005 13:48:13 +0000 Subject: [PATCH] If the ports tree is already up to date when we run `portsnap update`, exit early; this avoids spending five seconds rebuilding the INDEX files. Requested by: somebody on IRC, but I can't remember who --- usr.sbin/portsnap/portsnap/portsnap.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index 2b48385411f3..7ff1f6b4ae82 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -803,6 +803,11 @@ update_run() { return 0 fi + if sort ${WORKDIR}/INDEX | cmp ${PORTSDIR}/.portsnap.INDEX -; then + echo "Ports tree is already up to date." + return 0 + fi + echo -n "Removing old files and directories... " sort ${WORKDIR}/INDEX | comm -23 ${PORTSDIR}/.portsnap.INDEX - | cut -f 1 -d '|' | lam -s "${PORTSDIR}/" - | xargs rm -rf