diff options
-rw-r--r-- | spec/fs_spec.lua | 4 | ||||
-rw-r--r-- | src/luarocks/cmd/init.lua | 4 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 5 | ||||
-rw-r--r-- | src/luarocks/repos.lua | 24 |
4 files changed, 22 insertions, 15 deletions
diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua index 5410cff7..cd6e5c13 100644 --- a/spec/fs_spec.lua +++ b/spec/fs_spec.lua | |||
@@ -1476,9 +1476,9 @@ describe("luarocks.fs #unit", function() | |||
1476 | it("produces a wrapper for a Lua script", function() | 1476 | it("produces a wrapper for a Lua script", function() |
1477 | write_file("my_script", "io.write('Hello ' .. arg[1])", finally) | 1477 | write_file("my_script", "io.write('Hello ' .. arg[1])", finally) |
1478 | path.use_tree(testing_paths.testing_tree) | 1478 | path.use_tree(testing_paths.testing_tree) |
1479 | local wrapper_name = fs.absolute_name("wrapper") | 1479 | local wrapper_name = fs.absolute_name("wrapper") .. test_env.wrapper_extension |
1480 | fs.wrap_script("my_script", wrapper_name, "one", nil, nil, "World") | 1480 | fs.wrap_script("my_script", wrapper_name, "one", nil, nil, "World") |
1481 | local pd = assert(io.popen(wrapper_name .. test_env.wrapper_extension)) | 1481 | local pd = assert(io.popen(wrapper_name)) |
1482 | local data = pd:read("*a") | 1482 | local data = pd:read("*a") |
1483 | pd:close() | 1483 | pd:close() |
1484 | assert.same("Hello World", data) | 1484 | assert.same("Hello World", data) |
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua index af88760f..8bccb23f 100644 --- a/src/luarocks/cmd/init.lua +++ b/src/luarocks/cmd/init.lua | |||
@@ -145,7 +145,7 @@ function init.command(args) | |||
145 | luarocks_wrapper = dir.path(".", luarocks_wrapper) | 145 | luarocks_wrapper = dir.path(".", luarocks_wrapper) |
146 | if not fs.exists(luarocks_wrapper) then | 146 | if not fs.exists(luarocks_wrapper) then |
147 | util.printout("Preparing " .. luarocks_wrapper .. " ...") | 147 | util.printout("Preparing " .. luarocks_wrapper .. " ...") |
148 | fs.wrap_script(arg[0], "luarocks", "none", nil, nil, "--project-tree", tree) | 148 | fs.wrap_script(arg[0], luarocks_wrapper, "none", nil, nil, "--project-tree", tree) |
149 | else | 149 | else |
150 | util.printout(luarocks_wrapper .. " already exists. Not overwriting it!") | 150 | util.printout(luarocks_wrapper .. " already exists. Not overwriting it!") |
151 | end | 151 | end |
@@ -164,7 +164,7 @@ function init.command(args) | |||
164 | if util.check_lua_version(interp, cfg.lua_version) then | 164 | if util.check_lua_version(interp, cfg.lua_version) then |
165 | util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...") | 165 | util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...") |
166 | path.use_tree(tree) | 166 | path.use_tree(tree) |
167 | fs.wrap_script(nil, "lua", "all") | 167 | fs.wrap_script(nil, lua_wrapper, "all") |
168 | else | 168 | else |
169 | util.warning("No Lua interpreter detected for version " .. cfg.lua_version .. ". Not creating " .. lua_wrapper) | 169 | util.warning("No Lua interpreter detected for version " .. cfg.lua_version .. ". Not creating " .. lua_wrapper) |
170 | end | 170 | end |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 6d869d99..1902a691 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -154,10 +154,9 @@ function win32.wrap_script(script, target, deps_mode, name, version, ...) | |||
154 | assert(type(name) == "string" or not name) | 154 | assert(type(name) == "string" or not name) |
155 | assert(type(version) == "string" or not version) | 155 | assert(type(version) == "string" or not version) |
156 | 156 | ||
157 | local batname = target .. ".bat" | 157 | local wrapper = io.open(target, "wb") |
158 | local wrapper = io.open(batname, "wb") | ||
159 | if not wrapper then | 158 | if not wrapper then |
160 | return nil, "Could not open "..batname.." for writing." | 159 | return nil, "Could not open "..target.." for writing." |
161 | end | 160 | end |
162 | 161 | ||
163 | local lpath, lcpath = path.package_paths(deps_mode) | 162 | local lpath, lcpath = path.package_paths(deps_mode) |
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index cf2ce14b..764fe3ad 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
@@ -309,7 +309,7 @@ local function prepare_op_install() | |||
309 | return nil, err | 309 | return nil, err |
310 | end | 310 | end |
311 | 311 | ||
312 | local backup, err = backup_existing(op.backup, op.realdst or op.dst) | 312 | local backup, err = backup_existing(op.backup, op.dst) |
313 | if err then | 313 | if err then |
314 | return nil, err | 314 | return nil, err |
315 | end | 315 | end |
@@ -403,14 +403,22 @@ end | |||
403 | --- Double check that all files referenced in `rock_manifest` are installed in `repo`. | 403 | --- Double check that all files referenced in `rock_manifest` are installed in `repo`. |
404 | function repos.check_everything_is_installed(name, version, rock_manifest, repo, accept_versioned) | 404 | function repos.check_everything_is_installed(name, version, rock_manifest, repo, accept_versioned) |
405 | local missing = {} | 405 | local missing = {} |
406 | local suffix = cfg.wrapper_suffix or "" | ||
406 | for _, category in ipairs({"bin", "lua", "lib"}) do | 407 | for _, category in ipairs({"bin", "lua", "lib"}) do |
407 | local suffix = (category == "bin") and cfg.wrapper_suffix or "" | ||
408 | if rock_manifest[category] then | 408 | if rock_manifest[category] then |
409 | repos.recurse_rock_manifest_entry(rock_manifest[category], function(file_path) | 409 | repos.recurse_rock_manifest_entry(rock_manifest[category], function(file_path) |
410 | local paths = get_deploy_paths(name, version, category, file_path, repo) | 410 | local paths = get_deploy_paths(name, version, category, file_path, repo) |
411 | if not (fs.exists(paths.nv .. suffix) or (accept_versioned and fs.exists(paths.v .. suffix))) then | 411 | if category == "bin" then |
412 | table.insert(missing, paths.nv .. suffix) | 412 | if (fs.exists(paths.nv) or fs.exists(paths.nv .. suffix)) |
413 | or (accept_versioned and (fs.exists(paths.v) or fs.exists(paths.v .. suffix))) then | ||
414 | return | ||
415 | end | ||
416 | else | ||
417 | if fs.exists(paths.nv) or (accept_versioned and fs.exists(paths.v)) then | ||
418 | return | ||
419 | end | ||
413 | end | 420 | end |
421 | table.insert(missing, paths.nv) | ||
414 | end) | 422 | end) |
415 | end | 423 | end |
416 | end | 424 | end |
@@ -470,10 +478,10 @@ function repos.deploy_files(name, version, wrap_bin_scripts, deps_mode) | |||
470 | end | 478 | end |
471 | local target = mode == "nv" and paths.nv or paths.v | 479 | local target = mode == "nv" and paths.nv or paths.v |
472 | local backup = name ~= cur_name or version ~= cur_version | 480 | local backup = name ~= cur_name or version ~= cur_version |
473 | local realdst = (wrap_bin_scripts and fs.is_lua(source)) | 481 | if wrap_bin_scripts and fs.is_lua(source) then |
474 | and (target .. (cfg.wrapper_suffix or "")) | 482 | target = target .. (cfg.wrapper_suffix or "") |
475 | or target | 483 | end |
476 | table.insert(installs, { fn = install_binary, src = source, dst = target, backup = backup, realdst = realdst }) | 484 | table.insert(installs, { fn = install_binary, src = source, dst = target, backup = backup }) |
477 | end) | 485 | end) |
478 | end | 486 | end |
479 | 487 | ||