Friday, January 26, 2018

Re: [PATCH] for rebar16, rebar17, rebar18 and rebar19

Index: patches/patch-src_rebar_escripter_erl
===================================================================
RCS file: /depot/cvs/openbsd/ports/devel/rebar/patches/patch-src_rebar_escripter_erl,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_rebar_escripter_erl
--- patches/patch-src_rebar_escripter_erl 25 Jun 2015 13:18:41 -0000 1.1
+++ patches/patch-src_rebar_escripter_erl 24 Jan 2018 19:35:26 -0000
@@ -1,12 +1,16 @@
$OpenBSD: patch-src_rebar_escripter_erl,v 1.1 2015/06/25 13:18:41 jasper Exp $
---- src/rebar_escripter.erl.orig Thu Jun 25 10:54:14 2015
-+++ src/rebar_escripter.erl Thu Jun 25 10:54:35 2015
-@@ -71,7 +71,7 @@ escriptize(Config0, AppFile) ->
+Index: src/rebar_escripter.erl
+--- src/rebar_escripter.erl.orig
++++ src/rebar_escripter.erl
+@@ -71,9 +71,9 @@ escriptize(Config0, AppFile) ->
%% Archive was successfully created. Prefix that binary with our
%% header and write to our escript file
Shebang = rebar_config:get(Config, escript_shebang,
- "#!/usr/bin/env escript\n"),
+ "#!/usr/bin/env escript${ERL_VERSION}\n"),
Comment = rebar_config:get(Config, escript_comment, "%%\n"),
- DefaultEmuArgs = ?FMT("%%! -pa ~s/~s/ebin\n",
+- DefaultEmuArgs = ?FMT("%%! -pa ~s/~s/ebin\n",
++ DefaultEmuArgs = ?FMT("%%! -escript main rebar -pa ~s/~s/ebin\n",
[AppNameStr, AppNameStr]),
+ EmuArgs = rebar_config:get(Config, escript_emu_args,
+ DefaultEmuArgs),
On 01/24/18 11:58, William Karh wrote:
> Hey ports,
>
> After install, the rebar1[6789] package complains about an undefined
> main function. For example:
>
> $ doas pkg_add rebar16
> quirks-2.406 signed on 2018-01-23T00:21:31Z
> rebar16-2.6.2: ok
> $ rebar16
> escript: exception error: undefined function rebar16:main/1
> in function escript:run/2 (escript.erl, line 747)
> in call from escript:start/1 (escript.erl, line 277)
> in call from init:start_it /1
> in call from init:start_em /1
>
> Since the package changes the name of the program based on the version
> of underlying installation of erlang, escript(1) is confused and can't
> find the main function.
>
> From the escript(1) man page, "By default the main/1 function in the
> module with the same name as the basename of the escript file will be
> invoked. This behavior can be overridden by setting the flag -escript
> main Module as one of the emulator flags."
>
> The following patch fixes this problem on rebar16, rebar17, rebar18 and
> rebar19.
>
> Index: patches/patch-src_rebar _escripter _erl
> |=================================================================|
> RCS file: /depot/cvs/openbsd/ports/devel/rebar/patches/patch-src_rebar
> _escripter _erl,v
> retrieving revision 1.1
> diff -u -p -u -r1.1 patch-src_rebar _escripter _erl
> — patches/patch-src_rebar _escripter _erl 25 Jun 2015 13:18:41 -0000 1.1
> + patches/patch-src_rebar _escripter _erl 24 Jan 2018 19:35:26 -0000
> @@ -1,12 +1,16 @@
> $OpenBSD: patch-src_rebar _escripter _erl,v 1.1 2015/06/25 13:18:41
> jasper Exp $
> -— src/rebar_escripter.erl.orig Thu Jun 25 10:54:14 2015
> -+ src/rebar_escripter.erl Thu Jun 25 10:54:35 2015
> -@@ -71,7 +71,7 @@ escriptize(Config0, AppFile) ->
> +Index: src/rebar_escripter.erl
> — src/rebar_escripter.erl.orig
> + src/rebar_escripter.erl
> +@@ -71,9 +71,9 @@ escriptize(Config0, AppFile) ->
> %% Archive was successfully created. Prefix that binary with our
> %% header and write to our escript file
> Shebang = rebar_config :get(Config, escript_shebang ,
>
> * "#!/usr/bin/env escript\n"),
> * "#!/usr/bin/env escript${ERL_VERSION }\n"),
> Comment = rebar_config :get(Config, escript_comment , "%%\n"),
>
> * DefaultEmuArgs = ?FMT("%%! -pa ~s/~s/ebin\n",
>
> - DefaultEmuArgs = ?FMT("%%! -pa ~s/~s/ebin\n",
> + DefaultEmuArgs = ?FMT("%%! -escript main rebar -pa ~s/~s/ebin\n",
> [AppNameStr, AppNameStr]),
>
> * EmuArgs = rebar_config :get(Config, escript_emu _args ,
> * DefaultEmuArgs),
>
> Thanks,
> Bill

In-line patch was mangled by email client. Trying again with patch as
attachment.

Thanks,
Bill

No comments:

Post a Comment