From 4744dc4520e9129a8c98b76c63d341e0e66a7ca0 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 28 Aug 2013 20:34:54 -0300 Subject: Should fix installation of parallel LuaRocks versions when using 'make bootstrap' on both. Thanks to Philipp Janda for the test case! --- Makefile | 7 ++++++- src/luarocks/manif.lua | 2 +- src/luarocks/repos.lua | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index be83c012..1213a589 100644 --- a/Makefile +++ b/Makefile @@ -168,6 +168,11 @@ write_sysconfig: built install: install_bins install_luas install_site_config write_sysconfig bootstrap: src/luarocks/site_config.lua install_site_config write_sysconfig - LUA_PATH="$$PWD/src/?.lua;$$LUA_PATH" src/bin/luarocks make rockspec --tree="$(PREFIX)" + if [ -n "$$LUA_PATH_5_2" ] ;\ + then \ + LUA_PATH="$$PWD/src/?.lua;$$LUA_PATH" LUA_PATH_5_2="$$PWD/src/?.lua;$$LUA_PATH_5_2" src/bin/luarocks make rockspec --tree="$(PREFIX)" ;\ + else \ + LUA_PATH="$$PWD/src/?.lua;$$LUA_PATH" src/bin/luarocks make rockspec --tree="$(PREFIX)" ;\ + fi install_rock: install_bins install_luas diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index c17da71e..d0bd5e04 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua @@ -403,7 +403,7 @@ local function find_providers(file, root) local manifest, err = manif_core.load_local_manifest(path.rocks_dir(root)) if not manifest then - return nil, err .. " -- corrupted local rocks tree?" + return nil, "untracked" end local deploy_bin = path.deploy_bin_dir(root) local deploy_lua = path.deploy_lua_dir(root) diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index c7b381df..23398cbb 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua @@ -214,7 +214,12 @@ function deploy_files(name, version, wrap_bin_scripts) if fs.exists(target) then local new_target, err = resolve_conflict(target, deploy_dir, name, version) if err == "untracked" then - fs.delete(target) + local backup = target + repeat + backup = target.."~" + until not fs.exists(backup) -- slight race condition here, but shouldn't be a problem. + util.printerr("Warning: "..target.." is not tracked by this installation of LuaRocks. Moving it to "..backup) + fs.move(target, backup) elseif err then return nil, err.." Cannot install new version." else -- cgit v1.2.3-55-g6feb