aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c>2009-05-27 00:04:35 +0000
committerhisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c>2009-05-27 00:04:35 +0000
commit0f2b7ef0feeeead5edfbb087b4713addb026c739 (patch)
tree547d1e314f6d118962f28117446d63abab2b95ad /src
parent6e519fd6b29411fd77d27134f01a79cff4d626b2 (diff)
downloadluarocks-0f2b7ef0feeeead5edfbb087b4713addb026c739.tar.gz
luarocks-0f2b7ef0feeeead5edfbb087b4713addb026c739.tar.bz2
luarocks-0f2b7ef0feeeead5edfbb087b4713addb026c739.zip
work in conversion of manifest format
git-svn-id: http://luarocks.org/svn/luarocks/trunk@25 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'src')
-rw-r--r--src/luarocks.lua2
-rw-r--r--src/luarocks/manif.lua9
-rw-r--r--src/luarocks/rep.lua20
3 files changed, 13 insertions, 18 deletions
diff --git a/src/luarocks.lua b/src/luarocks.lua
index aef93363..8530fd90 100644
--- a/src/luarocks.lua
+++ b/src/luarocks.lua
@@ -182,7 +182,7 @@ local function pick_module(module, constraints)
182 for _, tree in pairs(rocks_trees) do 182 for _, tree in pairs(rocks_trees) do
183 local entries = tree.manifest.modules[module] 183 local entries = tree.manifest.modules[module]
184 if entries then 184 if entries then
185 for _, entry in pairs(entries) do 185 for entry, _ in pairs(entries) do
186 local name, version = entry:match("^([^/]*)/(.*)$") 186 local name, version = entry:match("^([^/]*)/(.*)$")
187 if context[name] == version then 187 if context[name] == version then
188 return name, version, tree 188 return name, version, tree
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua
index f9c53d4f..6bf3fe15 100644
--- a/src/luarocks/manif.lua
+++ b/src/luarocks/manif.lua
@@ -72,14 +72,14 @@ local function store_package_items(itemsfn, pkg, version, tbl)
72 assert(type(version) == "string") 72 assert(type(version) == "string")
73 assert(type(tbl) == "table") 73 assert(type(tbl) == "table")
74 74
75 local path = pkg.."/"..version 75 local pkg_version = pkg.."/"..version
76 local result = {} 76 local result = {}
77 for item, _ in pairs(itemsfn(pkg, version)) do 77 for item, path in pairs(itemsfn(pkg, version)) do
78 table.insert(result, item) 78 result[item] = path
79 if not tbl[item] then 79 if not tbl[item] then
80 tbl[item] = {} 80 tbl[item] = {}
81 end 81 end
82 table.insert(tbl[item], path) 82 tbl[item][pkg_version] = path
83 end 83 end
84 return result 84 return result
85end 85end
@@ -237,7 +237,6 @@ function make_manifest(repo)
237 query.exact_name = false 237 query.exact_name = false
238 query.arch = "any" 238 query.arch = "any"
239 local results = search.disk_search(repo, query) 239 local results = search.disk_search(repo, query)
240
241 local manifest = { repository = {}, modules = {}, commands = {} } 240 local manifest = { repository = {}, modules = {}, commands = {} }
242 manif_core.manifest_cache[repo] = manifest 241 manif_core.manifest_cache[repo] = manifest
243 store_results(results, manifest) 242 store_results(results, manifest)
diff --git a/src/luarocks/rep.lua b/src/luarocks/rep.lua
index 304832f1..392c4353 100644
--- a/src/luarocks/rep.lua
+++ b/src/luarocks/rep.lua
@@ -107,18 +107,14 @@ function package_modules(package, version)
107 assert(type(version) == "string") 107 assert(type(version) == "string")
108 108
109 local result = {} 109 local result = {}
110 local luas = fs.find(path.lua_dir(package, version)) 110 for _, pathdir in pairs{ path.lua_dir, path.lib_dir } do
111 local libs = fs.find(path.lib_dir(package, version)) 111 local basedir = pathdir(package, version)
112 for _, file in ipairs(luas) do 112 local files = fs.find(basedir)
113 local name = path.path_to_module(file) 113 for _, file in ipairs(files) do
114 if name then 114 local name = path.path_to_module(file)
115 result[name] = file 115 if name then
116 end 116 result[name] = dir.path(basedir, file)
117 end 117 end
118 for _, file in ipairs(libs) do
119 local name = path.path_to_module(file)
120 if name then
121 result[name] = file
122 end 118 end
123 end 119 end
124 return result 120 return result