sprinkle-tool / sprinkle

Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
https://github.com/sprinkle-tool/sprinkle
MIT License
1.15k stars 138 forks source link

Incorrect output with custom `configure_command` for source installer #134

Closed skateinmars closed 11 years ago

skateinmars commented 11 years ago

The new option configure_command for the source install does not output a correct bash command:

package :nginx_vanilla do
  description 'Nginx HTTP Server'
  version '1.4.1'

  requires :stuff

  source "http://nginx.org/download/nginx-#{version}.tar.gz" do
    prefix '/usr/local/nginx'
    configure_command './configure --with-http_ssl_module --with-http_gzip_static_module'
  end

  verify do
    #...
  end
end

This will output the following command for the install sequence:

nginx_vanilla install sequence: mkdir -p /usr/local/nginx; mkdir -p /usr/local/build; mkdir -p /usr/local/sources; wget -cq -O '/usr/local/sources/nginx-1.4.1.tar.gz' http://nginx.org/download/nginx-1.4.1.tar.gz; bash -c 'cd /usr/local/build && tar xzf /usr/local/sources/nginx-1.4.1.tar.gz'; bash -c 'cd /usr/local/build/nginx-1.4.1 && ["./configure --with-http_ssl_module --with-http_gzip_static_module"] --prefix=/usr/local/nginx > nginx_vanilla-configure.log 2>&1'; bash -c 'cd /usr/local/build/nginx-1.4.1 && make > nginx_vanilla-build.log 2>&1'; bash -c 'cd /usr/local/build/nginx-1.4.1 && make install > nginx_vanilla-install.log 2>&1' for roles: app

This step will fail with error code 32512.

I haven't taken much time to dig into the source and provide a PR but the following workaround works:

installer = source "http://nginx.org/download/nginx-#{version}.tar.gz" do
  prefix '/usr/local/nginx'
  configure_command './configure --with-http_ssl_module --with-http_gzip_static_module'
end
def installer.configure_command
  super.first
end
joshgoebel commented 11 years ago

./configure is the default, there is no need to override it. Use with instead.

source "http://nginx.org/download/nginx-#{version}.tar.gz" do
    prefix '/usr/local/nginx'
    with :http_ssl_module
end

Etc.

joshgoebel commented 11 years ago

Although technically what you're doing should work. Give master a test. I just pushed a fix. (although it's the wrong way to do it)

skateinmars commented 11 years ago

You're right, I missed the doc for configure options. The bug did apply to build_command and install_command though.

Anyway, your fix works perfectly. Thanks!