On Mon, May 24, 2021 at 05:07:12PM +0100, Stuart Henderson wrote: > danj pointed out https://ferd.ca/you-ve-got-to-upgrade-rebar3.html; > here's an update for the port to a version which both has a fix for this, > and still supports erlang 21 (3.15.x support OTP 19 to 23; 3.16.x > supports 22 to 24).
Thanks for looking at this. > > while there I fixed the distfile name from the current bare version > number, and got tests to work. > > i think the existing patches to change these ... > > - "$BINDIR/erl" -boot start_clean \ > + "$BINDIR/erl${ERL_VERSION}" -boot start_clean \ > > in relx_get_nodename() etc are incorrect, BINDIR refers to > /usr/local/lib/erlang21/erts-10.2/bin where the files have no version > suffix, so i've dropped those. (of course I've kept the patches for > filenames searched in the default PATH). I'm a bit confused about this. BINDIR can also be the erts/bin directory of a release generated by rebar3/relx, and in those, the erl binary does have the version suffix. I'm not sure how it gets there. I'll look into this more. > > the test suite passes, but i'm not really a user of this, so a > real-world test is probably a good idea. My main use for rebar3 is building current versions of databases/riak (not yet in the ports tree), and last time I tried, it didn't work with newer versions of rebar3. I may be able to find something else. > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/devel/rebar3/Makefile,v > retrieving revision 1.4 > diff -u -p -r1.4 Makefile > --- Makefile 19 Feb 2021 03:58:34 -0000 1.4 > +++ Makefile 24 May 2021 15:43:55 -0000 > @@ -2,24 +2,21 @@ > > COMMENT = Erlang build tool > > -V= 3.13.2 > -PKGNAME= rebar3-${V} > -DISTNAME= ${V} > -CATEGORIES= devel > -HOMEPAGE= https://www.rebar3.org > +GH_ACCOUNT = erlang > +GH_PROJECT = rebar3 > +GH_TAGNAME = 3.15.2 > +CATEGORIES = devel > +HOMEPAGE = https://www.rebar3.org > MAINTAINER = Jonathan Matthew <jmatt...@openbsd.org> > > # APLv2 > -PERMIT_PACKAGE= Yes > +PERMIT_PACKAGE = Yes > > FLAVORS = erlang21 > FLAVOR ?= erlang21 > > -MASTER_SITES = https://github.com/erlang/rebar3/archive/ > MASTER_SITES1 = https://repo.hex.pm/tarballs/ > > -WRKDIST = ${WRKDIR}/rebar3-${V} > - > .if ${FLAVOR:Merlang21} > _EV = ${FLAVOR:C/.*([0-9][0-9]+\$)/\1/} > RUN_DEPENDS = lang/erlang/${_EV} > @@ -28,22 +25,26 @@ ERL_VERSION = ${_EV} > ERRORS += "Invalid FLAVOR set: ${FLAVOR}" > .endif > > -EXTRACT_ONLY = ${V}.tar.gz > +EXTRACT_ONLY = rebar3-${GH_TAGNAME}.tar.gz > > +# certifi held back; >=2.6.0 -> "undefined parse transform 'certifi_pt'" > HEX_MODULES = \ > - bbmustache 1.8.0 \ > - certifi 2.5.1 \ > - cf 0.2.2 \ > - cth_readable 1.4.6 \ > - erlware_commons 1.3.1 \ > + bbmustache 1.12.1 \ > + certifi 2.5.3 \ > + cf 0.3.1 \ > + cth_readable 1.5.1 \ > + erlware_commons 1.5.0 \ > eunit_formatters 0.5.0 \ > - getopt 1.0.1 \ > - parse_trans 3.3.0 \ > + getopt 1.0.2 \ > + parse_trans 3.4.0 \ > providers 1.8.1 \ > - relx 3.33.0 \ > - ssl_verify_fun 1.1.5 > + relx 4.4.0 \ > + ssl_verify_fun 1.1.6 > +# for tests > +HEX_MODULES += \ > + meck 0.8.13 > > -DISTFILES = ${V}.tar.gz > +DISTFILES = rebar3-{}${GH_TAGNAME}.tar.gz > .for _m _v in ${HEX_MODULES} > DISTFILES += ${_m}-${_v}.tar:1 > .endfor > @@ -75,5 +76,11 @@ do-build: > > do-install: > ${INSTALL_SCRIPT} ${WRKSRC}/rebar3 ${PREFIX}/bin/rebar3-${ERL_VERSION} > + > +PORTHOME= ${WRKDIR} > +do-test: > + cd ${WRKSRC} && \ > + ${SETENV} ${ALL_TEST_ENV} ./rebar3 escriptize && \ > + ${SETENV} ${ALL_TEST_ENV} ./rebar3 ct > > .include <bsd.port.mk> > Index: distinfo > =================================================================== > RCS file: /cvs/ports/devel/rebar3/distinfo,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 distinfo > --- distinfo 26 Nov 2020 03:31:56 -0000 1.1.1.1 > +++ distinfo 24 May 2021 15:43:55 -0000 > @@ -1,24 +1,26 @@ > -SHA256 (3.13.2.tar.gz) = 4UzcH1t9Njojip9VX4noeLxPyDbJcFcbQbkO6Uf5FQU= > -SHA256 (bbmustache-1.8.0.tar) = GQ6iIGEovfq/XZIAuN+X9lEdnGKVNlWCjijCvHkWElI= > -SHA256 (certifi-2.5.1.tar) = gFq9l1Ocr4nsbUcyyR5iup2gzaUaxGI4C70o7ml6jEI= > -SHA256 (cf-0.2.2.tar) = SCg7MBm8f61W57IwKKXaTT5s1ZilU6sqmaIVO/XxmyE= > -SHA256 (cth_readable-1.4.6.tar) = > j3mde/1ESr/itMB8yzHFboAEMzXh7Tkzot+6NfjZdSM= > -SHA256 (erlware_commons-1.3.1.tar) = > eq2pPzaNCgQwEi45kxt/tKyelNvwQ83JgK1DMP2c0WY= > +SHA256 (bbmustache-1.12.1.tar) = 9DIHeMMaghoqZk24iUYYq7ecGve798A8cDyIaNm7Cf4= > +SHA256 (certifi-2.5.3.tar) = 7VFqyzkpsQEgip1wAGLVIPOVPaO2uRjYZhBv+pgOHBA= > +SHA256 (cf-0.3.1.tar) = MV6NRH06SwK82/o5etA7u5iKbgqm9E063Q9OPDv5dnI= > +SHA256 (cth_readable-1.5.1.tar) = > aGVBoi7+bKWkGgR7OVFsLdKPs8reXySi8ZFFs5Z/nYA= > +SHA256 (erlware_commons-1.5.0.tar) = > PnxvsrpMKbDdXf6dAxtmRJ4giOzsGoFGW9n94F7X0Ns= > SHA256 (eunit_formatters-0.5.0.tar) = > 1si6ITQklE5uBbvAl8MgAc3Qq+OSXQJFTyKbINaHY8k= > -SHA256 (getopt-1.0.1.tar) = U+Grg7nOtlyWctPno1uAkum9ybPugHIUcaFhwQxZlZw= > -SHA256 (parse_trans-3.3.0.tar) = F+9jq96DetMGgOp/hX3Z587ZR2zdewOUQyr0v8JBuWA= > +SHA256 (getopt-1.0.2.tar) = oAKa6kMi+4KmH2h2ptnGbcmHi2y2H6oT3zGHOE/U6iY= > +SHA256 (meck-0.8.13.tar) = 008BPBVttRrVfMVWiRuXIOahwd9f4uFa+ZnITWzr6xo= > +SHA256 (parse_trans-3.4.0.tar) = +Z42iDC+pEVSIk434ElDpUh08IuFkEhd6NE4MrY6LcM= > SHA256 (providers-1.8.1.tar) = 5FdFrenEdqmkaeoIQOQYqxk2DcRPAaIzME4RikRIa6A= > -SHA256 (relx-3.33.0.tar) = bgRWE5/HC63gxF/4qBl8XoeaV/15L3cfxjK5TFrsHqw= > -SHA256 (ssl_verify_fun-1.1.5.tar) = > ExBNeJfjjtfwRMTelTpsKFl9HJUgdesuMovG1vK/xJY= > -SIZE (3.13.2.tar.gz) = 380862 > -SIZE (bbmustache-1.8.0.tar) = 15872 > -SIZE (certifi-2.5.1.tar) = 133120 > -SIZE (cf-0.2.2.tar) = 10240 > -SIZE (cth_readable-1.4.6.tar) = 18944 > -SIZE (erlware_commons-1.3.1.tar) = 53248 > +SHA256 (rebar3-3.15.2.tar.gz) = Eba+rYNUIaJ24odWJYhYC2OsHI3LDjxR9nSIfkqzlc0= > +SHA256 (relx-4.4.0.tar) = VcDtY7tdVeuYOhnrlNfzB1320Sbb3/QxAqZmCpH86SU= > +SHA256 (ssl_verify_fun-1.1.6.tar) = > vbDSRx9FPIj/OQjnaG+G+b4yfQZcwewW+kVAGX6gRoA= > +SIZE (bbmustache-1.12.1.tar) = 17920 > +SIZE (certifi-2.5.3.tar) = 159232 > +SIZE (cf-0.3.1.tar) = 10240 > +SIZE (cth_readable-1.5.1.tar) = 19968 > +SIZE (erlware_commons-1.5.0.tar) = 53760 > SIZE (eunit_formatters-0.5.0.tar) = 14848 > -SIZE (getopt-1.0.1.tar) = 19456 > -SIZE (parse_trans-3.3.0.tar) = 35840 > +SIZE (getopt-1.0.2.tar) = 19456 > +SIZE (meck-0.8.13.tar) = 34304 > +SIZE (parse_trans-3.4.0.tar) = 36352 > SIZE (providers-1.8.1.tar) = 14336 > -SIZE (relx-3.33.0.tar) = 87552 > -SIZE (ssl_verify_fun-1.1.5.tar) = 17408 > +SIZE (rebar3-3.15.2.tar.gz) = 432659 > +SIZE (relx-4.4.0.tar) = 74240 > +SIZE (ssl_verify_fun-1.1.6.tar) = 14848 > Index: patches/patch-_build_default_lib_relx_priv_templates_bin > =================================================================== > RCS file: > /cvs/ports/devel/rebar3/patches/patch-_build_default_lib_relx_priv_templates_bin,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 patch-_build_default_lib_relx_priv_templates_bin > --- patches/patch-_build_default_lib_relx_priv_templates_bin 26 Nov 2020 > 03:31:56 -0000 1.1.1.1 > +++ patches/patch-_build_default_lib_relx_priv_templates_bin 24 May 2021 > 15:43:55 -0000 > @@ -5,12 +5,12 @@ use versioned erlang binary > Index: _build/default/lib/relx/priv/templates/bin > --- _build/default/lib/relx/priv/templates/bin.orig > +++ _build/default/lib/relx/priv/templates/bin > -@@ -21,7 +21,7 @@ find_erts_dir() { > +@@ -20,7 +20,7 @@ find_erts_dir() { > + if [ -d "$__erts_dir" ]; then > ERTS_DIR="$__erts_dir"; > - ROOTDIR="$RELEASE_ROOT_DIR" > else > -- __erl="$(which erl)" > -+ __erl="$(which erl${ERL_VERSION})" > +- __erl="$(command -v erl)" > ++ __erl="$(command -v erl${ERL_VERSION})" > code="io:format(\"~s\", [code:root_dir()]), halt()." > __erl_root="$("$__erl" -boot no_dot_erlang -noshell -eval "$code")" > ERTS_DIR="$__erl_root/erts-$ERTS_VSN" > Index: patches/patch-_build_default_lib_relx_priv_templates_extended_bin > =================================================================== > RCS file: > /cvs/ports/devel/rebar3/patches/patch-_build_default_lib_relx_priv_templates_extended_bin,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 patch-_build_default_lib_relx_priv_templates_extended_bin > --- patches/patch-_build_default_lib_relx_priv_templates_extended_bin 26 Nov > 2020 03:31:56 -0000 1.1.1.1 > +++ patches/patch-_build_default_lib_relx_priv_templates_extended_bin 24 May > 2021 15:43:55 -0000 > @@ -5,39 +5,12 @@ use versioned erlang binary > Index: _build/default/lib/relx/priv/templates/extended_bin > --- _build/default/lib/relx/priv/templates/extended_bin.orig > +++ _build/default/lib/relx/priv/templates/extended_bin > -@@ -127,7 +127,7 @@ find_erts_dir() { > +@@ -193,7 +193,7 @@ find_erts_dir() { > + if [ -d "$__erts_dir" ]; then > ERTS_DIR="$__erts_dir"; > - ROOTDIR="$RELEASE_ROOT_DIR" > else > -- __erl="$(which erl)" > -+ __erl="$(which erl${ERL_VERSION})" > +- __erl="$(command -v erl)" > ++ __erl="$(command -v erl${ERL_VERSION})" > code="io:format(\"~s\", [code:root_dir()]), halt()." > __erl_root="$("$__erl" -boot no_dot_erlang -sasl errlog_type error > -noshell -eval "$code")" > ERTS_DIR="$__erl_root/erts-$ERTS_VSN" > -@@ -150,7 +150,7 @@ relx_get_pid() { > - relx_get_nodename() { > - id="longname$(relx_gen_id)-${NAME}" > - if [ -z "$COOKIE" ]; then > -- "$BINDIR/erl" -boot start_clean \ > -+ "$BINDIR/erl${ERL_VERSION}" -boot start_clean \ > - -mode interactive \ > - -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \ > - -eval > '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), > io:format("~s~n",[H]), halt()' \ > -@@ -158,7 +158,7 @@ relx_get_nodename() { > - -noshell ${NAME_TYPE} $id > - else > - # running with setcookie prevents a ~/.erlang.cookie from being > created > -- "$BINDIR/erl" -boot start_clean \ > -+ "$BINDIR/erl${ERL_VERSION}" -boot start_clean \ > - -mode interactive \ > - -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \ > - -eval > '[_,H]=re:split(atom_to_list(node()),"@",[unicode,{return,list}]), > io:format("~s~n",[H]), halt()' \ > -@@ -178,7 +178,7 @@ relx_rem_sh() { > - TICKTIME="$(relx_nodetool rpcterms net_kernel get_net_ticktime)" > - > - # Setup remote shell command to control node > -- exec "$BINDIR/erl" "$NAME_TYPE" "$id" -remsh "$NAME" -boot start_clean > -mode interactive \ > -+ exec "$BINDIR/erl${ERL_VERSION}" "$NAME_TYPE" "$id" -remsh "$NAME" > -boot start_clean -mode interactive \ > - -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" $MAYBE_DIST_ARGS \ > - -setcookie "$COOKIE" -hidden -kernel net_ticktime $TICKTIME > - } > Index: patches/patch-rebar_config > =================================================================== > RCS file: /cvs/ports/devel/rebar3/patches/patch-rebar_config,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 patch-rebar_config > --- patches/patch-rebar_config 26 Nov 2020 03:31:56 -0000 1.1.1.1 > +++ patches/patch-rebar_config 24 May 2021 15:43:55 -0000 > @@ -5,12 +5,13 @@ set main module name for escript > Index: rebar.config > --- rebar.config.orig > +++ rebar.config > -@@ -24,7 +24,7 @@ > - > +@@ -25,7 +25,8 @@ > {escript_name, rebar3}. > - {escript_comment, "%%Rebar3 3.13.2\n"}. > + {escript_wrappers_windows, ["cmd", "powershell"]}. > + {escript_comment, "%%Rebar3 3.15.2\n"}. > -{escript_emu_args, "%%! +sbtu +A1\n"}. > +{escript_emu_args, "%%! +sbtu +A1 -escript main rebar3\n"}. > ++ > %% escript_incl_extra is for internal rebar-private use only. > %% Do not use outside rebar. Config interface is not stable. > {escript_incl_extra, [{"relx/priv/templates/*", "_build/default/lib/"}, > Index: patches/patch-src_rebar_prv_escriptize_erl > =================================================================== > RCS file: /cvs/ports/devel/rebar3/patches/patch-src_rebar_prv_escriptize_erl,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 patch-src_rebar_prv_escriptize_erl > --- patches/patch-src_rebar_prv_escriptize_erl 26 Nov 2020 03:31:56 > -0000 1.1.1.1 > +++ patches/patch-src_rebar_prv_escriptize_erl 24 May 2021 15:43:55 > -0000 > @@ -5,7 +5,7 @@ Use versioned escript > Index: src/rebar_prv_escriptize.erl > --- src/rebar_prv_escriptize.erl.orig > +++ src/rebar_prv_escriptize.erl > -@@ -126,7 +126,7 @@ escriptize(State0, App) -> > +@@ -138,7 +138,7 @@ escriptize(State0, App) -> > [AppNameStr, AppNameStr, AppNameStr]), > EscriptSections = > [ {shebang, >