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 | |
| 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
| -rw-r--r-- | .travis.yml | 5 | ||||
| -rw-r--r-- | Makefile | 52 | ||||
| -rw-r--r-- | appveyor.yml | 6 | ||||
| -rwxr-xr-x | configure | 29 | ||||
| -rw-r--r-- | install.bat | 13 | ||||
| -rw-r--r-- | spec/build_spec.lua | 40 | ||||
| -rw-r--r-- | spec/config_spec.lua | 12 | ||||
| -rw-r--r-- | spec/deps_spec.lua | 64 | ||||
| -rw-r--r-- | spec/doc_spec.lua | 6 | ||||
| -rw-r--r-- | spec/install_spec.lua | 12 | ||||
| -rw-r--r-- | spec/list_spec.lua | 3 | ||||
| -rw-r--r-- | spec/make_spec.lua | 10 | ||||
| -rw-r--r-- | spec/remove_spec.lua | 20 | ||||
| -rw-r--r-- | spec/util_spec.lua | 63 | ||||
| -rw-r--r-- | src/luarocks/core/cfg.lua | 11 | ||||
| -rw-r--r-- | test/test_environment.lua | 42 |
16 files changed, 161 insertions, 227 deletions
diff --git a/.travis.yml b/.travis.yml index e842371a..466177f9 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -63,8 +63,9 @@ install: | |||
| 63 | - if [ ! -f lua_install/bin/luacov ]; then luarocks install luacov; luarocks install luacov-coveralls; fi | 63 | - if [ ! -f lua_install/bin/luacov ]; then luarocks install luacov; luarocks install luacov-coveralls; fi |
| 64 | 64 | ||
| 65 | script: | 65 | script: |
| 66 | - busted -o gtest --verbose -Xhelper travis | 66 | - lua -v |
| 67 | - busted -o gtest --verbose -Xhelper travis,env=full | 67 | - busted -o gtest --verbose -Xhelper "lua_dir=$PWD/lua_install,travis" |
| 68 | - busted -o gtest --verbose -Xhelper "lua_dir=$PWD/lua_install,travis,env=full" | ||
| 68 | 69 | ||
| 69 | after_success: | 70 | after_success: |
| 70 | - luacov -c $TRAVIS_BUILD_DIR/test/luacov.config | 71 | - luacov -c $TRAVIS_BUILD_DIR/test/luacov.config |
| @@ -24,64 +24,60 @@ all: | |||
| 24 | include Makefile.setup.inc | 24 | include Makefile.setup.inc |
| 25 | include Makefile.install.inc | 25 | include Makefile.install.inc |
| 26 | 26 | ||
| 27 | build: src/luarocks/site_config.lua build_bins | 27 | build: $(SITE_CONFIG) build_bins |
| 28 | @echo | 28 | @echo |
| 29 | @echo "Done. Type 'make install' to install into $(PREFIX)." | 29 | @echo "Done. Type 'make install' to install into $(PREFIX)." |
| 30 | @echo | 30 | @echo |
| 31 | 31 | ||
| 32 | src/luarocks/site_config.lua: config.unix | 32 | $(SITE_CONFIG): config.unix |
| 33 | rm -f src/luarocks/site_config.lua | 33 | rm -f $(SITE_CONFIG) |
| 34 | echo 'local site_config = {}' >> src/luarocks/site_config.lua | 34 | echo 'local site_config = {}' >> $(SITE_CONFIG) |
| 35 | if [ -n "$(PREFIX)" ] ;\ | 35 | if [ -n "$(PREFIX)" ] ;\ |
| 36 | then \ | 36 | then \ |
| 37 | echo "site_config.LUAROCKS_PREFIX=[[$(PREFIX)]]" >> src/luarocks/site_config.lua ;\ | 37 | echo "site_config.LUAROCKS_PREFIX=[[$(PREFIX)]]" >> $(SITE_CONFIG) ;\ |
| 38 | fi | 38 | fi |
| 39 | if [ -n "$(LUA_INCDIR)" ] ;\ | 39 | if [ -n "$(LUA_INCDIR)" ] ;\ |
| 40 | then \ | 40 | then \ |
| 41 | echo "site_config.LUA_INCDIR=[[$(LUA_INCDIR)]]" >> src/luarocks/site_config.lua ;\ | 41 | echo "site_config.LUA_INCDIR=[[$(LUA_INCDIR)]]" >> $(SITE_CONFIG) ;\ |
| 42 | fi | 42 | fi |
| 43 | if [ -n "$(LUA_LIBDIR)" ] ;\ | 43 | if [ -n "$(LUA_LIBDIR)" ] ;\ |
| 44 | then \ | 44 | then \ |
| 45 | echo "site_config.LUA_LIBDIR=[[$(LUA_LIBDIR)]]" >> src/luarocks/site_config.lua ;\ | 45 | echo "site_config.LUA_LIBDIR=[[$(LUA_LIBDIR)]]" >> $(SITE_CONFIG) ;\ |
| 46 | fi | 46 | fi |
| 47 | if [ -n "$(LUA_BINDIR)" ] ;\ | 47 | if [ -n "$(LUA_BINDIR)" ] ;\ |
| 48 | then \ | 48 | then \ |
| 49 | echo "site_config.LUA_BINDIR=[[$(LUA_BINDIR)]]" >> src/luarocks/site_config.lua ;\ | 49 | echo "site_config.LUA_BINDIR=[[$(LUA_BINDIR)]]" >> $(SITE_CONFIG) ;\ |
| 50 | fi | 50 | fi |
| 51 | if [ -n "$(LUA_SUFFIX)" ] ;\ | 51 | if [ -n "$(LUA_SUFFIX)" ] ;\ |
| 52 | then \ | 52 | then \ |
| 53 | echo "site_config.LUA_INTERPRETER=[[lua$(LUA_SUFFIX)]]" >> src/luarocks/site_config.lua ;\ | 53 | echo "site_config.LUA_INTERPRETER=[[lua$(LUA_SUFFIX)]]" >> $(SITE_CONFIG) ;\ |
| 54 | fi | 54 | fi |
| 55 | if [ -n "$(SYSCONFDIR)" ] ;\ | 55 | if [ -n "$(SYSCONFDIR)" ] ;\ |
| 56 | then \ | 56 | then \ |
| 57 | echo "site_config.LUAROCKS_SYSCONFDIR=[[$(SYSCONFDIR)]]" >> src/luarocks/site_config.lua ;\ | 57 | echo "site_config.LUAROCKS_SYSCONFDIR=[[$(SYSCONFDIR)]]" >> $(SITE_CONFIG) ;\ |
| 58 | fi | 58 | fi |
| 59 | if [ -n "$(ROCKS_TREE)" ] ;\ | 59 | if [ -n "$(ROCKS_TREE)" ] ;\ |
| 60 | then \ | 60 | then \ |
| 61 | echo "site_config.LUAROCKS_ROCKS_TREE=[[$(ROCKS_TREE)]]" >> src/luarocks/site_config.lua ;\ | 61 | echo "site_config.LUAROCKS_ROCKS_TREE=[[$(ROCKS_TREE)]]" >> $(SITE_CONFIG) ;\ |
| 62 | fi | 62 | fi |
| 63 | if [ -n "$(FORCE_CONFIG)" ] ;\ | 63 | if [ -n "$(FORCE_CONFIG)" ] ;\ |
| 64 | then \ | 64 | then \ |
| 65 | echo "site_config.LUAROCKS_FORCE_CONFIG=true" >> src/luarocks/site_config.lua ;\ | 65 | echo "site_config.LUAROCKS_FORCE_CONFIG=true" >> $(SITE_CONFIG) ;\ |
| 66 | fi | ||
| 67 | if [ -n "$(LUAROCKS_ROCKS_SUBDIR)" ] ;\ | ||
| 68 | then \ | ||
| 69 | echo "site_config.LUAROCKS_ROCKS_SUBDIR=[[$(LUAROCKS_ROCKS_SUBDIR)]]" >> src/luarocks/site_config.lua ;\ | ||
| 70 | fi | 66 | fi |
| 71 | if [ "$(LUA_DIR_SET)" = "yes" ] ;\ | 67 | if [ "$(LUA_DIR_SET)" = "yes" ] ;\ |
| 72 | then \ | 68 | then \ |
| 73 | echo "site_config.LUA_DIR_SET=true" >> src/luarocks/site_config.lua ;\ | 69 | echo "site_config.LUA_DIR_SET=true" >> $(SITE_CONFIG) ;\ |
| 74 | fi | 70 | fi |
| 75 | echo "site_config.LUAROCKS_UNAME_S=[[$(LUAROCKS_UNAME_S)]]" >> src/luarocks/site_config.lua | 71 | echo "site_config.LUAROCKS_UNAME_S=[[$(LUAROCKS_UNAME_S)]]" >> $(SITE_CONFIG) |
| 76 | echo "site_config.LUAROCKS_UNAME_M=[[$(LUAROCKS_UNAME_M)]]" >> src/luarocks/site_config.lua | 72 | echo "site_config.LUAROCKS_UNAME_M=[[$(LUAROCKS_UNAME_M)]]" >> $(SITE_CONFIG) |
| 77 | echo "site_config.LUAROCKS_DOWNLOADER=[[$(LUAROCKS_DOWNLOADER)]]" >> src/luarocks/site_config.lua | 73 | echo "site_config.LUAROCKS_DOWNLOADER=[[$(LUAROCKS_DOWNLOADER)]]" >> $(SITE_CONFIG) |
| 78 | echo "site_config.LUAROCKS_MD5CHECKER=[[$(LUAROCKS_MD5CHECKER)]]" >> src/luarocks/site_config.lua | 74 | echo "site_config.LUAROCKS_MD5CHECKER=[[$(LUAROCKS_MD5CHECKER)]]" >> $(SITE_CONFIG) |
| 79 | if [ -n "$(MULTIARCH_SUBDIR)" ] ;\ | 75 | if [ -n "$(MULTIARCH_SUBDIR)" ] ;\ |
| 80 | then \ | 76 | then \ |
| 81 | echo 'site_config.LUAROCKS_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[$(MULTIARCH_SUBDIR)]] }, include="include" }' >> src/luarocks/site_config.lua ;\ | 77 | echo 'site_config.LUAROCKS_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[$(MULTIARCH_SUBDIR)]] }, include="include" }' >> $(SITE_CONFIG) ;\ |
| 82 | echo 'site_config.LUAROCKS_RUNTIME_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[$(MULTIARCH_SUBDIR)]] }, include="include" }' >> src/luarocks/site_config.lua ;\ | 78 | echo 'site_config.LUAROCKS_RUNTIME_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[$(MULTIARCH_SUBDIR)]] }, include="include" }' >> $(SITE_CONFIG) ;\ |
| 83 | fi | 79 | fi |
| 84 | echo "return site_config" >> src/luarocks/site_config.lua | 80 | echo "return site_config" >> $(SITE_CONFIG) |
| 85 | 81 | ||
| 86 | dev: | 82 | dev: |
| 87 | $(MAKE) build_bins LUADIR=$(PWD)/src | 83 | $(MAKE) build_bins LUADIR=$(PWD)/src |
| @@ -123,14 +119,14 @@ cleanup_bins: | |||
| 123 | done | 119 | done |
| 124 | 120 | ||
| 125 | clean: cleanup_bins | 121 | clean: cleanup_bins |
| 126 | rm -f src/luarocks/site_config.lua | 122 | rm -f $(SITE_CONFIG) |
| 127 | 123 | ||
| 128 | run_luarocks: | 124 | run_luarocks: |
| 129 | '$(LUA_BINDIR)/lua$(LUA_SUFFIX)' -e "package.path=[[$(SAFEPWD)/src/?.lua;]]..package.path" src/bin/luarocks make rockspec --tree="$(PREFIX)" | 125 | '$(LUA_BINDIR)/lua$(LUA_SUFFIX)' -e "package.path=[[$(SAFEPWD)/src/?.lua;]]..package.path" src/bin/luarocks make rockspec --tree="$(PREFIX)" |
| 130 | 126 | ||
| 131 | install_site_config: src/luarocks/site_config.lua | 127 | install_site_config: $(SITE_CONFIG) |
| 132 | mkdir -p "$(DESTDIR)$(LUADIR)/luarocks" | 128 | mkdir -p "$(DESTDIR)$(LUADIR)/luarocks" |
| 133 | cp src/luarocks/site_config.lua "$(DESTDIR)$(LUADIR)/luarocks" | 129 | cp $(SITE_CONFIG) "$(DESTDIR)$(LUADIR)/luarocks" |
| 134 | 130 | ||
| 135 | write_sysconfig: | 131 | write_sysconfig: |
| 136 | mkdir -p "$(DESTDIR)$(ROCKS_TREE)" | 132 | mkdir -p "$(DESTDIR)$(ROCKS_TREE)" |
| @@ -148,7 +144,7 @@ write_sysconfig: | |||
| 148 | 144 | ||
| 149 | install: install_bins install_luas install_site_config write_sysconfig | 145 | install: install_bins install_luas install_site_config write_sysconfig |
| 150 | 146 | ||
| 151 | bootstrap: src/luarocks/site_config.lua run_luarocks install_site_config write_sysconfig cleanup_bins | 147 | bootstrap: $(SITE_CONFIG) run_luarocks install_site_config write_sysconfig cleanup_bins |
| 152 | 148 | ||
| 153 | install_rock: install_bins install_luas | 149 | install_rock: install_bins install_luas |
| 154 | 150 | ||
diff --git a/appveyor.yml b/appveyor.yml index a7cf1be6..3255e2db 100644 --- a/appveyor.yml +++ b/appveyor.yml | |||
| @@ -38,14 +38,14 @@ init: | |||
| 38 | before_build: | 38 | before_build: |
| 39 | - set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH | 39 | - set PATH=C:\Python27\Scripts;%PATH% # Add directory containing 'pip' to PATH |
| 40 | - pip install hererocks | 40 | - pip install hererocks |
| 41 | - hererocks env --%LUA% --luarocks @luarocks-3 --target=%COMPILER% | 41 | - hererocks lua_install --%LUA% --luarocks @luarocks-3 --target=%COMPILER% |
| 42 | - call env\bin\activate | 42 | - call lua_install\bin\activate |
| 43 | 43 | ||
| 44 | build_script: | 44 | build_script: |
| 45 | - luarocks install busted 1> NUL 2> NUL | 45 | - luarocks install busted 1> NUL 2> NUL |
| 46 | 46 | ||
| 47 | test_script: | 47 | test_script: |
| 48 | - busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper appveyor,%COMPILER% | 48 | - busted --lpath=.//?.lua --exclude-tags=ssh,unix,mock -Xhelper lua_dir=%CD%\lua_install,appveyor,%COMPILER% |
| 49 | 49 | ||
| 50 | after_test: | 50 | after_test: |
| 51 | - if "%LUA%"=="lua 5.1" (luarocks show bit32 || luarocks install bit32) | 51 | - if "%LUA%"=="lua 5.1" (luarocks show bit32 || luarocks install bit32) |
| @@ -58,9 +58,6 @@ system's package manager. | |||
| 58 | --with-md5-checker=TOOL Which tool to use as a downloader. | 58 | --with-md5-checker=TOOL Which tool to use as a downloader. |
| 59 | Valid options are: md5sum, openssl | 59 | Valid options are: md5sum, openssl |
| 60 | Default is to auto-detect. | 60 | Default is to auto-detect. |
| 61 | --versioned-rocks-dir Use a versioned rocks dir, such as | ||
| 62 | \$PREFIX/lib/luarocks/rocks-$LUA_VERSION/. | ||
| 63 | Default is to auto-detect the necessity. | ||
| 64 | --force-config Use a single config location. Do not use the | 61 | --force-config Use a single config location. Do not use the |
| 65 | \$LUAROCKS_CONFIG variable or the user's home | 62 | \$LUAROCKS_CONFIG variable or the user's home |
| 66 | directory. Useful to avoid conflicts when LuaRocks | 63 | directory. Useful to avoid conflicts when LuaRocks |
| @@ -155,7 +152,8 @@ do | |||
| 155 | FORCE_CONFIG=yes | 152 | FORCE_CONFIG=yes |
| 156 | ;; | 153 | ;; |
| 157 | --versioned-rocks-dir) | 154 | --versioned-rocks-dir) |
| 158 | VERSIONED_ROCKS_DIR=yes | 155 | echo "--versioned-rocks-dir is no longer necessary." |
| 156 | echo "The rocks tree in LuaRocks 3.0 is always versioned." | ||
| 159 | ;; | 157 | ;; |
| 160 | --lua-suffix) | 158 | --lua-suffix) |
| 161 | [ -n "$value" ] || die "Missing value in flag $key." | 159 | [ -n "$value" ] || die "Missing value in flag $key." |
| @@ -411,25 +409,6 @@ for v in 5.1 5.2 5.3; do | |||
| 411 | fi | 409 | fi |
| 412 | done | 410 | done |
| 413 | 411 | ||
| 414 | LUAROCKS_ROCKS_SUBDIR=/lib/luarocks/rocks | ||
| 415 | if [ "$VERSIONED_ROCKS_DIR" = "yes" ] | ||
| 416 | then | ||
| 417 | LUAROCKS_ROCKS_SUBDIR=$LUAROCKS_ROCKS_SUBDIR-$LUA_VERSION | ||
| 418 | echo "Using versioned rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" | ||
| 419 | elif [ -e "$PREFIX/share/lua/$LUA_VERSION/luarocks/site_config.lua" ] | ||
| 420 | then | ||
| 421 | echo "Existing installation detected." | ||
| 422 | LUAROCKS_ROCKS_SUBDIR=`grep "LUAROCKS_ROCKS_SUBDIR" "$PREFIX/share/lua/$LUA_VERSION/luarocks/site_config.lua" | sed 's,.*=\[\[\(.*\)\]\],\1,'` | ||
| 423 | echo "Using previously configured rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" | ||
| 424 | elif [ -n "$LUA_OTHER_VERSION" ] | ||
| 425 | then | ||
| 426 | echo "Existing installation detected for other Lua version ($LUA_OTHER_VERSION)." | ||
| 427 | LUAROCKS_ROCKS_SUBDIR=$LUAROCKS_ROCKS_SUBDIR-$LUA_VERSION | ||
| 428 | echo "Using versioned rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" | ||
| 429 | else | ||
| 430 | echo "Using unversioned rocks dir: $PREFIX$LUAROCKS_ROCKS_SUBDIR" | ||
| 431 | fi | ||
| 432 | |||
| 433 | if [ "$LUAROCKS_UNAME_S" = Linux ] | 412 | if [ "$LUAROCKS_UNAME_S" = Linux ] |
| 434 | then | 413 | then |
| 435 | GCC_ARCH=`gcc -print-multiarch 2>/dev/null` | 414 | GCC_ARCH=`gcc -print-multiarch 2>/dev/null` |
| @@ -447,6 +426,8 @@ if [ -f config.unix ]; then | |||
| 447 | rm -f config.unix | 426 | rm -f config.unix |
| 448 | fi | 427 | fi |
| 449 | 428 | ||
| 429 | SITE_CONFIG=src/luarocks/core/site_config_$(echo "$LUA_VERSION" | sed 's,\.,_,').lua | ||
| 430 | |||
| 450 | # Write config | 431 | # Write config |
| 451 | 432 | ||
| 452 | echo "Writing configuration..." | 433 | echo "Writing configuration..." |
| @@ -458,6 +439,7 @@ cat <<EOF > config.unix | |||
| 458 | # Run "./configure --help" for details. | 439 | # Run "./configure --help" for details. |
| 459 | 440 | ||
| 460 | LUA_VERSION=$LUA_VERSION | 441 | LUA_VERSION=$LUA_VERSION |
| 442 | SITE_CONFIG=$SITE_CONFIG | ||
| 461 | PREFIX=$PREFIX | 443 | PREFIX=$PREFIX |
| 462 | SYSCONFDIR=$SYSCONFDIR | 444 | SYSCONFDIR=$SYSCONFDIR |
| 463 | ROCKS_TREE=$ROCKS_TREE | 445 | ROCKS_TREE=$ROCKS_TREE |
| @@ -472,7 +454,6 @@ LUAROCKS_UNAME_M=$LUAROCKS_UNAME_M | |||
| 472 | LUAROCKS_UNAME_S=$LUAROCKS_UNAME_S | 454 | LUAROCKS_UNAME_S=$LUAROCKS_UNAME_S |
| 473 | LUAROCKS_DOWNLOADER=$LUAROCKS_DOWNLOADER | 455 | LUAROCKS_DOWNLOADER=$LUAROCKS_DOWNLOADER |
| 474 | LUAROCKS_MD5CHECKER=$LUAROCKS_MD5CHECKER | 456 | LUAROCKS_MD5CHECKER=$LUAROCKS_MD5CHECKER |
| 475 | LUAROCKS_ROCKS_SUBDIR=$LUAROCKS_ROCKS_SUBDIR | ||
| 476 | MULTIARCH_SUBDIR=$MULTIARCH_SUBDIR | 457 | MULTIARCH_SUBDIR=$MULTIARCH_SUBDIR |
| 477 | 458 | ||
| 478 | EOF | 459 | EOF |
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 |
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 2ff7cbe6..ffae144d 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
| @@ -63,22 +63,22 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 63 | 63 | ||
| 64 | it("LuaRocks build lpeg branch=master", function() | 64 | it("LuaRocks build lpeg branch=master", function() |
| 65 | assert.is_true(run.luarocks_bool("build --branch=master lpeg")) | 65 | assert.is_true(run.luarocks_bool("build --branch=master lpeg")) |
| 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 67 | end) | 67 | end) |
| 68 | 68 | ||
| 69 | it("LuaRocks build lpeg deps-mode=123", function() | 69 | it("LuaRocks build lpeg deps-mode=123", function() |
| 70 | assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose")) | 70 | assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose")) |
| 71 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 71 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 72 | end) | 72 | end) |
| 73 | 73 | ||
| 74 | it("LuaRocks build lpeg only-sources example", function() | 74 | it("LuaRocks build lpeg only-sources example", function() |
| 75 | assert.is_true(run.luarocks_bool("download --rockspec lpeg")) | 75 | assert.is_true(run.luarocks_bool("download --rockspec lpeg")) |
| 76 | assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.rockspec")) | 76 | assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.rockspec")) |
| 77 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 77 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 78 | 78 | ||
| 79 | assert.is_true(run.luarocks_bool("download --source lpeg")) | 79 | assert.is_true(run.luarocks_bool("download --source lpeg")) |
| 80 | assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.src.rock")) | 80 | assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.src.rock")) |
| 81 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 81 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 82 | 82 | ||
| 83 | assert.is_true(os.remove("lpeg-1.0.0-1.rockspec")) | 83 | assert.is_true(os.remove("lpeg-1.0.0-1.rockspec")) |
| 84 | assert.is_true(os.remove("lpeg-1.0.0-1.src.rock")) | 84 | assert.is_true(os.remove("lpeg-1.0.0-1.src.rock")) |
| @@ -86,7 +86,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 86 | 86 | ||
| 87 | it("LuaRocks build lpeg with empty tree", function() | 87 | it("LuaRocks build lpeg with empty tree", function() |
| 88 | assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) | 88 | assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) |
| 89 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 89 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 90 | end) | 90 | end) |
| 91 | end) | 91 | end) |
| 92 | 92 | ||
| @@ -97,17 +97,17 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 97 | 97 | ||
| 98 | it("LuaRocks build luacov diff version", function() | 98 | it("LuaRocks build luacov diff version", function() |
| 99 | assert.is_true(run.luarocks_bool("build luacov 0.11.0-1")) | 99 | assert.is_true(run.luarocks_bool("build luacov 0.11.0-1")) |
| 100 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luacov/0.11.0-1/luacov-0.11.0-1.rockspec")) | 100 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/0.11.0-1/luacov-0.11.0-1.rockspec")) |
| 101 | end) | 101 | end) |
| 102 | 102 | ||
| 103 | it("LuaRocks build command stdlib", function() | 103 | it("LuaRocks build command stdlib", function() |
| 104 | assert.is_true(run.luarocks_bool("build stdlib")) | 104 | assert.is_true(run.luarocks_bool("build stdlib")) |
| 105 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) | 105 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) |
| 106 | end) | 106 | end) |
| 107 | 107 | ||
| 108 | it("LuaRocks build install bin luarepl", function() | 108 | it("LuaRocks build install bin luarepl", function() |
| 109 | assert.is_true(run.luarocks_bool("build luarepl")) | 109 | assert.is_true(run.luarocks_bool("build luarepl")) |
| 110 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/luarepl-0.4-1.rockspec")) | 110 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/luarepl-0.4-1.rockspec")) |
| 111 | end) | 111 | end) |
| 112 | 112 | ||
| 113 | it("LuaRocks build supported platforms lpty", function() | 113 | it("LuaRocks build supported platforms lpty", function() |
| @@ -115,24 +115,24 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 115 | assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms | 115 | assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms |
| 116 | else | 116 | else |
| 117 | assert.is_true(run.luarocks_bool("build lpty")) | 117 | assert.is_true(run.luarocks_bool("build lpty")) |
| 118 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) | 118 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) |
| 119 | end | 119 | end |
| 120 | end) | 120 | end) |
| 121 | 121 | ||
| 122 | it("LuaRocks build luasec with skipping dependency checks", function() | 122 | it("LuaRocks build luasec with skipping dependency checks", function() |
| 123 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) | 123 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) |
| 124 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) | 124 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) |
| 125 | end) | 125 | end) |
| 126 | 126 | ||
| 127 | it("LuaRocks build lmathx deps partial match", function() | 127 | it("LuaRocks build lmathx deps partial match", function() |
| 128 | assert.is_true(run.luarocks_bool("build lmathx")) | 128 | assert.is_true(run.luarocks_bool("build lmathx")) |
| 129 | 129 | ||
| 130 | if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then | 130 | if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then |
| 131 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec")) | 131 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec")) |
| 132 | elseif test_env.LUA_V == "5.2" then | 132 | elseif test_env.LUA_V == "5.2" then |
| 133 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec")) | 133 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec")) |
| 134 | elseif test_env.LUA_V == "5.3" then | 134 | elseif test_env.LUA_V == "5.3" then |
| 135 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20150505-1/lmathx-20150505-1.rockspec")) | 135 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20150505-1/lmathx-20150505-1.rockspec")) |
| 136 | end | 136 | end |
| 137 | end) | 137 | end) |
| 138 | end) | 138 | end) |
| @@ -148,15 +148,15 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 148 | it("LuaRocks build luasec only deps", function() | 148 | it("LuaRocks build luasec only deps", function() |
| 149 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) | 149 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) |
| 150 | assert.is_false(run.luarocks_bool("show luasec")) | 150 | assert.is_false(run.luarocks_bool("show luasec")) |
| 151 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) | 151 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec")) |
| 152 | end) | 152 | end) |
| 153 | 153 | ||
| 154 | it("LuaRocks build only deps of downloaded rockspec of lxsh", function() | 154 | it("LuaRocks build only deps of downloaded rockspec of lxsh", function() |
| 155 | assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) | 155 | assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) |
| 156 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) | 156 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) |
| 157 | assert.is_false(run.luarocks_bool("show lxsh")) | 157 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 158 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 158 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 159 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 159 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 160 | assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) | 160 | assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) |
| 161 | end) | 161 | end) |
| 162 | 162 | ||
| @@ -164,8 +164,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 164 | assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) | 164 | assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) |
| 165 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) | 165 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) |
| 166 | assert.is_false(run.luarocks_bool("show lxsh")) | 166 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 167 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 167 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 168 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 168 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 169 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) | 169 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) |
| 170 | end) | 170 | end) |
| 171 | 171 | ||
| @@ -174,7 +174,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 174 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) | 174 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) |
| 175 | 175 | ||
| 176 | assert.is.truthy(run.luarocks("show validate-args")) | 176 | assert.is.truthy(run.luarocks("show validate-args")) |
| 177 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) | 177 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) |
| 178 | 178 | ||
| 179 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) | 179 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) |
| 180 | end) | 180 | end) |
| @@ -185,7 +185,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 185 | 185 | ||
| 186 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) | 186 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) |
| 187 | assert.is.truthy(run.luarocks("show validate-args")) | 187 | assert.is.truthy(run.luarocks("show validate-args")) |
| 188 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) | 188 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) |
| 189 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) | 189 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) |
| 190 | end) | 190 | end) |
| 191 | 191 | ||
diff --git a/spec/config_spec.lua b/spec/config_spec.lua index cdb5ccc4..6be586c2 100644 --- a/spec/config_spec.lua +++ b/spec/config_spec.lua | |||
| @@ -12,7 +12,7 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
| 12 | before_each(function() | 12 | before_each(function() |
| 13 | test_env.setup_specs() | 13 | test_env.setup_specs() |
| 14 | test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs | 14 | test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs |
| 15 | site_config = require("luarocks.site_config") | 15 | site_config = require("luarocks.core.site_config_" .. test_env.lua_version:gsub("%.", "_")) |
| 16 | end) | 16 | end) |
| 17 | 17 | ||
| 18 | describe("LuaRocks config - basic tests", function() | 18 | describe("LuaRocks config - basic tests", function() |
| @@ -64,15 +64,7 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
| 64 | 64 | ||
| 65 | describe("LuaRocks config - more complex tests", function() | 65 | describe("LuaRocks config - more complex tests", function() |
| 66 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" | 66 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" |
| 67 | local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" | 67 | local configfile = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" |
| 68 | local scname = scdir .. "/config.lua" | ||
| 69 | |||
| 70 | local configfile | ||
| 71 | if test_env.TEST_TARGET_OS == "windows" then | ||
| 72 | configfile = versioned_scname | ||
| 73 | else | ||
| 74 | configfile = scname | ||
| 75 | end | ||
| 76 | 68 | ||
| 77 | it("LuaRocks fail system config", function() | 69 | it("LuaRocks fail system config", function() |
| 78 | os.rename(configfile, configfile .. ".bak") | 70 | os.rename(configfile, configfile .. ".bak") |
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua index e453c9a1..8c4effcd 100644 --- a/spec/deps_spec.lua +++ b/spec/deps_spec.lua | |||
| @@ -23,59 +23,59 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() | |||
| 23 | assert.is_true(run.luarocks_bool("build --tree=system lpeg")) | 23 | assert.is_true(run.luarocks_bool("build --tree=system lpeg")) |
| 24 | assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh")) | 24 | assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh")) |
| 25 | 25 | ||
| 26 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 26 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 27 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 27 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 28 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 28 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 29 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 29 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 30 | end) | 30 | end) |
| 31 | 31 | ||
| 32 | it("LuaRocks deps mode order", function() | 32 | it("LuaRocks deps mode order", function() |
| 33 | assert.is_true(run.luarocks_bool("build --tree=system lpeg")) | 33 | assert.is_true(run.luarocks_bool("build --tree=system lpeg")) |
| 34 | assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh")) | 34 | assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh")) |
| 35 | 35 | ||
| 36 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 36 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 38 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 38 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 39 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 39 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 40 | end) | 40 | end) |
| 41 | 41 | ||
| 42 | it("LuaRocks deps mode order sys", function() | 42 | it("LuaRocks deps mode order sys", function() |
| 43 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) | 43 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) |
| 44 | assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) | 44 | assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) |
| 45 | 45 | ||
| 46 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 46 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 47 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 47 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 48 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 48 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 49 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 49 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 50 | end) | 50 | end) |
| 51 | 51 | ||
| 52 | it("LuaRocks deps mode all sys", function() | 52 | it("LuaRocks deps mode all sys", function() |
| 53 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) | 53 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) |
| 54 | assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) | 54 | assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh")) |
| 55 | 55 | ||
| 56 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 56 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 57 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 57 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 58 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 58 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 59 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 59 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 60 | end) | 60 | end) |
| 61 | 61 | ||
| 62 | it("LuaRocks deps mode none", function() | 62 | it("LuaRocks deps mode none", function() |
| 63 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) | 63 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) |
| 64 | assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh")) | 64 | assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh")) |
| 65 | 65 | ||
| 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 67 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 67 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 68 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 68 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 69 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 69 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 70 | end) | 70 | end) |
| 71 | 71 | ||
| 72 | it("LuaRocks nodeps alias", function() | 72 | it("LuaRocks nodeps alias", function() |
| 73 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh")) | 73 | assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh")) |
| 74 | 74 | ||
| 75 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 75 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 76 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 76 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 77 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 77 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 78 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 78 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 79 | end) | 79 | end) |
| 80 | 80 | ||
| 81 | it("LuaRocks deps mode make order", function() | 81 | it("LuaRocks deps mode make order", function() |
| @@ -89,10 +89,10 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() | |||
| 89 | test_env.remove_dir("lxsh-0.8.6-2") | 89 | test_env.remove_dir("lxsh-0.8.6-2") |
| 90 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) | 90 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) |
| 91 | 91 | ||
| 92 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 92 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 93 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 93 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 94 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 94 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 95 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 95 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 96 | end) | 96 | end) |
| 97 | 97 | ||
| 98 | it("LuaRocks deps mode make order sys", function() | 98 | it("LuaRocks deps mode make order sys", function() |
| @@ -106,9 +106,9 @@ describe("LuaRocks deps tests #blackbox #b_deps", function() | |||
| 106 | test_env.remove_dir("lxsh-0.8.6-2") | 106 | test_env.remove_dir("lxsh-0.8.6-2") |
| 107 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) | 107 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) |
| 108 | 108 | ||
| 109 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 109 | assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 110 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) | 110 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) |
| 111 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 111 | assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 112 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 112 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 113 | end) | 113 | end) |
| 114 | end) | 114 | end) |
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua index a04d3c14..ea42cd6b 100644 --- a/spec/doc_spec.lua +++ b/spec/doc_spec.lua | |||
| @@ -28,12 +28,12 @@ describe("LuaRocks doc tests #blackbox #b_doc", function() | |||
| 28 | end) | 28 | end) |
| 29 | it("LuaRocks doc with no home page and no doc folder", function() | 29 | it("LuaRocks doc with no home page and no doc folder", function() |
| 30 | assert.is_true(run.luarocks_bool("install c3")) | 30 | assert.is_true(run.luarocks_bool("install c3")) |
| 31 | test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/c3/1.0-1/doc") | 31 | test_env.remove_dir(testing_paths.testing_sys_rocks .. "/c3/1.0-1/doc") |
| 32 | assert.is_false(run.luarocks_bool("doc c3")) | 32 | assert.is_false(run.luarocks_bool("doc c3")) |
| 33 | end) | 33 | end) |
| 34 | it("LuaRocks doc with no doc folder opening descript.homepage", function() | 34 | it("LuaRocks doc with no doc folder opening descript.homepage", function() |
| 35 | assert.is_true(run.luarocks_bool("install luarepl")) | 35 | assert.is_true(run.luarocks_bool("install luarepl")) |
| 36 | test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/doc") | 36 | test_env.remove_dir(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/doc") |
| 37 | local output = run.luarocks("doc luarepl") | 37 | local output = run.luarocks("doc luarepl") |
| 38 | assert.is.truthy(output:find("Local documentation directory not found")) | 38 | assert.is.truthy(output:find("Local documentation directory not found")) |
| 39 | end) | 39 | end) |
| @@ -53,7 +53,7 @@ describe("LuaRocks doc tests #blackbox #b_doc", function() | |||
| 53 | it("LuaRocks doc of luacov and list doc folder", function() | 53 | it("LuaRocks doc of luacov and list doc folder", function() |
| 54 | assert.is_true(run.luarocks_bool("install luacov")) | 54 | assert.is_true(run.luarocks_bool("install luacov")) |
| 55 | local output = assert.is.truthy(run.luarocks("doc luacov --list")) | 55 | local output = assert.is.truthy(run.luarocks("doc luacov --list")) |
| 56 | assert.is.truthy(output:find("/lib/luarocks/rocks/luacov/0.11.0--1/doc/")) | 56 | assert.is.truthy(output:find("/lib/luarocks/rocks%-.*/luacov/0.11.0%-1/doc/", 1)) |
| 57 | end) | 57 | end) |
| 58 | 58 | ||
| 59 | it("LuaRocks doc of luacov local", function() | 59 | it("LuaRocks doc of luacov local", function() |
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 74f8f493..92b780d3 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
| @@ -83,9 +83,9 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
| 83 | assert.is_true(run.luarocks_bool("show luasec")) | 83 | assert.is_true(run.luarocks_bool("show luasec")) |
| 84 | if env_variables.TYPE_TEST_ENV == "minimal" then | 84 | if env_variables.TYPE_TEST_ENV == "minimal" then |
| 85 | assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) | 85 | assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) |
| 86 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 86 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 87 | end | 87 | end |
| 88 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) | 88 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec")) |
| 89 | end) | 89 | end) |
| 90 | 90 | ||
| 91 | it('LuaRocks install - handle relative path in --tree #632', function() | 91 | it('LuaRocks install - handle relative path in --tree #632', function() |
| @@ -170,22 +170,22 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
| 170 | assert.is_true(run.luarocks_bool("install say 1.2")) | 170 | assert.is_true(run.luarocks_bool("install say 1.2")) |
| 171 | assert.is_true(run.luarocks_bool("install luassert")) | 171 | assert.is_true(run.luarocks_bool("install luassert")) |
| 172 | assert.is_true(run.luarocks_bool("install say 1.0")) | 172 | assert.is_true(run.luarocks_bool("install say 1.0")) |
| 173 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) | 173 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) |
| 174 | end) | 174 | end) |
| 175 | it("LuaRocks install break dependencies force", function() | 175 | it("LuaRocks install break dependencies force", function() |
| 176 | assert.is_true(run.luarocks_bool("install say 1.2")) | 176 | assert.is_true(run.luarocks_bool("install say 1.2")) |
| 177 | assert.is_true(run.luarocks_bool("install luassert")) | 177 | assert.is_true(run.luarocks_bool("install luassert")) |
| 178 | local output = run.luarocks("install --force say 1.0") | 178 | local output = run.luarocks("install --force say 1.0") |
| 179 | assert.is.truthy(output:find("Checking stability of dependencies")) | 179 | assert.is.truthy(output:find("Checking stability of dependencies")) |
| 180 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) | 180 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) |
| 181 | end) | 181 | end) |
| 182 | it("LuaRocks install break dependencies force fast", function() | 182 | it("LuaRocks install break dependencies force fast", function() |
| 183 | assert.is_true(run.luarocks_bool("install say 1.2")) | 183 | assert.is_true(run.luarocks_bool("install say 1.2")) |
| 184 | assert.is_true(run.luarocks_bool("install luassert")) | 184 | assert.is_true(run.luarocks_bool("install luassert")) |
| 185 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) | 185 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) |
| 186 | local output = run.luarocks("install --force-fast say 1.0") | 186 | local output = run.luarocks("install --force-fast say 1.0") |
| 187 | assert.is.falsy(output:find("Checking stability of dependencies")) | 187 | assert.is.falsy(output:find("Checking stability of dependencies")) |
| 188 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.0-1")) | 188 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.0-1")) |
| 189 | end) | 189 | end) |
| 190 | end) | 190 | end) |
| 191 | end) | 191 | end) |
diff --git a/spec/list_spec.lua b/spec/list_spec.lua index 1b082ab6..b9a8e4c4 100644 --- a/spec/list_spec.lua +++ b/spec/list_spec.lua | |||
| @@ -22,8 +22,7 @@ describe("LuaRocks list tests #blackbox #b_list", function() | |||
| 22 | 22 | ||
| 23 | it("LuaRocks list porcelain", function() | 23 | it("LuaRocks list porcelain", function() |
| 24 | local output = run.luarocks("list --porcelain") | 24 | local output = run.luarocks("list --porcelain") |
| 25 | local path = testing_paths.testing_sys_tree:gsub("-", "--") -- !not sure! why this is good | 25 | assert.is.truthy(output:find("luacov\t0.11.0-1\tinstalled\t" .. testing_paths.testing_sys_rocks, 1, true)) |
| 26 | assert.is.truthy(output:find("luacov\t0.11.0--1\tinstalled\t" .. path .. "/lib/luarocks/rocks" )) | ||
| 27 | end) | 26 | end) |
| 28 | 27 | ||
| 29 | it("LuaRocks install outdated and list it", function() | 28 | it("LuaRocks install outdated and list it", function() |
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index ab2d49a3..4c406c68 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
| @@ -35,7 +35,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
| 35 | 35 | ||
| 36 | -- test it | 36 | -- test it |
| 37 | assert.is_true(run.luarocks_bool("show luasocket")) | 37 | assert.is_true(run.luarocks_bool("show luasocket")) |
| 38 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) | 38 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) |
| 39 | 39 | ||
| 40 | -- delete downloaded and unpacked files | 40 | -- delete downloaded and unpacked files |
| 41 | lfs.chdir(testing_paths.luarocks_dir) | 41 | lfs.chdir(testing_paths.luarocks_dir) |
| @@ -63,7 +63,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
| 63 | assert.is_true(run.luarocks_bool("make")) | 63 | assert.is_true(run.luarocks_bool("make")) |
| 64 | 64 | ||
| 65 | assert.is_true(run.luarocks_bool("show lxsh")) | 65 | assert.is_true(run.luarocks_bool("show lxsh")) |
| 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) | 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) |
| 67 | end) | 67 | end) |
| 68 | 68 | ||
| 69 | it("LuaRocks make unnamed rockspec", function() | 69 | it("LuaRocks make unnamed rockspec", function() |
| @@ -71,7 +71,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
| 71 | assert.is_true(run.luarocks_bool("make")) | 71 | assert.is_true(run.luarocks_bool("make")) |
| 72 | 72 | ||
| 73 | assert.is_true(run.luarocks_bool("show lxsh")) | 73 | assert.is_true(run.luarocks_bool("show lxsh")) |
| 74 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 74 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 75 | os.remove("rockspec") | 75 | os.remove("rockspec") |
| 76 | end) | 76 | end) |
| 77 | 77 | ||
| @@ -81,7 +81,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
| 81 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) | 81 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) |
| 82 | 82 | ||
| 83 | assert.is_false(run.luarocks_bool("show lxsh")) | 83 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 84 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 84 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 85 | end) | 85 | end) |
| 86 | 86 | ||
| 87 | it("LuaRocks make ambiguous unnamed rockspec", function() | 87 | it("LuaRocks make ambiguous unnamed rockspec", function() |
| @@ -91,7 +91,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
| 91 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) | 91 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) |
| 92 | 92 | ||
| 93 | assert.is_false(run.luarocks_bool("show lxsh")) | 93 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 94 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 94 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
| 95 | end) | 95 | end) |
| 96 | 96 | ||
| 97 | it("LuaRocks make pack binary rock", function() | 97 | it("LuaRocks make pack binary rock", function() |
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 03b3681e..4d3f5cdc 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua | |||
| @@ -37,16 +37,16 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
| 37 | 37 | ||
| 38 | it("LuaRocks remove built abelhas", function() | 38 | it("LuaRocks remove built abelhas", function() |
| 39 | assert.is_true(run.luarocks_bool("build abelhas 1.0")) | 39 | assert.is_true(run.luarocks_bool("build abelhas 1.0")) |
| 40 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | 40 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) |
| 41 | assert.is_true(run.luarocks_bool("remove abelhas 1.0")) | 41 | assert.is_true(run.luarocks_bool("remove abelhas 1.0")) |
| 42 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | 42 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) |
| 43 | end) | 43 | end) |
| 44 | 44 | ||
| 45 | it("LuaRocks remove built abelhas with uppercase name", function() | 45 | it("LuaRocks remove built abelhas with uppercase name", function() |
| 46 | assert.is_true(run.luarocks_bool("build abelhas 1.0")) | 46 | assert.is_true(run.luarocks_bool("build abelhas 1.0")) |
| 47 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | 47 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) |
| 48 | assert.is_true(run.luarocks_bool("remove Abelhas 1.0")) | 48 | assert.is_true(run.luarocks_bool("remove Abelhas 1.0")) |
| 49 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | 49 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas")) |
| 50 | end) | 50 | end) |
| 51 | end) | 51 | end) |
| 52 | 52 | ||
| @@ -56,28 +56,28 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
| 56 | end) | 56 | end) |
| 57 | 57 | ||
| 58 | it("LuaRocks remove fail, break dependencies", function() | 58 | it("LuaRocks remove fail, break dependencies", function() |
| 59 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 59 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 60 | assert.is_true(run.luarocks_bool("build lualogging")) | 60 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 61 | 61 | ||
| 62 | assert.is_false(run.luarocks_bool("remove luasocket")) | 62 | assert.is_false(run.luarocks_bool("remove luasocket")) |
| 63 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 63 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 64 | end) | 64 | end) |
| 65 | 65 | ||
| 66 | it("LuaRocks remove force", function() | 66 | it("LuaRocks remove force", function() |
| 67 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 67 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 68 | assert.is_true(run.luarocks_bool("build lualogging")) | 68 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 69 | 69 | ||
| 70 | local output = run.luarocks("remove --force luasocket") | 70 | local output = run.luarocks("remove --force luasocket") |
| 71 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 71 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 72 | assert.is.truthy(output:find("Checking stability of dependencies")) | 72 | assert.is.truthy(output:find("Checking stability of dependencies")) |
| 73 | end) | 73 | end) |
| 74 | 74 | ||
| 75 | it("LuaRocks remove force fast", function() | 75 | it("LuaRocks remove force fast", function() |
| 76 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 76 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 77 | assert.is_true(run.luarocks_bool("build lualogging")) | 77 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 78 | 78 | ||
| 79 | local output = run.luarocks("remove --force-fast luasocket") | 79 | local output = run.luarocks("remove --force-fast luasocket") |
| 80 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 80 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket")) |
| 81 | assert.is.falsy(output:find("Checking stability of dependencies")) | 81 | assert.is.falsy(output:find("Checking stability of dependencies")) |
| 82 | end) | 82 | end) |
| 83 | end) | 83 | end) |
diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 988d8ef0..25cc51d8 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua | |||
| @@ -55,66 +55,19 @@ describe("Basic tests #blackbox #b_util", function() | |||
| 55 | end) | 55 | end) |
| 56 | 56 | ||
| 57 | it("LuaRocks test site config", function() | 57 | it("LuaRocks test site config", function() |
| 58 | assert.is.truthy(os.rename("src/luarocks/site_config.lua", "src/luarocks/site_config.lua.tmp")) | 58 | local scname = "src/luarocks/core/site_config_"..test_env.lua_version:gsub("%.", "_")..".lua" |
| 59 | assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua")) | 59 | |
| 60 | assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp")) | 60 | assert.is.truthy(os.rename(scname, scname..".tmp")) |
| 61 | assert.is.falsy(lfs.attributes(scname)) | ||
| 62 | assert.is.truthy(lfs.attributes(scname..".tmp")) | ||
| 61 | 63 | ||
| 62 | assert.is.truthy(run.luarocks("")) | 64 | assert.is.truthy(run.luarocks("")) |
| 63 | 65 | ||
| 64 | assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua")) | 66 | assert.is.truthy(os.rename(scname..".tmp", scname)) |
| 65 | assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp")) | 67 | assert.is.falsy(lfs.attributes(scname..".tmp")) |
| 66 | assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) | 68 | assert.is.truthy(lfs.attributes(scname)) |
| 67 | end) | 69 | end) |
| 68 | 70 | ||
| 69 | -- Disable versioned config temporarily, because it always takes | ||
| 70 | -- precedence over config.lua (config-5.x.lua is installed by default on Windows, | ||
| 71 | -- but not on Unix, so on Unix the os.rename commands below will fail silently, but this is harmless) | ||
| 72 | describe("LuaRocks config - more complex tests", function() | ||
| 73 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" | ||
| 74 | local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" | ||
| 75 | local scname = scdir .. "/config.lua" | ||
| 76 | |||
| 77 | local configfile | ||
| 78 | if test_env.TEST_TARGET_OS == "windows" then | ||
| 79 | configfile = versioned_scname | ||
| 80 | else | ||
| 81 | configfile = scname | ||
| 82 | end | ||
| 83 | |||
| 84 | it("LuaRocks fail system config", function() | ||
| 85 | os.rename(versioned_scname, versioned_scname .. "bak") | ||
| 86 | local ok = run.luarocks_bool("config --system-config") | ||
| 87 | os.rename(versioned_scname .. ".bak", versioned_scname) | ||
| 88 | assert.is_false(ok) | ||
| 89 | end) | ||
| 90 | |||
| 91 | it("LuaRocks system config", function() | ||
| 92 | lfs.mkdir(testing_paths.testing_lrprefix) | ||
| 93 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | ||
| 94 | lfs.mkdir(scdir) | ||
| 95 | |||
| 96 | local sysconfig = io.open(configfile, "w+") | ||
| 97 | sysconfig:write(" ") | ||
| 98 | sysconfig:close() | ||
| 99 | |||
| 100 | local output = run.luarocks("config --system-config") | ||
| 101 | os.remove(configfile) | ||
| 102 | assert.are.same(output, configfile) | ||
| 103 | end) | ||
| 104 | |||
| 105 | it("LuaRocks fail system config invalid", function() | ||
| 106 | lfs.mkdir(testing_paths.testing_lrprefix) | ||
| 107 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | ||
| 108 | lfs.mkdir(scdir) | ||
| 109 | |||
| 110 | local sysconfig = io.open(configfile, "w+") | ||
| 111 | sysconfig:write("if if if") | ||
| 112 | sysconfig:close() | ||
| 113 | local ok = run.luarocks_bool("config --system-config") | ||
| 114 | os.remove(configfile) | ||
| 115 | assert.is_false(ok) | ||
| 116 | end) | ||
| 117 | end) | ||
| 118 | end) | 71 | end) |
| 119 | 72 | ||
| 120 | test_env.unload_luarocks() | 73 | test_env.unload_luarocks() |
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 8c005aaa..f22acbb4 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
| @@ -19,12 +19,9 @@ cfg.lua_version = _VERSION:match(" (5%.[123])$") or "5.1" | |||
| 19 | local version_suffix = cfg.lua_version:gsub("%.", "_") | 19 | local version_suffix = cfg.lua_version:gsub("%.", "_") |
| 20 | 20 | ||
| 21 | -- Load site-local global configurations | 21 | -- Load site-local global configurations |
| 22 | local ok, site_config = pcall(require, "luarocks.site_config_"..version_suffix) | 22 | local ok, site_config = pcall(require, "luarocks.core.site_config_"..version_suffix) |
| 23 | if not ok then | 23 | if not ok then |
| 24 | ok, site_config = pcall(require, "luarocks.site_config") | 24 | io.stderr:write("Site-local luarocks/core/site_config_"..version_suffix..".lua file not found. Incomplete installation?\n") |
| 25 | end | ||
| 26 | if not ok then | ||
| 27 | io.stderr:write("Site-local luarocks/site_config.lua file not found. Incomplete installation?\n") | ||
| 28 | site_config = {} | 25 | site_config = {} |
| 29 | end | 26 | end |
| 30 | 27 | ||
| @@ -229,7 +226,6 @@ do | |||
| 229 | sys_config_file_default = sys_config_dir.."/config-"..cfg.lua_version..".lua" | 226 | sys_config_file_default = sys_config_dir.."/config-"..cfg.lua_version..".lua" |
| 230 | sys_config_file = load_config_file({ | 227 | sys_config_file = load_config_file({ |
| 231 | site_config.LUAROCKS_SYSCONFIG or sys_config_file_default, | 228 | site_config.LUAROCKS_SYSCONFIG or sys_config_file_default, |
| 232 | sys_config_dir.."/config.lua", | ||
| 233 | }) | 229 | }) |
| 234 | sys_config_ok = (sys_config_file ~= nil) | 230 | sys_config_ok = (sys_config_file ~= nil) |
| 235 | end | 231 | end |
| @@ -260,7 +256,6 @@ if not site_config.LUAROCKS_FORCE_CONFIG then | |||
| 260 | if not home_config_ok then | 256 | if not home_config_ok then |
| 261 | local list = { | 257 | local list = { |
| 262 | home_config_file_default, | 258 | home_config_file_default, |
| 263 | home_config_dir.."/config.lua", | ||
| 264 | } | 259 | } |
| 265 | home_config_file = load_config_file(list) | 260 | home_config_file = load_config_file(list) |
| 266 | home_config_ok = (home_config_file ~= nil) | 261 | home_config_ok = (home_config_file ~= nil) |
| @@ -337,7 +332,7 @@ local defaults = { | |||
| 337 | 332 | ||
| 338 | lua_modules_path = "/share/lua/"..cfg.lua_version, | 333 | lua_modules_path = "/share/lua/"..cfg.lua_version, |
| 339 | lib_modules_path = "/lib/lua/"..cfg.lua_version, | 334 | lib_modules_path = "/lib/lua/"..cfg.lua_version, |
| 340 | rocks_subdir = site_config.LUAROCKS_ROCKS_SUBDIR or "/lib/luarocks/rocks", | 335 | rocks_subdir = "/lib/luarocks/rocks-"..cfg.lua_version, |
| 341 | 336 | ||
| 342 | arch = "unknown", | 337 | arch = "unknown", |
| 343 | lib_extension = "unknown", | 338 | lib_extension = "unknown", |
diff --git a/test/test_environment.lua b/test/test_environment.lua index 6338da0a..56b394cd 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua | |||
| @@ -12,13 +12,15 @@ REQUIREMENTS | |||
| 12 | USAGE | 12 | USAGE |
| 13 | busted [-Xhelper <arguments>] | 13 | busted [-Xhelper <arguments>] |
| 14 | ARGUMENTS | 14 | ARGUMENTS |
| 15 | env=<type> Set type of environment to use ("minimal" or "full", | 15 | env=<type> Set type of environment to use ("minimal" or "full", |
| 16 | default: "minimal"). | 16 | default: "minimal"). |
| 17 | noreset Don't reset environment after each test | 17 | noreset Don't reset environment after each test |
| 18 | clean Remove existing testing environment. | 18 | clean Remove existing testing environment. |
| 19 | travis Add if running on TravisCI. | 19 | travis Add if running on TravisCI. |
| 20 | appveyor Add if running on Appveyor. | 20 | appveyor Add if running on Appveyor. |
| 21 | os=<type> Set OS ("linux", "osx", or "windows"). | 21 | os=<type> Set OS ("linux", "osx", or "windows"). |
| 22 | lua_dir=<path> Path of Lua installation (default "/usr/local") | ||
| 23 | lua_interpreter=<lua> Name of the interpreter (default "lua") | ||
| 22 | ]] | 24 | ]] |
| 23 | 25 | ||
| 24 | local function help() | 26 | local function help() |
| @@ -128,6 +130,7 @@ local function execute_bool(command, print_command, env_variables) | |||
| 128 | if print_command ~= nil then | 130 | if print_command ~= nil then |
| 129 | redirect_filename = test_env.testing_paths.luarocks_tmp.."/output.txt" | 131 | redirect_filename = test_env.testing_paths.luarocks_tmp.."/output.txt" |
| 130 | redirect = " > "..redirect_filename | 132 | redirect = " > "..redirect_filename |
| 133 | os.remove(redirect_filename) | ||
| 131 | end | 134 | end |
| 132 | local ok = os.execute(command .. redirect) | 135 | local ok = os.execute(command .. redirect) |
| 133 | ok = (ok == true or ok == 0) -- normalize Lua 5.1 output to boolean | 136 | ok = (ok == true or ok == 0) -- normalize Lua 5.1 output to boolean |
| @@ -160,8 +163,10 @@ end | |||
| 160 | function test_env.set_lua_version() | 163 | function test_env.set_lua_version() |
| 161 | if _G.jit then | 164 | if _G.jit then |
| 162 | test_env.LUAJIT_V = _G.jit.version:match("(2%.%d)%.%d") | 165 | test_env.LUAJIT_V = _G.jit.version:match("(2%.%d)%.%d") |
| 166 | test_env.lua_version = "5.1" | ||
| 163 | else | 167 | else |
| 164 | test_env.LUA_V = _VERSION:match("5%.%d") | 168 | test_env.LUA_V = _VERSION:match("5%.%d") |
| 169 | test_env.lua_version = test_env.LUA_V | ||
| 165 | end | 170 | end |
| 166 | end | 171 | end |
| 167 | 172 | ||
| @@ -192,6 +197,10 @@ function test_env.set_args() | |||
| 192 | test_env.MINGW = true | 197 | test_env.MINGW = true |
| 193 | elseif argument == "vs" then | 198 | elseif argument == "vs" then |
| 194 | test_env.MINGW = false | 199 | test_env.MINGW = false |
| 200 | elseif argument:find("^lua_dir=") then | ||
| 201 | test_env.LUA_DIR = argument:match("^lua_dir=(.*)$") | ||
| 202 | elseif argument:find("^lua_interpreter=") then | ||
| 203 | test_env.LUA_INTERPRETER = argument:match("^lua_interpreter=(.*)$") | ||
| 195 | else | 204 | else |
| 196 | help() | 205 | help() |
| 197 | end | 206 | end |
| @@ -338,7 +347,12 @@ local function create_env(testing_paths) | |||
| 338 | local env_variables = {} | 347 | local env_variables = {} |
| 339 | env_variables.LUA_VERSION = luaversion_short | 348 | env_variables.LUA_VERSION = luaversion_short |
| 340 | env_variables.LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua" | 349 | env_variables.LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config.lua" |
| 341 | env_variables.LUA_PATH = testing_paths.testing_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;" | 350 | if test_env.TEST_TARGET_OS == "windows" then |
| 351 | env_variables.LUA_PATH = testing_paths.testing_lrprefix .. "\\lua\\?.lua;" | ||
| 352 | else | ||
| 353 | env_variables.LUA_PATH = testing_paths.testing_lrprefix .. "/share/lua/" .. luaversion_short .. "/?.lua;" | ||
| 354 | end | ||
| 355 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;" | ||
| 342 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;" | 356 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;" |
| 343 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;" | 357 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/" .. luaversion_short .. "/?.lua;" |
| 344 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;" | 358 | env_variables.LUA_PATH = env_variables.LUA_PATH .. testing_paths.testing_sys_tree .. "/share/lua/".. luaversion_short .. "/?/init.lua;" |
| @@ -451,11 +465,10 @@ local function reset_environment(testing_paths, md5sums) | |||
| 451 | end | 465 | end |
| 452 | 466 | ||
| 453 | local function create_paths(luaversion_full) | 467 | local function create_paths(luaversion_full) |
| 454 | local cfg = require("luarocks.core.cfg") | ||
| 455 | 468 | ||
| 456 | local testing_paths = {} | 469 | local testing_paths = {} |
| 457 | testing_paths.luadir = cfg.variables.LUA_BINDIR:gsub("/bin/?$", "") | 470 | testing_paths.luadir = (test_env.LUA_DIR or "/usr/local") |
| 458 | testing_paths.lua = cfg.variables.LUA_BINDIR .. "/" .. cfg.lua_interpreter | 471 | testing_paths.lua = testing_paths.luadir .. "/bin/" .. (test_env.LUA_INTERPRETER or "lua") |
| 459 | 472 | ||
| 460 | if test_env.TEST_TARGET_OS == "windows" then | 473 | if test_env.TEST_TARGET_OS == "windows" then |
| 461 | testing_paths.luarocks_tmp = os.getenv("TEMP") | 474 | testing_paths.luarocks_tmp = os.getenv("TEMP") |
| @@ -479,6 +492,9 @@ local function create_paths(luaversion_full) | |||
| 479 | testing_paths.testing_cache = testing_paths.testing_dir .. "/testing_cache-" .. luaversion_full | 492 | testing_paths.testing_cache = testing_paths.testing_dir .. "/testing_cache-" .. luaversion_full |
| 480 | testing_paths.testing_server = testing_paths.testing_dir .. "/testing_server-" .. luaversion_full | 493 | testing_paths.testing_server = testing_paths.testing_dir .. "/testing_server-" .. luaversion_full |
| 481 | 494 | ||
| 495 | testing_paths.testing_rocks = testing_paths.testing_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version | ||
| 496 | testing_paths.testing_sys_rocks = testing_paths.testing_sys_tree .. "/lib/luarocks/rocks-" .. test_env.lua_version | ||
| 497 | |||
| 482 | if test_env.TEST_TARGET_OS == "windows" then | 498 | if test_env.TEST_TARGET_OS == "windows" then |
| 483 | testing_paths.win_tools = testing_paths.testing_lrprefix .. "/tools" | 499 | testing_paths.win_tools = testing_paths.testing_lrprefix .. "/tools" |
| 484 | end | 500 | end |
| @@ -658,12 +674,12 @@ local function install_luarocks(install_env_vars) | |||
| 658 | if test_env.TEST_TARGET_OS == "windows" then | 674 | if test_env.TEST_TARGET_OS == "windows" then |
| 659 | local compiler_flag = test_env.MINGW and "/MW" or "" | 675 | local compiler_flag = test_env.MINGW and "/MW" or "" |
| 660 | assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " " .. compiler_flag .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) | 676 | assert(execute_bool("install.bat /LUA " .. testing_paths.luadir .. " " .. compiler_flag .. " /P " .. testing_paths.testing_lrprefix .. " /NOREG /NOADMIN /F /Q /CONFIG " .. testing_paths.testing_lrprefix .. "/etc/luarocks", false, install_env_vars)) |
| 661 | assert(execute_bool(testing_paths.win_tools .. "/cp " .. testing_paths.testing_lrprefix .. "/lua/luarocks/site_config* " .. testing_paths.src_dir .. "/luarocks/site_config.lua")) | 677 | assert(execute_bool(testing_paths.win_tools .. "/cp " .. testing_paths.testing_lrprefix .. "/lua/luarocks/core/site_config* " .. testing_paths.src_dir .. "/luarocks/core")) |
| 662 | else | 678 | else |
| 663 | local configure_cmd = "./configure --with-lua=" .. testing_paths.luadir .. " --prefix=" .. testing_paths.testing_lrprefix | 679 | local configure_cmd = "./configure --with-lua=" .. testing_paths.luadir .. " --prefix=" .. testing_paths.testing_lrprefix |
| 664 | assert(execute_bool(configure_cmd, false, install_env_vars)) | 680 | assert(execute_bool(configure_cmd, false, install_env_vars)) |
| 665 | assert(execute_bool("make clean", false, install_env_vars)) | 681 | assert(execute_bool("make clean", false, install_env_vars)) |
| 666 | assert(execute_bool("make src/luarocks/site_config.lua", false, install_env_vars)) | 682 | assert(execute_bool("make src/luarocks/core/site_config_"..test_env.lua_version:gsub("%.", "_")..".lua", false, install_env_vars)) |
| 667 | assert(execute_bool("make dev", false, install_env_vars)) | 683 | assert(execute_bool("make dev", false, install_env_vars)) |
| 668 | end | 684 | end |
| 669 | print("LuaRocks installed correctly!") | 685 | print("LuaRocks installed correctly!") |
