passenger 4.0.33 → 4.0.34

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (112) hide show
  1. checksums.yaml +15 -0
  2. checksums.yaml.gz.asc +12 -0
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +60 -0
  5. data/bin/passenger-config +1 -1
  6. data/bin/passenger-install-apache2-module +510 -40
  7. data/bin/passenger-install-nginx-module +26 -2
  8. data/build/cxx_tests.rb +1 -1
  9. data/build/documentation.rb +19 -21
  10. data/build/integration_tests.rb +39 -12
  11. data/build/misc.rb +18 -0
  12. data/build/packaging.rb +116 -56
  13. data/build/rpm.rb +20 -11
  14. data/build/ruby_tests.rb +2 -3
  15. data/build/test_basics.rb +9 -0
  16. data/debian.template/passenger.conf +2 -0
  17. data/debian.template/passenger.load +2 -0
  18. data/dev/run_travis.sh +3 -5
  19. data/dev/test_rpm_packaging.sh +28 -0
  20. data/doc/Users guide Apache.idmap.txt +6 -4
  21. data/doc/users_guide_snippets/installation.txt +20 -2
  22. data/doc/users_guide_snippets/tips.txt +1 -1
  23. data/ext/common/ApplicationPool2/Pool.h +1 -1
  24. data/ext/common/Constants.h +5 -1
  25. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
  26. data/ext/common/agents/Watchdog/AgentWatcher.cpp +20 -0
  27. data/ext/common/agents/Watchdog/Main.cpp +10 -0
  28. data/ext/ruby/passenger_native_support.c +23 -11
  29. data/helper-scripts/classic-rails-loader.rb +9 -3
  30. data/helper-scripts/classic-rails-preloader.rb +10 -4
  31. data/helper-scripts/download_binaries/extconf.rb +46 -22
  32. data/helper-scripts/meteor-loader.rb +0 -1
  33. data/helper-scripts/node-loader.js +2 -1
  34. data/helper-scripts/prespawn +7 -1
  35. data/helper-scripts/rack-loader.rb +32 -3
  36. data/helper-scripts/rack-preloader.rb +10 -4
  37. data/lib/phusion_passenger.rb +40 -21
  38. data/lib/phusion_passenger/abstract_installer.rb +7 -4
  39. data/lib/phusion_passenger/analytics_logger.rb +4 -3
  40. data/lib/phusion_passenger/config/about_command.rb +27 -6
  41. data/lib/phusion_passenger/{config.rb → config/main.rb} +3 -2
  42. data/lib/phusion_passenger/config/restart_app_command.rb +1 -1
  43. data/lib/phusion_passenger/config/validate_install_command.rb +231 -0
  44. data/lib/phusion_passenger/constants.rb +2 -0
  45. data/lib/phusion_passenger/loader_shared_helpers.rb +92 -19
  46. data/lib/phusion_passenger/native_support.rb +33 -11
  47. data/lib/phusion_passenger/packaging.rb +1 -0
  48. data/lib/phusion_passenger/platform_info.rb +5 -2
  49. data/lib/phusion_passenger/platform_info/apache.rb +229 -60
  50. data/lib/phusion_passenger/platform_info/apache_detector.rb +26 -31
  51. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +4 -4
  52. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +1 -1
  54. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +1 -1
  55. data/lib/phusion_passenger/platform_info/linux.rb +2 -1
  56. data/lib/phusion_passenger/platform_info/ruby.rb +7 -0
  57. data/lib/phusion_passenger/preloader_shared_helpers.rb +2 -1
  58. data/lib/phusion_passenger/request_handler.rb +2 -1
  59. data/lib/phusion_passenger/request_handler/thread_handler.rb +2 -1
  60. data/lib/phusion_passenger/standalone/runtime_installer.rb +35 -13
  61. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  62. data/lib/phusion_passenger/utils.rb +1 -23
  63. data/lib/phusion_passenger/utils/ansi_colors.rb +7 -1
  64. data/lib/phusion_passenger/utils/download.rb +36 -2
  65. data/lib/phusion_passenger/utils/native_support_utils.rb +65 -0
  66. data/resources/templates/apache2/apache_install_broken.txt.erb +20 -0
  67. data/resources/templates/apache2/config_snippets.txt.erb +2 -4
  68. data/resources/templates/apache2/present_choice_for_no_update_config.txt.erb +5 -0
  69. data/resources/templates/installer_common/cannot_access_files_as_root.txt.erb +15 -0
  70. data/resources/templates/installer_common/run_installer_as_root.txt.erb +6 -3
  71. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +1 -1
  72. data/resources/templates/nginx/other_nginx_installations_exist.txt.erb +17 -0
  73. data/rpm/apache-passenger.conf.in +26 -0
  74. data/rpm/config.json +30 -0
  75. data/rpm/passenger.logrotate +7 -0
  76. data/rpm/passenger.spec.template +456 -0
  77. data/rpm/passenger_dynamic_thread_group.patch +16 -0
  78. data/rpm/passenger_tests_default_config_example.patch +44 -0
  79. data/rpm/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +21 -0
  80. data/rpm/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +45 -0
  81. data/test/config.json.rpm-automation +15 -0
  82. data/test/integration_tests/downloaded_binaries_tests.rb +80 -2
  83. data/test/integration_tests/native_packaging_spec.rb +136 -44
  84. data/test/integration_tests/standalone_tests.rb +2 -11
  85. data/test/ruby/analytics_logger_spec.rb +65 -19
  86. data/test/ruby/utils_spec.rb +2 -0
  87. metadata +532 -548
  88. metadata.gz.asc +7 -7
  89. data/resources/templates/apache2/no_write_permission_to_passenger_root.txt.erb +0 -9
  90. data/rpm/README.rdoc +0 -117
  91. data/rpm/config/apache-passenger.conf.in +0 -19
  92. data/rpm/config/nginx-passenger.conf.in +0 -10
  93. data/rpm/config/rubygem-passenger.te +0 -10
  94. data/rpm/doc/README.nginx-alternatives +0 -5
  95. data/rpm/doc/example_yum_repository_htaccess +0 -5
  96. data/rpm/doc/footer.shtml +0 -12
  97. data/rpm/doc/header.shtml +0 -156
  98. data/rpm/nginx-alternatives.spec +0 -97
  99. data/rpm/passenger-release.spec +0 -91
  100. data/rpm/passenger.spec +0 -667
  101. data/rpm/patches/passenger-force-native.patch +0 -63
  102. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +0 -33
  103. data/rpm/release/build-release.sh +0 -35
  104. data/rpm/release/build.rb +0 -301
  105. data/rpm/release/create-mirrors.sh +0 -16
  106. data/rpm/release/mirrors +0 -1
  107. data/rpm/release/mock-repo/comps.xml +0 -21
  108. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  109. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  110. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  111. data/rpm/release/mocksetup-first.sh +0 -102
  112. data/rpm/release/mocksetup.sh +0 -67
@@ -34,7 +34,12 @@ module App
34
34
  def self.format_exception(e)
35
35
  result = "#{e} (#{e.class})"
36
36
  if !e.backtrace.empty?
37
- result << "\n " << e.backtrace.join("\n ")
37
+ if e.respond_to?(:html?) && e.html?
38
+ require 'erb' if !defined?(ERB)
39
+ result << "\n<pre> " << ERB::Util.h(e.backtrace.join("\n ")) << "</pre>"
40
+ else
41
+ result << "\n " << e.backtrace.join("\n ")
42
+ end
38
43
  end
39
44
  return result
40
45
  end
@@ -69,9 +74,8 @@ module App
69
74
  PhusionPassenger.require_passenger_lib 'preloader_shared_helpers'
70
75
  PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
71
76
  PhusionPassenger.require_passenger_lib 'request_handler'
72
- LoaderSharedHelpers.init
73
- PreloaderSharedHelpers.init
74
- @@options = LoaderSharedHelpers.sanitize_spawn_options(@@options)
77
+ @@options = LoaderSharedHelpers.init(@@options)
78
+ @@options = PreloaderSharedHelpers.init(@@options)
75
79
  Utils.passenger_tmpdir = options["generation_dir"]
76
80
  if defined?(NativeSupport)
77
81
  NativeSupport.disable_stdio_buffering
@@ -79,6 +83,7 @@ module App
79
83
  rescue Exception => e
80
84
  LoaderSharedHelpers.about_to_abort(e) if defined?(LoaderSharedHelpers)
81
85
  puts "!> Error"
86
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
82
87
  puts "!> "
83
88
  puts format_exception(e)
84
89
  exit exit_code_for_exception(e)
@@ -124,6 +129,7 @@ module App
124
129
  rescue Exception => e
125
130
  LoaderSharedHelpers.about_to_abort(e)
126
131
  puts "!> Error"
132
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
127
133
  puts "!> "
128
134
  puts format_exception(e)
129
135
  exit exit_code_for_exception(e)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010-2013 Phusion
3
+ # Copyright (c) 2010-2014 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -53,38 +53,62 @@ if !PhusionPassenger.installed_from_release_package?
53
53
  end
54
54
 
55
55
  # Create download directory and do some preparation
56
- require 'phusion_passenger/platform_info'
57
- require 'phusion_passenger/platform_info/binary_compatibility'
56
+ PhusionPassenger.require_passenger_lib 'platform_info'
57
+ PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
58
58
  cxx_compat_id = PhusionPassenger::PlatformInfo.cxx_binary_compatibility_id
59
59
  ruby_compat_id = PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_id
60
60
 
61
+ ABORT_ON_ERROR = ARGV[0] == "--abort-on-error"
62
+ if url_root = ENV['BINARIES_URL_ROOT']
63
+ SITES = [{ :url => url_root }]
64
+ else
65
+ SITES = PhusionPassenger.binaries_sites
66
+ end
67
+
61
68
  FileUtils.mkdir_p(PhusionPassenger.download_cache_dir)
62
69
  Dir.chdir(PhusionPassenger.download_cache_dir)
63
70
 
64
71
  # Initiate downloads
65
72
  require 'phusion_passenger/utils/download'
66
73
  require 'logger'
67
- def download(name)
68
- if !File.exist?(name)
69
- url = "#{PhusionPassenger::BINARIES_URL_ROOT}/#{PhusionPassenger::VERSION_STRING}/#{name}"
70
- cert = PhusionPassenger.binaries_ca_cert_path
71
- puts "Attempting to download #{url} into #{Dir.pwd}"
72
- File.unlink("#{name}.tmp") rescue nil
73
- logger = Logger.new(STDOUT)
74
- logger.level = Logger::WARN
75
- logger.formatter = proc { |severity, datetime, progname, msg| "*** #{msg}\n" }
76
- result = PhusionPassenger::Utils::Download.download(url, "#{name}.tmp",
77
- :cacert => cert, :logger => logger)
78
- if result
79
- File.rename("#{name}.tmp", name)
80
- else
81
- File.unlink("#{name}.tmp") rescue nil
74
+
75
+ def download(name, options = {})
76
+ if File.exist?(name)
77
+ puts "#{Dir.pwd}/#{name} already exists"
78
+ return true
79
+ end
80
+
81
+ logger = Logger.new(STDOUT)
82
+ logger.level = Logger::WARN
83
+ logger.formatter = proc { |severity, datetime, progname, msg| "*** #{msg}\n" }
84
+
85
+ SITES.each do |site|
86
+ if really_download(site, name, logger, options)
87
+ return true
82
88
  end
89
+ end
90
+ abort "Cannot download #{name}, aborting" if ABORT_ON_ERROR
91
+ return false
92
+ end
93
+
94
+ def really_download(site, name, logger, options)
95
+ url = "#{site[:url]}/#{PhusionPassenger::VERSION_STRING}/#{name}"
96
+ puts "Attempting to download #{url} into #{Dir.pwd}"
97
+ File.unlink("#{name}.tmp") rescue nil
98
+
99
+ options = {
100
+ :cacert => site[:cert],
101
+ :logger => logger
102
+ }.merge(options)
103
+ result = PhusionPassenger::Utils::Download.download(url, "#{name}.tmp", options)
104
+ if result
105
+ File.rename("#{name}.tmp", name)
83
106
  else
84
- puts "#{Dir.pwd}/#{name} already exists"
107
+ File.unlink("#{name}.tmp") rescue nil
85
108
  end
109
+ return result
86
110
  end
87
111
 
88
- download "support-#{cxx_compat_id}.tar.gz"
89
- download "nginx-#{PhusionPassenger::PREFERRED_NGINX_VERSION}-#{cxx_compat_id}.tar.gz"
90
- download "rubyext-#{ruby_compat_id}.tar.gz"
112
+ download "rubyext-#{ruby_compat_id}.tar.gz", :total_timeout => 10
113
+ download "webhelper-#{PhusionPassenger::PREFERRED_NGINX_VERSION}-#{cxx_compat_id}.tar.gz", :total_timeout => 120
114
+ download "support-#{cxx_compat_id}.tar.gz", :total_timeout => 900
@@ -120,7 +120,6 @@ module App
120
120
  end
121
121
  puts "!> Ready"
122
122
  puts "!> socket: main;tcp://127.0.0.1:#{port};http_session;0"
123
- puts "!> pid: #{pid}"
124
123
  puts "!> "
125
124
  begin
126
125
  STDIN.readline
@@ -32,7 +32,8 @@ var LineReader = require('phusion_passenger/line_reader').LineReader;
32
32
  var RequestHandler = require('phusion_passenger/request_handler').RequestHandler;
33
33
  var HttplibEmulation = require('phusion_passenger/httplib_emulation');
34
34
 
35
- GLOBAL.PhusionPassenger = new EventEmitter();
35
+ module.isApplicationLoader = true; // https://groups.google.com/forum/#!topic/compoundjs/4txxkNtROQg
36
+ GLOBAL.PhusionPassenger = exports.PhusionPassenger = new EventEmitter();
36
37
  var stdinReader = new LineReader(process.stdin);
37
38
  beginHandshake();
38
39
  readInitializationHeader();
@@ -27,6 +27,7 @@ STDERR.sync = true
27
27
 
28
28
  require 'uri'
29
29
  require 'socket'
30
+ require 'timeout'
30
31
 
31
32
  class PrespawnLocation
32
33
  class InvalidURLError < RuntimeError
@@ -92,7 +93,12 @@ class PrespawnLocation
92
93
  socket.write("Connection: close\r\n")
93
94
  socket.write("\r\n")
94
95
 
95
- socket.read
96
+ begin
97
+ Timeout.timeout(10) do
98
+ socket.read
99
+ end
100
+ rescue Timeout::Error
101
+ end
96
102
  end
97
103
  end
98
104
 
@@ -1,5 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: binary
3
+ # Phusion Passenger - https://www.phusionpassenger.com/
4
+ # Copyright (c) 2013 Phusion
5
+ #
6
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+
3
26
  module PhusionPassenger
4
27
  module App
5
28
  def self.options
@@ -13,7 +36,12 @@ module App
13
36
  def self.format_exception(e)
14
37
  result = "#{e} (#{e.class})"
15
38
  if !e.backtrace.empty?
16
- result << "\n " << e.backtrace.join("\n ")
39
+ if e.respond_to?(:html?) && e.html?
40
+ require 'erb' if !defined?(ERB)
41
+ result << "\n<pre> " << ERB::Util.h(e.backtrace.join("\n ")) << "</pre>"
42
+ else
43
+ result << "\n " << e.backtrace.join("\n ")
44
+ end
17
45
  end
18
46
  return result
19
47
  end
@@ -48,8 +76,7 @@ module App
48
76
  PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
49
77
  PhusionPassenger.require_passenger_lib 'request_handler'
50
78
  PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
51
- LoaderSharedHelpers.init
52
- @@options = LoaderSharedHelpers.sanitize_spawn_options(@@options)
79
+ @@options = LoaderSharedHelpers.init(@@options)
53
80
  Utils.passenger_tmpdir = options["generation_dir"]
54
81
  if defined?(NativeSupport)
55
82
  NativeSupport.disable_stdio_buffering
@@ -58,6 +85,7 @@ module App
58
85
  rescue Exception => e
59
86
  LoaderSharedHelpers.about_to_abort(e) if defined?(LoaderSharedHelpers)
60
87
  puts "!> Error"
88
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
61
89
  puts "!> "
62
90
  puts format_exception(e)
63
91
  exit exit_code_for_exception(e)
@@ -84,6 +112,7 @@ module App
84
112
  rescue Exception => e
85
113
  LoaderSharedHelpers.about_to_abort(e)
86
114
  puts "!> Error"
115
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
87
116
  puts "!> "
88
117
  puts format_exception(e)
89
118
  exit exit_code_for_exception(e)
@@ -38,7 +38,12 @@ module App
38
38
  def self.format_exception(e)
39
39
  result = "#{e} (#{e.class})"
40
40
  if !e.backtrace.empty?
41
- result << "\n " << e.backtrace.join("\n ")
41
+ if e.respond_to?(:html?) && e.html?
42
+ require 'erb' if !defined?(ERB)
43
+ result << "\n<pre> " << ERB::Util.h(e.backtrace.join("\n ")) << "</pre>"
44
+ else
45
+ result << "\n " << e.backtrace.join("\n ")
46
+ end
42
47
  end
43
48
  return result
44
49
  end
@@ -74,9 +79,8 @@ module App
74
79
  PhusionPassenger.require_passenger_lib 'loader_shared_helpers'
75
80
  PhusionPassenger.require_passenger_lib 'request_handler'
76
81
  PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
77
- LoaderSharedHelpers.init
78
- PreloaderSharedHelpers.init
79
- @@options = LoaderSharedHelpers.sanitize_spawn_options(@@options)
82
+ @@options = LoaderSharedHelpers.init(@@options)
83
+ @@options = PreloaderSharedHelpers.init(@@options)
80
84
  Utils.passenger_tmpdir = options["generation_dir"]
81
85
  if defined?(NativeSupport)
82
86
  NativeSupport.disable_stdio_buffering
@@ -85,6 +89,7 @@ module App
85
89
  rescue Exception => e
86
90
  LoaderSharedHelpers.about_to_abort(e) if defined?(LoaderSharedHelpers)
87
91
  puts "!> Error"
92
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
88
93
  puts "!> "
89
94
  puts format_exception(e)
90
95
  exit exit_code_for_exception(e)
@@ -111,6 +116,7 @@ module App
111
116
  rescue Exception => e
112
117
  LoaderSharedHelpers.about_to_abort(e)
113
118
  puts "!> Error"
119
+ puts "!> html: true" if e.respond_to?(:html?) && e.html?
114
120
  puts "!> "
115
121
  puts format_exception(e)
116
122
  exit exit_code_for_exception(e)
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010-2013 Phusion
3
+ # Copyright (c) 2010-2014 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -30,7 +30,7 @@ module PhusionPassenger
30
30
 
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '4.0.33'
33
+ VERSION_STRING = '4.0.34'
34
34
 
35
35
  PREFERRED_NGINX_VERSION = '1.4.4'
36
36
  NGINX_SHA256_CHECKSUM = '7c989a58e5408c9593da0bebcd0e4ffc3d892d1316ba5042ddb0be5b0b4102b9'
@@ -46,6 +46,8 @@ module PhusionPassenger
46
46
  GLOBAL_NAMESPACE_DIRNAME = "passenger"
47
47
  # Subdirectory under $HOME to use for storing stuff.
48
48
  USER_NAMESPACE_DIRNAME = ".passenger"
49
+ # The name for the /etc/apache2/mods-available/*.{load,conf} file.
50
+ APACHE2_MODULE_CONF_NAME = "passenger"
49
51
 
50
52
  # Directories in which to look for plugins.
51
53
  PLUGIN_DIRS = [
@@ -72,8 +74,23 @@ module PhusionPassenger
72
74
  # Directory in which downloaded Phusion Passenger binaries are stored.
73
75
  # Only available when originally packaged.
74
76
  :download_cache_dir,
77
+ # Directory which contains the main Phusion Passenger Rakefile. Only
78
+ # available when originally packaged,
79
+ :build_system_dir,
75
80
  # Directory in which the build system's output is stored, e.g.
76
- # the compiled agent executables. Only available when originally packaged.
81
+ # the compiled agent executables. Only available when originally
82
+ # packaged.
83
+ :buildout_dir,
84
+ # Directory in which we can run 'rake apache2'. Used by
85
+ # passenger-install-apache2-module. Rake will save the Apache module
86
+ # to `apache2_module_path`.
87
+ :apache2_module_source_dir
88
+ ].freeze
89
+ # The subset of the optional fields which are only available when
90
+ # originally packaged.
91
+ ORIGINALLY_PACKAGED_LOCATIONS_INI_FIELDS = [
92
+ :download_cache_dir,
93
+ :build_system_dir,
77
94
  :buildout_dir
78
95
  ].freeze
79
96
 
@@ -86,21 +103,18 @@ module PhusionPassenger
86
103
  filename = root_or_file
87
104
  options = parse_ini_file(filename)
88
105
 
89
- @natively_packaged = get_bool_option(filename, options, 'natively_packaged')
90
- if natively_packaged?
91
- @native_packaging_method = get_option(filename, options, 'native_packaging_method')
92
- end
106
+ @natively_packaged = get_bool_option(filename, options, 'natively_packaged')
93
107
  REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
94
108
  instance_variable_set("@#{field}", get_option(filename, options, field.to_s).freeze)
95
109
  end
96
110
  OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
97
111
  instance_variable_set("@#{field}", get_option(filename, options, field.to_s, false).freeze)
98
112
  end
99
- if !originally_packaged?
100
- # Since these options are only supposed to be available when
101
- # originally packaged, force them to be nil when natively packaged.
102
- @download_cache_dir = nil
103
- @buildout_dir = nil
113
+ if natively_packaged?
114
+ @native_packaging_method = get_option(filename, options, 'native_packaging_method')
115
+ ORIGINALLY_PACKAGED_LOCATIONS_INI_FIELDS.each do |field|
116
+ instance_variable_set("@#{field}", nil)
117
+ end
104
118
  end
105
119
  else
106
120
  @source_root = File.dirname(File.dirname(FILE_LOCATION))
@@ -112,13 +126,15 @@ module PhusionPassenger
112
126
  @resources_dir = "#{@source_root}/resources".freeze
113
127
  @include_dir = "#{@source_root}/ext".freeze
114
128
  @doc_dir = "#{@source_root}/doc".freeze
115
- @ruby_libdir = File.dirname(FILE_LOCATION)
129
+ @ruby_libdir = File.dirname(FILE_LOCATION).freeze
116
130
  @node_libdir = "#{@source_root}/node_lib".freeze
117
131
  @apache2_module_path = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze
118
- @ruby_extension_source_dir = "#{@source_root}/ext/ruby"
119
- @nginx_module_source_dir = "#{@source_root}/ext/nginx"
120
- @download_cache_dir = "#{@source_root}/download_cache"
121
- @buildout_dir = "#{@source_root}/buildout"
132
+ @ruby_extension_source_dir = "#{@source_root}/ext/ruby".freeze
133
+ @nginx_module_source_dir = "#{@source_root}/ext/nginx".freeze
134
+ @download_cache_dir = "#{@source_root}/download_cache".freeze
135
+ @build_system_dir = @source_root.dup.freeze
136
+ @buildout_dir = "#{@source_root}/buildout".freeze
137
+ @apache2_module_source_dir = @source_root.dup.freeze
122
138
  REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
123
139
  if instance_variable_get("@#{field}").nil?
124
140
  raise "BUG: @#{field} not set"
@@ -138,7 +154,7 @@ module PhusionPassenger
138
154
  end
139
155
 
140
156
  # If Phusion Passenger is natively packaged, returns which packaging
141
- # method was used. Can be 'deb' or 'rpm'.
157
+ # method was used. Can be 'deb', 'rpm' or 'homebrew'.
142
158
  def self.native_packaging_method
143
159
  return @native_packaging_method
144
160
  end
@@ -187,14 +203,17 @@ module PhusionPassenger
187
203
 
188
204
  ###### Other resource locations ######
189
205
 
190
- BINARIES_URL_ROOT = "https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release"
191
206
  INDEX_DOC_NAME = "Users guide.html"
192
207
  APACHE2_DOC_NAME = "Users guide Apache.html"
193
208
  NGINX_DOC_NAME = "Users guide Nginx.html"
194
209
  STANDALONE_DOC_NAME = "Users guide Standalone.html"
195
210
 
196
- def self.binaries_ca_cert_path
197
- return "#{resources_dir}/oss-binaries.phusionpassenger.com.crt"
211
+ def self.binaries_sites
212
+ return [
213
+ { :url => "https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release",
214
+ :cacert => "#{resources_dir}/oss-binaries.phusionpassenger.com.crt" },
215
+ { :url => "https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release" }
216
+ ]
198
217
  end
199
218
 
200
219
 
@@ -105,6 +105,9 @@ protected
105
105
 
106
106
 
107
107
  def before_install
108
+ if STDOUT.respond_to?(:set_encoding)
109
+ STDOUT.set_encoding("UTF-8")
110
+ end
108
111
  STDOUT.write(Utils::AnsiColors::DEFAULT_TERMINAL_COLOR)
109
112
  STDOUT.flush
110
113
  end
@@ -186,9 +189,9 @@ protected
186
189
  end
187
190
 
188
191
  if Process.uid != 0 &&
189
- PhusionPassenger.source_root =~ /^#{Regexp.escape home_dir}\// &&
190
- PhusionPassenger.source_root =~ /^#{Regexp.escape Gem.dir}\// &&
191
- File.stat(PhusionPassenger.source_root).uid == 0
192
+ PhusionPassenger.build_system_dir =~ /^#{Regexp.escape home_dir}\// &&
193
+ PhusionPassenger.build_system_dir =~ /^#{Regexp.escape Gem.dir}\// &&
194
+ File.stat(PhusionPassenger.build_system_dir).uid == 0
192
195
  new_screen
193
196
  render_template 'installer_common/gem_install_permission_problems'
194
197
  return false
@@ -200,7 +203,7 @@ protected
200
203
  def check_directory_accessible_by_web_server
201
204
  return true if PhusionPassenger.natively_packaged?
202
205
  inaccessible_directories = []
203
- list_parent_directories(PhusionPassenger.source_root).each do |path|
206
+ list_parent_directories(PhusionPassenger.build_system_dir).each do |path|
204
207
  if !world_executable?(path)
205
208
  inaccessible_directories << path
206
209
  end
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010-2013 Phusion
2
+ # Copyright (c) 2010-2014 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -23,6 +23,7 @@
23
23
 
24
24
  require 'thread'
25
25
  PhusionPassenger.require_passenger_lib 'utils'
26
+ PhusionPassenger.require_passenger_lib 'utils/native_support_utils'
26
27
  PhusionPassenger.require_passenger_lib 'debug_logging'
27
28
  PhusionPassenger.require_passenger_lib 'message_channel'
28
29
 
@@ -81,12 +82,12 @@ class AnalyticsLogger
81
82
  else
82
83
  extra_info_base64 = nil
83
84
  end
84
- times = NativeSupport.process_times
85
+ times = Utils::NativeSupportUtils.process_times
85
86
  message "BEGIN: #{name} (#{current_timestamp.to_s(36)},#{times.utime.to_s(36)},#{times.stime.to_s(36)}) #{extra_info_base64}"
86
87
  end
87
88
 
88
89
  def end_measure(name, error_encountered = false)
89
- times = NativeSupport.process_times
90
+ times = Utils::NativeSupportUtils.process_times
90
91
  if error_encountered
91
92
  message "FAIL: #{name} (#{current_timestamp.to_s(36)},#{times.utime.to_s(36)},#{times.stime.to_s(36)})"
92
93
  else