Software /
code /
prosody
Annotate
util/dependencies.lua @ 2531:697ff4f98033
mod_presence: Added handler for presence subscriptions and probes to local hosts.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 29 Jan 2010 21:06:51 +0500 |
parent | 2513:a8aa7616b154 |
child | 2562:f321211978f6 |
rev | line source |
---|---|
1523
841d61be198f
Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
1 -- Prosody IM |
760
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
449
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
449
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
449
diff
changeset
|
8 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
9 module("dependencies", package.seeall) |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
11 function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil, lib; end end |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 |
2513
a8aa7616b154
util.dependencies: Load luarocks.loader/luarocks.require
Matthew Wild <mwild1@gmail.com>
parents:
2510
diff
changeset
|
13 -- Required to be able to find packages installed with luarocks |
a8aa7616b154
util.dependencies: Load luarocks.loader/luarocks.require
Matthew Wild <mwild1@gmail.com>
parents:
2510
diff
changeset
|
14 if not softreq "luarocks.loader" then -- LuaRocks 2.x |
a8aa7616b154
util.dependencies: Load luarocks.loader/luarocks.require
Matthew Wild <mwild1@gmail.com>
parents:
2510
diff
changeset
|
15 softreq "luarocks.require"; -- LuaRocks <1.x |
a8aa7616b154
util.dependencies: Load luarocks.loader/luarocks.require
Matthew Wild <mwild1@gmail.com>
parents:
2510
diff
changeset
|
16 end |
a8aa7616b154
util.dependencies: Load luarocks.loader/luarocks.require
Matthew Wild <mwild1@gmail.com>
parents:
2510
diff
changeset
|
17 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
18 function missingdep(name, sources, msg) |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
19 print(""); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
20 print("**************************"); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 print("Prosody was unable to find "..tostring(name)); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 print("This package can be obtained in the following ways:"); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 print(""); |
2146
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
24 local longest_platform = 0; |
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
25 for platform in pairs(sources) do |
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
26 longest_platform = math.max(longest_platform, #platform); |
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
27 end |
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
28 for platform, source in pairs(sources) do |
5c54097ef84a
util.dependencies: Make the commands line up properly in the "missing dependency" output. Yes, this was the commit you didn't know you were waiting for!
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
29 print("", platform..":"..(" "):rep(4+longest_platform-#platform)..source); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 end |
410
5ce6801ad2e4
Trivial whitespace fix in the missing dependency message
Matthew Wild <mwild1@gmail.com>
parents:
409
diff
changeset
|
31 print(""); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 print(msg or (name.." is required for Prosody to run, so we will now exit.")); |
526 | 33 print("More help can be found on our website, at http://prosody.im/doc/depends"); |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
34 print("**************************"); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
35 print(""); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
38 function check_dependencies() |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
39 local fatal; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
40 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
41 local lxp = softreq "lxp" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
42 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
43 if not lxp then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
44 missingdep("luaexpat", { |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
45 ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-expat0"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
46 ["luarocks"] = "luarocks install luaexpat"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
47 ["Source"] = "http://www.keplerproject.org/luaexpat/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
48 }); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
49 fatal = true; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
50 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
51 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
52 local socket = softreq "socket" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
53 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
54 if not socket then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
55 missingdep("luasocket", { |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
56 ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-socket2"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
57 ["luarocks"] = "luarocks install luasocket"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
58 ["Source"] = "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
59 }); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
60 fatal = true; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
61 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
62 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
63 local lfs, err = softreq "lfs" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
64 if not lfs then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
65 missingdep("luafilesystem", { |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
66 ["luarocks"] = "luarocks install luafilesystem"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
67 ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-filesystem0"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
68 ["Source"] = "http://www.keplerproject.org/luafilesystem/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
69 }); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
70 fatal = true; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
71 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
72 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
73 local ssl = softreq "ssl" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
74 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
75 if not ssl then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
76 if config.get("*", "core", "run_without_ssl") then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
77 log("warn", "Running without SSL support because run_without_ssl is defined in the config"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
78 else |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
79 missingdep("LuaSec", { |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
80 ["Debian/Ubuntu"] = "http://prosody.im/download/start#debian_and_ubuntu"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
81 ["luarocks"] = "luarocks install luasec"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
82 ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
83 }, "SSL/TLS support will not be available"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
84 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
85 else |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
86 local major, minor, veryminor, patched = ssl._VERSION:match("(%d+)%.(%d+)%.?(%d*)(M?)"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
87 if not major or ((tonumber(major) == 0 and (tonumber(minor) or 0) <= 3 and (tonumber(veryminor) or 0) <= 2) and patched ~= "M") then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
88 log("error", "This version of LuaSec contains a known bug that causes disconnects, see http://prosody.im/doc/depends"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
89 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
90 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
91 |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
92 local encodings, err = softreq "util.encodings" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
93 if not encodings then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
94 if err:match("not found") then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
95 missingdep("util.encodings", { ["Windows"] = "Make sure you have encodings.dll from the Prosody distribution in util/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
96 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/encodings.so"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
97 }); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
98 else |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
99 print "***********************************" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
100 print("util/encodings couldn't be loaded. Check that you have a recent version of libidn"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
101 print "" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
102 print("The full error was:"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
103 print(err) |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
104 print "***********************************" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
105 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
106 fatal = true; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
107 end |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
108 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
109 local hashes, err = softreq "util.hashes" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
110 if not hashes then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
111 if err:match("not found") then |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
112 missingdep("util.hashes", { ["Windows"] = "Make sure you have hashes.dll from the Prosody distribution in util/"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
113 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/hashes.so"; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
114 }); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
115 else |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
116 print "***********************************" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
117 print("util/hashes couldn't be loaded. Check that you have a recent version of OpenSSL (libcrypto in particular)"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
118 print "" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
119 print("The full error was:"); |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
120 print(err) |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
121 print "***********************************" |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
122 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
123 fatal = true; |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
124 end |
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
125 return not fatal; |
2156
a6608ccab383
util.dependencies: Add LuaFileSystem as a hard dependency
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
126 end |
a6608ccab383
util.dependencies: Add LuaFileSystem as a hard dependency
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
127 |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
128 |
2510
97b5ea975cb9
util.dependencies, prosody, prosodyctl: Give util.dependencies a check_dependencies() function so the caller can decide what to do when dependencies aren't met - update prosody/prosodyctl for this change
Matthew Wild <mwild1@gmail.com>
parents:
2299
diff
changeset
|
129 return _M; |