diff options
-rw-r--r-- | install.bat | 131 | ||||
-rw-r--r-- | src/luarocks/build.lua | 6 | ||||
-rw-r--r-- | src/luarocks/cfg.lua | 17 | ||||
-rw-r--r-- | src/luarocks/command_line.lua | 11 | ||||
-rw-r--r-- | src/luarocks/help.lua | 12 | ||||
-rw-r--r-- | src/luarocks/install.lua | 6 | ||||
-rw-r--r-- | src/luarocks/make.lua | 6 | ||||
-rw-r--r-- | src/luarocks/remove.lua | 6 |
8 files changed, 149 insertions, 46 deletions
diff --git a/install.bat b/install.bat index f6d6f842..8f877c57 100644 --- a/install.bat +++ b/install.bat | |||
@@ -5,10 +5,10 @@ rem=rem --[[ | |||
5 | local vars = {} | 5 | local vars = {} |
6 | 6 | ||
7 | 7 | ||
8 | vars.PREFIX = os.getenv("PROGRAMFILES")..[[\LuaRocks]] | 8 | vars.PREFIX = nil |
9 | vars.VERSION = "2.1" | 9 | vars.VERSION = "2.1" |
10 | vars.SYSCONFDIR = (os.getenv("PROGRAMDATA") or (os.getenv("ALLUSERSPROFILE")..[[\Application Data]])) .. [[\LuaRocks]] -- ALLUSERS for WinXP compat | 10 | vars.SYSCONFDIR = nil |
11 | vars.ROCKS_TREE = vars.SYSCONFDIR | 11 | vars.ROCKS_TREE = nil |
12 | vars.SCRIPTS_DIR = nil | 12 | vars.SCRIPTS_DIR = nil |
13 | vars.LUA_INTERPRETER = nil | 13 | vars.LUA_INTERPRETER = nil |
14 | vars.LUA_PREFIX = nil | 14 | vars.LUA_PREFIX = nil |
@@ -26,9 +26,10 @@ local FORCE = false | |||
26 | local FORCE_CONFIG = false | 26 | local FORCE_CONFIG = false |
27 | local INSTALL_LUA = false | 27 | local INSTALL_LUA = false |
28 | local USE_MINGW = false | 28 | local USE_MINGW = false |
29 | local REGISTRY = false | 29 | local REGISTRY = true |
30 | local NOADMIN = false | 30 | local NOADMIN = false |
31 | local PROMPT = true | 31 | local PROMPT = true |
32 | local SELFCONTAINED = false | ||
32 | 33 | ||
33 | --- | 34 | --- |
34 | -- Some helpers | 35 | -- Some helpers |
@@ -120,10 +121,19 @@ Installs LuaRocks. | |||
120 | 121 | ||
121 | Configuring the destinations: | 122 | Configuring the destinations: |
122 | /TREE [dir] Root of the local tree of installed rocks. | 123 | /TREE [dir] Root of the local tree of installed rocks. |
123 | Default is %PROGRAMDATA%\LuaRocks | 124 | Default is %PROGRAMFILES%\LuaRocks\systree |
124 | /SCRIPTS [dir] Where to install commandline scripts installed by | 125 | /SCRIPTS [dir] Where to install commandline scripts installed by |
125 | rocks. Default is {TREE}/bin. | 126 | rocks. Default is {TREE}/bin. |
126 | 127 | /CONFIG [dir] Location where the config file should be installed. | |
128 | Default is %PROGRAMFILES%\LuaRocks | ||
129 | /SELFCONTAINED Creates a self contained installation in a single | ||
130 | directory given by /P. | ||
131 | Sets the /TREE and /CONFIG options to the same | ||
132 | location as /P. And does not load registry info | ||
133 | with option /NOREG. The only option NOT self | ||
134 | contained is the user rock tree, so don't use that | ||
135 | if you create a self contained installation. | ||
136 | |||
127 | Configuring the Lua interpreter: | 137 | Configuring the Lua interpreter: |
128 | /LV [version] Lua version to use; either 5.1 or 5.2. | 138 | /LV [version] Lua version to use; either 5.1 or 5.2. |
129 | Default is 5.1 | 139 | Default is 5.1 |
@@ -149,14 +159,12 @@ Compiler configuration: | |||
149 | /MW Use mingw as build system instead of MSVC | 159 | /MW Use mingw as build system instead of MSVC |
150 | 160 | ||
151 | Other options: | 161 | Other options: |
152 | /CONFIG [dir] Location where the config file should be installed. | ||
153 | Default is %PROGRAMDATA%\LuaRocks | ||
154 | /FORCECONFIG Use a single config location. Do not use the | 162 | /FORCECONFIG Use a single config location. Do not use the |
155 | LUAROCKS_CONFIG variable or the user's home directory. | 163 | LUAROCKS_CONFIG variable or the user's home directory. |
156 | Useful to avoid conflicts when LuaRocks | 164 | Useful to avoid conflicts when LuaRocks |
157 | is embedded within an application. | 165 | is embedded within an application. |
158 | /F Remove installation directory if it already exists. | 166 | /F Remove installation directory if it already exists. |
159 | /R Load registry information to register '.rockspec' | 167 | /NOREG Do not load registry info to register '.rockspec' |
160 | extension with LuaRocks commands (right-click). | 168 | extension with LuaRocks commands (right-click). |
161 | /NOADMIN The installer requires admin priviledges. If not | 169 | /NOADMIN The installer requires admin priviledges. If not |
162 | available it will elevate a new process. Use this | 170 | available it will elevate a new process. Use this |
@@ -165,10 +173,6 @@ Other options: | |||
165 | user. | 173 | user. |
166 | /Q Do not prompt for confirmation of settings | 174 | /Q Do not prompt for confirmation of settings |
167 | 175 | ||
168 | Example: | ||
169 | To create a self contained install use (assuming Lua is in your PATH): | ||
170 | INSTALL /P c:\LuaRocks /TREE c:\LuaRocks /CONFIG c:\LuaRocks | ||
171 | |||
172 | ]]) | 176 | ]]) |
173 | end | 177 | end |
174 | 178 | ||
@@ -207,8 +211,10 @@ local function parse_options(args) | |||
207 | FORCE_CONFIG = true | 211 | FORCE_CONFIG = true |
208 | elseif name == "/F" then | 212 | elseif name == "/F" then |
209 | FORCE = true | 213 | FORCE = true |
210 | elseif name == "/R" then | 214 | elseif name == "/SELFCONTAINED" then |
211 | REGISTRY = true | 215 | SELFCONTAINED = true |
216 | elseif name == "/NOREG" then | ||
217 | REGISTRY = false | ||
212 | elseif name == "/NOADMIN" then | 218 | elseif name == "/NOADMIN" then |
213 | NOADMIN = true | 219 | NOADMIN = true |
214 | elseif name == "/Q" then | 220 | elseif name == "/Q" then |
@@ -221,6 +227,14 @@ end | |||
221 | 227 | ||
222 | -- check for combination/required flags | 228 | -- check for combination/required flags |
223 | local function check_flags() | 229 | local function check_flags() |
230 | if SELFCONTAINED then | ||
231 | if not vars.PREFIX then | ||
232 | die("Option /P is required when using /SELFCONTAINED") | ||
233 | end | ||
234 | if vars.SYSCONFDIR or vars.ROCKS_TREE or vars.SCRIPTS_DIR then | ||
235 | die("Cannot combine /TREE, /SCRIPTS or /CONFIG with /SELFCONTAINED") | ||
236 | end | ||
237 | end | ||
224 | if INSTALL_LUA then | 238 | if INSTALL_LUA then |
225 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then | 239 | if vars.LUA_INCDIR or vars.LUA_BINDIR or vars.LUA_LIBDIR or vars.LUA_PREFIX then |
226 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") | 240 | die("Cannot combine option /L with any of /LUA /BIN /LIB /INC") |
@@ -505,6 +519,14 @@ end | |||
505 | 519 | ||
506 | print(S"LuaRocks $VERSION.x installer.\n") | 520 | print(S"LuaRocks $VERSION.x installer.\n") |
507 | 521 | ||
522 | print([[ | ||
523 | |||
524 | ======================== | ||
525 | == Checking system... == | ||
526 | ======================== | ||
527 | |||
528 | ]]) | ||
529 | |||
508 | parse_options(config) | 530 | parse_options(config) |
509 | check_flags() | 531 | check_flags() |
510 | 532 | ||
@@ -536,6 +558,7 @@ else | |||
536 | print("Admin priviledges available for installing") | 558 | print("Admin priviledges available for installing") |
537 | end | 559 | end |
538 | 560 | ||
561 | vars.PREFIX = vars.PREFIX or os.getenv("PROGRAMFILES")..[[\LuaRocks]] | ||
539 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" | 562 | vars.FULL_PREFIX = S"$PREFIX\\$VERSION" |
540 | vars.BINDIR = vars.FULL_PREFIX | 563 | vars.BINDIR = vars.FULL_PREFIX |
541 | vars.LIBDIR = vars.FULL_PREFIX | 564 | vars.LIBDIR = vars.FULL_PREFIX |
@@ -561,16 +584,38 @@ else | |||
561 | vars.UNAME_M = get_architecture() -- can only do when installation was found | 584 | vars.UNAME_M = get_architecture() -- can only do when installation was found |
562 | end | 585 | end |
563 | 586 | ||
587 | local datapath | ||
588 | if vars.UNAME_M == "x86" then | ||
589 | datapath = os.getenv("PROGRAMFILES") .. [[\LuaRocks]] | ||
590 | else | ||
591 | -- our target interpreter is 64bit, so the tree (with binaries) should go into 64bit program files | ||
592 | datapath = os.getenv("ProgramW6432") .. [[\LuaRocks]] | ||
593 | end | ||
594 | vars.SYSCONFDIR = vars.SYSCONDFIR or datapath | ||
595 | vars.ROCKS_TREE = vars.ROCKS_TREE or datapath..[[\systree]] | ||
596 | if SELFCONTAINED then | ||
597 | vars.SYSCONFDIR = vars.PREFIX | ||
598 | vars.ROCKS_TREE = vars.PREFIX..[[\systree]] | ||
599 | REGISTRY = false | ||
600 | end | ||
601 | |||
564 | print(S[[ | 602 | print(S[[ |
565 | 603 | ||
604 | ========================== | ||
605 | == System check results == | ||
606 | ========================== | ||
607 | |||
566 | Will configure LuaRocks with the following paths: | 608 | Will configure LuaRocks with the following paths: |
567 | LuaRocks : $FULL_PREFIX | 609 | LuaRocks : $FULL_PREFIX |
568 | Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER | 610 | Config file : $SYSCONFDIR\config.lua |
569 | binaries : $LUA_BINDIR | 611 | Rocktree : $ROCKS_TREE |
570 | libraries : $LUA_LIBDIR | 612 | |
571 | includes : $LUA_INCDIR | 613 | Lua interpreter : $LUA_BINDIR\$LUA_INTERPRETER |
572 | Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME | 614 | binaries : $LUA_BINDIR |
573 | System architecture detected as: $UNAME_M | 615 | libraries : $LUA_LIBDIR |
616 | includes : $LUA_INCDIR | ||
617 | architecture: $UNAME_M | ||
618 | binary link : $LUA_LIBNAME with runtime $LUA_RUNTIME.dll | ||
574 | 619 | ||
575 | ]]) | 620 | ]]) |
576 | 621 | ||
@@ -579,6 +624,14 @@ if PROMPT then | |||
579 | io.read() | 624 | io.read() |
580 | end | 625 | end |
581 | 626 | ||
627 | print([[ | ||
628 | |||
629 | ============================ | ||
630 | == Installing LuaRocks... == | ||
631 | ============================ | ||
632 | |||
633 | ]]) | ||
634 | |||
582 | -- *********************************************************** | 635 | -- *********************************************************** |
583 | -- Install LuaRocks files | 636 | -- Install LuaRocks files |
584 | -- *********************************************************** | 637 | -- *********************************************************** |
@@ -646,6 +699,35 @@ IF NOT "%LUA_PATH_5_2%"=="" ( | |||
646 | ) | 699 | ) |
647 | SET "PATH=$BINDIR;%PATH%" | 700 | SET "PATH=$BINDIR;%PATH%" |
648 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* | 701 | "$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* |
702 | IF NOT "%ERRORLEVEL%"=="2" GOTO EXITLR | ||
703 | |||
704 | REM Permission denied error, try and auto elevate... | ||
705 | REM already an admin? (checking to prevent loops) | ||
706 | NET SESSION >NUL 2>&1 | ||
707 | IF "%ERRORLEVEL%"=="0" GOTO EXITLR | ||
708 | |||
709 | REM Do we have PowerShell available? | ||
710 | PowerShell /? >NUL 2>&1 | ||
711 | IF NOT "%ERRORLEVEL%"=="0" GOTO EXITLR | ||
712 | |||
713 | :GETTEMPNAME | ||
714 | SET TMPFILE=%TEMP%\LuaRocks-Elevator-%RANDOM%.bat | ||
715 | IF EXIST "%TMPFILE%" GOTO :GETTEMPNAME | ||
716 | |||
717 | ECHO @ECHO OFF > "%TMPFILE%" | ||
718 | ECHO CHDIR /D %CD% >> "%TMPFILE%" | ||
719 | ECHO ECHO %0 %* >> "%TMPFILE%" | ||
720 | ECHO ECHO. >> "%TMPFILE%" | ||
721 | ECHO CALL %0 %* >> "%TMPFILE%" | ||
722 | ECHO ECHO. >> "%TMPFILE%" | ||
723 | ECHO ECHO Press any key to close this window... >> "%TMPFILE%" | ||
724 | ECHO PAUSE ^> NUL >> "%TMPFILE%" | ||
725 | ECHO DEL "%TMPFILE%" >> "%TMPFILE%" | ||
726 | |||
727 | ECHO Now retrying as a priviledged user... | ||
728 | PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('%TMPFILE%', '', '', 'runas') | ||
729 | |||
730 | :EXITLR | ||
649 | ENDLOCAL | 731 | ENDLOCAL |
650 | ]]) | 732 | ]]) |
651 | f:close() | 733 | f:close() |
@@ -799,7 +881,10 @@ exec( S[[del "$FULL_PREFIX\pe-parser.lua" >NUL]] ) | |||
799 | 881 | ||
800 | print(S[[ | 882 | print(S[[ |
801 | 883 | ||
802 | *** LuaRocks is installed! *** | 884 | ============================ |
885 | == LuaRocks is installed! == | ||
886 | ============================ | ||
887 | |||
803 | 888 | ||
804 | You may want to add the following elements to your paths; | 889 | You may want to add the following elements to your paths; |
805 | Lua interpreter; | 890 | Lua interpreter; |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 5555d94a..ec269023 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -351,8 +351,8 @@ end | |||
351 | -- if returned a result, installs the matching rock. | 351 | -- if returned a result, installs the matching rock. |
352 | -- @param version string: When passing a package name, a version number may | 352 | -- @param version string: When passing a package name, a version number may |
353 | -- also be given. | 353 | -- also be given. |
354 | -- @return boolean or (nil, string): True if build was successful; nil and an | 354 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
355 | -- error message otherwise. | 355 | -- error message otherwise. exitcode is optionally returned. |
356 | function run(...) | 356 | function run(...) |
357 | local flags, name, version = util.parse_flags(...) | 357 | local flags, name, version = util.parse_flags(...) |
358 | if type(name) ~= "string" then | 358 | if type(name) ~= "string" then |
@@ -364,7 +364,7 @@ function run(...) | |||
364 | return pack.pack_binary_rock(name, version, do_build, name, version, deps.get_deps_mode(flags)) | 364 | return pack.pack_binary_rock(name, version, do_build, name, version, deps.get_deps_mode(flags)) |
365 | else | 365 | else |
366 | local ok, err = fs.check_command_permissions(flags) | 366 | local ok, err = fs.check_command_permissions(flags) |
367 | if not ok then return nil, err end | 367 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
368 | ok, err = do_build(name, version, deps.get_deps_mode(flags)) | 368 | ok, err = do_build(name, version, deps.get_deps_mode(flags)) |
369 | if not ok then return nil, err end | 369 | if not ok then return nil, err end |
370 | local name, version = ok, err | 370 | local name, version = ok, err |
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 2904146b..87777b86 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -35,6 +35,21 @@ major_version = program_version:match("([^.]%.[^.])") | |||
35 | 35 | ||
36 | local persist = require("luarocks.persist") | 36 | local persist = require("luarocks.persist") |
37 | 37 | ||
38 | _M.errorcodes = setmetatable({ | ||
39 | OK = 0, | ||
40 | UNSPECIFIED = 1, | ||
41 | PERMISSIONDENIED = 2, | ||
42 | },{ | ||
43 | __index = function(t, key) | ||
44 | local val = rawget(t, key) | ||
45 | if not val then | ||
46 | error("'"..tostring(key).."' is not a valid errorcode", 2) | ||
47 | end | ||
48 | return val | ||
49 | end | ||
50 | }) | ||
51 | |||
52 | |||
38 | local popen_ok, popen_result = pcall(io.popen, "") | 53 | local popen_ok, popen_result = pcall(io.popen, "") |
39 | if popen_ok then | 54 | if popen_ok then |
40 | if popen_result then | 55 | if popen_result then |
@@ -43,7 +58,7 @@ if popen_ok then | |||
43 | else | 58 | else |
44 | io.stderr:write("Your version of Lua does not support io.popen,\n") | 59 | io.stderr:write("Your version of Lua does not support io.popen,\n") |
45 | io.stderr:write("which is required by LuaRocks. Please check your Lua installation.\n") | 60 | io.stderr:write("which is required by LuaRocks. Please check your Lua installation.\n") |
46 | os.exit(1) | 61 | os.exit(_M.errorcodes.UNSPECIFIED) |
47 | end | 62 | end |
48 | 63 | ||
49 | -- System detection: | 64 | -- System detection: |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index b98084e0..e79b1442 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -12,7 +12,8 @@ local program = util.this_program("luarocks") | |||
12 | 12 | ||
13 | --- Display an error message and exit. | 13 | --- Display an error message and exit. |
14 | -- @param message string: The error message. | 14 | -- @param message string: The error message. |
15 | local function die(message) | 15 | -- @param exitcode number: the exitcode to use |
16 | local function die(message, exitcode) | ||
16 | assert(type(message) == "string") | 17 | assert(type(message) == "string") |
17 | 18 | ||
18 | local ok, err = pcall(util.run_scheduled_functions) | 19 | local ok, err = pcall(util.run_scheduled_functions) |
@@ -20,7 +21,7 @@ local function die(message) | |||
20 | util.printerr("\nLuaRocks "..cfg.program_version.." internal bug (please report at luarocks-developers@lists.sourceforge.net):\n"..err) | 21 | util.printerr("\nLuaRocks "..cfg.program_version.." internal bug (please report at luarocks-developers@lists.sourceforge.net):\n"..err) |
21 | end | 22 | end |
22 | util.printerr("\nError: "..message) | 23 | util.printerr("\nError: "..message) |
23 | os.exit(1) | 24 | os.exit(exitcode or cfg.errorcodes.UNSPECIFIED) |
24 | end | 25 | end |
25 | 26 | ||
26 | local function replace_tree(flags, args, tree) | 27 | local function replace_tree(flags, args, tree) |
@@ -83,7 +84,7 @@ function run_command(...) | |||
83 | util.printout(program.." "..cfg.program_version) | 84 | util.printout(program.." "..cfg.program_version) |
84 | util.printout(program_description) | 85 | util.printout(program_description) |
85 | util.printout() | 86 | util.printout() |
86 | os.exit(0) | 87 | os.exit(cfg.errorcodes.OK) |
87 | elseif flags["help"] or #nonflags == 0 then | 88 | elseif flags["help"] or #nonflags == 0 then |
88 | command = "help" | 89 | command = "help" |
89 | args = nonflags | 90 | args = nonflags |
@@ -184,13 +185,13 @@ function run_command(...) | |||
184 | -- I'm not changing this now to avoid messing with the run() | 185 | -- I'm not changing this now to avoid messing with the run() |
185 | -- interface, which I know some people use (even though | 186 | -- interface, which I know some people use (even though |
186 | -- I never published it as a public API...) | 187 | -- I never published it as a public API...) |
187 | local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) | 188 | local xp, ok, err, exitcode = xpcall(function() return commands[command].run(unpack(args)) end, function(err) |
188 | die(debug.traceback("LuaRocks "..cfg.program_version | 189 | die(debug.traceback("LuaRocks "..cfg.program_version |
189 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" | 190 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" |
190 | ..err, 2)) | 191 | ..err, 2)) |
191 | end) | 192 | end) |
192 | if xp and (not ok) then | 193 | if xp and (not ok) then |
193 | die(err) | 194 | die(err, exitcode) |
194 | end | 195 | end |
195 | else | 196 | else |
196 | die("Unknown command: "..command) | 197 | die("Unknown command: "..command) |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 33c684ad..2774dc41 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
@@ -8,6 +8,7 @@ module("luarocks.help", package.seeall) | |||
8 | 8 | ||
9 | local util = require("luarocks.util") | 9 | local util = require("luarocks.util") |
10 | local cfg = require("luarocks.cfg") | 10 | local cfg = require("luarocks.cfg") |
11 | local dir = require("luarocks.dir") | ||
11 | 12 | ||
12 | local program = util.this_program("luarocks") | 13 | local program = util.this_program("luarocks") |
13 | 14 | ||
@@ -81,19 +82,20 @@ function run(...) | |||
81 | end | 82 | end |
82 | print_section("CONFIGURATION") | 83 | print_section("CONFIGURATION") |
83 | util.printout("\tLua version: " .. cfg.lua_version) | 84 | util.printout("\tLua version: " .. cfg.lua_version) |
84 | util.printout("\tSystem configuration file: ".. sys_file .. " (" .. get_status(sys_ok) ..")") | 85 | util.printout("\tConfiguration files:") |
86 | util.printout("\t\tSystem: ".. dir.normalize(sys_file) .. " (" .. get_status(sys_ok) ..")") | ||
85 | if home_file then | 87 | if home_file then |
86 | util.printout("\tUser configuration file: ".. home_file .. " (" .. get_status(home_ok) ..")\n") | 88 | util.printout("\t\tUser : ".. dir.normalize(home_file) .. " (" .. get_status(home_ok) ..")\n") |
87 | else | 89 | else |
88 | util.printout("\tUser configuration file disabled in this LuaRocks installation.\n") | 90 | util.printout("\t\tUser : disabled in this LuaRocks installation.\n") |
89 | end | 91 | end |
90 | util.printout("\tRocks trees in use: ") | 92 | util.printout("\tRocks trees in use: ") |
91 | for _, tree in ipairs(cfg.rocks_trees) do | 93 | for _, tree in ipairs(cfg.rocks_trees) do |
92 | if type(tree) == "string" then | 94 | if type(tree) == "string" then |
93 | util.printout("\t\t"..tree) | 95 | util.printout("\t\t"..dir.normalize(tree)) |
94 | else | 96 | else |
95 | local name = tree.name and " (\""..tree.name.."\")" or "" | 97 | local name = tree.name and " (\""..tree.name.."\")" or "" |
96 | util.printout("\t\t"..tree.root..name) | 98 | util.printout("\t\t"..dir.normalize(tree.root)..name) |
97 | end | 99 | end |
98 | end | 100 | end |
99 | else | 101 | else |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index c181d612..b28e6282 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
@@ -120,8 +120,8 @@ end | |||
120 | -- if returned a result, installs the matching rock. | 120 | -- if returned a result, installs the matching rock. |
121 | -- @param version string: When passing a package name, a version number | 121 | -- @param version string: When passing a package name, a version number |
122 | -- may also be given. | 122 | -- may also be given. |
123 | -- @return boolean or (nil, string): True if installation was | 123 | -- @return boolean or (nil, string, exitcode): True if installation was |
124 | -- successful, nil and an error message otherwise. | 124 | -- successful, nil and an error message otherwise. exitcode is optionally returned. |
125 | function run(...) | 125 | function run(...) |
126 | local flags, name, version = util.parse_flags(...) | 126 | local flags, name, version = util.parse_flags(...) |
127 | if type(name) ~= "string" then | 127 | if type(name) ~= "string" then |
@@ -129,7 +129,7 @@ function run(...) | |||
129 | end | 129 | end |
130 | 130 | ||
131 | local ok, err = fs.check_command_permissions(flags) | 131 | local ok, err = fs.check_command_permissions(flags) |
132 | if not ok then return nil, err end | 132 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
133 | 133 | ||
134 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then | 134 | if name:match("%.rockspec$") or name:match("%.src%.rock$") then |
135 | util.printout("Using "..name.."... switching to 'build' mode") | 135 | util.printout("Using "..name.."... switching to 'build' mode") |
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index eef49d0c..3999e39f 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
@@ -40,8 +40,8 @@ To install rocks, you'll normally want to use the "install" and | |||
40 | 40 | ||
41 | --- Driver function for "make" command. | 41 | --- Driver function for "make" command. |
42 | -- @param name string: A local rockspec. | 42 | -- @param name string: A local rockspec. |
43 | -- @return boolean or (nil, string): True if build was successful; nil and an | 43 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
44 | -- error message otherwise. | 44 | -- error message otherwise. exitcode is optionally returned. |
45 | function run(...) | 45 | function run(...) |
46 | local flags, rockspec = util.parse_flags(...) | 46 | local flags, rockspec = util.parse_flags(...) |
47 | assert(type(rockspec) == "string" or not rockspec) | 47 | assert(type(rockspec) == "string" or not rockspec) |
@@ -73,7 +73,7 @@ function run(...) | |||
73 | return pack.pack_binary_rock(rspec.name, rspec.version, build.build_rockspec, rockspec, false, true, deps.get_deps_mode(flags)) | 73 | return pack.pack_binary_rock(rspec.name, rspec.version, build.build_rockspec, rockspec, false, true, deps.get_deps_mode(flags)) |
74 | else | 74 | else |
75 | local ok, err = fs.check_command_permissions(flags) | 75 | local ok, err = fs.check_command_permissions(flags) |
76 | if not ok then return nil, err end | 76 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
77 | ok, err = build.build_rockspec(rockspec, false, true, deps.get_deps_mode(flags)) | 77 | ok, err = build.build_rockspec(rockspec, false, true, deps.get_deps_mode(flags)) |
78 | if not ok then return nil, err end | 78 | if not ok then return nil, err end |
79 | local name, version = ok, err | 79 | local name, version = ok, err |
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 5a6e4dc5..f2f6997b 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
@@ -132,8 +132,8 @@ end | |||
132 | -- a specific version; otherwise, try to remove all versions. | 132 | -- a specific version; otherwise, try to remove all versions. |
133 | -- @param version string: When passing a package name, a version number | 133 | -- @param version string: When passing a package name, a version number |
134 | -- may also be given. | 134 | -- may also be given. |
135 | -- @return boolean or (nil, string): True if removal was | 135 | -- @return boolean or (nil, string, exitcode): True if removal was |
136 | -- successful, nil and an error message otherwise. | 136 | -- successful, nil and an error message otherwise. exitcode is optionally returned. |
137 | function run(...) | 137 | function run(...) |
138 | local flags, name, version = util.parse_flags(...) | 138 | local flags, name, version = util.parse_flags(...) |
139 | 139 | ||
@@ -144,7 +144,7 @@ function run(...) | |||
144 | local deps_mode = flags["deps-mode"] or cfg.deps_mode | 144 | local deps_mode = flags["deps-mode"] or cfg.deps_mode |
145 | 145 | ||
146 | local ok, err = fs.check_command_permissions(flags) | 146 | local ok, err = fs.check_command_permissions(flags) |
147 | if not ok then return nil, err end | 147 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
148 | 148 | ||
149 | local rock_type = name:match("%.(rock)$") or name:match("%.(rockspec)$") | 149 | local rock_type = name:match("%.(rock)$") or name:match("%.(rockspec)$") |
150 | local filename = name | 150 | local filename = name |