diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2017-10-04 11:14:42 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 11:14:42 -0300 |
commit | 84b4fe99cac37850a97858e0b641043bd3178d8a (patch) | |
tree | b4578689091b8360aed71f531faf2513b7d41684 /install.bat | |
parent | 100c18d048936b5a47f29f55e6ce8b24277fb70f (diff) | |
download | luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.gz luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.bz2 luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.zip |
Use versioned files only. (#734)
Let's take the opportunity of a new major version to make an important cleanup: getting rid of the error-prone unversioned configuration files. This drops support for:
* Unversioned config.lua -> use config-5.x.lua
* Unversioned luarocks/site_config.lua -> it always generates luarocks/core/site_config_5_x.lua
* Unversioned lib/luarocks/rocks -> it always uses lib/luarocks/rocks-5.x
Diffstat (limited to 'install.bat')
-rw-r--r-- | install.bat | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/install.bat b/install.bat index 118abfc7..0f334ab9 100644 --- a/install.bat +++ b/install.bat | |||
@@ -604,14 +604,14 @@ local function backup_config_files() | |||
604 | vars.CONFBACKUPDIR = temppath | 604 | vars.CONFBACKUPDIR = temppath |
605 | mkdir(vars.CONFBACKUPDIR) | 605 | mkdir(vars.CONFBACKUPDIR) |
606 | exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]]) | 606 | exec(S[[COPY "$PREFIX\config*.*" "$CONFBACKUPDIR" >NUL]]) |
607 | exec(S[[COPY "$PREFIX\lua\luarocks\site_config*.*" "$CONFBACKUPDIR" >NUL]]) | 607 | exec(S[[COPY "$PREFIX\lua\luarocks\core\site_config*.*" "$CONFBACKUPDIR" >NUL]]) |
608 | end | 608 | end |
609 | 609 | ||
610 | -- restore previously backed up config files | 610 | -- restore previously backed up config files |
611 | local function restore_config_files() | 611 | local function restore_config_files() |
612 | if not vars.CONFBACKUPDIR then return end -- there is no backup to restore | 612 | if not vars.CONFBACKUPDIR then return end -- there is no backup to restore |
613 | exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]]) | 613 | exec(S[[COPY "$CONFBACKUPDIR\config*.*" "$PREFIX" >NUL]]) |
614 | exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks" >NUL]]) | 614 | exec(S[[COPY "$CONFBACKUPDIR\site_config*.*" "$PREFIX\lua\luarocks\core" >NUL]]) |
615 | -- cleanup | 615 | -- cleanup |
616 | exec(S[[RD /S /Q "$CONFBACKUPDIR"]]) | 616 | exec(S[[RD /S /Q "$CONFBACKUPDIR"]]) |
617 | vars.CONFBACKUPDIR = nil | 617 | vars.CONFBACKUPDIR = nil |
@@ -937,13 +937,14 @@ print("Configuring LuaRocks...") | |||
937 | 937 | ||
938 | -- Create a site-config file | 938 | -- Create a site-config file |
939 | local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_") | 939 | local site_config = S("site_config_$LUA_VERSION"):gsub("%.","_") |
940 | if exists(S([[$LUADIR\luarocks\]]..site_config..[[.lua]])) then | 940 | |
941 | local nname = backup(S([[$LUADIR\luarocks\]]..site_config..[[.lua]]), site_config..".lua.bak") | 941 | if exists(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]])) then |
942 | local nname = backup(S([[$LUADIR\luarocks\core\]]..site_config..[[.lua]]), site_config..".lua.bak") | ||
942 | print("***************") | 943 | print("***************") |
943 | print("*** WARNING *** LuaRocks site_config file already exists: '"..site_config..".lua'. The old file has been renamed to '"..nname.."'") | 944 | print("*** WARNING *** LuaRocks site_config file already exists: '"..site_config..".lua'. The old file has been renamed to '"..nname.."'") |
944 | print("***************") | 945 | print("***************") |
945 | end | 946 | end |
946 | local f = io.open(vars.LUADIR.."\\luarocks\\"..site_config..".lua", "w") | 947 | local f = io.open(vars.LUADIR.."\\luarocks\\core\\"..site_config..".lua", "w") |
947 | f:write(S[=[ | 948 | f:write(S[=[ |
948 | local site_config = {} | 949 | local site_config = {} |
949 | site_config.LUA_INCDIR=[[$LUA_INCDIR]] | 950 | site_config.LUA_INCDIR=[[$LUA_INCDIR]] |
@@ -971,7 +972,7 @@ if vars.SYSCONFFORCE then -- only write this value when explcitly given, otherw | |||
971 | end | 972 | end |
972 | f:write("return site_config\n") | 973 | f:write("return site_config\n") |
973 | f:close() | 974 | f:close() |
974 | print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\]]..site_config..[[.lua]])) | 975 | print(S([[Created LuaRocks site-config file: $LUADIR\luarocks\core\]]..site_config..[[.lua]])) |
975 | 976 | ||
976 | -- create config file | 977 | -- create config file |
977 | if not exists(vars.SYSCONFDIR) then | 978 | if not exists(vars.SYSCONFDIR) then |