aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fs/unix/tools.lua30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua
index b2237b22..f63efc41 100644
--- a/src/luarocks/fs/unix/tools.lua
+++ b/src/luarocks/fs/unix/tools.lua
@@ -306,36 +306,6 @@ function get_md5(file)
306 return computed:match("("..("%x"):rep(32)..")") 306 return computed:match("("..("%x"):rep(32)..")")
307end 307end
308 308
309--- Unpack an archive.
310-- Extract the contents of an archive, detecting its format by
311-- filename extension.
312-- @param archive string: Filename of archive.
313-- @return boolean or (boolean, string): true on success, false and an error message on failure.
314function unpack_archive(archive)
315 assert(type(archive) == "string")
316
317 local ok
318 if archive:match("%.tar%.gz$") or archive:match("%.tgz$") then
319 -- ok = fs.execute("tar zxvpf ", archive)
320 ok = fs.execute_string("gunzip -c "..archive.."|tar -xf -")
321 elseif archive:match("%.tar%.bz2$") then
322 -- ok = fs.execute("tar jxvpf ", archive)
323 ok = fs.execute_string("bunzip2 -c "..archive.."|tar -xf -")
324 elseif archive:match("%.zip$") then
325 ok = fs.execute("unzip ", archive)
326 elseif archive:match("%.lua$") or archive:match("%.c$") then
327 -- Ignore .lua and .c files; they don't need to be extracted.
328 return true
329 else
330 local ext = archive:match(".*(%..*)")
331 return false, "Unrecognized filename extension "..(ext or "")
332 end
333 if not ok then
334 return false, "Failed extracting "..archive
335 end
336 return true
337end
338
339function get_permissions(filename) 309function get_permissions(filename)
340 local ret 310 local ret
341 311