diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-08 20:21:30 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-10-08 20:21:30 -0300 |
commit | 5ccd4ab61619088de4a23a37735f2b08fee85f52 (patch) | |
tree | db8b399b2929c5444fbff1bb5e2c27d6be0c0a4e /src | |
parent | 481fb40c6b505af45a67c0f9d158284c504b72e4 (diff) | |
parent | dde3ca9493dedbb950d5c1dfdf32a1bd1b152fca (diff) | |
download | luarocks-5ccd4ab61619088de4a23a37735f2b08fee85f52.tar.gz luarocks-5ccd4ab61619088de4a23a37735f2b08fee85f52.tar.bz2 luarocks-5ccd4ab61619088de4a23a37735f2b08fee85f52.zip |
Merge branch 'master' into multitree
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/command_line.lua | 12 | ||||
-rw-r--r-- | src/luarocks/fs/lua.lua | 7 | ||||
-rw-r--r-- | src/luarocks/search.lua | 4 | ||||
-rw-r--r-- | src/luarocks/util.lua | 44 |
4 files changed, 24 insertions, 43 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 8fa9073c..d08ffdfe 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -21,18 +21,6 @@ local function die(message) | |||
21 | os.exit(1) | 21 | os.exit(1) |
22 | end | 22 | end |
23 | 23 | ||
24 | local function is_writable(tree) | ||
25 | if type(tree) == "string" then | ||
26 | return fs.make_dir(tree) and fs.is_writable(tree) | ||
27 | else | ||
28 | writable = true | ||
29 | for k, v in pairs(tree) do | ||
30 | writable = writable and fs.make_dir(v) and fs.is_writable(v) | ||
31 | end | ||
32 | return writable | ||
33 | end | ||
34 | end | ||
35 | |||
36 | --- Main command-line processor. | 24 | --- Main command-line processor. |
37 | -- Parses input arguments and calls the appropriate driver function | 25 | -- Parses input arguments and calls the appropriate driver function |
38 | -- to execute the action requested on the command-line, forwarding | 26 | -- to execute the action requested on the command-line, forwarding |
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 879b5d75..cd199fbb 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -664,13 +664,18 @@ function check_command_permissions(flags) | |||
664 | local root_dir = path.root_dir(cfg.rocks_dir) | 664 | local root_dir = path.root_dir(cfg.rocks_dir) |
665 | local ok = true | 665 | local ok = true |
666 | local err = "" | 666 | local err = "" |
667 | for _, dir in ipairs { cfg.rocks_dir, root_dir, dir.dir_name(root_dir) } do | 667 | for _, dir in ipairs { cfg.rocks_dir, root_dir } do |
668 | if fs.exists(dir) and not fs.is_writable(dir) then | 668 | if fs.exists(dir) and not fs.is_writable(dir) then |
669 | ok = false | 669 | ok = false |
670 | err = "Your user does not have write permissions in " .. dir | 670 | err = "Your user does not have write permissions in " .. dir |
671 | break | 671 | break |
672 | end | 672 | end |
673 | end | 673 | end |
674 | local root_parent = dir.dir_name(root_dir) | ||
675 | if ok and not fs.exists(root_dir) and not fs.is_writable(root_parent) then | ||
676 | ok = false | ||
677 | err = root_dir.." does not exist and your user does not have write permissions in " .. root_parent | ||
678 | end | ||
674 | if ok then | 679 | if ok then |
675 | return true | 680 | return true |
676 | else | 681 | else |
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 4e0318c7..ec0fa69c 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
@@ -287,9 +287,7 @@ end | |||
287 | -- @param results table: A table where keys are package names and versions | 287 | -- @param results table: A table where keys are package names and versions |
288 | -- are tables matching version strings to an array of rocks servers. | 288 | -- are tables matching version strings to an array of rocks servers. |
289 | -- @param show_repo boolean or nil: Whether to show repository | 289 | -- @param show_repo boolean or nil: Whether to show repository |
290 | -- @param long boolean or nil: Whether to show module files | 290 | function print_results(results, show_repo) |
291 | -- information or not. Default is true. | ||
292 | function print_results(results, show_repo, long) | ||
293 | assert(type(results) == "table") | 291 | assert(type(results) == "table") |
294 | assert(type(show_repo) == "boolean" or not show_repo) | 292 | assert(type(show_repo) == "boolean" or not show_repo) |
295 | -- Force display of repo location for the time being | 293 | -- Force display of repo location for the time being |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 46802255..67a3778a 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -344,33 +344,23 @@ function remove_path_dupes(list, sep) | |||
344 | return table.concat(final, sep) | 344 | return table.concat(final, sep) |
345 | end | 345 | end |
346 | 346 | ||
347 | --[[ | 347 | --- |
348 | Author: Julio Manuel Fernandez-Diaz | 348 | -- Formats tables with cycles recursively to any depth. |
349 | Date: January 12, 2007 | 349 | -- References to other tables are shown as values. |
350 | (For Lua 5.1) | 350 | -- Self references are indicated. |
351 | 351 | -- The string returned is "Lua code", which can be procesed | |
352 | Formats tables with cycles recursively to any depth. | 352 | -- (in the case in which indent is composed by spaces or "--"). |
353 | The output is returned as a string. | 353 | -- Userdata and function keys and values are shown as strings, |
354 | References to other tables are shown as values. | 354 | -- which logically are exactly not equivalent to the original code. |
355 | Self references are indicated. | 355 | -- This routine can serve for pretty formating tables with |
356 | 356 | -- proper indentations, apart from printing them: | |
357 | The string returned is "Lua code", which can be procesed | 357 | -- io.write(table.show(t, "t")) -- a typical use |
358 | (in the case in which indent is composed by spaces or "--"). | 358 | -- Written by Julio Manuel Fernandez-Diaz, |
359 | Userdata and function keys and values are shown as strings, | 359 | -- Heavily based on "Saving tables with cycles", PIL2, p. 113. |
360 | which logically are exactly not equivalent to the original code. | 360 | -- @param t table: is the table. |
361 | 361 | -- @param name string: is the name of the table (optional) | |
362 | This routine can serve for pretty formating tables with | 362 | -- @param indent string: is a first indentation (optional). |
363 | proper indentations, apart from printing them: | 363 | -- @return string: the pretty-printed table |
364 | |||
365 | io.write(table.show(t, "t")) -- a typical use | ||
366 | |||
367 | Heavily based on "Saving tables with cycles", PIL2, p. 113. | ||
368 | |||
369 | Arguments: | ||
370 | t is the table. | ||
371 | name is the name of the table (optional) | ||
372 | indent is a first indentation (optional). | ||
373 | --]] | ||
374 | function show_table(t, name, indent) | 364 | function show_table(t, name, indent) |
375 | local cart -- a container | 365 | local cart -- a container |
376 | local autoref -- for self references | 366 | local autoref -- for self references |