diff options
-rw-r--r-- | src/luarocks/add.lua | 6 | ||||
-rw-r--r-- | src/luarocks/admin_remove.lua | 6 | ||||
-rw-r--r-- | src/luarocks/build.lua | 8 | ||||
-rw-r--r-- | src/luarocks/cache.lua | 5 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 17 | ||||
-rw-r--r-- | src/luarocks/fetch/cvs.lua | 3 | ||||
-rw-r--r-- | src/luarocks/fetch/git.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fetch/hg.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fetch/svn.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fs/lua.lua | 2 | ||||
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 7 | ||||
-rw-r--r-- | src/luarocks/new_version.lua | 3 | ||||
-rw-r--r-- | src/luarocks/pack.lua | 6 | ||||
-rw-r--r-- | src/luarocks/unpack.lua | 12 |
15 files changed, 67 insertions, 32 deletions
diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index d7c293e5..54991291 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua | |||
@@ -45,7 +45,8 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) | |||
45 | login_url = protocol.."://"..server_path | 45 | login_url = protocol.."://"..server_path |
46 | end | 46 | end |
47 | 47 | ||
48 | fs.change_dir(at) | 48 | local ok, err = fs.change_dir(at) |
49 | if not ok then return nil, err end | ||
49 | 50 | ||
50 | local files = {} | 51 | local files = {} |
51 | for i, rockfile in ipairs(rockfiles) do | 52 | for i, rockfile in ipairs(rockfiles) do |
@@ -62,7 +63,8 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) | |||
62 | return nil, "No files found" | 63 | return nil, "No files found" |
63 | end | 64 | end |
64 | 65 | ||
65 | fs.change_dir(local_cache) | 66 | local ok, err = fs.change_dir(local_cache) |
67 | if not ok then return nil, err end | ||
66 | 68 | ||
67 | util.printout("Updating manifest...") | 69 | util.printout("Updating manifest...") |
68 | manif.make_manifest(local_cache, "one", true) | 70 | manif.make_manifest(local_cache, "one", true) |
diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index 83b57fc9..31325a30 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua | |||
@@ -41,7 +41,8 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve | |||
41 | return nil, "This command requires 'rsync', check your configuration." | 41 | return nil, "This command requires 'rsync', check your configuration." |
42 | end | 42 | end |
43 | 43 | ||
44 | fs.change_dir(at) | 44 | local ok, err = fs.change_dir(at) |
45 | if not ok then return nil, err end | ||
45 | 46 | ||
46 | local nr_files = 0 | 47 | local nr_files = 0 |
47 | for i, rockfile in ipairs(rockfiles) do | 48 | for i, rockfile in ipairs(rockfiles) do |
@@ -58,7 +59,8 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve | |||
58 | return nil, "No files removed." | 59 | return nil, "No files removed." |
59 | end | 60 | end |
60 | 61 | ||
61 | fs.change_dir(local_cache) | 62 | local ok, err = fs.change_dir(local_cache) |
63 | if not ok then return nil, err end | ||
62 | 64 | ||
63 | util.printout("Updating manifest...") | 65 | util.printout("Updating manifest...") |
64 | manif.make_manifest(local_cache, "one", true) | 66 | manif.make_manifest(local_cache, "one", true) |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 40f02e38..7bd54a0c 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -148,7 +148,7 @@ function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode) | |||
148 | end | 148 | end |
149 | end | 149 | end |
150 | 150 | ||
151 | ok, err, errcode = deps.check_external_deps(rockspec, "build") | 151 | local ok, err, errcode = deps.check_external_deps(rockspec, "build") |
152 | if err then | 152 | if err then |
153 | return nil, err, errcode | 153 | return nil, err, errcode |
154 | end | 154 | end |
@@ -165,7 +165,8 @@ function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode) | |||
165 | if not ok then | 165 | if not ok then |
166 | return nil, source_dir, errcode | 166 | return nil, source_dir, errcode |
167 | end | 167 | end |
168 | fs.change_dir(source_dir) | 168 | local ok, err = fs.change_dir(source_dir) |
169 | if not ok then return nil, err end | ||
169 | elseif rockspec.source.file then | 170 | elseif rockspec.source.file then |
170 | local ok, err = fs.unpack_archive(rockspec.source.file) | 171 | local ok, err = fs.unpack_archive(rockspec.source.file) |
171 | if not ok then | 172 | if not ok then |
@@ -304,7 +305,8 @@ function build_rock(rock_file, need_to_fetch, deps_mode) | |||
304 | return nil, err, errcode | 305 | return nil, err, errcode |
305 | end | 306 | end |
306 | local rockspec_file = path.rockspec_name_from_rock(rock_file) | 307 | local rockspec_file = path.rockspec_name_from_rock(rock_file) |
307 | fs.change_dir(unpack_dir) | 308 | local ok, err = fs.change_dir(unpack_dir) |
309 | if not ok then return nil, err end | ||
308 | local ok, err, errcode = build_rockspec(rockspec_file, need_to_fetch, false, deps_mode) | 310 | local ok, err, errcode = build_rockspec(rockspec_file, need_to_fetch, false, deps_mode) |
309 | fs.pop_dir() | 311 | fs.pop_dir() |
310 | return ok, err, errcode | 312 | return ok, err, errcode |
diff --git a/src/luarocks/cache.lua b/src/luarocks/cache.lua index fe74ba18..6ea6e82a 100644 --- a/src/luarocks/cache.lua +++ b/src/luarocks/cache.lua | |||
@@ -62,11 +62,12 @@ function refresh_local_cache(server, url, user, password) | |||
62 | local_cache, err = fs.make_temp_dir("local_cache") | 62 | local_cache, err = fs.make_temp_dir("local_cache") |
63 | tmp_cache = true | 63 | tmp_cache = true |
64 | end | 64 | end |
65 | local ok = fs.make_dir(local_cache) | 65 | local ok, err = fs.make_dir(local_cache) |
66 | if not ok then | 66 | if not ok then |
67 | return nil, "Failed creating local cache dir." | 67 | return nil, "Failed creating local cache dir: "..err |
68 | end | 68 | end |
69 | fs.change_dir(local_cache) | 69 | fs.change_dir(local_cache) |
70 | if not ok then return nil, err end | ||
70 | util.printout("Refreshing cache "..local_cache.."...") | 71 | util.printout("Refreshing cache "..local_cache.."...") |
71 | 72 | ||
72 | -- TODO abstract away explicit 'wget' call | 73 | -- TODO abstract away explicit 'wget' call |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index be2f32c6..a742b7fc 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -71,7 +71,8 @@ function fetch_url_at_temp_dir(url, tmpname, filename) | |||
71 | return nil, "Failed creating temporary directory "..tmpname..": "..err | 71 | return nil, "Failed creating temporary directory "..tmpname..": "..err |
72 | end | 72 | end |
73 | util.schedule_function(fs.delete, temp_dir) | 73 | util.schedule_function(fs.delete, temp_dir) |
74 | fs.change_dir(temp_dir) | 74 | local ok, err = fs.change_dir(temp_dir) |
75 | if not ok then return nil, err end | ||
75 | local file, err, errcode = fetch_url(url, filename) | 76 | local file, err, errcode = fetch_url(url, filename) |
76 | fs.pop_dir() | 77 | fs.pop_dir() |
77 | if not file then | 78 | if not file then |
@@ -114,8 +115,9 @@ function fetch_and_unpack_rock(rock_file, dest) | |||
114 | if not dest then | 115 | if not dest then |
115 | util.schedule_function(fs.delete, unpack_dir) | 116 | util.schedule_function(fs.delete, unpack_dir) |
116 | end | 117 | end |
117 | fs.change_dir(unpack_dir) | 118 | local ok, err = fs.change_dir(unpack_dir) |
118 | local ok = fs.unzip(rock_file) | 119 | if not ok then return nil, err end |
120 | ok = fs.unzip(rock_file) | ||
119 | if not ok then | 121 | if not ok then |
120 | return nil, "Failed unpacking rock file: " .. rock_file | 122 | return nil, "Failed unpacking rock file: " .. rock_file |
121 | end | 123 | end |
@@ -234,7 +236,8 @@ function load_rockspec(filename, location) | |||
234 | 236 | ||
235 | local err, errcode | 237 | local err, errcode |
236 | if location then | 238 | if location then |
237 | fs.change_dir(location) | 239 | local ok, err = fs.change_dir(location) |
240 | if not ok then return nil, err end | ||
238 | filename, err = fetch_url(filename) | 241 | filename, err = fetch_url(filename) |
239 | fs.pop_dir() | 242 | fs.pop_dir() |
240 | else | 243 | else |
@@ -265,7 +268,8 @@ function get_sources(rockspec, extract, dest_dir) | |||
265 | local filename = rockspec.source.file | 268 | local filename = rockspec.source.file |
266 | local source_file, store_dir, err, errcode | 269 | local source_file, store_dir, err, errcode |
267 | if dest_dir then | 270 | if dest_dir then |
268 | fs.change_dir(dest_dir) | 271 | local ok, err = fs.change_dir(dest_dir) |
272 | if not ok then return nil, err end | ||
269 | source_file, err, errcode = fetch_url(url, filename) | 273 | source_file, err, errcode = fetch_url(url, filename) |
270 | fs.pop_dir() | 274 | fs.pop_dir() |
271 | store_dir = dest_dir | 275 | store_dir = dest_dir |
@@ -281,7 +285,8 @@ function get_sources(rockspec, extract, dest_dir) | |||
281 | end | 285 | end |
282 | end | 286 | end |
283 | if extract then | 287 | if extract then |
284 | fs.change_dir(store_dir) | 288 | local ok, err = fs.change_dir(store_dir) |
289 | if not ok then return nil, err end | ||
285 | fs.unpack_archive(rockspec.source.file) | 290 | fs.unpack_archive(rockspec.source.file) |
286 | if not fs.exists(rockspec.source.dir) then | 291 | if not fs.exists(rockspec.source.dir) then |
287 | return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file | 292 | return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file |
diff --git a/src/luarocks/fetch/cvs.lua b/src/luarocks/fetch/cvs.lua index a622cdcb..6b4cf186 100644 --- a/src/luarocks/fetch/cvs.lua +++ b/src/luarocks/fetch/cvs.lua | |||
@@ -34,7 +34,8 @@ function get_sources(rockspec, extract, dest_dir) | |||
34 | else | 34 | else |
35 | store_dir = dest_dir | 35 | store_dir = dest_dir |
36 | end | 36 | end |
37 | fs.change_dir(store_dir) | 37 | local ok, err = fs.change_dir(store_dir) |
38 | if not ok then return nil, err end | ||
38 | if not fs.execute(unpack(command)) then | 39 | if not fs.execute(unpack(command)) then |
39 | return nil, "Failed fetching files from CVS." | 40 | return nil, "Failed fetching files from CVS." |
40 | end | 41 | end |
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index e7c89435..44151927 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua | |||
@@ -48,7 +48,8 @@ function get_sources(rockspec, extract, dest_dir) | |||
48 | store_dir = dest_dir | 48 | store_dir = dest_dir |
49 | end | 49 | end |
50 | store_dir = fs.absolute_name(store_dir) | 50 | store_dir = fs.absolute_name(store_dir) |
51 | fs.change_dir(store_dir) | 51 | local ok, err = fs.change_dir(store_dir) |
52 | if not ok then return nil, err end | ||
52 | 53 | ||
53 | local command = {git_cmd, "clone", "--depth=1", rockspec.source.url, module} | 54 | local command = {git_cmd, "clone", "--depth=1", rockspec.source.url, module} |
54 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch | 55 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch |
@@ -65,7 +66,8 @@ function get_sources(rockspec, extract, dest_dir) | |||
65 | if not fs.execute(unpack(command)) then | 66 | if not fs.execute(unpack(command)) then |
66 | return nil, "Failed cloning git repository." | 67 | return nil, "Failed cloning git repository." |
67 | end | 68 | end |
68 | fs.change_dir(module) | 69 | local ok, err = fs.change_dir(module) |
70 | if not ok then return nil, err end | ||
69 | if tag_or_branch and not git_can_clone_by_tag() then | 71 | if tag_or_branch and not git_can_clone_by_tag() then |
70 | local checkout_command = {git_cmd, "checkout", tag_or_branch} | 72 | local checkout_command = {git_cmd, "checkout", tag_or_branch} |
71 | if not fs.execute(unpack(checkout_command)) then | 73 | if not fs.execute(unpack(checkout_command)) then |
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua index a08520a5..32e40469 100644 --- a/src/luarocks/fetch/hg.lua +++ b/src/luarocks/fetch/hg.lua | |||
@@ -39,11 +39,13 @@ function get_sources(rockspec, extract, dest_dir) | |||
39 | else | 39 | else |
40 | store_dir = dest_dir | 40 | store_dir = dest_dir |
41 | end | 41 | end |
42 | fs.change_dir(store_dir) | 42 | local ok, err = fs.change_dir(store_dir) |
43 | if not ok then return nil, err end | ||
43 | if not fs.execute(unpack(command)) then | 44 | if not fs.execute(unpack(command)) then |
44 | return nil, "Failed cloning hg repository." | 45 | return nil, "Failed cloning hg repository." |
45 | end | 46 | end |
46 | fs.change_dir(module) | 47 | local ok, err = fs.change_dir(module) |
48 | if not ok then return nil, err end | ||
47 | 49 | ||
48 | fs.delete(dir.path(store_dir, module, ".hg")) | 50 | fs.delete(dir.path(store_dir, module, ".hg")) |
49 | fs.delete(dir.path(store_dir, module, ".hgignore")) | 51 | fs.delete(dir.path(store_dir, module, ".hgignore")) |
diff --git a/src/luarocks/fetch/svn.lua b/src/luarocks/fetch/svn.lua index a4e952d2..7aa37ec5 100644 --- a/src/luarocks/fetch/svn.lua +++ b/src/luarocks/fetch/svn.lua | |||
@@ -36,11 +36,13 @@ function get_sources(rockspec, extract, dest_dir) | |||
36 | else | 36 | else |
37 | store_dir = dest_dir | 37 | store_dir = dest_dir |
38 | end | 38 | end |
39 | fs.change_dir(store_dir) | 39 | local ok, err = fs.change_dir(store_dir) |
40 | if not ok then return nil, err end | ||
40 | if not fs.execute(unpack(command)) then | 41 | if not fs.execute(unpack(command)) then |
41 | return nil, "Failed fetching files from Subversion." | 42 | return nil, "Failed fetching files from Subversion." |
42 | end | 43 | end |
43 | fs.change_dir(module) | 44 | ok, err = fs.change_dir(module) |
45 | if not ok then return nil, err end | ||
44 | for _, d in ipairs(fs.find(".")) do | 46 | for _, d in ipairs(fs.find(".")) do |
45 | if dir.base_name(d) == ".svn" then | 47 | if dir.base_name(d) == ".svn" then |
46 | fs.delete(dir.path(store_dir, module, d)) | 48 | fs.delete(dir.path(store_dir, module, d)) |
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 7e208357..f50ecf75 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -150,7 +150,7 @@ end | |||
150 | function change_dir(d) | 150 | function change_dir(d) |
151 | table.insert(dir_stack, lfs.currentdir()) | 151 | table.insert(dir_stack, lfs.currentdir()) |
152 | d = dir.normalize(d) | 152 | d = dir.normalize(d) |
153 | lfs.chdir(d) | 153 | return lfs.chdir(d) |
154 | end | 154 | end |
155 | 155 | ||
156 | --- Change directory to root. | 156 | --- Change directory to root. |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 23bd8161..64992b91 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -48,7 +48,11 @@ end | |||
48 | -- @param directory string: The directory to switch to. | 48 | -- @param directory string: The directory to switch to. |
49 | function change_dir(directory) | 49 | function change_dir(directory) |
50 | assert(type(directory) == "string") | 50 | assert(type(directory) == "string") |
51 | table.insert(dir_stack, directory) | 51 | if fs.is_dir(directory) then |
52 | table.insert(dir_stack, directory) | ||
53 | return true | ||
54 | end | ||
55 | return nil, "directory not found: "..directory | ||
52 | end | 56 | end |
53 | 57 | ||
54 | --- Change directory to root. | 58 | --- Change directory to root. |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 97ba4fe5..6960ab35 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -77,9 +77,14 @@ end | |||
77 | -- semantics of chdir, as it does not handle errors the same way, | 77 | -- semantics of chdir, as it does not handle errors the same way, |
78 | -- but works well for our purposes for now. | 78 | -- but works well for our purposes for now. |
79 | -- @param directory string: The directory to switch to. | 79 | -- @param directory string: The directory to switch to. |
80 | -- @return boolean or (nil, string): true if successful, (nil, error message) if failed. | ||
80 | function change_dir(directory) | 81 | function change_dir(directory) |
81 | assert(type(directory) == "string") | 82 | assert(type(directory) == "string") |
82 | table.insert(dir_stack, directory) | 83 | if fs.is_dir(directory) then |
84 | table.insert(dir_stack, directory) | ||
85 | return true | ||
86 | end | ||
87 | return nil, "directory not found: "..directory | ||
83 | end | 88 | end |
84 | 89 | ||
85 | --- Change directory to root. | 90 | --- Change directory to root. |
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index cb170321..f93d0c29 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
@@ -64,7 +64,8 @@ local function check_url_and_update_md5(out_rs, out_name) | |||
64 | end | 64 | end |
65 | util.printout("File successfully downloaded. Updating MD5 checksum...") | 65 | util.printout("File successfully downloaded. Updating MD5 checksum...") |
66 | out_rs.source.md5 = fs.get_md5(file) | 66 | out_rs.source.md5 = fs.get_md5(file) |
67 | fs.change_dir(temp_dir) | 67 | local ok, err = fs.change_dir(temp_dir) |
68 | if not ok then return nil, err end | ||
68 | fs.unpack_archive(file) | 69 | fs.unpack_archive(file) |
69 | local base_dir = out_rs.source.dir or fetch.url_to_base_dir(out_rs.source.url) | 70 | local base_dir = out_rs.source.dir or fetch.url_to_base_dir(out_rs.source.url) |
70 | if not fs.exists(base_dir) then | 71 | if not fs.exists(base_dir) then |
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index ede992ce..0ef7344b 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
@@ -45,7 +45,8 @@ local function pack_source_rock(rockspec_file) | |||
45 | if not source_file then | 45 | if not source_file then |
46 | return nil, source_dir | 46 | return nil, source_dir |
47 | end | 47 | end |
48 | fs.change_dir(source_dir) | 48 | local ok, err = fs.change_dir(source_dir) |
49 | if not ok then return nil, err end | ||
49 | 50 | ||
50 | fs.delete(rock_file) | 51 | fs.delete(rock_file) |
51 | fs.copy(rockspec_file, source_dir) | 52 | fs.copy(rockspec_file, source_dir) |
@@ -139,7 +140,8 @@ local function do_pack_binary_rock(name, version) | |||
139 | if not ok then return nil, "Failed copying back files: " .. err end | 140 | if not ok then return nil, "Failed copying back files: " .. err end |
140 | end | 141 | end |
141 | 142 | ||
142 | fs.change_dir(temp_dir) | 143 | local ok, err = fs.change_dir(temp_dir) |
144 | if not ok then return nil, err end | ||
143 | if not is_binary and not repos.has_binaries(name, version) then | 145 | if not is_binary and not repos.has_binaries(name, version) then |
144 | rock_file = rock_file:gsub("%."..cfg.arch:gsub("%-","%%-").."%.", ".all.") | 146 | rock_file = rock_file:gsub("%."..cfg.arch:gsub("%-","%%-").."%.", ".all.") |
145 | end | 147 | end |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index 67db5ca5..2e6166ca 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
@@ -31,12 +31,14 @@ local function unpack_rockspec(rockspec_file, dir_name) | |||
31 | if not rockspec then | 31 | if not rockspec then |
32 | return nil, "Failed loading rockspec "..rockspec_file..": "..err | 32 | return nil, "Failed loading rockspec "..rockspec_file..": "..err |
33 | end | 33 | end |
34 | fs.change_dir(dir_name) | 34 | local ok, err = fs.change_dir(dir_name) |
35 | if not ok then return nil, err end | ||
35 | local ok, sources_dir = fetch.fetch_sources(rockspec, true, ".") | 36 | local ok, sources_dir = fetch.fetch_sources(rockspec, true, ".") |
36 | if not ok then | 37 | if not ok then |
37 | return nil, sources_dir | 38 | return nil, sources_dir |
38 | end | 39 | end |
39 | fs.change_dir(dir_name) | 40 | ok, err = fs.change_dir(dir_name) |
41 | if not ok then return nil, err end | ||
40 | build.apply_patches(rockspec) | 42 | build.apply_patches(rockspec) |
41 | fs.pop_dir() | 43 | fs.pop_dir() |
42 | return rockspec | 44 | return rockspec |
@@ -57,7 +59,8 @@ local function unpack_rock(rock_file, dir_name, kind) | |||
57 | if not ok then | 59 | if not ok then |
58 | return nil, "Failed unzipping rock "..rock_file, errcode | 60 | return nil, "Failed unzipping rock "..rock_file, errcode |
59 | end | 61 | end |
60 | fs.change_dir(dir_name) | 62 | ok, err = fs.change_dir(dir_name) |
63 | if not ok then return nil, err end | ||
61 | local rockspec_file = dir_name..".rockspec" | 64 | local rockspec_file = dir_name..".rockspec" |
62 | local rockspec, err = fetch.load_rockspec(rockspec_file) | 65 | local rockspec, err = fetch.load_rockspec(rockspec_file) |
63 | if not rockspec then | 66 | if not rockspec then |
@@ -69,7 +72,8 @@ local function unpack_rock(rock_file, dir_name, kind) | |||
69 | if not ok then | 72 | if not ok then |
70 | return nil, err | 73 | return nil, err |
71 | end | 74 | end |
72 | fs.change_dir(rockspec.source.dir) | 75 | ok, err = fs.change_dir(rockspec.source.dir) |
76 | if not ok then return nil, err end | ||
73 | build.apply_patches(rockspec) | 77 | build.apply_patches(rockspec) |
74 | fs.pop_dir() | 78 | fs.pop_dir() |
75 | end | 79 | end |