lunarmodules / Penlight

A set of pure Lua libraries focusing on input data handling (such as reading configuration files), functional programming (such as map, reduce, placeholder expressions,etc), and OS path management. Much of the functionality is inspired by the Python standard libraries.
https://lunarmodules.github.io/Penlight/
MIT License
1.9k stars 238 forks source link

luarock install fails on windows #56

Closed hrafnkelle closed 8 years ago

hrafnkelle commented 11 years ago

Using a fresh luarocks install on windows 7 x64 luarocks 2.0.12 Doing luarocks install penlight fails with Error: Build error: Failed copying contents of 'lua' directory.

hrafnkelle commented 11 years ago

Seems to fail when running the "builtin" build backend, during copy of the lua directory. Fails on

         ok = fs.copy_contents("lua", luadir)
         if not ok then err = "Failed copying contents of 'lua' directory." end

in builtin.run and that seems to be because cp -a lua.\ "C:\LuaRocks\lib\luarocks\rocks\penlight\1.1.0-1\lua" 2> NUL 1> NUL fails because the rocks\penlight directory does not exsist yet

Tieske commented 11 years ago

same here...

C:\Users\Thijs>luarocks install penlight
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:/progra~1/wget/etc/wgetrc
Installing http://luarocks.org/repositories/rocks/penlight-1.1.0-1.src.rock...
Using http://luarocks.org/repositories/rocks/penlight-1.1.0-1.src.rock... switching to 'build' mode
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:/progra~1/wget/etc/wgetrc

7-Zip 9.10 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-12-22

Processing archive: C:\Users\Thijs\AppData\Local\Temp\luarocks_luarocks-rock-penlight-1.1.0-1-3021\penlight-1.1.0-1.src.rock

Extracting  penlight-1.1.0-1.rockspec
Extracting  penlight-1.1.0-core.zip

Everything is Ok

Files: 2
Size:       114403
Compressed: 113331

7-Zip 9.10 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-12-22

Processing archive: penlight-1.1.0-core.zip

Extracting  penlight-1.1.0\lua
Extracting  penlight-1.1.0\lua\pl
Extracting  penlight-1.1.0\lua\pl\app.lua
Extracting  penlight-1.1.0\lua\pl\array2d.lua
Extracting  penlight-1.1.0\lua\pl\class.lua
Extracting  penlight-1.1.0\lua\pl\comprehension.lua
Extracting  penlight-1.1.0\lua\pl\config.lua
Extracting  penlight-1.1.0\lua\pl\data.lua
Extracting  penlight-1.1.0\lua\pl\Date.lua
Extracting  penlight-1.1.0\lua\pl\dir.lua
Extracting  penlight-1.1.0\lua\pl\file.lua
Extracting  penlight-1.1.0\lua\pl\func.lua
Extracting  penlight-1.1.0\lua\pl\import_into.lua
Extracting  penlight-1.1.0\lua\pl\init.lua
Extracting  penlight-1.1.0\lua\pl\input.lua
Extracting  penlight-1.1.0\lua\pl\lapp.lua
Extracting  penlight-1.1.0\lua\pl\lexer.lua
Extracting  penlight-1.1.0\lua\pl\List.lua
Extracting  penlight-1.1.0\lua\pl\luabalanced.lua
Extracting  penlight-1.1.0\lua\pl\Map.lua
Extracting  penlight-1.1.0\lua\pl\MultiMap.lua
Extracting  penlight-1.1.0\lua\pl\operator.lua
Extracting  penlight-1.1.0\lua\pl\OrderedMap.lua
Extracting  penlight-1.1.0\lua\pl\path.lua
Extracting  penlight-1.1.0\lua\pl\permute.lua
Extracting  penlight-1.1.0\lua\pl\platf
Extracting  penlight-1.1.0\lua\pl\platf\luajava.lua
Extracting  penlight-1.1.0\lua\pl\pretty.lua
Extracting  penlight-1.1.0\lua\pl\seq.lua
Extracting  penlight-1.1.0\lua\pl\Set.lua
Extracting  penlight-1.1.0\lua\pl\sip.lua
Extracting  penlight-1.1.0\lua\pl\strict.lua
Extracting  penlight-1.1.0\lua\pl\stringio.lua
Extracting  penlight-1.1.0\lua\pl\stringx.lua
Extracting  penlight-1.1.0\lua\pl\tablex.lua
Extracting  penlight-1.1.0\lua\pl\template.lua
Extracting  penlight-1.1.0\lua\pl\test.lua
Extracting  penlight-1.1.0\lua\pl\text.lua
Extracting  penlight-1.1.0\lua\pl\utils.lua
Extracting  penlight-1.1.0\lua\pl\xml.lua

Everything is Ok

Folders: 3
Files: 37
Size:       324327
Compressed: 112245

Error: Build error: Failed copying contents of 'lua' directory.

C:\Users\Thijs>
Tieske commented 11 years ago

Workaround

in file LuaRocks\2.0\lua\luarocks\fs\win32\tools.lua find function copy_contents(src, dest) and replace line

   if fs.execute_string(fs.quiet(vars.CP.." -a "..src.."\\*.* "..fs.Q(dest))) then

with this one

   if fs.execute_string(fs.quiet("xcopy "..src.."\\*.* "..fs.Q(dest).." /S/E/Y")) then
Tieske commented 11 years ago

root cause; The rock zipfile contains a file \lua\pl\platf\luajava.lua which is not mentioned in the rockspec. Because this is the only file in the platf subdirectory and it is not mentioned in the rockspec, LuaRocks doesn't create the platf subdirectory in the target location and the following copy command then fails. The workaround uses xcopy which, while copying files, also creates the target directory structure.

stevedonovan commented 11 years ago

Thanks, Thijs. That platf\luajava.lua should go, it's an old experiment. The quick fix is to update the rockspec to include this useless file, but really I should do a repack.

A question: should the plain penlight rockspec also deliver tests and docs? Because if not I'd revert to making a 'core' zipfile so not to waste bandwidth for such a basic dependency.

Tieske commented 11 years ago

dunno, I usually do pack the stuff, but never use it from where LuaRocks puts it (don't even know where that might be)

stevedonovan commented 11 years ago

I think that's the point - there's a little-known luarocks show package command which provides that information, but I'd prefer for the rockspec just to deliver the code. Then people would have to download the tests separately, that's what I was wondering about.

hrafnkelle commented 11 years ago

I see the test as development dependency, not usage dependency.

If you want to do development, you get the original sources from the source code repository.

Docs I'm not sure about. I never read the docs installed locally, prefer to use the same documentation on the web. But they are for the user and some people are not always online....

On Thu, Apr 4, 2013 at 8:04 AM, Steve J Donovan notifications@github.comwrote:

I think that's the point - there's a little-known luarocks show package command which provides that information, but I'd prefer for the rockspec just\ to deliver the code. Then people would have to download the tests separately, that's what I was wondering about.

— Reply to this email directly or view it on GitHubhttps://github.com/stevedonovan/Penlight/issues/56#issuecomment-15884404 .

Tieske commented 11 years ago

well, there recently was some discussion to whether tests should be included and automatically be run to verify the installation went as expected. That does sound useful.

stevedonovan commented 11 years ago

On Thu, Apr 4, 2013 at 11:53 AM, Thijs Schreijer notifications@github.comwrote:

well, there recently was some discussion to whether tests should be included and automatically be run to verify the installation went as expected. That does sound useful

That's a good point. At some stage, tools will come along and use that information. So I should at least update the Penlight rockspec to copy the test directory; maybe the manual (in Markdown) as well.