rake-compiler / rake-compiler-dock

Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.
MIT License
77 stars 30 forks source link

Failure needs to be idempotent #1

Closed tduehr closed 5 years ago

tduehr commented 9 years ago

While debugging OSX support, I can into several situations where the build was expecting a working directory I wasn't currently using:

CDPATH="${ZSH_VERSION+.}:" && cd /src/ext/ffi_c/libffi && /bin/bash /src/ext/ffi_c/libffi/missing --run autoconf
/usr/local/rvm/scripts/extras/bash_zsh_support/chpwd/function.sh: line 5: cd: /src/ext/ffi_c/libffi: No such file or directory
 cd /src/ext/ffi_c/libffi && /bin/bash /src/ext/ffi_c/libffi/missing --run automake-1.11 --foreign Makefile
/usr/local/rvm/scripts/extras/bash_zsh_support/chpwd/function.sh: line 5: cd: /src/ext/ffi_c/libffi: No such file or directory
make[1]: *** [/src/ext/ffi_c/libffi/configure] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [/src/ext/ffi_c/libffi/Makefile.in] Error 1
make[1]: Leaving directory `/Users/eroot/repos/ffi/build/i386-mingw32/ffi_c/1.8.7/libffi-i386-mingw32'
make: *** ["/Users/eroot/repos/ffi/build/i386-mingw32/ffi_c/1.8.7/libffi-i386-mingw32"/.libs/libffi_convenience.a] Error 2
rake aborted!
Command failed with status (2): [nice make -j`nproc`...]
/usr/local/rvm/gems/ruby-2.2.2/gems/rake-compiler-0.9.5/lib/rake/extensiontask.rb:155:in `block (2 levels) in define_compile_tasks'
/usr/local/rvm/gems/ruby-2.2.2/gems/rake-compiler-0.9.5/lib/rake/extensiontask.rb:154:in `block in define_compile_tasks'
Tasks: TOP => native => native:i386-mingw32 => native:ffi:i386-mingw32 => build/i386-mingw32/stage/lib/1.8/ffi_c.so => copy:ffi_c:i386-mingw32:1.8.7 => build/i386-mingw32/ffi_c/1.8.7/ffi_c.so
(See full trace by running task with --trace)

I also noticed the build leaving a bunch of junk (bin/ and .bundle) in the source directory.

The build process needs to detect failures and clean up. A separate working directory should be used as well.

larskanis commented 9 years ago

rake-compiler-dock itself should be idempotent. It does not do any changes to the build directory and all changes to the image/container are local to the running session only. So IMHO this is an issue of the given project which uses rake-compiler-dock or possibly an issue of rake-compiler.

I also noticed the build leaving a bunch of junk (bin/ and .bundle) in the source directory.

This is interesting and it is not intended. Could it be, that it was a result of the wrong UID before your change in commit https://github.com/larskanis/rake-compiler-dock/commit/641d47963 ?

tduehr commented 9 years ago

I was able to narrow this down some more. This particular error occurs when you change working directories in the docker call after creating the container. I think I may have found a way to clear out this config from the machine but I forget currently. I'll play with it some to narrow that down again.

sodabrew commented 9 years ago

Also happening for me, the .bundle/config was modified in my working directory after the docker run completed. Confusion ensued as I tried to figure out why Bundler was telling me my development gems were no longer installed :confused: I am on OS X 10.10.4.

larskanis commented 5 years ago

I'm going to close this issue, since I think there is no better way to connect rake-compiler-dock to the target project other than mapping the whole project directory into the container. Rake-compiler-dock doesn't do any filesystem modifications, but bundler and project's rake tasks do. So I think it's their responsibility to clean things up before or after the build as necessary.