aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-07-04 15:23:35 -0300
committerHisham Muhammad <hisham@gobolinux.org>2013-07-04 15:23:35 -0300
commit8fb82e6e543d916e35aa68e887bba8217f9b50d0 (patch)
treee77739a1afc17da8026218921b1268ba2ca39c29
parentaff559479ce9af00327295927e2ed85d72fe6cd0 (diff)
parenteb6a11ee3d7f1457b611c009532ba0ecf76a5e17 (diff)
downloadluarocks-8fb82e6e543d916e35aa68e887bba8217f9b50d0.tar.gz
luarocks-8fb82e6e543d916e35aa68e887bba8217f9b50d0.tar.bz2
luarocks-8fb82e6e543d916e35aa68e887bba8217f9b50d0.zip
Merge branch 'master' into remove_on_install
-rw-r--r--src/luarocks/deps.lua21
-rw-r--r--src/luarocks/fetch.lua4
2 files changed, 15 insertions, 10 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 7aefd40e..5ac822cf 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -170,10 +170,15 @@ local function parse_constraint(input)
170 assert(type(input) == "string") 170 assert(type(input) == "string")
171 171
172 local no_upgrade, op, version, rest = input:match("^(@?)([<>=~!]*)%s*([%w%.%_%-]+)[%s,]*(.*)") 172 local no_upgrade, op, version, rest = input:match("^(@?)([<>=~!]*)%s*([%w%.%_%-]+)[%s,]*(.*)")
173 op = operators[op] 173 local _op = operators[op]
174 version = parse_version(version) 174 version = parse_version(version)
175 if not op or not version then return nil end 175 if not _op then
176 return { op = op, version = version, no_upgrade = no_upgrade=="@" and true or nil }, rest 176 return nil, "Encountered bad constraint operator: '"..tostring(op).."' in '"..input.."'"
177 end
178 if not version then
179 return nil, "Could not parse version from constraint: '"..input.."'"
180 end
181 return { op = _op, version = version, no_upgrade = no_upgrade=="@" and true or nil }, rest
177end 182end
178 183
179--- Convert a list of constraints from string to table format. 184--- Convert a list of constraints from string to table format.
@@ -187,13 +192,13 @@ end
187function parse_constraints(input) 192function parse_constraints(input)
188 assert(type(input) == "string") 193 assert(type(input) == "string")
189 194
190 local constraints, constraint = {}, nil 195 local constraints, constraint, oinput = {}, nil, input
191 while #input > 0 do 196 while #input > 0 do
192 constraint, input = parse_constraint(input) 197 constraint, input = parse_constraint(input)
193 if constraint then 198 if constraint then
194 table.insert(constraints, constraint) 199 table.insert(constraints, constraint)
195 else 200 else
196 return nil 201 return nil, "Failed to parse constraint '"..tostring(oinput).."' with error: ".. input
197 end 202 end
198 end 203 end
199 return constraints 204 return constraints
@@ -213,9 +218,9 @@ function parse_dep(dep)
213 assert(type(dep) == "string") 218 assert(type(dep) == "string")
214 219
215 local name, rest = dep:match("^%s*([a-zA-Z][a-zA-Z0-9%.%-%_]*)%s*(.*)") 220 local name, rest = dep:match("^%s*([a-zA-Z][a-zA-Z0-9%.%-%_]*)%s*(.*)")
216 if not name then return nil end 221 if not name then return nil, "failed to extract dependency name from '"..tostring(dep).."'" end
217 local constraints = parse_constraints(rest) 222 local constraints, err = parse_constraints(rest)
218 if not constraints then return nil end 223 if not constraints then return nil, err end
219 return { name = name, constraints = constraints } 224 return { name = name, constraints = constraints }
220end 225end
221 226
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index 3bb0cdc0..bfdbacec 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -189,9 +189,9 @@ function load_local_rockspec(filename)
189 or base 189 or base
190 if rockspec.dependencies then 190 if rockspec.dependencies then
191 for i = 1, #rockspec.dependencies do 191 for i = 1, #rockspec.dependencies do
192 local parsed = deps.parse_dep(rockspec.dependencies[i]) 192 local parsed, err = deps.parse_dep(rockspec.dependencies[i])
193 if not parsed then 193 if not parsed then
194 return nil, "Parse error processing dependency '"..rockspec.dependencies[i].."'" 194 return nil, "Parse error processing dependency '"..rockspec.dependencies[i].."': "..tostring(err)
195 end 195 end
196 rockspec.dependencies[i] = parsed 196 rockspec.dependencies[i] = parsed
197 end 197 end