aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpeterv <petjamelnik@yandex.ru>2014-03-20 22:42:36 +0400
committermpeterv <petjamelnik@yandex.ru>2014-03-20 22:42:36 +0400
commit232317a633c5952f882ab4a891fa245d130dcc29 (patch)
tree781673d95565be6c5e7ef73b687736aaafa8b5a7
parent235124b431f2007dc2ecb6ee061c318d5f9b84a3 (diff)
downloadluarocks-232317a633c5952f882ab4a891fa245d130dcc29.tar.gz
luarocks-232317a633c5952f882ab4a891fa245d130dcc29.tar.bz2
luarocks-232317a633c5952f882ab4a891fa245d130dcc29.zip
Fixed strange things in deps modules + fixed a bug with luarocks.fs.lua.get_md5
-rw-r--r--src/luarocks/build/builtin.lua2
-rw-r--r--src/luarocks/fetch/git.lua2
-rw-r--r--src/luarocks/fetch/hg.lua2
-rw-r--r--src/luarocks/fs/lua.lua10
-rw-r--r--src/luarocks/fs/unix.lua1
-rw-r--r--src/luarocks/fs/win32.lua2
-rw-r--r--src/luarocks/tools/patch.lua8
7 files changed, 9 insertions, 18 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index e154e65c..fa03f0d2 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -173,11 +173,9 @@ function builtin.run(rockspec)
173 end 173 end
174 174
175 local ok = true 175 local ok = true
176 local err = "Build error"
177 local built_modules = {} 176 local built_modules = {}
178 local luadir = path.lua_dir(rockspec.name, rockspec.version) 177 local luadir = path.lua_dir(rockspec.name, rockspec.version)
179 local libdir = path.lib_dir(rockspec.name, rockspec.version) 178 local libdir = path.lib_dir(rockspec.name, rockspec.version)
180 local docdir = path.doc_dir(rockspec.name, rockspec.version)
181 --TODO EXEWRAPPER 179 --TODO EXEWRAPPER
182 -- On Windows, compiles an .exe for each Lua file in build.install.bin, and 180 -- On Windows, compiles an .exe for each Lua file in build.install.bin, and
183 -- replaces the filename with the .exe name. Strips the .lua extension if it exists, 181 -- replaces the filename with the .exe name. Strips the .lua extension if it exists,
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index 7fe4c4ee..824ea905 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -67,7 +67,7 @@ function git.get_sources(rockspec, extract, dest_dir, depth)
67 if not fs.execute(unpack(command)) then 67 if not fs.execute(unpack(command)) then
68 return nil, "Failed cloning git repository." 68 return nil, "Failed cloning git repository."
69 end 69 end
70 local ok, err = fs.change_dir(module) 70 ok, err = fs.change_dir(module)
71 if not ok then return nil, err end 71 if not ok then return nil, err end
72 if tag_or_branch and not git_can_clone_by_tag() then 72 if tag_or_branch and not git_can_clone_by_tag() then
73 local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch} 73 local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch}
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua
index 44af3afa..31b4f716 100644
--- a/src/luarocks/fetch/hg.lua
+++ b/src/luarocks/fetch/hg.lua
@@ -45,7 +45,7 @@ function hg.get_sources(rockspec, extract, dest_dir)
45 if not fs.execute(unpack(command)) then 45 if not fs.execute(unpack(command)) then
46 return nil, "Failed cloning hg repository." 46 return nil, "Failed cloning hg repository."
47 end 47 end
48 local ok, err = fs.change_dir(module) 48 ok, err = fs.change_dir(module)
49 if not ok then return nil, err end 49 if not ok then return nil, err end
50 50
51 fs.delete(dir.path(store_dir, module, ".hg")) 51 fs.delete(dir.path(store_dir, module, ".hg"))
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 495327ea..cd705eef 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -30,7 +30,7 @@ local dir_stack = {}
30 30
31math.randomseed(os.time()) 31math.randomseed(os.time())
32 32
33dir_separator = "/" 33local dir_separator = "/"
34 34
35--- Quote argument for shell processing. 35--- Quote argument for shell processing.
36-- Adds single quotes and escapes. 36-- Adds single quotes and escapes.
@@ -683,10 +683,10 @@ if md5_ok then
683-- @return string: The MD5 checksum or nil + error 683-- @return string: The MD5 checksum or nil + error
684function fs_lua.get_md5(file) 684function fs_lua.get_md5(file)
685 file = fs.absolute_name(file) 685 file = fs.absolute_name(file)
686 local file = io.open(file, "rb") 686 local file_handler = io.open(file, "rb")
687 if not file then return nil, "Failed to open file for reading: "..file end 687 if not file_handler then return nil, "Failed to open file for reading: "..file end
688 local computed = md5.sumhexa(file:read("*a")) 688 local computed = md5.sumhexa(file_handler:read("*a"))
689 file:close() 689 file_handler:close()
690 if computed then return computed end 690 if computed then return computed end
691 return nil, "Failed to compute MD5 hash for file "..file 691 return nil, "Failed to compute MD5 hash for file "..file
692end 692end
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index 3e6b9080..a70ed116 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -7,7 +7,6 @@ local fs = require("luarocks.fs")
7 7
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9local dir = require("luarocks.dir") 9local dir = require("luarocks.dir")
10local fs = require("luarocks.fs")
11local util = require("luarocks.util") 10local util = require("luarocks.util")
12 11
13math.randomseed(os.time()) 12math.randomseed(os.time())
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index c4c20349..238a25e9 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -144,7 +144,7 @@ function win32.copy_binary(filename, dest)
144 end 144 end
145 local exe_pattern = "%.[Ee][Xx][Ee]$" 145 local exe_pattern = "%.[Ee][Xx][Ee]$"
146 local base = dir.base_name(filename) 146 local base = dir.base_name(filename)
147 local dest = dir.dir_name(dest) 147 dest = dir.dir_name(dest)
148 if base:match(exe_pattern) then 148 if base:match(exe_pattern) then
149 base = base:gsub(exe_pattern, ".lua") 149 base = base:gsub(exe_pattern, ".lua")
150 local helpname = dest.."/"..base 150 local helpname = dest.."/"..base
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua
index a3e1602d..4479e642 100644
--- a/src/luarocks/tools/patch.lua
+++ b/src/luarocks/tools/patch.lua
@@ -6,6 +6,7 @@
6-- Code is heavilly based on the Python-based patch.py version 8.06-1 6-- Code is heavilly based on the Python-based patch.py version 8.06-1
7-- Copyright (c) 2008 rainforce.org, MIT License 7-- Copyright (c) 2008 rainforce.org, MIT License
8-- Project home: http://code.google.com/p/python-patch/ . 8-- Project home: http://code.google.com/p/python-patch/ .
9-- Version 0.1
9 10
10--module("luarocks.tools.patch", package.seeall) 11--module("luarocks.tools.patch", package.seeall)
11local patch = {} 12local patch = {}
@@ -13,8 +14,6 @@ local patch = {}
13local fs = require("luarocks.fs") 14local fs = require("luarocks.fs")
14local util = require("luarocks.util") 15local util = require("luarocks.util")
15 16
16local version = '0.1'
17
18local io = io 17local io = io
19local os = os 18local os = os
20local string = string 19local string = string
@@ -397,7 +396,6 @@ local function find_hunk(file, h, hno)
397 for i=0,#file do 396 for i=0,#file do
398 local found = true 397 local found = true
399 local location = lineno 398 local location = lineno
400 local total = #h.text - fuzz
401 for l, hline in ipairs(h.text) do 399 for l, hline in ipairs(h.text) do
402 if l > fuzz then 400 if l > fuzz then
403 -- todo: \ No newline at the end of file 401 -- todo: \ No newline at the end of file
@@ -448,9 +446,6 @@ local function load_file(filename)
448end 446end
449 447
450local function find_hunks(file, hunks) 448local function find_hunks(file, hunks)
451 local matched = true
452 local lineno = 1
453 local hno = nil
454 for hno, h in ipairs(hunks) do 449 for hno, h in ipairs(hunks) do
455 find_hunk(file, h, hno) 450 find_hunk(file, h, hno)
456 end 451 end
@@ -459,7 +454,6 @@ end
459local function check_patched(file, hunks) 454local function check_patched(file, hunks)
460 local matched = true 455 local matched = true
461 local lineno = 1 456 local lineno = 1
462 local hno = nil
463 local ok, err = pcall(function() 457 local ok, err = pcall(function()
464 if #file == 0 then 458 if #file == 0 then
465 error 'nomatch' 459 error 'nomatch'