diff options
| author | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-05-05 13:58:26 +0000 |
|---|---|---|
| committer | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-05-05 13:58:26 +0000 |
| commit | e3fd7f99c00ff34a0425bffe936ce71519f34095 (patch) | |
| tree | 5a3639c3d4840a80a97b159ec5f1b7f512306544 | |
| parent | f234f1189c4fca39b229c1d7fd09f28d82b5b6a2 (diff) | |
| download | luarocks-e3fd7f99c00ff34a0425bffe936ce71519f34095.tar.gz luarocks-e3fd7f99c00ff34a0425bffe936ce71519f34095.tar.bz2 luarocks-e3fd7f99c00ff34a0425bffe936ce71519f34095.zip | |
fixes to build from rockspec and patch feature
git-svn-id: http://luarocks.org/svn/luarocks/trunk@17 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
| -rw-r--r-- | src/luarocks/fetch.lua | 3 | ||||
| -rw-r--r-- | src/luarocks/tools/patch.lua | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 9d65e6e8..4e17c91d 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -122,7 +122,8 @@ end | |||
| 122 | -- or nil followed by an error message. | 122 | -- or nil followed by an error message. |
| 123 | function load_local_rockspec(filename) | 123 | function load_local_rockspec(filename) |
| 124 | assert(type(filename) == "string") | 124 | assert(type(filename) == "string") |
| 125 | local rockspec, err = persist.load_into_table(fs.absolute_name(filename)) | 125 | filename = fs.absolute_name(filename) |
| 126 | local rockspec, err = persist.load_into_table(filename) | ||
| 126 | if not rockspec then | 127 | if not rockspec then |
| 127 | return nil, "Could not load rockspec file "..filename.." ("..err..")" | 128 | return nil, "Could not load rockspec file "..filename.." ("..err..")" |
| 128 | end | 129 | end |
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua index 4fc5c3b5..6069f389 100644 --- a/src/luarocks/tools/patch.lua +++ b/src/luarocks/tools/patch.lua | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | module("luarocks.tools.patch", package.seeall) | 10 | module("luarocks.tools.patch", package.seeall) |
| 11 | 11 | ||
| 12 | local fs = require("luarocks.fs") | ||
| 13 | |||
| 12 | local version = '0.1' | 14 | local version = '0.1' |
| 13 | 15 | ||
| 14 | local io = io | 16 | local io = io |
| @@ -93,11 +95,12 @@ local function string_as_file(s) | |||
| 93 | eof = false, | 95 | eof = false, |
| 94 | read = function(self, n) | 96 | read = function(self, n) |
| 95 | if self.eof then return nil end | 97 | if self.eof then return nil end |
| 96 | local chunk = self.str:sub(at, at+n) | 98 | local chunk = self.str:sub(self.at, self.at+n) |
| 97 | self.at = self.at + n | 99 | self.at = self.at + n |
| 98 | if at > self.len then | 100 | if self.at > self.len then |
| 99 | self.eof = true | 101 | self.eof = true |
| 100 | end | 102 | end |
| 103 | return chunk | ||
| 101 | end, | 104 | end, |
| 102 | close = function(self) | 105 | close = function(self) |
| 103 | self.eof = true | 106 | self.eof = true |
| @@ -187,6 +190,7 @@ function read_patch(filename, data) | |||
| 187 | fp = filename == '-' and io.stdin or assert(io.open(filename, "rb")) | 190 | fp = filename == '-' and io.stdin or assert(io.open(filename, "rb")) |
| 188 | end | 191 | end |
| 189 | local lineno = 0 | 192 | local lineno = 0 |
| 193 | |||
| 190 | for line in file_lines(fp) do | 194 | for line in file_lines(fp) do |
| 191 | lineno = lineno + 1 | 195 | lineno = lineno + 1 |
| 192 | if state == 'header' then | 196 | if state == 'header' then |
| @@ -470,7 +474,6 @@ local function check_patched(file, hunks) | |||
| 470 | error 'nomatch' | 474 | error 'nomatch' |
| 471 | end | 475 | end |
| 472 | lineno = h.starttgt | 476 | lineno = h.starttgt |
| 473 | print() for k,v in pairs(h) do print(k,v) end print() | ||
| 474 | for _, hline in ipairs(h.text) do | 477 | for _, hline in ipairs(h.text) do |
| 475 | -- todo: \ No newline at the end of file | 478 | -- todo: \ No newline at the end of file |
| 476 | if not startswith(hline, "-") and not startswith(hline, "\\") then | 479 | if not startswith(hline, "-") and not startswith(hline, "\\") then |
| @@ -575,6 +578,7 @@ function apply_patch(patch, strip) | |||
| 575 | local f2patch = filename | 578 | local f2patch = filename |
| 576 | if not exists(f2patch) then | 579 | if not exists(f2patch) then |
| 577 | f2patch = strip_dirs(patch.target[fileno], strip) | 580 | f2patch = strip_dirs(patch.target[fileno], strip) |
| 581 | f2patch = fs.absolute_name(f2patch) | ||
| 578 | if not exists(f2patch) then --FIX:if f2patch nil | 582 | if not exists(f2patch) then --FIX:if f2patch nil |
| 579 | warning(format("source/target file does not exist\n--- %s\n+++ %s", | 583 | warning(format("source/target file does not exist\n--- %s\n+++ %s", |
| 580 | filename, f2patch)) | 584 | filename, f2patch)) |
