stevedonovan / Lake

A Lua-based Build Tool
MIT License
134 stars 17 forks source link

file.group on *nix #31

Closed moteus closed 11 years ago

moteus commented 11 years ago

lua-AesFileEncrypt On Windows/MinGW build ok. On BuildHive i get

$ LAKE LUA_RUNNER=LUA LUA_INCLUDE_DIR=$LUA_INCLUDE ROOT=$LUA_SHARE/AesFileEncrypt LUADIR=$LUA_LIBS LIBDIR=$LUA_LIBS clean install test
.....
cp: cannot stat `src/fileenc/test*': No such file or directory
......
cp src/fileenc/test* /scratch/jenkins/workspace/moteus/lua-AesFileEncrypt/lua51/share/AesFileEncrypt/test/test*
stevedonovan commented 11 years ago

I've just tried the following little lakefile on LInux:

default{file.group{src='dir/one*',odir='out'}}

where dir contains one.c and oneone.c.

Seems to work fine here:

cp dir/one.c out/one.c
cp dir/oneone.c out/oneone.c

Saying it cannot stat 'src/fileenc/test*' means that it has not expanded that wildcard?

moteus commented 11 years ago

This does not work

install = target('install', {
  file.group{odir=LIBDIR; src = AesFileEncrypt };
  file.group{odir=J(ROOT, 'test'); src = AesFileEncryptTest };
  file.group{odir=J(ROOT, 'test'); src = J('test', '*.*') };
})

This works

install = target('install', {
  file.group{odir=LIBDIR; src = AesFileEncrypt };
  file.group{odir=J(ROOT, 'test'); src = J('test', '*.*') };
})

Problem appear when i add build and install AesFileEncryptTest to lakefile. Now master has worked lakefile. But reference from my post point on non working. lua-AesFileEncrypt has no external deps so you can try build. this command should work

# ROOT/test Where install tests
# LIBDIR    Where install c lib
# LUADIR    Where install lua lib
lake ROOT=$TEMP/AesFileEncrypt LIBDIR=$TEMP/AesFileEncrypt  install
moteus commented 11 years ago

I think i can reproduce this: FS tree has 2 files:

./src/readme
./src/readme.txt

./lakefile

target("install",{
  file.group{odir=path.join('.','dst'); src=path.join('.','src','readme.txt')};
  file.group{odir=path.join('.','dst'); src=path.join('.','src','readme')};
})

default("install")

lake -v

...
target: .\dst\readme*
.\dst\readme*   .\src\readme*   -1      -1
copy .\src\readme* .\dst\readme*
...

Command copy .\src\readme* .\dst\readme* work on windows but may be on *nix it is not correct. Also I think this is bug in lake. file.group{odir=path.join('.','dst'); src=path.join('.','src','readme')}; should copy only one file.

stevedonovan commented 11 years ago

Yes, you are right - there is a bug. On Linux I get

cp ./src/readme*  ./dst/readme*
cp: target './dst/readme.txt' is not a directory

Which happens because Unix shells expand the '*' wildcard before executing.

Lake should not pass a wildcard to this command! Let me have a look!

stevedonovan commented 11 years ago

That should fix the problem - I was using ext='*' to flag that a rule should use any extension, but that '*' got added. So, another if-statement...

moteus commented 11 years ago

Now it works. Thanks.