Sorry for the delay,

On 2023/03/07 21:20:59 +0100, Volker Schlecht <openbsd-po...@schlecht.dev> 
wrote:
> On 3/7/23 11:26, Omar Polo wrote:
> > Yeah, it should help.  I suspect most upstream will just use `rebar3'.
> > Will test this later when i'll get the time to look at the erlang
> > update, but it's ok op@ if someone wants to go ahead with it in the
> > meantime (provided it doesn't break other ports.)
> 
> Would you be willing to give the attached diff to erlang.port.mk a shot? 
> That would enable us to bundle Erlang dependencies much like we do for 
> Go, Rust etc. if needed for i.e. testing.

I like it!

> It doesn't cause any fallout for net/rabbitmq, lang/elixir, devel/rebar3 
> (from which it was largely ripped anyway).

Yep; rebuilt all consumers just in case and can confirm.  Would be
nice to replace the manual handling in devel/rebar3 with this eventually.

> I'm attaching a version of the lang/lfe that builds and tests fine with 
> it ...

builds and tests runs fine!  Still ok op@ to import (given that we're
fine with the timing wrt 7.3)

> Index: erlang.port.mk
> ===================================================================
> RCS file: /cvs/ports/lang/erlang/erlang.port.mk,v
> retrieving revision 1.31
> diff -u -p -r1.31 erlang.port.mk
> --- erlang.port.mk    16 Jan 2023 18:27:29 -0000      1.31
> +++ erlang.port.mk    7 Mar 2023 20:08:46 -0000
> @@ -42,7 +42,7 @@ MODERL_BUILD_DEPENDS +=     devel/rebar3
>  REBAR_BIN ?=         ${LOCALBASE}/bin/rebar3-${MODERL_VERSION}
>  # Make sure rebar gets called as 'rebar3', otherwise escript tries to call 
> the
>  # binary name (e.g. rebar3-25) as the script entrypoint.
> -_MODERL_LINKS +=     rebar3-${MODERL_VERSION} rebar
> +_MODERL_LINKS +=     rebar3-${MODERL_VERSION} rebar3
>  .endif

I'd commit this

>  # Append the flavor to all the Erlang dependencies
> @@ -115,20 +115,44 @@ pre-configure:
>  .endif
>  .endif
>  
> -.if ${CONFIGURE_STYLE:L} == "rebar" || ${CONFIGURE_STYLE:L} == "rebar3"
> +.if ${CONFIGURE_STYLE:L} == "rebar3"

and this separatedly from the rest.  These two bits are just cleaning.
No port has CONFIGURE_STYLE=rebar and noone seems to use `rebar'.

>  # Some modules bundle their own rebar escript, force them to use the system
>  # rebar instead.

How much of this is still true?  Only lang/elixir and the proposed
lang/lfe have CONFIGURE_STYLE=rebar3 and none provides this rebar3
script.  Could be gc'd?  How much is used in the erlang community?

> -# While here, remove the deps{} block from rebar.config, we cannot download
> -# dependencies on the fly (blocked by systrace) and it obfuscates dependency
> -# management from the ports Makefile.

(rip systrace)

but what's the impact of the change?  If an update grows more
dependencies rebar will still try to fetch them at build time?  Isn't
it better to keep the deps block remvoal (which I guess triggers an
error during the build)?

>  .  if ! target(pre-build)
>  pre-build:
> -     @cp -f ${REBAR_BIN} ${WRKSRC}/rebar
> -     @perl -pi -e 'BEGIN{undef $$/;} s/{deps,.*?]}.//smg' 
> ${WRKSRC}/rebar.config
> +     @cp -f ${REBAR_BIN} ${WRKSRC}/rebar3
>  .  endif
>  .endif
>  
> -# Regression test handing:
> +# Add possibility to include additional build or test dependencies from 
> +# https://hex.pm. Shamelessly ripped off from go.port.mk and devel/rebar3.

I'd drop the "Shamelessly" part ;)

> +MASTER_SITE_ATHENS = https://repo.hex.pm/tarballs/
> +
> +MODERL_MASTER_SITEN =        9
> +MASTER_SITES${MODERL_MASTER_SITEN} ?= ${MASTER_SITE_ATHENS}
> +
> +.  for _m _v in ${MODERL_MODULES}
> +MODERL_DISTFILES += ${_m}-${_v}.tar:${MODERL_MASTER_SITEN}
> +.  endfor
> +
> +.  if ! empty(MODERL_MODULES)
> +.    for _m _v in ${MODERL_MODULES}
> +MODERL_SETUP_WORKSPACE += mkdir -p ${WRKDIR}/${_m}; \
> +             tar xf ${FULLDISTDIR}/${_m}-${_v}.tar -C ${WRKDIR}/${_m}; \
> +             mkdir -p ${WRKSRC}/_checkouts/${_m}; \
> +             mkdir -p ${WRKSRC}/_build/default/lib; \
> +             tar xzf ${WRKDIR}/${_m}/contents.tar.gz -C 
> ${WRKSRC}/_checkouts/${_m}; \
> +             cp -r ${WRKSRC}/_checkouts/${_m} ${WRKSRC}/_build/default/lib/;
> +.    endfor
> +MODERLANG_post-extract += ${MODERL_SETUP_WORKSPACE}
> +.  endif
> +
> +
> +.  if defined(MODERL_DISTFILES)
> +DISTFILES += ${MODERL_DISTFILES}
> +.  endif

One last nitpick: I'd stuff the MODERL_DISTFILES in a subdir, much
like we have go_modules/ for go.  See MODGO_DIST_SUBDIR in go.port.mk

> +# Regression test handling:
>  # If nothing is explicitly set, then MODERL_TEST=Yes and default
>  # target 'test' is used. Otherwise, if MODERL_TEST=eunit, then
>  # TEST_TARGET=eunit

Reply via email to