aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabio Mascarenhas <mascarenhas@lambda-2.local>2010-01-16 01:42:57 -0200
committerFabio Mascarenhas <mascarenhas@lambda-2.local>2010-01-16 01:42:57 -0200
commit208f150e363188b617123d4d0e1406ced5d93ba3 (patch)
treed13f142547f3167cd37c700e9554cfc89df353bb /src
parentaadfebb888572534a566da6986a458db8c4c7250 (diff)
downloadluarocks-208f150e363188b617123d4d0e1406ced5d93ba3.tar.gz
luarocks-208f150e363188b617123d4d0e1406ced5d93ba3.tar.bz2
luarocks-208f150e363188b617123d4d0e1406ced5d93ba3.zip
use 7z for all archive operations on windows
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fs/win32/tools.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua
index 0555a3b1..5a0f41f3 100644
--- a/src/luarocks/fs/win32/tools.lua
+++ b/src/luarocks/fs/win32/tools.lua
@@ -279,7 +279,7 @@ end
279-- additional arguments. 279-- additional arguments.
280-- @return boolean: true on success, false on failure. 280-- @return boolean: true on success, false on failure.
281function zip(zipfile, ...) 281function zip(zipfile, ...)
282 return fs.execute("zip -r", zipfile, ...) 282 return fs.execute("7z a", zipfile, ...)
283end 283end
284 284
285--- Uncompress files from a .zip archive. 285--- Uncompress files from a .zip archive.
@@ -287,17 +287,14 @@ end
287-- @return boolean: true on success, false on failure. 287-- @return boolean: true on success, false on failure.
288function unzip(zipfile) 288function unzip(zipfile)
289 assert(zipfile) 289 assert(zipfile)
290 return fs.execute("unzip", zipfile) 290 return fs.execute("7z x", zipfile)
291end 291end
292 292
293--- Uncompress gzip file. 293--- Uncompress gzip file.
294-- @param archive string: Filename of archive. 294-- @param archive string: Filename of archive.
295-- @return boolean : success status 295-- @return boolean : success status
296local function gunzip(archive) 296local function gunzip(archive)
297 local cmd = fs.execute("gunzip -h 1>NUL 2>NUL") and 'gunzip' or 297 return fs.execute("7z x", archive)
298 fs.execute("gzip -h 1>NUL 2>NUL") and 'gzip -d'
299 local ok = fs.execute(cmd, archive)
300 return ok
301end 298end
302 299
303--- Unpack an archive. 300--- Unpack an archive.
@@ -312,20 +309,20 @@ function unpack_archive(archive)
312 if archive:match("%.tar%.gz$") then 309 if archive:match("%.tar%.gz$") then
313 ok = gunzip(archive) 310 ok = gunzip(archive)
314 if ok then 311 if ok then
315 ok = fs.execute("tar -xf ", strip_extension(archive)) 312 ok = fs.execute("7z x", strip_extension(archive))
316 end 313 end
317 elseif archive:match("%.tgz$") then 314 elseif archive:match("%.tgz$") then
318 ok = gunzip(archive) 315 ok = gunzip(archive)
319 if ok then 316 if ok then
320 ok = fs.execute("tar -xf ", strip_extension(archive)..".tar") 317 ok = fs.execute("7z x ", strip_extension(archive)..".tar")
321 end 318 end
322 elseif archive:match("%.tar%.bz2$") then 319 elseif archive:match("%.tar%.bz2$") then
323 ok = fs.execute("bunzip2 ", archive) 320 ok = fs.execute("7z x ", archive)
324 if ok then 321 if ok then
325 ok = fs.execute("tar -xf ", strip_extension(archive)) 322 ok = fs.execute("7z x ", strip_extension(archive))
326 end 323 end
327 elseif archive:match("%.zip$") then 324 elseif archive:match("%.zip$") then
328 ok = fs.execute("unzip ", archive) 325 ok = fs.execute("7z x ", archive)
329 elseif archive:match("%.lua$") or archive:match("%.c$") then 326 elseif archive:match("%.lua$") or archive:match("%.c$") then
330 -- Ignore .lua and .c files; they don't need to be extracted. 327 -- Ignore .lua and .c files; they don't need to be extracted.
331 return true 328 return true