diff options
| author | Hisham <hisham@gobolinux.org> | 2016-10-27 14:31:45 -0200 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-10-27 14:31:45 -0200 |
| commit | 5137884ef5ec78d1922a85691eefea48d6391c76 (patch) | |
| tree | 76a4d741ef85cfa4a07a5b2ef096410236a24847 /src | |
| parent | 518e3b4f49f95a345d5f93600c85ce61b0f9fc41 (diff) | |
| parent | f7ae6213f430798ec86883f9ab9917b156e1758d (diff) | |
| download | luarocks-5137884ef5ec78d1922a85691eefea48d6391c76.tar.gz luarocks-5137884ef5ec78d1922a85691eefea48d6391c76.tar.bz2 luarocks-5137884ef5ec78d1922a85691eefea48d6391c76.zip | |
Merge branch 'master' into luarocks-3
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/build/builtin.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/command_line.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/core/cfg.lua | 89 | ||||
| -rw-r--r-- | src/luarocks/doc.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/download.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/lint.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/manif.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/new_version.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/pack.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/path_cmd.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/remove.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/show.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/unpack.lua | 2 |
14 files changed, 72 insertions, 43 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 3601dc9b..f3b054d2 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -226,7 +226,7 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 226 | end | 226 | end |
| 227 | 227 | ||
| 228 | if not minimal_mode then | 228 | if not minimal_mode then |
| 229 | local _, source_dir | 229 | local source_dir |
| 230 | if need_to_fetch then | 230 | if need_to_fetch then |
| 231 | ok, source_dir, errcode = fetch.fetch_sources(rockspec, true) | 231 | ok, source_dir, errcode = fetch.fetch_sources(rockspec, true) |
| 232 | if not ok then | 232 | if not ok then |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 3a4beb17..db6f8bc4 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -175,7 +175,7 @@ function builtin.run(rockspec) | |||
| 175 | add_flags(extras, "-Wl,-rpath,%s:", libdirs) | 175 | add_flags(extras, "-Wl,-rpath,%s:", libdirs) |
| 176 | end | 176 | end |
| 177 | add_flags(extras, "-l%s", libraries) | 177 | add_flags(extras, "-l%s", libraries) |
| 178 | if cfg.is_platform("cygwin") then | 178 | if cfg.link_lua_explicitly then |
| 179 | add_flags(extras, "-l%s", {"lua"}) | 179 | add_flags(extras, "-l%s", {"lua"}) |
| 180 | end | 180 | end |
| 181 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, "-L"..variables.LUA_LIBDIR, unpack(extras)) | 181 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, "-L"..variables.LUA_LIBDIR, unpack(extras)) |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index f7f6ccb6..96891b75 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | --- Functions for command-line scripts. | 2 | --- Functions for command-line scripts. |
| 3 | local command_line = {} | 3 | local command_line = {} |
| 4 | 4 | ||
| 5 | local pack = function(...) return {...}, select("#", ...) end | ||
| 6 | local unpack = unpack or table.unpack | 5 | local unpack = unpack or table.unpack |
| 7 | 6 | ||
| 8 | local util = require("luarocks.util") | 7 | local util = require("luarocks.util") |
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 17f76d14..de8b9281 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
| @@ -131,24 +131,27 @@ else | |||
| 131 | -- Fall back to Unix in unknown systems. | 131 | -- Fall back to Unix in unknown systems. |
| 132 | end | 132 | end |
| 133 | 133 | ||
| 134 | -- Set order for platform overrides | 134 | -- Set order for platform overrides. |
| 135 | -- More general platform identifiers should be listed first, | ||
| 136 | -- more specific ones later. | ||
| 135 | local platform_order = { | 137 | local platform_order = { |
| 136 | -- Unixes | 138 | -- Unixes |
| 137 | unix = 1, | 139 | "unix", |
| 138 | bsd = 2, | 140 | "bsd", |
| 139 | solaris = 3, | 141 | "solaris", |
| 140 | netbsd = 4, | 142 | "netbsd", |
| 141 | openbsd = 5, | 143 | "openbsd", |
| 142 | freebsd = 6, | 144 | "freebsd", |
| 143 | linux = 7, | 145 | "linux", |
| 144 | macosx = 8, | 146 | "macosx", |
| 145 | cygwin = 9, | 147 | "cygwin", |
| 146 | msys = 10, | 148 | "msys", |
| 147 | haiku = 11, | 149 | "haiku", |
| 148 | -- Windows | 150 | -- Windows |
| 149 | win32 = 12, | 151 | "win32", |
| 150 | mingw32 = 13, | 152 | "mingw32", |
| 151 | windows = 14 } | 153 | "windows", |
| 154 | } | ||
| 152 | 155 | ||
| 153 | -- Path configuration: | 156 | -- Path configuration: |
| 154 | local sys_config_file, home_config_file | 157 | local sys_config_file, home_config_file |
| @@ -274,26 +277,50 @@ if not next(cfg.rocks_trees) then | |||
| 274 | end | 277 | end |
| 275 | end | 278 | end |
| 276 | 279 | ||
| 277 | |||
| 278 | -- update platforms list; keyed -> array | 280 | -- update platforms list; keyed -> array |
| 279 | do | 281 | do |
| 280 | local lst = {} -- use temp array to not confuse `pairs` in loop | 282 | -- if explicitly given by user, |
| 281 | for plat in pairs(cfg.platforms) do | 283 | if cfg.platforms[1] then |
| 282 | if cfg.platforms[plat] then -- entries set to 'false' skipped | 284 | local is_windows = cfg.platforms.windows |
| 283 | if not platform_order[plat] then | 285 | -- Clear auto-detected values |
| 284 | local pl = "" | 286 | for k, _ in pairs(cfg.platforms) do |
| 285 | for k,_ in pairs(platform_order) do pl = pl .. ", " .. k end | 287 | if type(k) == "string" then |
| 286 | io.stderr:write("Bad platform given; "..tostring(plat)..". Valid entries are: "..pl:sub(3,-1) ..".\n") | 288 | cfg.platforms[k] = nil |
| 287 | os.exit(cfg.errorcodes.CONFIGFILE) | 289 | end |
| 290 | end | ||
| 291 | -- and set the ones given by the user. | ||
| 292 | for _, plat in ipairs(cfg.platforms) do | ||
| 293 | cfg.platforms[plat] = true | ||
| 294 | end | ||
| 295 | -- If no major platform family was set by the user, | ||
| 296 | if not (cfg.platforms.unix or cfg.platforms.windows) then | ||
| 297 | -- set some fallback defaults in case the user provides an incomplete configuration. | ||
| 298 | -- LuaRocks expects a set of defaults to be available. | ||
| 299 | -- This is used for setting defaults here only; the platform overrides | ||
| 300 | -- will use only the user's list. | ||
| 301 | if is_windows then | ||
| 302 | cfg.platforms.windows = true | ||
| 303 | table.insert(cfg.platforms, "windows") | ||
| 304 | else | ||
| 305 | cfg.platforms.unix = true | ||
| 306 | table.insert(cfg.platforms, "unix") | ||
| 307 | end | ||
| 308 | end | ||
| 309 | else | ||
| 310 | -- Sort detected platform defaults | ||
| 311 | local order = {} | ||
| 312 | for i, v in ipairs(platform_order) do | ||
| 313 | order[v] = i | ||
| 314 | end | ||
| 315 | local entries = {} | ||
| 316 | for k, v in pairs(cfg.platforms) do | ||
| 317 | if type(k) == "string" and v == true then | ||
| 318 | table.insert(entries, k) | ||
| 288 | end | 319 | end |
| 289 | table.insert(lst, plat) | ||
| 290 | else | ||
| 291 | cfg.platforms[plat] = nil | ||
| 292 | end | 320 | end |
| 321 | table.sort(entries, function(a, b) return order[a] < order[b] end) | ||
| 322 | util.deep_merge(cfg.platforms, entries) | ||
| 293 | end | 323 | end |
| 294 | -- platform overrides depent on the order, so set priorities | ||
| 295 | table.sort(lst, function(key1, key2) return platform_order[key1] < platform_order[key2] end) | ||
| 296 | util.deep_merge(cfg.platforms, lst) | ||
| 297 | end | 324 | end |
| 298 | 325 | ||
| 299 | -- Configure defaults: | 326 | -- Configure defaults: |
| @@ -315,6 +342,7 @@ local defaults = { | |||
| 315 | arch = "unknown", | 342 | arch = "unknown", |
| 316 | lib_extension = "unknown", | 343 | lib_extension = "unknown", |
| 317 | obj_extension = "unknown", | 344 | obj_extension = "unknown", |
| 345 | link_lua_explicitly = false, | ||
| 318 | 346 | ||
| 319 | rocks_servers = { | 347 | rocks_servers = { |
| 320 | { | 348 | { |
| @@ -536,6 +564,7 @@ if cfg.platforms.cygwin then | |||
| 536 | defaults.variables.CC = "echo -llua | xargs gcc" | 564 | defaults.variables.CC = "echo -llua | xargs gcc" |
| 537 | defaults.variables.LD = "echo -llua | xargs gcc" | 565 | defaults.variables.LD = "echo -llua | xargs gcc" |
| 538 | defaults.variables.LIBFLAG = "-shared" | 566 | defaults.variables.LIBFLAG = "-shared" |
| 567 | defaults.link_lua_explicitly = true | ||
| 539 | end | 568 | end |
| 540 | 569 | ||
| 541 | if cfg.platforms.msys then | 570 | if cfg.platforms.msys then |
diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index 63c4c4e3..5d521276 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua | |||
| @@ -61,6 +61,8 @@ function doc.command(flags, name, version) | |||
| 61 | return nil, "Argument missing. "..util.see_help("doc") | 61 | return nil, "Argument missing. "..util.see_help("doc") |
| 62 | end | 62 | end |
| 63 | 63 | ||
| 64 | name = name:lower() | ||
| 65 | |||
| 64 | local iname, iversion, repo = search.pick_installed_rock(name, version, flags["tree"]) | 66 | local iname, iversion, repo = search.pick_installed_rock(name, version, flags["tree"]) |
| 65 | if not iname then | 67 | if not iname then |
| 66 | util.printout(name..(version and " "..version or "").." is not installed. Looking for it in the rocks servers...") | 68 | util.printout(name..(version and " "..version or "").." is not installed. Looking for it in the rocks servers...") |
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index c81958de..557d1b65 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
| @@ -100,7 +100,7 @@ function download.command(flags, name, version) | |||
| 100 | arch = flags["arch"] | 100 | arch = flags["arch"] |
| 101 | end | 101 | end |
| 102 | 102 | ||
| 103 | local dl, err = download.download(arch, name, version, flags["all"]) | 103 | local dl, err = download.download(arch, name:lower(), version, flags["all"]) |
| 104 | return dl and true, err | 104 | return dl and true, err |
| 105 | end | 105 | end |
| 106 | 106 | ||
diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index 742f1736..c9ea45ea 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua | |||
| @@ -24,7 +24,7 @@ function lint.command(flags, input) | |||
| 24 | local filename = input | 24 | local filename = input |
| 25 | if not input:match(".rockspec$") then | 25 | if not input:match(".rockspec$") then |
| 26 | local err | 26 | local err |
| 27 | filename, err = download.download("rockspec", input) | 27 | filename, err = download.download("rockspec", input:lower()) |
| 28 | if not filename then | 28 | if not filename then |
| 29 | return nil, err | 29 | return nil, err |
| 30 | end | 30 | end |
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 40657fdf..8277b3a5 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
| @@ -32,6 +32,7 @@ function manif.load_rock_manifest(name, version, root) | |||
| 32 | return rock_manifest.rock_manifest | 32 | return rock_manifest.rock_manifest |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | |||
| 35 | local function fetch_manifest_from(repo_url, filename) | 36 | local function fetch_manifest_from(repo_url, filename) |
| 36 | local url = dir.path(repo_url, filename) | 37 | local url = dir.path(repo_url, filename) |
| 37 | local name = repo_url:gsub("[/:]","_") | 38 | local name = repo_url:gsub("[/:]","_") |
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 000b459b..b13dbb97 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
| @@ -140,7 +140,7 @@ function new_version.command(flags, input, version, url) | |||
| 140 | return nil, err | 140 | return nil, err |
| 141 | end | 141 | end |
| 142 | else | 142 | else |
| 143 | filename, err = download.download("rockspec", input) | 143 | filename, err = download.download("rockspec", input:lower()) |
| 144 | if not filename then | 144 | if not filename then |
| 145 | return nil, err | 145 | return nil, err |
| 146 | end | 146 | end |
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index 49c68e85..655cbf37 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
| @@ -180,7 +180,7 @@ function pack.command(flags, arg, version) | |||
| 180 | if arg:match(".*%.rockspec") then | 180 | if arg:match(".*%.rockspec") then |
| 181 | file, err = pack.pack_source_rock(arg) | 181 | file, err = pack.pack_source_rock(arg) |
| 182 | else | 182 | else |
| 183 | file, err = do_pack_binary_rock(arg, version, flags["tree"]) | 183 | file, err = do_pack_binary_rock(arg:lower(), version, flags["tree"]) |
| 184 | end | 184 | end |
| 185 | if err then | 185 | if err then |
| 186 | return nil, err | 186 | return nil, err |
diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua index 1f5bb07f..627d97cf 100644 --- a/src/luarocks/path_cmd.lua +++ b/src/luarocks/path_cmd.lua | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | local path_cmd = {} | 4 | local path_cmd = {} |
| 5 | 5 | ||
| 6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
| 7 | local deps = require("luarocks.deps") | ||
| 8 | local cfg = require("luarocks.core.cfg") | 7 | local cfg = require("luarocks.core.cfg") |
| 8 | local cfg = require("luarocks.cfg") | ||
| 9 | 9 | ||
| 10 | path_cmd.help_summary = "Return the currently configured package path." | 10 | path_cmd.help_summary = "Return the currently configured package path." |
| 11 | path_cmd.help_arguments = "" | 11 | path_cmd.help_arguments = "" |
| @@ -34,8 +34,6 @@ And on Windows: | |||
| 34 | --- Driver function for "path" command. | 34 | --- Driver function for "path" command. |
| 35 | -- @return boolean This function always succeeds. | 35 | -- @return boolean This function always succeeds. |
| 36 | function path_cmd.command(flags) | 36 | function path_cmd.command(flags) |
| 37 | local deps_mode = deps.get_deps_mode(flags) | ||
| 38 | |||
| 39 | local lr_path, lr_cpath, lr_bin = cfg.package_paths(flags["tree"]) | 37 | local lr_path, lr_cpath, lr_bin = cfg.package_paths(flags["tree"]) |
| 40 | local path_sep = cfg.export_path_separator | 38 | local path_sep = cfg.export_path_separator |
| 41 | 39 | ||
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 008d2616..e7f37604 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
| @@ -10,7 +10,6 @@ local repos = require("luarocks.repos") | |||
| 10 | local path = require("luarocks.path") | 10 | local path = require("luarocks.path") |
| 11 | local util = require("luarocks.util") | 11 | local util = require("luarocks.util") |
| 12 | local cfg = require("luarocks.core.cfg") | 12 | local cfg = require("luarocks.core.cfg") |
| 13 | local writer = require("luarocks.manif.writer") | ||
| 14 | local fs = require("luarocks.fs") | 13 | local fs = require("luarocks.fs") |
| 15 | 14 | ||
| 16 | remove.help_summary = "Uninstall a rock." | 15 | remove.help_summary = "Uninstall a rock." |
| @@ -154,6 +153,7 @@ function remove.command(flags, name, version) | |||
| 154 | end | 153 | end |
| 155 | 154 | ||
| 156 | local results = {} | 155 | local results = {} |
| 156 | name = name:lower() | ||
| 157 | search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) | 157 | search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) |
| 158 | if not results[name] then | 158 | if not results[name] then |
| 159 | return nil, "Could not find rock '"..name..(version and " "..version or "").."' in "..path.rocks_tree_to_string(cfg.root_dir) | 159 | return nil, "Could not find rock '"..name..(version and " "..version or "").."' in "..path.rocks_tree_to_string(cfg.root_dir) |
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 53d8ffa5..1ff81e08 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
| @@ -76,7 +76,7 @@ function show.command(flags, name, version) | |||
| 76 | end | 76 | end |
| 77 | 77 | ||
| 78 | local repo, repo_url | 78 | local repo, repo_url |
| 79 | name, version, repo, repo_url = search.pick_installed_rock(name, version, flags["tree"]) | 79 | name, version, repo, repo_url = search.pick_installed_rock(name:lower(), version, flags["tree"]) |
| 80 | if not name then | 80 | if not name then |
| 81 | return nil, version | 81 | return nil, version |
| 82 | end | 82 | end |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index af3398ab..c50701b0 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
| @@ -157,7 +157,7 @@ function unpack.command(flags, name, version) | |||
| 157 | return run_unpacker(name, flags["force"]) | 157 | return run_unpacker(name, flags["force"]) |
| 158 | else | 158 | else |
| 159 | local search = require("luarocks.search") | 159 | local search = require("luarocks.search") |
| 160 | return search.act_on_src_or_rockspec(run_unpacker, name, version) | 160 | return search.act_on_src_or_rockspec(run_unpacker, name:lower(), version) |
| 161 | end | 161 | end |
| 162 | end | 162 | end |
| 163 | 163 | ||
