From eikemeier@fillmore-labs.com  Sun Nov 23 15:31:55 2003
Return-Path: <eikemeier@fillmore-labs.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E7DE916A4CE
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sun, 23 Nov 2003 15:31:54 -0800 (PST)
Received: from mx2.fillmore-labs.com (lima.fillmore-labs.com [62.138.193.83])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B2CE343FEC
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sun, 23 Nov 2003 15:31:53 -0800 (PST)
	(envelope-from eikemeier@fillmore-labs.com)
Received: from pd958ac68.dip.t-dialin.net
	([217.88.172.104] helo=fillmore-labs.com ident=tldf49fkbck4pmvx)
	by mx2.fillmore-labs.com with asmtp (TLSv1:AES256-SHA:256)
	(Exim 4.24; FreeBSD 4.9)
	id 1AO3hn-000JHl-OQ; Mon, 24 Nov 2003 00:31:52 +0100
Message-Id: <3FC14366.3000907@fillmore-labs.com>
Date: Mon, 24 Nov 2003 00:31:50 +0100
From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: Kris Kennaway <kris@obsecurity.org>
Subject: [PATCH] bsd.port.subdir.mk: more informative INDEX breakage

>Number:         59626
>Category:       ports
>Synopsis:       [PATCH] bsd.port.subdir.mk: more informative INDEX breakage
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 23 15:40:13 PST 2003
>Closed-Date:    Tue Jan 20 11:17:21 PST 2004
>Last-Modified:  Tue Jan 20 11:17:21 PST 2004
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

The `INDEX build failed' reminder mails are helpful but lack the basic 
information which port causes the failure, causing a major guesswork based on 
the most recent updates which port caused the failure. This is a great 
opportunity to learn about the structure of the FreeBSD ports tree but delays 
fixing the error, which can sometimes be tedious.

>How-To-Repeat:

Insert
XXX!=		/nonexistent
in line 7 of arabic/openoffice-1.1/Makefile

and do a `make index >/dev/null'. You'll get:

/nonexistent: not found
"Makefile", line 7: warning: "/nonexistent" returned non-zero status

>Fix:

This patch collects error output from `make describe' in a temporary file and
prefixes that with the ports origin if not empty, so you'll get:

===> arabic/openoffice-1.1 failed:
/nonexistent: not found
"Makefile", line 7: warning: "/nonexistent" returned non-zero status

--- bsd.port.subdir.mk.patch begins here ---
diff -u Mk/bsd.port.subdir.mk.orig Mk/bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk.orig	7 Nov 2003 08:51:46 -0000
+++ Mk/bsd.port.subdir.mk	23 Nov 2003 17:01:37 -0000
@@ -83,7 +88,6 @@
 TARGETS+=	deinstall
 TARGETS+=	depend
 TARGETS+=	depends
-TARGETS+=	describe
 TARGETS+=	distclean
 TARGETS+=	extract
 TARGETS+=	fetch
@@ -108,7 +112,7 @@
 
 .if defined(SUBDIR) && !empty(SUBDIR)
 
-.for __target in ${TARGETS} checksubdirs readmes
+.for __target in ${TARGETS} checksubdirs describe readmes
 ${SUBDIR:S/^/_/:S/$/.${__target}/}: _SUBDIRUSE
 .endfor
 
@@ -184,6 +188,43 @@
 	    ${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
 	  fi \
 	done
+.endif
+
+.if !target(describe)
+.if defined(PORTSTOP)
+describe: ${SUBDIR:S/^/_/:S/$/.describe/}
+.else
+describe:
+	@TMPFILE=`mktemp -q /tmp/describe.XXXXXX` || exit 1; \
+	for sub in ${SUBDIR}; do \
+	OK=""; \
+	for dud in $$DUDS; do \
+		if [ $${dud} = $$sub ]; then \
+			OK="false"; \
+			${ECHO_MSG} "===> ${DIRPRFX}$$sub skipped"; \
+		fi; \
+	done; \
+	if test -d ${.CURDIR}/$${sub}.${MACHINE_ARCH}; then \
+		edir=$${sub}.${MACHINE_ARCH}; \
+	elif test -d ${.CURDIR}/$${sub}; then \
+		edir=$${sub}; \
+	else \
+		OK="false"; \
+		${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
+	fi; \
+	if [ "$$OK" = "" ]; then \
+		${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
+		cd ${.CURDIR}/$${edir}; \
+		${MAKE} -B describe 2>$${TMPFILE}; \
+		if [ -s $${TMPFILE} ]; then \
+			echo "===> ${DIRPRFX}$${sub} failed:" >&2; \
+			cat $${TMPFILE} >&2; \
+			echo -n >$${TMPFILE}; \
+		fi; \
+	fi; \
+	done; \
+	rm -f $${TMPFILE}
+.endif
 .endif
 
 .if !target(readmes)
--- bsd.port.subdir.mk.patch ends here ---

If this patch finds consent it can probably reworked it to reduce code 
duplication.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: eik 
Responsible-Changed-When: Mon Nov 24 02:21:01 CET 2003 
Responsible-Changed-Why:  
portmgr territory: deals with bsd.port.subdir.mk 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59626 
State-Changed-From-To: open->analyzed 
State-Changed-By: marcus 
State-Changed-When: Tue Jan 13 20:35:09 PST 2004 
State-Changed-Why:  
This patch is currently being tested on bento. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59626 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Tue Jan 20 11:17:11 PST 2004 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59626 
>Unformatted:
