From paulm@inetstat.net  Mon May 12 05:06:39 2014
Return-Path: <paulm@inetstat.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id F1B4D2C4
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 May 2014 05:06:38 +0000 (UTC)
Received: from srv00.inetstat.net (srv00.inetstat.net [91.121.154.174])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "srv00.inetstat.net", Issuer "srv00.inetstat.net" (not verified))
	by mx1.freebsd.org (Postfix) with ESMTPS id 8CE702853
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 May 2014 05:06:37 +0000 (UTC)
Received: from srv00.inetstat.net (localhost [127.0.0.1])
	by srv00.inetstat.net (Postfix) with ESMTP id 9FBF3D78D2
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 May 2014 05:06:28 +0000 (UTC)
Received: from srv00.inetstat.net ([IPv6:::1])
	by srv00.inetstat.net (srv00.inetstat.net [IPv6:::1]) (amavisd-new, port 10026)
	with ESMTP id wa54HfLl-beA; Mon, 12 May 2014 05:06:26 +0000 (UTC)
Received: by srv00.inetstat.net (Postfix, from userid 1001)
	id 34DE6D78D1; Mon, 12 May 2014 05:06:26 +0000 (UTC)
Message-Id: <20140512050626.34DE6D78D1@srv00.inetstat.net>
Date: Mon, 12 May 2014 05:06:26 +0000 (UTC)
From: Paul J Murphy <paul@inetstat.net>
Reply-To: Paul J Murphy <paul@inetstat.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] ports/Mk/Uses/perl.mk: post-stage fails during "port test"
X-Send-Pr-Version: 3.114
X-GNATS-Notify:

>Number:         189694
>Category:       ports
>Synopsis:       [patch] ports/Mk/Uses/perl.mk: post-stage fails during "port test"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    perl
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 12 05:10:00 UTC 2014
>Closed-Date:    Sun May 25 20:58:20 UTC 2014
>Last-Modified:  Sun May 25 21:00:00 UTC 2014
>Originator:     Paul J Murphy
>Release:        FreeBSD 10.0-RELEASE-p2 amd64
>Organization:
iNetStat.net
>Environment:
System: FreeBSD srv00.inetstat.net 10.0-RELEASE-p2 FreeBSD 10.0-RELEASE-p2 #0 r265140: Wed Apr 30 12:18:59 UTC 2014 root@srv00.inetstat.net:/usr/obj/usr/src/sys/GENERIC amd64

>Description:
The problem is triggered by "port test" doing builds with LOCALBASE != PREFIX.  perl.mk's post-stage is using:

    ${STAGEDIR}${SITE_PERL}/...

which expands to:

    ${STAGEDIR}${LOCALBASE}/${SITE_PERL_REL}/...

So, either ${SITE_PERL} is incorrectly defined for the context, or post-stage is using the wrong macros for its path.  My hunch is that it's the latter, and that the correct path to use in post-stage is:

    ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/...

Someone more familiar with the dark corners of the build system needs to spend at least 10 minutes considering whether my hunch is probably good, or whether it's actually SITE_PERL that's incorrectly defined in perl.mk, or something else.

The symptoms are the "*** Error code 1 (ignored) just before compress-man, then problems with a .packlist in stage-qa, as the previous error was post-stage failing to run.  Use "make -dl stage-qa" and "make -dl post-stage" to see what's going on around the point of failure.

--- port test output begins here ---
...
install  -o root -g wheel -m 555 /usr/ports/mail/p5-Mail-DKIM/work/Mail-DKIM-0.40/scripts/dkim*.pl /usr/ports/mail/p5-Mail-DKIM/work/stage/tmp/p5-Mail-DKIM-0.40_1/bin
*** Error code 1 (ignored)
====> Compressing man pages (compress-man)
====> Running Q/A tests (stage-qa)
Error: 'lib/perl5/site_perl/5.18/mach/auto/Mail/DKIM/.packlist' is referring to /usr/ports/mail/p5-Mail-DKIM/work/stage
*** Error code 1

Stop.
make: stopped in /usr/ports/mail/p5-Mail-DKIM
===> Error running make stage
===> Cleaning up
--- port test output ends here ---

>How-To-Repeat:
# FreeBSD 10.0-RELEASE-p2 system with SVN /usr/ports
svn update /usr/ports
# p5-Mail-DKIM is just an example, it hits other perl modules too
cd /usr/ports/mail/p5-Mail-DKIM
make clean
port test

# Use this to examine what's going on in post-stage and spot the use of
# .../work/stage/usr/local/... when the "port test" build has gone into
# .../work/stage/tmp/p5-Mail-DKIM-0.40_1 (i.e. work/stage/PREFIX)
make -dl post-stage PREFIX=/tmp/p5-Mail-DKIM-0.40_1

>Fix:

This patch fixed it for me, with the following caveats:

1) I've done very little testing to ensure that this doesn't horribly break the build system in other ways.
2) I'm not an expert on the inner workings of the build system, so this should be reviewed carefully by someone who is.

--- perl5.mk.diff begins here ---
Index: ports/Mk/Uses/perl5.mk
===================================================================
--- ports/Mk/Uses/perl5.mk	(revision 353739)
+++ ports/Mk/Uses/perl5.mk	(working copy)
@@ -256,7 +256,7 @@
 # TODO: change to ${_USE_PERL5:Mconfigure} when M::B creates .packlist
 .if ${USE_PERL5:Mconfigure} || ${USE_PERL5:Mmodbuildtiny}
 post-stage::
-	-@[ -d ${STAGEDIR}${SITE_PERL}/${PERL_ARCH}/auto ] && ${FIND} ${STAGEDIR}${SITE_PERL}/${PERL_ARCH}/auto -name .packlist -exec ${SED} -i '' 's|^${STAGEDIR}||' '{}' \;
+	-@[ -d ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto ] && ${FIND} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto -name .packlist -exec ${SED} -i '' 's|^${STAGEDIR}||' '{}' \;
 .endif
 
 .if !target(regression-test)
--- perl5.mk.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon May 12 05:10:04 UTC 2014 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=189694 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: Cc: bug-followup@FreeBSD.org
Subject: Re: ports/189694: [patch] ports/Mk/Uses/perl.mk: post-stage fails during "port test"
Date: Mon, 12 May 2014 05:10:03 UT

 Maintainer of Mk/Uses,
 
 Please note that PR ports/189694 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/189694
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org
Responsible-Changed-From-To: freebsd-ports-bugs->perl 
Responsible-Changed-By: miwi 
Responsible-Changed-When: Sun May 25 10:35:59 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=189694 
State-Changed-From-To: feedback->closed 
State-Changed-By: mat 
State-Changed-When: Sun May 25 20:58:19 UTC 2014 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=189694 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/189694: commit references a PR
Date: Sun, 25 May 2014 20:58:19 +0000 (UTC)

 Author: mat
 Date: Sun May 25 20:58:14 2014
 New Revision: 355267
 URL: http://svnweb.freebsd.org/changeset/ports/355267
 QAT: https://qat.redports.org/buildarchive/r355267/
 
 Log:
   SITE_PERL is relative to LOCALBASE, switch to PREFIX for the post-stage fixups.
   
   PR:		ports/189694
   Submitted by:	Paul J Murphy
   Sponsored by:	Absolight
 
 Modified:
   head/Mk/Uses/perl5.mk
 
 Modified: head/Mk/Uses/perl5.mk
 ==============================================================================
 --- head/Mk/Uses/perl5.mk	Sun May 25 20:07:24 2014	(r355266)
 +++ head/Mk/Uses/perl5.mk	Sun May 25 20:58:14 2014	(r355267)
 @@ -258,7 +258,7 @@ do-install:
  # TODO: change to ${_USE_PERL5:Mconfigure} when M::B creates .packlist
  .if ${USE_PERL5:Mconfigure} || ${USE_PERL5:Mmodbuildtiny} || ${USE_PERL5:Mfixpacklist}
  fix-packlist::
 -	-@[ -d ${STAGEDIR}${SITE_PERL}/${PERL_ARCH}/auto ] && ${FIND} ${STAGEDIR}${SITE_PERL}/${PERL_ARCH}/auto -name .packlist -exec ${SED} -i '' 's|^${STAGEDIR}||' '{}' \;
 +	-@[ -d ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto ] && ${FIND} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto -name .packlist -exec ${SED} -i '' 's|^${STAGEDIR}||' '{}' \;
  .endif
  
  .if !target(regression-test)
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
