Bug 190716

Summary: update www/mod_authnz_crowd to be staged
Product: Ports & Packages Reporter: Vick Khera <vivek>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: miwi, rakuco
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch as attachment
none
revised patch
none
revised patch as per discussion vivek: maintainer-approval+

Description Vick Khera 2014-06-06 15:37:24 UTC
this updates the port to be staged. i'm not sure if bumping the portrevision
is correct, as nothing about the actual software changed.

Fix:
diff -Nru mod_authnz_crowd.old/Makefile mod_authnz_crowd/Makefile
--- mod_authnz_crowd.old/Makefile	2014-04-16 14:28:47.000000000 -0400
+++ mod_authnz_crowd/Makefile	2014-06-06 11:22:25.550288436 -0400
@@ -3,7 +3,7 @@
 
 PORTNAME=	mod_authnz_crowd
 PORTVERSION=	2.2.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	www
 MASTER_SITES=	http://downloads.atlassian.com/software/crowd/downloads/cwdapache/
 DIST_SUBDIR=	apache2
@@ -16,7 +16,8 @@
 LIB_DEPENDS=	libsvn_client-1.so:${PORTSDIR}/devel/subversion \
 		libcurl.so:${PORTSDIR}/ftp/curl
 
-USE_AUTOTOOLS=	autoconf:env automake:env libtool:env
+USE_AUTOTOOLS=	autoconf:env automake:env
+USES=		libtool
 GNU_CONFIGURE=	yes
 USE_GNOME=	libxml2
 USE_GCC=	any
@@ -35,12 +36,17 @@
 
 LDFLAGS+=	-L${PREFIX}/lib
 
-NO_STAGE=	yes
+post-patch:
+	${REINPLACE_CMD} -e 's|@APXS_STAGE@|-S LIBEXECDIR=${STAGEDIR}${PREFIX}/${APACHEMODDIR}|' \
+		${WRKSRC}/src/Makefile.am
+
+pre-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEMODDIR}
+	@${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes
+
+
 post-install:
 	${INSTALL_DATA} ${WRKDIR}/zzz_authnz_crowd.conf \
-		${PREFIX}/${APACHEETCDIR}/Includes/
-	@${ECHO_CMD}
-	@${CAT} ${PKGMESSAGE}
-	@${ECHO_CMD}
+		${STAGEDIR}${PREFIX}/${APACHEETCDIR}/Includes/
 
 .include <bsd.port.mk>
diff -Nru mod_authnz_crowd.old/files/patch-src__Makefile.am mod_authnz_crowd/files/patch-src__Makefile.am
--- mod_authnz_crowd.old/files/patch-src__Makefile.am	2014-01-14 15:31:13.000000000 -0500
+++ mod_authnz_crowd/files/patch-src__Makefile.am	2014-06-06 11:22:06.693288655 -0400
@@ -24,6 +24,6 @@
 -	if [ -e /etc/apache2/mods-enabled/dav_svn.load ]; then mv /etc/apache2/mods-enabled/dav_svn.load /etc/apache2/mods-enabled/1dav_svn.load; fi
 -	@APACHECTL@ configtest || mv /tmp/httpd.conf.bak @HTTPD_CONF@
 -	@APACHECTL@ graceful
-+	@APXS@ -i mod_authnz_crowd.la
-+	@APXS@ -e -n dav_svn modules/mod_dav_svn.so
-+	@APXS@ -i svn/mod_authz_svn_crowd.la
++	@APXS@ @APXS_STAGE@ -i mod_authnz_crowd.la
++	@APXS@ @APXS_STAGE@ -e -n dav_svn modules/mod_dav_svn.so
++	@APXS@ @APXS_STAGE@ -i svn/mod_authz_svn_crowd.la
Comment 1 Martin Wilke freebsd_committer freebsd_triage 2014-06-15 09:29:57 UTC
Can you please attache a patch? thx
Comment 2 Vick Khera 2014-06-16 15:40:29 UTC
Created attachment 143832 [details]
patch as attachment

Here's the patch as an attachment. It seems the transition from the old PR to bugzilla failed to detect this one.
Comment 3 Vick Khera 2014-06-16 16:50:38 UTC
Created attachment 143833 [details]
revised patch

Here's a revised patch that updates the port to reference the new mod_dav_svn port, so it can be built as a package.
Comment 4 Raphael Kubo da Costa freebsd_committer freebsd_triage 2014-06-20 15:42:16 UTC
The build currently fails because ${LOCALBASE}/${APACHEMODDIR} is not a directory normally looked at for shared libraries, so mod_dav_svn.so is always considered not to be present. How about replacing that with a BUILD_DEPENDS and/or a RUN_DEPENDS?
Comment 5 Vick Khera 2014-06-23 02:09:44 UTC
Could you show me what your failure is? I've been building packages from this patched version for a while now, and it always works. I use poudriere to build the package in a totally clean environment, so I'm fairly confident it does work.

I also don't understand what you mean by adding a build/run depends against this. That directory is exactly where apache looks for its shared modules, and it is the right sentinel file to look for that dependency to be installed. Ie, this apache module depends on the existence of another apache module.

Please clarify so I can make any necessary adjustments you are requesting.
Comment 6 Raphael Kubo da Costa freebsd_committer freebsd_triage 2014-06-23 07:45:31 UTC
(In reply to Vick Khera from comment #5)
> Could you show me what your failure is?

$ ls /usr/local/libexec/apache22/mod_dav_svn.so
/usr/local/libexec/apache22/mod_dav_svn.so
$ svn patch --strip 1 new.diff
$ make clean lib-depends DISTDIR=/tmp
===>  Cleaning for mod_authnz_crowd-2.2.2_2
===>   mod_authnz_crowd-2.2.2_2 depends on shared library: /usr/local/libexec/apache22/mod_dav_svn.so - not found
===>    Verifying for /usr/local/libexec/apache22/mod_dav_svn.so in /usr/ports/www/mod_dav_svn

(starts building mod_dav_svn again, and fails because I'm not root and
it cannot write to /usr/ports)

In poudriere, I get this:

===========================================================================
====>> Recording filesystem state for prebuild... done
=======================<phase: configure      >============================
===>   mod_authnz_crowd-2.2.2_2 depends on file: /usr/local/sbin/apxs - found
===>   mod_authnz_crowd-2.2.2_2 depends on executable: gcc47 - found
===>   mod_authnz_crowd-2.2.2_2 depends on file: /usr/local/bin/as - found
===>   mod_authnz_crowd-2.2.2_2 depends on file: /usr/local/bin/automake-1.14 - found
===>   mod_authnz_crowd-2.2.2_2 depends on file: /usr/local/bin/autoconf-2.69 - found
===>   mod_authnz_crowd-2.2.2_2 depends on package: libtool>=2.4 - found
===>   mod_authnz_crowd-2.2.2_2 depends on file: /usr/local/bin/ccache - found
===>   mod_authnz_crowd-2.2.2_2 depends on shared library: /usr/local/libexec/apache22/mod_dav_svn.so - not found
===>    Verifying for /usr/local/libexec/apache22/mod_dav_svn.so in /usr/ports/www/mod_dav_svn
===>   Installing existing package /packages/All/mod_dav_svn-1.8.9_4.txz
Installing mod_dav_svn-1.8.9_4...mod_dav_svn-1.8.9_4 already installed

Failed to install the following 1 package(s): /packages/All/mod_dav_svn-1.8.9_4.txz
*** Error code 70

> I also don't understand what you mean by adding a build/run depends against
> this. That directory is exactly where apache looks for its shared modules,
> and it is the right sentinel file to look for that dependency to be
> installed. Ie, this apache module depends on the existence of another apache
> module.

I'm talking about how the ports infrastructure determines whether
mod_dav_svn.so is present or not.

From Mk/bsd.ports.mk:
        ${ECHO_MSG}  -n "===>   ${PKGNAME} depends on shared library: $${lib}" ; \
        found=0 ; \
        dirs="${LIB_DIRS} `${CAT} ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || : `" ; \

None of the entries in ${LOCALBASE}/libdata/libconfig (or ${LIB_DIRS})
point to /usr/local/libexec/apache22, so mod_dav_svn.so is never found
in the lib-depends target.

This does not happen for build and runtime depends because the check is
different.

While the apache port itself could install something into
${LOCALBASE}/libdata/ldconfig, the easiest fix for this port at least
for now would probably be to replace that LIB_DEPENDS with RUN_DEPENDS
and BUILD_DEPENDS.
Comment 7 Vick Khera 2014-06-24 13:16:33 UTC
Created attachment 144098 [details]
revised patch as per discussion

Here's the patch with the corrections to the dependencies. i tested it building under poudriere for 9.2 and 10.0.
Comment 8 Raphael Kubo da Costa freebsd_committer freebsd_triage 2014-06-25 19:53:32 UTC
The patch introduces a few extra new lines and the RUN_DEPENDS line has a wrong backslash at the end. I'll fix those and land.
Comment 9 Raphael Kubo da Costa freebsd_committer freebsd_triage 2014-06-25 19:55:18 UTC
Committed, thank you.
Comment 10 commit-hook freebsd_committer freebsd_triage 2014-06-25 19:55:51 UTC
A commit references this bug:

Author: rakuco
Date: Wed Jun 25 19:55:04 UTC 2014
New revision: 359297
URL: http://svnweb.freebsd.org/changeset/ports/359297

Log:
  - Support staging.
  - Depend on www/mod_dav_svn so the port can be built as a package.

  PR:		190716
  Submitted by:	Vick Khera <vivek@khera.org> (maintainer)

Changes:
  head/www/mod_authnz_crowd/Makefile
  head/www/mod_authnz_crowd/files/patch-src__Makefile.am