Annotate

util/dependencies.lua @ 410:5ce6801ad2e4

Trivial whitespace fix in the missing dependency message
author Matthew Wild <mwild1@gmail.com>
date Tue, 25 Nov 2008 02:33:13 +0000
parent 409:2269e9cbe153
child 413:4b61529d0884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
408
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local fatal;
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local function missingdep(name, sources, msg)
409
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
6 print("");
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
7 print("**************************");
408
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 print("Prosody was unable to find "..tostring(name));
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 print("This package can be obtained in the following ways:");
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 print("");
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 for k,v in pairs(sources) do
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 print("", k, v);
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 end
410
5ce6801ad2e4 Trivial whitespace fix in the missing dependency message
Matthew Wild <mwild1@gmail.com>
parents: 409
diff changeset
14 print("");
408
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 print(msg or (name.." is required for Prosody to run, so we will now exit."));
409
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
16 print("More help can be found on our website, at http://.../doc/depends");
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
17 print("**************************");
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
18 print("");
408
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 end
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 local lxp = softreq "lxp"
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 if not lxp then
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; });
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 fatal = true;
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 end
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28 local socket = softreq "socket"
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 if not socket then
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; });
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 fatal = true;
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33 end
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
35 local ssl = softreq "ssl"
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 if not ssl then
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
39 end
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40
409
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
41
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
42 local md5 = softreq "md5";
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
43
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
44 if not md5 then
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
45 missingdep("MD5", { ["luarocks"] = "luarocks install md5"; ["Source"] = "http://luaforge.net/frs/?group_id=155" });
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
46 fatal = true;
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
47 end
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
48
2269e9cbe153 Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents: 408
diff changeset
49
408
eb1a0960cefb Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 if fatal then os.exit(1); end