ports/105835: Use portsnap by default for 'make update'

Erwin Lansing erwin at FreeBSD.org
Wed Nov 29 17:45:07 UTC 2006


MFp4:
Be a bit more userfriendly now portsnap is used by default.
Test that portsnap has created PORTSDIR to make sure that an
unsuspecting user doesn't need to fetch 45Mb only to be told
afterwards that portsnap can't run anyway. Print a helpful
text instead to tell the user to run 'portsnap fetch extract'
by hand or use another way to update.

New diff against cvs:

--- /usr/ports/Makefile	Sat Feb 11 03:26:30 2006
+++ Makefile	Wed Nov 29 18:39:18 2006
@@ -146,13 +146,7 @@
 SUPFLAGS+=	-h ${SUPHOST}
 .endif
 update:
-.if defined(PORTSNAP_UPDATE)
-	@echo "--------------------------------------------------------------"
-	@echo ">>> Running ${PORTSNAP}"
-	@echo "--------------------------------------------------------------"
-	@${PORTSNAP} ${PORTSNAP_FLAGS} fetch
-	@${PORTSNAP} ${PORTSNAP_FLAGS} update
-.elif defined(SUP_UPDATE) && defined(PORTSSUPFILE)
+.if defined(SUP_UPDATE) && defined(PORTSSUPFILE)
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Running ${SUP}"
 	@echo "--------------------------------------------------------------"
@@ -166,5 +160,17 @@
 	@${ECHO_MSG} "Error: Please define PORTSSUPFILE before doing make update."
 	@exit 1
 .else
-	@${ECHO_MSG} "Error: Please define either PORTSNAP_UPDATE, SUP_UPDATE, or CVS_UPDATE first."
+	@echo "--------------------------------------------------------------"
+	@echo ">>> Running ${PORTSNAP}"
+	@echo "--------------------------------------------------------------"
+.if !exists(${PORTSDIR}/.portsnap.INDEX)
+	@echo "Error: 'make update' uses portsnap(8) by default and"
+	@echo "needs ${PORTSDIR} to be created by portsnap on its first run."
+	@echo "Please run 'portsnap fetch extract' first."
+	@echo "You can also define SUP_UPDATE and PORTSSUPFILE to use csup(1)"
+	@echo "or CVS_UPDATE to use cvs(1) for updating."
+.else
+	@${PORTSNAP} ${PORTSNAP_FLAGS} fetch
+	@${PORTSNAP} ${PORTSNAP_FLAGS} update
+.endif
 .endif




More information about the freebsd-ports-bugs mailing list