aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-04-12 17:29:21 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-04-13 17:11:12 -0300
commit6bab7030971e07cb8950cb829cef58ba5debe792 (patch)
tree08e5cbaa1e3f59c276e1a9ff19f7cb2587e8b46f
parent2871199838131b5a4c5a99d8e1fedbcd26017b0e (diff)
downloadluarocks-6bab7030971e07cb8950cb829cef58ba5debe792.tar.gz
luarocks-6bab7030971e07cb8950cb829cef58ba5debe792.tar.bz2
luarocks-6bab7030971e07cb8950cb829cef58ba5debe792.zip
Support build_dependencies in the show command
-rw-r--r--spec/show_spec.lua11
-rw-r--r--src/luarocks/cmd/show.lua30
-rw-r--r--src/luarocks/util.lua1
3 files changed, 33 insertions, 9 deletions
diff --git a/spec/show_spec.lua b/spec/show_spec.lua
index abf9a93b..4880106d 100644
--- a/spec/show_spec.lua
+++ b/spec/show_spec.lua
@@ -77,4 +77,15 @@ describe("LuaRocks show #blackbox #b_show", function()
77 run.luarocks("install luacov 0.11.0") 77 run.luarocks("install luacov 0.11.0")
78 run.luarocks_bool("show luacov 0.11.0") 78 run.luarocks_bool("show luacov 0.11.0")
79 end) 79 end)
80
81 it("shows #build_dependencies", function()
82 assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" ))
83 assert.match("a_build_dep", run.luarocks("show has_build_dep"))
84 end)
85
86 it("gets #build_dependencies via --build-deps", function()
87 assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" ))
88 assert.match("a_build_dep", run.luarocks("show has_build_dep --build-deps"))
89 end)
90
80end) 91end)
diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua
index bed210d2..dfd2f3de 100644
--- a/src/luarocks/cmd/show.lua
+++ b/src/luarocks/cmd/show.lua
@@ -7,7 +7,6 @@ local search = require("luarocks.search")
7local cfg = require("luarocks.core.cfg") 7local cfg = require("luarocks.core.cfg")
8local util = require("luarocks.util") 8local util = require("luarocks.util")
9local path = require("luarocks.path") 9local path = require("luarocks.path")
10local vers = require("luarocks.core.vers")
11local fetch = require("luarocks.fetch") 10local fetch = require("luarocks.fetch")
12local manif = require("luarocks.manif") 11local manif = require("luarocks.manif")
13local repos = require("luarocks.repos") 12local repos = require("luarocks.repos")
@@ -19,13 +18,14 @@ show.help = [[
19Without any flags, show all module information. 18Without any flags, show all module information.
20With these flags, return only the desired information: 19With these flags, return only the desired information:
21 20
22--home home page of project 21--home home page of project
23--modules all modules provided by this package as used by require() 22--modules all modules provided by this package as used by require()
24--deps packages this package depends on 23--deps packages this package depends on
25--rockspec the full path of the rockspec file 24--build-deps build-only dependencies for this package
26--mversion the package version 25--rockspec the full path of the rockspec file
27--rock-tree local tree where rock is installed 26--mversion the package version
28--rock-dir data directory of the installed rock 27--rock-tree local tree where rock is installed
28--rock-dir data directory of the installed rock
29]] 29]]
30 30
31local function keys_as_string(t, sep) 31local function keys_as_string(t, sep)
@@ -112,6 +112,10 @@ function show.command(flags, name, version)
112 for _, dep in ipairs(rockspec.dependencies) do 112 for _, dep in ipairs(rockspec.dependencies) do
113 util.printout(tostring(dep)) 113 util.printout(tostring(dep))
114 end 114 end
115 elseif flags["build-deps"] then
116 for _, dep in ipairs(rockspec.build_dependencies) do
117 util.printout(tostring(dep))
118 end
115 elseif flags["rockspec"] then util.printout(rockspec_file) 119 elseif flags["rockspec"] then util.printout(rockspec_file)
116 elseif flags["mversion"] then util.printout(version) 120 elseif flags["mversion"] then util.printout(version)
117 else 121 else
@@ -148,6 +152,14 @@ function show.command(flags, name, version)
148 print_items(name, version, minfo.modules, "module", repo) 152 print_items(name, version, minfo.modules, "module", repo)
149 end 153 end
150 154
155 if #rockspec.build_dependencies > 0 then
156 util.printout()
157 util.printout("Has build dependency on:")
158 for _, dep in ipairs(rockspec.build_dependencies) do
159 util.printout("\t"..tostring(dep).." "..installed_rock_label(dep, flags["tree"]))
160 end
161 end
162
151 local direct_deps = {} 163 local direct_deps = {}
152 if #rockspec.dependencies > 0 then 164 if #rockspec.dependencies > 0 then
153 util.printout() 165 util.printout()
@@ -166,7 +178,7 @@ function show.command(flags, name, version)
166 has_indirect_deps = true 178 has_indirect_deps = true
167 end 179 end
168 180
169 util.printout("\t"..dep_name.." "..installed_rock_label(dep_name, flags["tree"])) 181 util.printout("\t"..tostring(dep_name).." "..installed_rock_label(queries.new(dep_name), flags["tree"]))
170 end 182 end
171 end 183 end
172 util.printout() 184 util.printout()
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index 426868e4..c797fa80 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -86,6 +86,7 @@ local supported_flags = {
86 ["bin"] = true, 86 ["bin"] = true,
87 ["binary"] = true, 87 ["binary"] = true,
88 ["branch"] = "<branch-name>", 88 ["branch"] = "<branch-name>",
89 ["build-deps"] = true,
89 ["debug"] = true, 90 ["debug"] = true,
90 ["deps"] = true, 91 ["deps"] = true,
91 ["deps-mode"] = "<mode>", 92 ["deps-mode"] = "<mode>",