diff options
author | Hisham <hisham@gobolinux.org> | 2016-10-19 15:18:37 -0400 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-10-19 15:18:37 -0400 |
commit | 02dd4e1301ea11d60be2e36d66392d367c8e2c5b (patch) | |
tree | 940f6c5c8f55ebc80e9dcafb3ddcbbb05eca54f9 /src | |
parent | e1197dc9e029cb32b91c99c8cc26794ab4ab3cc1 (diff) | |
download | luarocks-02dd4e1301ea11d60be2e36d66392d367c8e2c5b.tar.gz luarocks-02dd4e1301ea11d60be2e36d66392d367c8e2c5b.tar.bz2 luarocks-02dd4e1301ea11d60be2e36d66392d367c8e2c5b.zip |
Add format-check function in rockspec table.
This avoids sprinkling the luarocks.deps dependency everywhere.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/build.lua | 4 | ||||
-rw-r--r-- | src/luarocks/build/cmake.lua | 3 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 7 | ||||
-rw-r--r-- | src/luarocks/fetch/git.lua | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 1d2925f9..790efef8 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -161,7 +161,7 @@ local function check_macosx_deployment_target(rockspec) | |||
161 | rockspec.variables[var] = "env MACOSX_DEPLOYMENT_TARGET="..target.." "..rockspec.variables[var] | 161 | rockspec.variables[var] = "env MACOSX_DEPLOYMENT_TARGET="..target.." "..rockspec.variables[var] |
162 | end | 162 | end |
163 | end | 163 | end |
164 | if cfg.platforms.macosx and deps.format_is_at_least(rockspec, "3.0") and target then | 164 | if cfg.platforms.macosx and rockspec:format_is_at_least("3.0") and target then |
165 | local version = util.popen_read("sw_vers -productVersion") | 165 | local version = util.popen_read("sw_vers -productVersion") |
166 | local versionminor = minor(version) | 166 | local versionminor = minor(version) |
167 | local targetminor = minor(target) | 167 | local targetminor = minor(target) |
@@ -431,7 +431,7 @@ function build.command(flags, name, version) | |||
431 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end | 431 | if not ok then return nil, err, cfg.errorcodes.PERMISSIONDENIED end |
432 | ok, err = do_build(name, version, deps.get_deps_mode(flags), flags["only-deps"]) | 432 | ok, err = do_build(name, version, deps.get_deps_mode(flags), flags["only-deps"]) |
433 | if not ok then return nil, err end | 433 | if not ok then return nil, err end |
434 | local name, version = ok, err | 434 | name, version = ok, err |
435 | if flags["only-deps"] then | 435 | if flags["only-deps"] then |
436 | return name, version | 436 | return name, version |
437 | end | 437 | end |
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index 43702979..8ee6b6b2 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua | |||
@@ -5,7 +5,6 @@ local cmake = {} | |||
5 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
7 | local cfg = require("luarocks.core.cfg") | 7 | local cfg = require("luarocks.core.cfg") |
8 | local deps = require("luarocks.deps") | ||
9 | 8 | ||
10 | --- Driver function for the "cmake" build back-end. | 9 | --- Driver function for the "cmake" build back-end. |
11 | -- @param rockspec table: the loaded rockspec. | 10 | -- @param rockspec table: the loaded rockspec. |
@@ -54,7 +53,7 @@ function cmake.run(rockspec) | |||
54 | end | 53 | end |
55 | 54 | ||
56 | local do_build, do_install | 55 | local do_build, do_install |
57 | if deps.format_is_at_least(rockspec, "3.0") then | 56 | if rockspec:format_is_at_least("3.0") then |
58 | do_build = (build.build_pass == nil) and true or build.build_pass | 57 | do_build = (build.build_pass == nil) and true or build.build_pass |
59 | do_install = (build.install_pass == nil) and true or build.install_pass | 58 | do_install = (build.install_pass == nil) and true or build.install_pass |
60 | else | 59 | else |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 9bf1922a..37db78f4 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -208,6 +208,7 @@ function fetch.load_local_rockspec(filename, quick) | |||
208 | return nil, "Rockspec format "..rockspec.rockspec_format.." is not supported, please upgrade LuaRocks." | 208 | return nil, "Rockspec format "..rockspec.rockspec_format.." is not supported, please upgrade LuaRocks." |
209 | end | 209 | end |
210 | end | 210 | end |
211 | rockspec.format_is_at_least = deps.format_is_at_least | ||
211 | 212 | ||
212 | util.platform_overrides(rockspec.build) | 213 | util.platform_overrides(rockspec.build) |
213 | util.platform_overrides(rockspec.dependencies) | 214 | util.platform_overrides(rockspec.dependencies) |
@@ -247,12 +248,12 @@ function fetch.load_local_rockspec(filename, quick) | |||
247 | rockspec.source.dir = rockspec.source.dir | 248 | rockspec.source.dir = rockspec.source.dir |
248 | or rockspec.source.module | 249 | or rockspec.source.module |
249 | or ( (filebase:match("%.lua$") or filebase:match("%.c$")) | 250 | or ( (filebase:match("%.lua$") or filebase:match("%.c$")) |
250 | and (deps.format_is_at_least(rockspec, "3.0") | 251 | and (rockspec:format_is_at_least("3.0") |
251 | and (fetch.is_basic_protocol(protocol) and "." or base) | 252 | and (fetch.is_basic_protocol(protocol) and "." or base) |
252 | or ".") ) | 253 | or ".") ) |
253 | or base | 254 | or base |
254 | 255 | ||
255 | rockspec.rocks_provided = (deps.format_is_at_least(rockspec, "3.0") | 256 | rockspec.rocks_provided = (rockspec:format_is_at_least("3.0") |
256 | and cfg.rocks_provided_3_0 | 257 | and cfg.rocks_provided_3_0 |
257 | or cfg.rocks_provided) | 258 | or cfg.rocks_provided) |
258 | 259 | ||
@@ -363,7 +364,7 @@ function fetch.get_sources(rockspec, extract, dest_dir) | |||
363 | -- with rockspecs newer than 3.0. | 364 | -- with rockspecs newer than 3.0. |
364 | local dir_count, found_dir = 0 | 365 | local dir_count, found_dir = 0 |
365 | 366 | ||
366 | if not rockspec.source.dir_set and deps.format_is_at_least(rockspec, "3.0") then | 367 | if not rockspec.source.dir_set and rockspec:format_is_at_least("3.0") then |
367 | local files = fs.list_dir() | 368 | local files = fs.list_dir() |
368 | for _, f in ipairs(files) do | 369 | for _, f in ipairs(files) do |
369 | if fs.is_dir(f) then | 370 | if fs.is_dir(f) then |
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index eaba7ffd..72da4974 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua | |||
@@ -110,7 +110,7 @@ function git.get_sources(rockspec, extract, dest_dir, depth) | |||
110 | end | 110 | end |
111 | 111 | ||
112 | -- Fetching git submodules is supported only when rockspec format is >= 3.0. | 112 | -- Fetching git submodules is supported only when rockspec format is >= 3.0. |
113 | if deps.format_is_at_least(rockspec, "3.0") then | 113 | if rockspec:format_is_at_least("3.0") then |
114 | command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"} | 114 | command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"} |
115 | 115 | ||
116 | if git_supports_shallow_submodules(git_cmd) then | 116 | if git_supports_shallow_submodules(git_cmd) then |