ports/61351: [patch] make ports framework more robust w/rt make index

Mark Linimon linimon at lonesome.com
Wed Jan 14 07:50:14 UTC 2004


>Number:         61351
>Category:       ports
>Synopsis:       [patch] make ports framework more robust w/rt make index
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 13 23:50:08 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Mark Linimon
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
Lonesome Dove Computing Services
>Environment:
System: FreeBSD lonesome.lonesome.com 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #0: Fri Sep 5 01:19:33 CDT 2003 linimon at lonesome.lonesome.com:/usr/src/sys/compile/MULTIMEDIA_DEBUG i386
>Description:
	Recently on my ports monitoring machine, I encountered a
	problem where "make index" would not complete.  (Actually,
	I use its per-port predecessor "make describe", but that's
	irrelevant to this issue).  The problem was that recently
	changes have crept in to ports/bsd.*.mk that include static
	(non-scoped) error exits.  (Think of these as "assert
	failures", if you will).

	In particular, for one port, the fact that I had openssl
	installed from ports was enough to cause its "make describe"
	to fail; in fact, even such a simple operation as
	"make -V PORTNAME" would fail, because the Makefile
	basically refused to run.

	IMHO this is totally wrong.  Nothing in a port Makefile
	should be able to derail either "make index" or especially
	"make -V <foo>".

	The problem is the very liberal use of .BEGIN statements
	in various pieces of bsd.*.mk.
>How-To-Repeat:
	USE_OPENSSL_BASE=YES;export USE_OPENSSL_BASE

	and then any one of the following:

	cd /usr/ports/net/SSLtelnet; make describe
	cd /usr/ports/net; make describe
	cd /usr/ports; make index
>Fix:
	I have (with a great deal of trepidation) tried to break
	out the various assertions into various new targets.  Few
	ports trigger these things, so the performance impact
	_should_ be minimal.  If nothing else, the code is now
	much clearer to read, always an advantage in that particular
	code-nest.

	A side-effect of this is to introduce some new targets that
	can replace the use of the "pre-everything" target.  IMHO, this
	target has become overloaded with about 10 different meanings
	and its use in the ports collection is inconsistent.  This
	patch will allow a way to enforce such consistency; however,
	it does not in itself attempt to patch the various ports.

	Note: I have run numerous regression tests to try to ensure
	that I've exercised all the changes I've made.  I believe
	that I have tested almost all of them, but what I have so
	far failed to trigger, at all, are:

	- tests in bsd.port.mk for multiple inclusion of bsd.port.pre.mk
	- the test in bsd.port.mk for the antique MD5 layout
	- the test in bsd.port.mk for the wrong perl binary in base
	- the tests in bsd.port.mk for bogus tokens in group definitions
	- tests in bsd.java.mk for various bogus variables

	I am continuing to try to test for these cases, but they are
	quite opaque.  Any help especially for java would be appreciated.

	Lastly, the asserts' error messages were too terse, so I have
	made them a little bit more readable.

	Final note: this patch has the potential to be disruptive, so
	it should be evaluated _carefully_ by those most familiar with
	bsd.port.mk, and only then attempted on e.g. an exp-4 build.

Index: bsd.emacs.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.emacs.mk,v
retrieving revision 1.28
diff -r1.28 bsd.emacs.mk
201,202c201,202
< .BEGIN:
< 	@${ECHO} "Error: Bad value of EMACS_PORT_NAME: ${EMACS_PORT_NAME}."
---
> check-makevars::
> 	@${ECHO} "Makefile error: Bad value of EMACS_PORT_NAME: ${EMACS_PORT_NAME}."
Index: bsd.java.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.java.mk,v
retrieving revision 1.36
diff -r1.36 bsd.java.mk
434,435c434,435
< .BEGIN:
< 	@${ECHO} "${PKGNAME}: \"${USE_JAVA}\" is not a valid value for USE_JAVA. It should be one of: ${_JAVA_VERSIONS} (with an optional \"+\" suffix.)";
---
> check-makevers::
> 	@${ECHO} "${PKGNAME}: Makefile error: \"${USE_JAVA}\" is not a valid value for USE_JAVA. It should be one of: ${_JAVA_VERSIONS} (with an optional \"+\" suffix.)";
466,467c466,467
< .BEGIN:
< 	@${ECHO} "${PKGNAME}: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
---
> check-makevers::
> 	@${ECHO} "${PKGNAME}: Makefile error: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
521,522c521,522
< .BEGIN:
< 	@${ECHO} "${PKGNAME}: NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time.";
---
> check-makevers::
> 	@${ECHO} "${PKGNAME}: Makefile error: NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time.";
Index: bsd.openssl.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.openssl.mk,v
retrieving revision 1.11
diff -r1.11 bsd.openssl.mk
65,66c65,66
< .BEGIN:
< 	@${ECHO_CMD} "This port requires the OpenSSL library, which is part of"
---
> check-depends::
> 	@${ECHO_CMD} "Dependency error: this port requires the OpenSSL library, which is part of"
75,76c75,76
< .BEGIN:
< 	@${ECHO_CMD} "This port wants the OpenSSL library from the FreeBSD"
---
> check-depends::
> 	@${ECHO_CMD} "Dependency error: this port wants the OpenSSL library from the FreeBSD"
78c78
< 	@${ECHO_CMD} "Version is installed by a port."
---
> 	@${ECHO_CMD} "version is installed by a port."
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.474
diff -r1.474 bsd.port.mk
643c643,645
< # Default sequence for "all" is:  fetch checksum extract patch configure build
---
> # Default sequence for "all" is:
> #
> #     sanity-check fetch checksum extract patch configure build
827,828c829,830
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: You cannot include bsd.port[.pre].mk twice"
---
> check-makefile::
> 	@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.pre].mk twice"
957a960
> # check for old, crufty, makefile types, part 1:
959,960c962,963
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
---
> check-makefile::
> 	@${ECHO_CMD} "Makefile error: you need to define PORTNAME and PORTVERSION instead of PKGNAME."
965a969
> .if defined(PORTVERSION)
968a973
> .endif
979a985,987
> # check for old, crufty, makefile types, part 2.  The "else" case
> # should have been handled in part 1, above.
> .if !defined(PKGNAME)
980a989
> .endif
1013,1014c1022,1023
< pre-everything::
< 	@${ECHO_CMD} "Error: your port uses an old layout.  Please update it to match this bsd.port.mk.  If you have updated your ports collection via cvsup and are still getting this error, see Q12 and Q13 in the cvsup FAQ on http://www.polstra.com for further information."
---
> check-makefile::
> 	@${ECHO_CMD} "Makefile error: your port uses an old layout.  Please update it to match this bsd.port.mk.  If you have updated your ports collection via cvsup and are still getting this error, see Q12 and Q13 in the cvsup FAQ on http://www.polstra.com for further information."
1161,1162c1170,1171
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: You cannot include bsd.port[.post].mk twice"
---
> check-makefile::
> 	@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.post].mk twice"
1199,1200c1208,1209
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: Value of MANCOMPRESSED (is \"${MANCOMPRESSED}\") can only be \"yes\", \"no\" or \"maybe\"".
---
> check-makevars::
> 	@${ECHO_CMD} "${PKGNAME}: Makefile error: value of MANCOMPRESSED (is \"${MANCOMPRESSED}\") can only be \"yes\", \"no\" or \"maybe\"".
1611,1612c1620,1621
< pre-everything::
< 	@${ECHO_CMD} "Error: you don't have the right version of perl in /usr/bin."
---
> check-depends::
> 	@${ECHO_CMD} "Dependency error: you don't have the right version of perl in /usr/bin."
1955,1956c1964,1965
< .BEGIN:
< 		@${ECHO_CMD} 'There is no COMMENT variable defined'
---
> check-makevars::
> 		@${ECHO_CMD} 'Makefile error: there is no COMMENT variable defined'
1961,1962c1970,1971
< .BEGIN:
< 		@${ECHO_CMD} 'There is a COMMENTFILE in this port.'
---
> check-makevars::
> 		@${ECHO_CMD} 'Makefile error: There is a COMMENTFILE in this port.'
1989,1990c1998,1999
< .BEGIN:
< 				@${ECHO_CMD} "The words all, ALL and default are reserved and cannot be"
---
> check-makevars::
> 				@${ECHO_CMD} "Makefile error: the words all, ALL and default are reserved and cannot be"
2006c2015
< .BEGIN:
---
> check-makevars::
2028,2029c2037,2038
< .BEGIN:
< 				@${ECHO_CMD} "The words all, ALL and default are reserved and cannot be"
---
> check-makevars::
> 				@${ECHO_CMD} "Makefile error: the words all, ALL and default are reserved and cannot be"
2049,2050c2058,2059
< .BEGIN:
< 				@${ECHO_CMD} "The words all, ALL and default are reserved and cannot be"
---
> check-makevars::
> 				@${ECHO_CMD} "Makefile error: the words all, ALL and default are reserved and cannot be"
2372a2382,2386
> .if !target(check-makefile)
> check-makefile:
> 	@${DO_NADA}
> .endif
> 
2374,2375c2388,2389
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: CATEGORIES is mandatory."
---
> check-categories:
> 	@${ECHO_CMD} "${PKGNAME}: Makefile error: CATEGORIES is mandatory."
2399c2413
< 		${ECHO_CMD} "${PKGNAME}: category ${cat} not in list of valid categories."; \
---
> 		${ECHO_CMD} "${PKGNAME}: Makefile error: category ${cat} not in list of valid categories."; \
2404a2419,2428
> .if !target(check-makevars)
> check-makevars:
> 	@${DO_NADA}
> .endif
> 
> .if !target(check-depends)
> check-depends:
> 	@${DO_NADA}
> .endif
> 
2478,2479c2502,2503
< .BEGIN:
< 	@${ECHO_CMD} "${PKGNAME}: Unable to parse MLINKS."
---
> check-makevars::
> 	@${ECHO_CMD} "${PKGNAME}: Makefile error: unable to parse MLINKS."
2666c2690
< .for target in fetch checksum extract patch configure all build install reinstall package
---
> .for target in sanity-check fetch checksum extract patch configure all build install reinstall package
2793a2818,2819
> # XXX MCL suggests deprecating this in favor of something
> # less likely to be abused by overloading
2794a2821,2823
> 	@${DO_NADA}
> 
> buildanyway-message:
2799a2829,2830
> 
> options-message:
3417c3448,3452
< _FETCH_SEQ=		pre-everything fetch-depends pre-fetch pre-fetch-script \
---
> _SANITY_SEQ=	pre-everything check-makefile check-categories \
> 				check-makevars check-depends \
> 				buildanyway-message options-message
> _FETCH_DEP=		check-sanity
> _FETCH_SEQ=		fetch-depends pre-fetch pre-fetch-script \
3434c3469
< _INSTALL_SEQ=	install-message check-categories check-conflicts \
---
> _INSTALL_SEQ=	install-message check-conflicts \
3444a3480,3484
> .if !target(check-sanity)
> check-sanity: ${_SANITY_SEQ}
> .endif
> 
> # XXX MCL might need to move in loop below?
3446c3486
< fetch: ${_FETCH_SEQ}
---
> fetch: ${_FETCH_DEP} ${_FETCH_SEQ}
3495c3535,3536
< .ORDER: ${_FETCH_SEQ}
---
> .ORDER: ${_SANITY_SEQ}
> .ORDER: ${_FETCH_DEP} ${_FETCH_SEQ}
3519c3560
< .for name in fetch extract patch configure build install package
---
> .for name in sanity-check fetch extract patch configure build install package
Index: bsd.python.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.python.mk,v
retrieving revision 1.42
diff -r1.42 bsd.python.mk
253,254c253,254
< .BEGIN:
< 	@${ECHO} "Error: bad value for PYTHON_VERSION: ${PYTHON_VERSION}."
---
> check-makevars::
> 	@${ECHO} "Makefile error: bad value for PYTHON_VERSION: ${PYTHON_VERSION}."
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list