jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.13k stars 1.07k forks source link

fpm packaging busted with jruby #268

Closed fetep closed 11 years ago

fetep commented 11 years ago
(cd build; fpm -t deb -d jre -a noarch -n cepmon -v 0.5 -s dir -C root opt)
/home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/deb.rb:23 warning: already initialized constant COMPRESSION_TYPES
Errno::EEXIST: File exists - opt/cepmon/cepmon.jar or /tmp/package-dir-staging20120927-1476-wtv0y5/opt/cepmon/cepmon.jar
                               link at org/jruby/RubyFile.java:1608
  link_with_potential_path_argument at (eval):3
                               copy at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/dir.rb:114
                              clone at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/dir.rb:81
                               find at /home/petef/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/find.rb:39
                              catch at org/jruby/RubyKernel.java:1183
                               find at /home/petef/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/find.rb:38
                              clone at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/dir.rb:79
                              input at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/dir.rb:36
                              chdir at org/jruby/RubyDir.java:466
                              input at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/package/dir.rb:32
                            execute at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/command.rb:286
                               each at org/jruby/RubyArray.java:1615
                            execute at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/lib/fpm/command.rb:285
                                run at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/clamp-0.3.1/lib/clamp/command.rb:64
                                run at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/clamp-0.3.1/lib/clamp/command.rb:126
                             (root) at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/gems/fpm-0.4.19/bin/fpm:8
                               load at org/jruby/RubyKernel.java:1058
                             (root) at /home/petef/.rvm/gems/jruby-1.6.7@cepmon/bin/fpm:19

same fpm command works fine with regular 1.8 and 1.9 ruby.

r4um commented 11 years ago

spec/fpm/package/deb_spec.rb doesn't pass with jruby-1.6.8 or jruby-1.7.0. Looks like a problem with errno thrown by File.link as reported to jruby https://github.com/jruby/jruby/issues/409.

Methods in lib/fpm/package/dir.rb depend on errno exceptions to be thrown correctly.

r4um commented 11 years ago

The File.link problems are resolved in 1.7.3. fpm uses the open4 gem which uses fork(), fork() isn't available on jruby. An enhancement to open4 to support jruby or make fpm use a more portable gem/method.

astrostl commented 11 years ago

Created https://github.com/ahoward/open4/issues/21

torrancew commented 11 years ago

Any chance something like spoon could be used to work around this on JRuby? I ran into the same issue when trying to build and package logstash from source with fpm-cookery.

torrancew commented 11 years ago

This commit may fix the issue. Just committed, and currently only tested on JRuby 1.7.3, and even then, only briefly. Have yet to confirm result of specs, etc, and command output is currently not preserved or logged in any way. this seems to show how to attempt to preserve that, but it's a bit beyond my grasp just yet. Once this seems to be remotely sane and usable, I can gladly open a pull.

I'm also open to making this be a condition of the platform, if needed.

jordansissel commented 11 years ago

Yeah we can totally do this with spoon, I'm sure. I dont' want to lose the logging though, so If you don't, I'll take a look at doing dup2 in spawn with FileActions

torrancew commented 11 years ago

@jordansissel spent some time on this last night, but I'm having a hard time using dup2() to duplicate a Ruby filehandle to anything inside of a Spoon::FileActions object, which I presume is related to the JVM virtual filehandles that helped start this whole mess. Any suggestions you could provide for wiring the posix_spawnp()'d process's STDIN and STDOUT into cabin is appreciated.