These are chat archives for synrc/n2o

19th
Mar 2017
fxmy wang
@fxmy
Mar 19 2017 08:24
How do I add OTP libs as applications dependencies with mad? I've tried adding snmp in applications section of .app.src file. But running ./mad com plan repl results Apps couldn't be loaded: [snmp]
Andy
@m-2k
Mar 19 2017 08:26
Try a tart it manually
fxmy wang
@fxmy
Mar 19 2017 08:27
also code:get_path() seems incomplete
```
["/usr/local/lib/erlang/lib/asn1-4.0.4/ebin",
"/usr/local/lib/erlang/lib/compiler-7.0.2/ebin",
"/usr/local/lib/erlang/lib/compiler-7.0.4/ebin",
"/usr/local/lib/erlang/lib/crypto-3.7.1/ebin",
"/usr/local/lib/erlang/lib/crypto-3.7.3/ebin",
"/usr/local/lib/erlang/lib/eldap-1.2.2/ebin",
"/usr/local/lib/erlang/lib/et-1.6/ebin",
"/usr/local/lib/erlang/lib/eunit-2.3.1/ebin",
"/usr/local/lib/erlang/lib/hipe-3.15.2/ebin",
"/usr/local/lib/erlang/lib/hipe-3.15.4/ebin",
"/usr/local/lib/erlang/lib/inets-6.3.3/ebin",
"/usr/local/lib/erlang/lib/inets-6.3.5/ebin",
"/usr/local/lib/erlang/lib/inets-6.3.6/ebin",
"/usr/local/lib/erlang/lib/kernel-5.1/ebin",
"/usr/local/lib/erlang/lib/kernel-5.2/ebin",
"/usr/local/lib/erlang/lib/mnesia-4.14.1/ebin",
"/usr/local/lib/erlang/lib/mnesia-4.14.3/ebin",
"/usr/local/lib/erlang/lib/observer-2.2.2/ebin",
"/usr/local/lib/erlang/lib/observer-2.3.1/ebin",
"/usr/local/lib/erlang/lib/os_mon-2.4.1/ebin",
"/usr/local/lib/erlang/lib/os_mon-2.4.2/ebin",
"/usr/local/lib/erlang/lib/public_key-1.2/ebin",
"/usr/local/lib/erlang/lib/public_key-1.4/ebin",
"/usr/local/lib/erlang/lib/reltool-0.7.2/ebin",
"/usr/local/lib/erlang/lib/reltool-0.7.3/ebin",
"/usr/local/lib/erlang/lib/runtime_tools-1.10.1/ebin",
"/usr/local/lib/erlang/lib/runtime_tools-1.11.1/ebin",
"/usr/local/lib/erlang/lib/sasl-3.0.1/ebin",
"/usr/local/lib/erlang/lib/sasl-3.0.3/ebin",
"/usr/local/lib/erlang/lib/ssh-4.3.3/ebin",
"/usr/local/lib/erlang/lib/ssh-4.3.4/ebin",
"/usr/local/lib/erlang/lib/ssh-4.3.5/ebin",
"/usr/local/lib/erlang/lib/ssh-4.3.6/ebin",
"/usr/local/lib/erlang/lib/ssh-4.4.1/ebin",
"/usr/local/lib/erlang/lib/ssh-4.4/ebin",
"/usr/local/lib/erlang/lib/ssl-8.0.3/ebin",
"/usr/local/lib/erlang/lib/ssl-8.1.1/ebin",
"/usr/local/lib/erlang/lib/ssl-8.1/ebin",
"/usr/local/lib/erlang/lib/stdlib-3.1/ebin",
"/usr/local/lib/erlang/lib/stdlib-3.2/ebin",
"/usr/local/lib/erlang/lib/stdlib-3.3/ebin",
"/usr/local/lib/erlang/lib/syntax_tools-2.1/ebin",
"/usr/local/lib/erlang/lib/tools-2.8.6/ebin",
"/usr/local/lib/erlang/lib/tools-2.9.1/ebin",
"/usr/local/lib/erlang/lib/wx-1.7.1/ebin",
"/usr/local/lib/erlang/lib/xmerl-1.3.12/ebin",
"/usr/local/lib/erlang/lib/xmerl-1.3.13/ebin",
"/home/fxmy/github/switch_watchman/deps/active/ebin",
"/home/fxmy/github/switch_watchman/deps/cowboy/ebin",
"/home/fxmy/github/switch_watchman/deps/cowlib/ebin",
"/home/fxmy/github/switch_watchman/deps/erlydtl/ebin",
"/home/fxmy/github/switch_watchman/deps/fs/ebin",
"/home/fxmy/github/switch_watchman/deps/mad/ebin",
"/home/fxmy/github/switch_watchman/deps/n2o/ebin",
"/home/fxmy/github/switch_watchman/deps/nitro/ebin",
"/home/fxmy/github/switch_watchman/deps/ranch/ebin",
"/home/fxmy/github/switch_watchman/deps/sh/ebin",
"/home/fxmy/github/switch_watchman/deps/syn/ebin","ebin",
"/home/fxmy/github/switch_watchman/mad"]
Andy
@m-2k
Mar 19 2017 08:30
Don't need modify app section
Just put it to deps
Apps/rebar.config:
{sub_dirs, [ "app1", "snmp" ]}.
Next: mad pla
Enjoy
fxmy wang
@fxmy
Mar 19 2017 08:43
OK, I'm a bit lost..
cat rebar.config 
{erl_opts, [debug_info]}.
{lib_dirs, ["deps"]}.
{deps_dir, "deps"}.

{sub_dirs, ["snmp"]}.

{deps, [
    {syn,    ".*", {git, "git://github.com/ostinelli/syn", {tag, "1.1.0"}    }},
    {active, ".*", {git, "git://github.com/synrc/active",  {tag,"1.9"}}},
    {erlydtl,".*", {git, "git://github.com/evanmiller/erlydtl", {tag, "0.8.0"}  }},
    {nitro,  ".*", {git, "git://github.com/synrc/nitro",   {tag,"master"}}},
    {snmp, "5.2.5"},
    {n2o,    ".*", {git, "git://github.com/synrc/n2o",     {tag,"master"}}}
]}.

{erlydtl_opts, [
%%    {doc_root,   "priv/static"},
    {out_dir,    "ebin"},
    {compiler_options, [report, return, debug_info]},
    {source_ext, ".html"},
    {module_ext, "_view"}
]}.
switch_watchman   master ●  ls
deps  ebin  include  LICENSE  mad  manager  otp.mk  priv  README.md  rebar.config  src  sys.config  vm.args
it's a top level application without apps dir.
running ./mad deps com plan repl results in escript: exception error: no case clause matching "5.2.5"
What am I doing wrong?
And compare.
fxmy wang
@fxmy
Mar 19 2017 08:53
Eh.. the snmp application I was trying to import is standard OTP lib.
Shouldn't mad resolve and load its code path automatically?
Just like mnesia and such libs
Andy
@m-2k
Mar 19 2017 08:56
Ah, ok
And run mad pla
And check .applist in U project
fxmy wang
@fxmy
Mar 19 2017 09:02
cat .applist 
[snmp,kernel,stdlib,fs,ranch,crypto,compiler,syntax_tools,inets,mnesia,cowlib,syn,cowboy,n2o,active,erlydtl,mad,nitro,sh,switch_watchman]
order seems wrong?
Andy
@m-2k
Mar 19 2017 09:04
Maybe
fxmy wang
@fxmy
Mar 19 2017 09:05
.app.src:
{applications,
   [kernel, stdlib, mnesia, syn, snmp, n2o ]}
Andy
@m-2k
Mar 19 2017 09:08
Don't help u now, sorry. Try start apps with application:start manually and find problem
fxmy wang
@fxmy
Mar 19 2017 09:09
Thanks Andy, I'll try to hunt this down.
I suspect somehow code search path is broken.
application:load(snmp).
{error,{"no such file or directory","snmp.app"}}
xiufan
@xiufan
Mar 19 2017 09:48
when mad make app project like rebar ?just only do make app sample
Namdak Tonpa
@5HT
Mar 19 2017 11:33
-module(mad_repl).
-copyright('Maxim Sokhatsky').
-compile(export_all).

disabled() -> [].
system() -> [compiler,syntax_tools,sasl,tools,mnesia,reltool,xmerl,crypto,kernel,stdlib,ssh,eldap,
             wx,ssl,runtime_tools,public_key,observer,inets,asn1,et,eunit,hipe,os_mon,parsetools,odbc].
try to add snmp here, and rebuild mad
if ok apply patch
fxmy wang
@fxmy
Mar 19 2017 12:54
Thanks Namdak, it works like a charm. Now ./mad repl works as expected.
However, if I run ./mad com repl I still get Apps couldn't be loaded: [snmp]. Digging....
fxmy wang
@fxmy
Mar 19 2017 16:20
So it seems that when calling ./mad com repl, call path in src/provision/mad_repl:sh/1 is never actually called.
Thus completely skipped code:set_path(SystemPath++UserPath) ...
Now going to bed zzzZZZZ
_( |3JZ)_