On Thu, 2016-04-14 at 14:58 -0400, Bryan C. Everly wrote:
> Kurt,
>
> Thanks for the feedback on this. Your suggestions were great - now
> that I've implemented them it has dramatically simplified things.
>
> I have attached the sample port for snakeyaml that uses the new
> infrastructure as well as a new diff for the java.port.mk file below.
>
> I'd appreciate any further feedback and, if all is good, a commit from
> some kind soul. :-)
>
Hi Bryan,
Thanks for incorporating the feedback so far. I received some additional
feedback from other devs about the current approach. Could you explore
the following ideas?
We need a directory to point maven.repo.local at that contains the
dependencies for the port. It should be possible to set all maven ports
to use the same DIST_SUBDIR. This would reduce bloat by not having to
have each maven port have custom built dependencies distfile that might
have duplicate data in it. See comments inline below:
> Index: java.port.mk
> ===================================================================
> RCS file: /home/cvs/ports/devel/jdk/java.port.mk,v
> retrieving revision 1.34
> diff -u -p -r1.34 java.port.mk
> --- java.port.mk 17 Jun 2015 17:16:04 -0000 1.34
> +++ java.port.mk 14 Apr 2016 18:54:07 -0000
> @@ -110,6 +110,33 @@ do-build:
> . endif
> .endif
>
> +# Allow ports that use devel/maven to set MODJAVA_BUILD=maven
> +# Since maven downloads dependencies at build-time (which is not allowed
> +# in our production builds because we turn on networking support only
> +# for the fetch phase of the build), maven's offline repository support
> +# is used and the port maintainer is expected to supply an archive that
> +# holds the complete set of dependencies needed to build the port.
> +.if defined(MODJAVA_BUILD) && ${MODJAVA_BUILD:L} == "maven"
> +BUILD_DEPENDS += devel/maven
> + MODJAVA_BUILD_DEP_SITE ?=
This var looks unused. Kill it perhaps.
> + MODJAVA_BUILD_TARGET_NAME ?= package
> + MODJAVA_BUILD_FILE ?= pom.xml
> + MODJAVA_BUILD_DIR ?= ${WRKSRC}
> + MODJAVA_BUILD_ARGS ?=
DIST_SUBDIR ?= maven
> + MODJAVA_BUILD_DEP_DIR ?=
Change to MODJAVA_BUILD_DEP_DIR ?= ${FULLDISTDIR}
> +
> +MODJAVA_BUILD_TARGET = \
> + cd ${MODJAVA_BUILD_DIR} && \
> + ${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/mvn \
> + -f ${MODJAVA_BUILD_FILE} \
> + -Dmaven.repo.local="${MODJAVA_BUILD_DEP_DIR}" \
> + -o ${MODJAVA_BUILD_ARGS} ${MODJAVA_BUILD_TARGET_NAME}
> +. if !target(do-build)
> +do-build:
> + ${MODJAVA_BUILD_TARGET}
> +. endif
> +.endif
> +
> # Convenience variables.
> # Ports that install .jar files for public use (ie, in ${MODJAVA_JAR_DIR})
> # please install unversioned .jar files. If a port installs
Next you would adjust your port, snakeyaml, to have a separate distfile
for each dependency with :0,1,2 and corresponding MASTER_SITES0,1,2 for
download locations. By default ports infrastructure would attempt to
extract all distfiles when building, so you would need to use
EXTRACT_ONLY set to the snakeyaml distfile to have only the snakeyaml
distfile extracted.
If this set of changes works out, I think it will improve the maven
built ports by reducing downloads and also gets rid of the requirement
that a porter has to maintain a separate distfile for each maven port.
-Kurt