passenger 5.1.10 → 5.1.11

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 (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +18 -0
  3. data/Rakefile +20 -17
  4. data/bin/passenger-install-apache2-module +14 -11
  5. data/build/agent.rb +45 -18
  6. data/build/apache2.rb +32 -16
  7. data/build/basics.rb +29 -40
  8. data/build/common_library.rb +70 -54
  9. data/build/cxx_tests.rb +34 -43
  10. data/build/integration_tests.rb +10 -10
  11. data/build/misc.rb +6 -6
  12. data/build/node_tests.rb +1 -2
  13. data/build/oxt_tests.rb +7 -5
  14. data/build/packaging.rb +11 -441
  15. data/build/ruby_extension.rb +1 -1
  16. data/build/ruby_tests.rb +1 -2
  17. data/build/support/cplusplus.rb +6 -5
  18. data/build/support/cxx_dependency_map.rb +357 -833
  19. data/build/support/general.rb +23 -1
  20. data/build/test_basics.rb +3 -28
  21. data/dev/ci/tests/rpm/Jenkinsfile +68 -0
  22. data/dev/ci/tests/rpm/run +63 -0
  23. data/dev/ci/tests/source-packaging/run +1 -1
  24. data/dev/ci/tests/source-packaging/setup +1 -1
  25. data/doc/{Packaging.txt.md → Packaging.md} +0 -0
  26. data/resources/templates/apache2/deployment_example.txt.erb +2 -2
  27. data/resources/templates/apache2/multiple_apache_installations_detected.txt.erb +2 -2
  28. data/resources/templates/nginx/deployment_example.txt.erb +1 -1
  29. data/resources/templates/standalone/mass_deployment_default_server.erb +2 -2
  30. data/resources/templates/standalone/server.erb +2 -2
  31. data/src/agent/AgentMain.cpp +0 -4
  32. data/src/agent/Core/CoreMain.cpp +88 -5
  33. data/src/agent/Core/SpawningKit/Spawner.h +2 -1
  34. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1109 -0
  35. data/src/agent/Shared/Fundamentals/AbortHandler.h +63 -0
  36. data/src/agent/Shared/Fundamentals/Implementation.cpp +7 -0
  37. data/src/agent/Shared/Fundamentals/Initialization.cpp +614 -0
  38. data/src/agent/Shared/{Base.h → Fundamentals/Initialization.h} +23 -14
  39. data/src/agent/Shared/Fundamentals/Utils.cpp +127 -0
  40. data/src/agent/Shared/Fundamentals/Utils.h +46 -0
  41. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
  42. data/src/agent/Watchdog/CoreWatcher.cpp +3 -1
  43. data/src/agent/Watchdog/InstanceDirToucher.cpp +90 -53
  44. data/src/agent/Watchdog/WatchdogMain.cpp +13 -29
  45. data/src/apache2_module/Hooks.cpp +4 -1
  46. data/src/cxx_supportlib/ConfigKit/Store.h +32 -5
  47. data/src/cxx_supportlib/Constants.h +1 -2
  48. data/src/cxx_supportlib/Crypto.cpp +2 -1
  49. data/src/cxx_supportlib/Hooks.h +16 -37
  50. data/src/cxx_supportlib/LoggingKit/Context.h +22 -0
  51. data/src/cxx_supportlib/LoggingKit/Forward.h +1 -0
  52. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +106 -22
  53. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +106 -0
  54. data/src/{agent/UstRouter/FileSink.h → cxx_supportlib/ProcessManagement/Ruby.h} +23 -47
  55. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +199 -0
  56. data/src/cxx_supportlib/ProcessManagement/Spawn.h +150 -0
  57. data/src/cxx_supportlib/ProcessManagement/Utils.cpp +459 -0
  58. data/src/cxx_supportlib/ProcessManagement/Utils.h +107 -0
  59. data/src/cxx_supportlib/Utils.cpp +41 -561
  60. data/src/cxx_supportlib/Utils.h +0 -68
  61. data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +187 -0
  62. data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +14 -2
  63. data/src/cxx_supportlib/WatchdogLauncher.h +2 -12
  64. data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +2 -2
  65. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +4 -0
  66. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +16 -1
  67. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +12 -9
  68. data/src/cxx_supportlib/vendor-modified/libev/ev++.h +4 -4
  69. data/src/cxx_supportlib/vendor-modified/libev/ev.h +3 -3
  70. data/src/nginx_module/CacheLocationConfig.c +0 -75
  71. data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +1 -0
  72. data/src/nginx_module/Configuration.c +0 -1
  73. data/src/nginx_module/Configuration.h +0 -1
  74. data/src/nginx_module/ConfigurationCommands.c +1 -1
  75. data/src/nginx_module/ContentHandler.c +0 -1
  76. data/src/nginx_module/ContentHandler.h +0 -1
  77. data/src/nginx_module/CreateLocationConfig.c +0 -5
  78. data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +1 -0
  79. data/src/nginx_module/LocationConfig.h +0 -4
  80. data/src/nginx_module/LocationConfig.h.cxxcodebuilder +2 -1
  81. data/src/nginx_module/MergeLocationConfig.c +0 -12
  82. data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +1 -0
  83. data/src/nginx_module/ngx_http_passenger_module.h +0 -1
  84. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  85. data/src/ruby_supportlib/phusion_passenger/common_library.rb +20 -11
  86. data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
  87. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +0 -1
  88. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +10 -3
  89. data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +3 -1
  90. data/src/ruby_supportlib/phusion_passenger/constants.rb +0 -1
  91. data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
  92. data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +32 -6
  93. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +0 -1
  94. data/src/ruby_supportlib/phusion_passenger/packaging.rb +2 -4
  95. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +101 -20
  96. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +21 -9
  97. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +34 -31
  98. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +3 -1
  99. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +2 -14
  100. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +40 -3
  101. data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +15 -14
  102. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
  103. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
  104. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +8 -3
  105. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +19 -18
  106. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +6 -1
  107. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +17 -1
  108. metadata +19 -97
  109. data/build/documentation.rb +0 -70
  110. data/doc/CloudLicensingConfiguration.html +0 -172
  111. data/doc/CloudLicensingConfiguration.txt.md +0 -3
  112. data/doc/Packaging.html +0 -488
  113. data/doc/Security of user switching support.idmap.txt +0 -34
  114. data/doc/Security of user switching support.txt +0 -197
  115. data/doc/ServerOptimizationGuide.html +0 -172
  116. data/doc/ServerOptimizationGuide.txt.md +0 -3
  117. data/doc/images/by_sa.png +0 -0
  118. data/doc/images/cloud_licensing_batch_job.png +0 -0
  119. data/doc/images/code_walkthrough.jpg +0 -0
  120. data/doc/images/direct_spawning.png +0 -0
  121. data/doc/images/direct_spawning.svg +0 -251
  122. data/doc/images/glyphicons-halflings-white.png +0 -0
  123. data/doc/images/glyphicons-halflings.png +0 -0
  124. data/doc/images/icons/README +0 -5
  125. data/doc/images/icons/callouts/1.png +0 -0
  126. data/doc/images/icons/callouts/10.png +0 -0
  127. data/doc/images/icons/callouts/11.png +0 -0
  128. data/doc/images/icons/callouts/12.png +0 -0
  129. data/doc/images/icons/callouts/13.png +0 -0
  130. data/doc/images/icons/callouts/14.png +0 -0
  131. data/doc/images/icons/callouts/15.png +0 -0
  132. data/doc/images/icons/callouts/2.png +0 -0
  133. data/doc/images/icons/callouts/3.png +0 -0
  134. data/doc/images/icons/callouts/4.png +0 -0
  135. data/doc/images/icons/callouts/5.png +0 -0
  136. data/doc/images/icons/callouts/6.png +0 -0
  137. data/doc/images/icons/callouts/7.png +0 -0
  138. data/doc/images/icons/callouts/8.png +0 -0
  139. data/doc/images/icons/callouts/9.png +0 -0
  140. data/doc/images/icons/caution.png +0 -0
  141. data/doc/images/icons/example.png +0 -0
  142. data/doc/images/icons/home.png +0 -0
  143. data/doc/images/icons/important.png +0 -0
  144. data/doc/images/icons/next.png +0 -0
  145. data/doc/images/icons/note.png +0 -0
  146. data/doc/images/icons/prev.png +0 -0
  147. data/doc/images/icons/tip.png +0 -0
  148. data/doc/images/icons/up.png +0 -0
  149. data/doc/images/icons/warning.png +0 -0
  150. data/doc/images/many_web_framework_protocols.png +0 -0
  151. data/doc/images/passenger_architecture.png +0 -0
  152. data/doc/images/passenger_architecture.svg +0 -385
  153. data/doc/images/passenger_architecture_overview.png +0 -0
  154. data/doc/images/passenger_core_architecture.png +0 -0
  155. data/doc/images/passenger_nodejs_architecture.svg +0 -558
  156. data/doc/images/phusion_banner.png +0 -0
  157. data/doc/images/rack.png +0 -0
  158. data/doc/images/smart_spawning.png +0 -0
  159. data/doc/images/smart_spawning.svg +0 -323
  160. data/doc/images/spawn_server_architecture.png +0 -0
  161. data/doc/images/spawn_server_architecture.svg +0 -655
  162. data/doc/images/spawning_preparation_work.png +0 -0
  163. data/doc/images/startup_sequence.png +0 -0
  164. data/doc/images/typical_isolated_web_application.png +0 -0
  165. data/doc/images/typical_isolated_web_application.svg +0 -213
  166. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +0 -1
  167. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +0 -61
  168. data/doc/users_guide_snippets/appendix_a_about.txt +0 -13
  169. data/doc/users_guide_snippets/appendix_b_terminology.txt +0 -71
  170. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +0 -36
  171. data/doc/users_guide_snippets/deployment_basics.txt +0 -37
  172. data/doc/users_guide_snippets/enterprise_only.txt +0 -1
  173. data/doc/users_guide_snippets/environment_variables.txt +0 -44
  174. data/doc/users_guide_snippets/global_queueing_explained.txt +0 -74
  175. data/doc/users_guide_snippets/installation.txt +0 -228
  176. data/doc/users_guide_snippets/installation/run_installer.txt +0 -58
  177. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +0 -6
  178. data/doc/users_guide_snippets/passenger_spawn_method.txt +0 -37
  179. data/doc/users_guide_snippets/rackup_specifications.txt +0 -1
  180. data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -44
  181. data/doc/users_guide_snippets/since_version.txt +0 -1
  182. data/doc/users_guide_snippets/support_information.txt +0 -8
  183. data/doc/users_guide_snippets/tips.txt +0 -302
  184. data/doc/users_guide_snippets/troubleshooting/default.txt +0 -48
  185. data/doc/users_guide_snippets/troubleshooting/rails.txt +0 -59
  186. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +0 -24
  187. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +0 -10
  188. data/doc/users_guide_snippets/where_to_get_support.txt +0 -9
  189. data/src/agent/Shared/Base.cpp +0 -1678
  190. data/src/agent/UstRouter/ApiServer.h +0 -292
  191. data/src/agent/UstRouter/Client.h +0 -112
  192. data/src/agent/UstRouter/Controller.h +0 -1309
  193. data/src/agent/UstRouter/LogSink.h +0 -145
  194. data/src/agent/UstRouter/OptionParser.h +0 -180
  195. data/src/agent/UstRouter/RemoteSender.h +0 -853
  196. data/src/agent/UstRouter/RemoteSink.h +0 -145
  197. data/src/agent/UstRouter/Transaction.h +0 -278
  198. data/src/agent/UstRouter/UstRouterMain.cpp +0 -681
  199. data/src/agent/Watchdog/UstRouterWatcher.cpp +0 -80
  200. data/src/ruby_supportlib/phusion_passenger/platform_info/macos.rb +0 -45
@@ -22,10 +22,7 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- ORIG_TARBALL_FILES = lambda { PhusionPassenger::Packaging.files }
26
-
27
25
  def recursive_copy_files(files, destination_dir, preprocess = false, variables = {})
28
- require 'fileutils' if !defined?(FileUtils)
29
26
  if !STDOUT.tty?
30
27
  puts "Copying files..."
31
28
  end
@@ -54,64 +51,6 @@ def recursive_copy_files(files, destination_dir, preprocess = false, variables =
54
51
  end
55
52
  end
56
53
 
57
- def word_wrap(text, max = 72)
58
- while index = (lines = text.split("\n")).find_index{ |line| line.size > max }
59
- line = lines[index]
60
- pos = max
61
- while pos >= 0 && line[pos..pos] != " "
62
- pos -= 1
63
- end
64
- if pos < 0
65
- raise "Cannot wrap line: #{line}"
66
- else
67
- lines[index] = line[0 .. pos - 1]
68
- lines.insert(index + 1, line[pos + 1 .. -1])
69
- text = lines.join("\n")
70
- end
71
- end
72
- return text
73
- end
74
-
75
- def is_open_source?
76
- return !is_enterprise?
77
- end
78
-
79
- def is_enterprise?
80
- return PACKAGE_NAME =~ /enterprise/
81
- end
82
-
83
- def enterprise_git_url
84
- return "TODO"
85
- end
86
-
87
- def git_tag_prefix
88
- if is_open_source?
89
- return "release"
90
- else
91
- return "enterprise"
92
- end
93
- end
94
-
95
- def git_tag
96
- return "#{git_tag_prefix}-#{VERSION_STRING}"
97
- end
98
-
99
- def apt_repo_name
100
- if is_open_source?
101
- "passenger"
102
- else
103
- "passenger-enterprise"
104
- end
105
- end
106
-
107
- def homebrew_dir
108
- return "/tmp/homebrew"
109
- end
110
-
111
- def homebrew_tap_dir
112
- return "/tmp/homebrew_tap"
113
- end
114
-
115
54
  task :clobber => 'package:clean'
116
55
 
117
56
  task 'package:set_official' do
@@ -123,140 +62,7 @@ task 'package:set_official' do
123
62
  ENV.delete('USE_CCACHE')
124
63
  end
125
64
 
126
- desc "Build, sign & upload gem & tarball"
127
- task 'package:release' => ['package:set_official', 'package:gem', 'package:tarball', 'package:sign'] do
128
- PhusionPassenger.require_passenger_lib 'platform_info'
129
- require 'yaml'
130
- require 'uri'
131
- require 'net/http'
132
- require 'net/https'
133
- basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
134
- version = PhusionPassenger::VERSION_STRING
135
- is_beta = !!version.split('.')[3]
136
-
137
- if !`git status --porcelain | grep -Ev '^\\?\\? '`.empty?
138
- STDERR.puts "-------------------"
139
- abort "*** ERROR: There are uncommitted files. See 'git status'"
140
- end
141
-
142
- begin
143
- website_config = YAML.load_file(File.expand_path("~/.passenger_website.yml"))
144
- rescue Errno::ENOENT
145
- STDERR.puts "-------------------"
146
- abort "*** ERROR: Please put the Phusion Passenger website admin " +
147
- "password in ~/.passenger_website.yml:\n" +
148
- "admin_password: ..."
149
- end
150
-
151
- if !PhusionPassenger::PlatformInfo.find_command("hub")
152
- STDERR.puts "-------------------"
153
- abort "*** ERROR: Please 'brew install hub' first"
154
- end
155
-
156
- if is_open_source?
157
- if boolean_option('HOMEBREW_UPDATE', true) && !is_beta
158
- puts "Updating Homebrew formula..."
159
- Rake::Task['package:update_homebrew'].invoke
160
- else
161
- puts "HOMEBREW_UPDATE set to false, not updating Homebrew formula."
162
- end
163
- end
164
-
165
- sh "git tag -s #{git_tag} -u 0A212A8C -m 'Release #{version}'"
166
-
167
- puts "Proceed with pushing tag to remote Git repo and uploading the gem and signatures? [y/n]"
168
- if STDIN.readline == "y\n"
169
- sh "git push origin #{git_tag}"
170
-
171
- if is_open_source?
172
- sh "s3cmd -P put #{PKG_DIR}/passenger-#{version}.{gem,tar.gz,gem.asc,tar.gz.asc} s3://phusion-passenger/releases/"
173
- sh "gem push #{PKG_DIR}/passenger-#{version}.gem"
174
-
175
- puts "Updating version number on website..."
176
- if is_beta
177
- uri = URI.parse("https://www.phusionpassenger.com/latest_beta_version")
178
- else
179
- uri = URI.parse("https://www.phusionpassenger.com/latest_stable_version")
180
- end
181
- http = Net::HTTP.new(uri.host, uri.port)
182
- http.use_ssl = true
183
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
184
- request = Net::HTTP::Post.new(uri.request_uri)
185
- request.basic_auth("admin", website_config["admin_password"])
186
- request.set_form_data("version" => version)
187
- response = http.request(request)
188
- if response.code != 200 && response.body != "ok"
189
- abort "*** ERROR: Cannot update version number on www.phusionpassenger.com:\n" +
190
- "Status: #{response.code}\n\n" +
191
- response.body
192
- end
193
-
194
- puts "Initiating building of binaries"
195
- Rake::Task['package:initiate_binaries_building'].invoke
196
-
197
- if !is_beta
198
- puts "Initiating building of Debian packages"
199
- Rake::Task['package:initiate_debian_building'].invoke
200
- puts "Initiating building of RPM packages"
201
- Rake::Task['package:initiate_rpm_building'].invoke
202
- end
203
-
204
- puts "Building OS X binaries..."
205
- Rake::Task['package:build_osx_binaries'].invoke
206
-
207
- if !is_beta && boolean_option('HOMEBREW_UPDATE', true)
208
- if boolean_option('HOMEBREW_DRY_RUN', false)
209
- puts "HOMEBREW_DRY_RUN set, not submitting pull request. Please find the repo in /tmp/homebrew."
210
- else
211
- puts "Submitting Homebrew pull request..."
212
- sh "cd #{homebrew_dir} && hub pull-request -m 'passenger #{version}' -b Homebrew:master"
213
- end
214
- end
215
-
216
- puts "--------------"
217
- puts "All done."
218
- else
219
- dir = "/u/apps/passenger_website/shared"
220
- subdir = string_option('NAME', version)
221
-
222
- sh "scp #{PKG_DIR}/#{basename}.{gem,tar.gz,gem.asc,tar.gz.asc} app@shell.phusion.nl:#{dir}/"
223
- sh "ssh app@shell.phusion.nl 'mkdir -p \"#{dir}/assets/#{subdir}\" && mv #{dir}/#{basename}.{gem,tar.gz,gem.asc,tar.gz.asc} \"#{dir}/assets/#{subdir}/\"'"
224
- command = "curl -F file=@#{PKG_DIR}/#{basename}.gem --user admin:'#{website_config['admin_password']}' " +
225
- "--output /dev/stderr --write-out '%{http_code}' --silent " +
226
- "https://www.phusionpassenger.com/enterprise_gems/upload"
227
- puts command
228
- result = `#{command}`
229
- if result != "200"
230
- abort "Gem upload failed. HTTP status code: #{result.inspect}"
231
- else
232
- # The response body does not contain a newline,
233
- # so fix terminal output.
234
- puts
235
- end
236
-
237
- puts "Initiating building of binaries"
238
- Rake::Task['package:initiate_binaries_building'].invoke
239
-
240
- if !is_beta
241
- puts "Initiating building of Debian packages"
242
- Rake::Task['package:initiate_debian_building'].invoke
243
- puts "Initiating building of RPM packages"
244
- Rake::Task['package:initiate_rpm_building'].invoke
245
- end
246
-
247
- puts "Building OS X binaries..."
248
- Rake::Task['package:build_osx_binaries'].invoke
249
-
250
- puts "--------------"
251
- puts "All done."
252
- end
253
- else
254
- puts "Did not upload anything."
255
- end
256
- end
257
-
258
- task 'package:gem' => Packaging::PREGENERATED_FILES do
259
- require 'phusion_passenger'
65
+ task 'package:gem' => PhusionPassenger::Packaging::PREGENERATED_FILES do
260
66
  if ENV['OFFICIAL_RELEASE']
261
67
  release_file = "#{PhusionPassenger.resources_dir}/release.txt"
262
68
  File.unlink(release_file) rescue nil
@@ -275,14 +81,11 @@ task 'package:gem' => Packaging::PREGENERATED_FILES do
275
81
  sh "mv #{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}.gem #{PKG_DIR}/"
276
82
  end
277
83
 
278
- task 'package:tarball' => Packaging::PREGENERATED_FILES do
279
- require 'phusion_passenger'
280
- require 'fileutils'
281
-
84
+ task 'package:tarball' => PhusionPassenger::Packaging::PREGENERATED_FILES do
282
85
  basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
283
86
  sh "rm -rf #{PKG_DIR}/#{basename}"
284
87
  sh "mkdir -p #{PKG_DIR}/#{basename}"
285
- recursive_copy_files(ORIG_TARBALL_FILES.call, "#{PKG_DIR}/#{basename}")
88
+ recursive_copy_files(PhusionPassenger::Packaging.files, "#{PKG_DIR}/#{basename}")
286
89
  if ENV['OFFICIAL_RELEASE']
287
90
  File.open("#{PKG_DIR}/#{basename}/resources/release.txt", "w").close
288
91
  end
@@ -295,241 +98,10 @@ task 'package:tarball' => Packaging::PREGENERATED_FILES do
295
98
  sh "rm -rf #{PKG_DIR}/#{basename}"
296
99
  end
297
100
 
298
- task 'package:sign' do
299
- if File.exist?(File.expand_path("~/.gnupg/gpg-agent.conf")) || ENV['GPG_AGENT_INFO']
300
- puts "It looks like you're using gpg-agent, so skipping automatically password caching."
301
- else
302
- begin
303
- require 'highline'
304
- rescue LoadError
305
- abort "Please run `gem install highline` first."
306
- end
307
- h = HighLine.new
308
- password = h.ask("Password for software-signing@phusion.nl GPG key: ") { |q| q.echo = false }
309
- passphrase_opt = "--passphrase-file .gpg-password"
310
- end
311
-
312
- begin
313
- if password
314
- File.open(".gpg-password", "w", 0600) do |f|
315
- f.write(password)
316
- end
317
- end
318
- version = PhusionPassenger::VERSION_STRING
319
- ["passenger-#{version}.gem",
320
- "passenger-#{version}.tar.gz",
321
- "passenger-enterprise-server-#{version}.gem",
322
- "passenger-enterprise-server-#{version}.tar.gz"].each do |name|
323
- if File.exist?("pkg/#{name}")
324
- sh "gpg --sign --detach-sign #{passphrase_opt} --local-user software-signing@phusion.nl --armor pkg/#{name}"
325
- end
326
- end
327
- ensure
328
- File.unlink('.gpg-password') if File.exist?('.gpg-password')
329
- end
330
- end
331
-
332
- task 'package:update_homebrew' do
333
- require 'digest/sha2'
334
- version = VERSION_STRING
335
- sha256 = File.open("#{PKG_DIR}/passenger-#{version}.tar.gz", "rb") do |f|
336
- Digest::SHA256.hexdigest(f.read)
337
- end
338
- if !File.exist?(homebrew_dir)
339
- sh "git clone git@github.com:phusion/homebrew-core.git #{homebrew_dir}"
340
- sh "cd #{homebrew_dir} && git remote add Homebrew https://github.com/Homebrew/homebrew-core.git"
341
- end
342
- sh "cd #{homebrew_dir} && git fetch Homebrew"
343
- sh "cd #{homebrew_dir} && git reset --hard Homebrew/master"
344
- formula = File.read("/tmp/homebrew/Formula/passenger.rb")
345
- formula.gsub!(/passenger-.+?\.tar\.gz/, "passenger-#{version}.tar.gz") ||
346
- abort("Unable to substitute Homebrew formula tarball filename")
347
- formula.gsub!(/^ sha256 .*/, " sha256 \"#{sha256}\"") ||
348
- abort("Unable to substitute Homebrew formula SHA-256")
349
- necessary_dirs = ORIG_TARBALL_FILES.call.map{ |filename| filename.split("/").first }.uniq
350
- necessary_dirs -= Packaging::HOMEBREW_EXCLUDE
351
- necessary_dirs += ["buildout"]
352
- necessary_dirs_str = word_wrap(necessary_dirs.inspect).split("\n").join("\n ")
353
- formula.sub!(/necessary_files = .*?\]/m, "necessary_files = Dir#{necessary_dirs_str}") ||
354
- abort("Unable to substitute file whitelist")
355
- File.open("/tmp/homebrew/Formula/passenger.rb", "w") do |f|
356
- f.write(formula)
357
- end
358
- sh "cd #{homebrew_dir} && git commit -a -m 'passenger #{version}'"
359
- sh "cd #{homebrew_dir} && git push -f"
360
- if boolean_option('HOMEBREW_TEST', true)
361
- sh "cp #{homebrew_dir}/Formula/passenger.rb $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/passenger.rb"
362
- if `brew info nginx` !~ /^Not installed$/
363
- sh "brew uninstall nginx"
364
- end
365
- if `brew info nginx-passenger-enterprise` !~ /^Not installed$/
366
- sh "brew uninstall nginx-passenger-enterprise"
367
- end
368
- if `brew info passenger` !~ /^Not installed$/
369
- sh "brew uninstall passenger"
370
- end
371
- if `brew info passenger-enterprise` !~ /^Not installed$/
372
- sh "brew uninstall passenger-enterprise"
373
- end
374
- sh "cp #{PKG_DIR}/passenger-#{version}.tar.gz `brew --cache`/"
375
- sh "brew install passenger"
376
- sh "brew install nginx --with-passenger"
377
- Rake::Task['test:integration:native_packaging'].invoke
378
- end
379
- end
380
-
381
- task 'package:initiate_binaries_building' do
382
- require 'yaml'
383
- require 'uri'
384
- require 'net/http'
385
- require 'net/https'
386
- begin
387
- website_config = YAML.load_file(File.expand_path("~/.passenger_website.yml"))
388
- rescue Errno::ENOENT
389
- STDERR.puts "-------------------"
390
- abort "*** ERROR: Please put the Phusion Passenger website admin " +
391
- "password in ~/.passenger_website.yml:\n" +
392
- "admin_password: ..."
393
- end
394
- if is_open_source?
395
- type = "open%20source"
396
- jenkins_token = website_config["jenkins_token"]
397
- if !jenkins_token
398
- abort "*** ERROR: Please put the Passenger open source Jenkins " +
399
- "authentication token in ~/.passenger_website.yml, under " +
400
- "the 'jenkins_token' key."
401
- end
402
- else
403
- type = "Enterprise"
404
- jenkins_token = website_config["jenkins_enterprise_token"]
405
- if !jenkins_token
406
- abort "*** ERROR: Please put the Passenger Enterprise Jenkins " +
407
- "authentication token in ~/.passenger_website.yml, under " +
408
- "the 'jenkins_enterprise_token' key."
409
- end
410
- end
411
-
412
- uri = URI.parse("https://oss-jenkins.phusion.nl/buildByToken/buildWithParameters?" +
413
- "job=Passenger%20#{type}%20binaries%20(release)&ref=#{git_tag}&testing=false")
414
- http = Net::HTTP.new(uri.host, uri.port)
415
- http.use_ssl = true
416
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
417
- request = Net::HTTP::Post.new(uri.request_uri)
418
- request.set_form_data("token" => jenkins_token)
419
- response = http.request(request)
420
- if response.code != '201'
421
- abort "*** ERROR: Cannot initiate building of binaries:\n" +
422
- "Status: #{response.code}\n\n" +
423
- response.body
424
- end
425
- puts "Initiated building of binaries."
426
- end
427
-
428
- task 'package:initiate_debian_building' do
429
- require 'yaml'
430
- require 'uri'
431
- require 'net/http'
432
- require 'net/https'
433
- begin
434
- website_config = YAML.load_file(File.expand_path("~/.passenger_website.yml"))
435
- rescue Errno::ENOENT
436
- STDERR.puts "-------------------"
437
- abort "*** ERROR: Please put the Phusion Passenger website admin " +
438
- "password in ~/.passenger_website.yml:\n" +
439
- "admin_password: ..."
440
- end
441
- if is_open_source?
442
- type = "open%20source"
443
- jenkins_token = website_config["jenkins_token"]
444
- if !jenkins_token
445
- abort "*** ERROR: Please put the Passenger open source Jenkins " +
446
- "authentication token in ~/.passenger_website.yml, under " +
447
- "the 'jenkins_token' key."
448
- end
449
- else
450
- type = "Enterprise"
451
- jenkins_token = website_config["jenkins_enterprise_token"]
452
- if !jenkins_token
453
- abort "*** ERROR: Please put the Passenger Enterprise Jenkins " +
454
- "authentication token in ~/.passenger_website.yml, under " +
455
- "the 'jenkins_enterprise_token' key."
456
- end
457
- end
458
-
459
- uri = URI.parse("https://oss-jenkins.phusion.nl/buildByToken/buildWithParameters?" +
460
- "job=Passenger%20#{type}%20Debian%20packages%20(release)&ref=#{git_tag}&repo=#{apt_repo_name}")
461
- http = Net::HTTP.new(uri.host, uri.port)
462
- http.use_ssl = true
463
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
464
- request = Net::HTTP::Post.new(uri.request_uri)
465
- request.set_form_data("token" => jenkins_token)
466
- response = http.request(request)
467
- if response.code != '201'
468
- abort "*** ERROR: Cannot initiate building of Debian packages:\n" +
469
- "Status: #{response.code}\n\n" +
470
- response.body
471
- end
472
- puts "Initiated building of Debian packages."
473
- end
474
-
475
- task 'package:initiate_rpm_building' do
476
- require 'yaml'
477
- require 'uri'
478
- require 'net/http'
479
- require 'net/https'
480
- begin
481
- website_config = YAML.load_file(File.expand_path("~/.passenger_website.yml"))
482
- rescue Errno::ENOENT
483
- STDERR.puts "-------------------"
484
- abort "*** ERROR: Please put the Phusion Passenger website admin " +
485
- "password in ~/.passenger_website.yml:\n" +
486
- "admin_password: ..."
487
- end
488
- if is_open_source?
489
- type = "open%20source"
490
- jenkins_token = website_config["jenkins_token"]
491
- if !jenkins_token
492
- abort "*** ERROR: Please put the Passenger open source Jenkins " +
493
- "authentication token in ~/.passenger_website.yml, under " +
494
- "the 'jenkins_token' key."
495
- end
496
- else
497
- type = "Enterprise"
498
- jenkins_token = website_config["jenkins_enterprise_token"]
499
- if !jenkins_token
500
- abort "*** ERROR: Please put the Passenger Enterprise Jenkins " +
501
- "authentication token in ~/.passenger_website.yml, under " +
502
- "the 'jenkins_enterprise_token' key."
503
- end
504
- end
505
-
506
- uri = URI.parse("https://oss-jenkins.phusion.nl/buildByToken/buildWithParameters?" +
507
- "job=Passenger%20#{type}%20RPM%20packages%20(release)&ref=#{git_tag}&repo=#{apt_repo_name}")
508
- http = Net::HTTP.new(uri.host, uri.port)
509
- http.use_ssl = true
510
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
511
- request = Net::HTTP::Post.new(uri.request_uri)
512
- request.set_form_data("token" => jenkins_token)
513
- response = http.request(request)
514
- if response.code != '201'
515
- abort "*** ERROR: Cannot initiate building of RPM packages:\n" +
516
- "Status: #{response.code}\n\n" +
517
- response.body
518
- end
519
- puts "Initiated building of RPM packages."
520
- end
521
-
522
- task 'package:build_osx_binaries' do
523
- sh "env ENTERPRISE=#{!!is_enterprise?} TESTING=false " \
524
- "PASSENGER_ROOT=#{Shellwords.shellescape Dir.pwd} " \
525
- "./packaging/binaries/integration/publish/macos.sh"
526
- end
527
-
528
- desc "Remove gem, tarball and signatures"
101
+ desc "Remove gem and tarball"
529
102
  task 'package:clean' do
530
- require 'phusion_passenger'
531
103
  basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
532
- sh "rm -f pkg/#{basename}.{gem,gem.asc,tar.gz,tar.gz.asc}"
104
+ sh "rm -f #{PKG_DIR}/#{basename}.{gem,gem.asc,tar.gz,tar.gz.asc}"
533
105
  end
534
106
 
535
107
  def change_shebang(filename, value)
@@ -545,7 +117,6 @@ end
545
117
  desc "Create a fakeroot, useful for building native packages"
546
118
  task :fakeroot => [:apache2, :nginx, 'nginx:as_dynamic_module', :doc] do
547
119
  require 'rbconfig'
548
- require 'fileutils'
549
120
  include RbConfig
550
121
 
551
122
  fs_prefix = ENV['FS_PREFIX'] || "/usr"
@@ -575,7 +146,7 @@ task :fakeroot => [:apache2, :nginx, 'nginx:as_dynamic_module', :doc] do
575
146
  psg_ruby = ENV['RUBY'] || "#{fs_bindir}/ruby"
576
147
  psg_free_ruby = ENV['FREE_RUBY'] || "/usr/bin/env ruby"
577
148
 
578
- fakeroot = "pkg/fakeroot"
149
+ fakeroot = "#{PKG_DIR}/fakeroot"
579
150
  fake_rubylibdir = "#{fakeroot}#{psg_rubylibdir}"
580
151
  fake_nodelibdir = "#{fakeroot}#{psg_nodelibdir}"
581
152
  fake_libdir = "#{fakeroot}#{psg_libdir}"
@@ -616,7 +187,7 @@ task :fakeroot => [:apache2, :nginx, 'nginx:as_dynamic_module', :doc] do
616
187
  sh "mkdir -p #{fake_native_support_dir}"
617
188
  native_support_archdir = PlatformInfo.ruby_extension_binary_compatibility_id
618
189
  sh "mkdir -p #{fake_native_support_dir}"
619
- sh "cp -R buildout/ruby/#{native_support_archdir}/*.#{LIBEXT} #{fake_native_support_dir}/"
190
+ sh "cp -R buildout/ruby/#{native_support_archdir}/*.#{libext} #{fake_native_support_dir}/"
620
191
 
621
192
  # Support binaries
622
193
  sh "mkdir -p #{fake_support_binaries_dir}"
@@ -664,14 +235,13 @@ task :fakeroot => [:apache2, :nginx, 'nginx:as_dynamic_module', :doc] do
664
235
 
665
236
  # Documentation
666
237
  sh "mkdir -p #{fake_docdir}"
667
- sh "cp doc/*.html #{fake_docdir}/"
668
238
  sh "cp -R doc/images #{fake_docdir}/"
669
239
 
670
240
  # User binaries
671
241
  sh "mkdir -p #{fake_bindir}"
672
- Packaging::USER_EXECUTABLES.each do |exe|
242
+ PhusionPassenger::Packaging::USER_EXECUTABLES.each do |exe|
673
243
  sh "cp bin/#{exe} #{fake_bindir}/"
674
- if Packaging::EXECUTABLES_WITH_FREE_RUBY.include?(exe)
244
+ if PhusionPassenger::Packaging::EXECUTABLES_WITH_FREE_RUBY.include?(exe)
675
245
  shebang = psg_free_ruby
676
246
  else
677
247
  shebang = psg_ruby
@@ -681,9 +251,9 @@ task :fakeroot => [:apache2, :nginx, 'nginx:as_dynamic_module', :doc] do
681
251
 
682
252
  # Superuser binaries
683
253
  sh "mkdir -p #{fake_sbindir}"
684
- Packaging::SUPER_USER_EXECUTABLES.each do |exe|
254
+ PhusionPassenger::Packaging::SUPER_USER_EXECUTABLES.each do |exe|
685
255
  sh "cp bin/#{exe} #{fake_sbindir}/"
686
- if Packaging::EXECUTABLES_WITH_FREE_RUBY.include?(exe)
256
+ if PhusionPassenger::Packaging::EXECUTABLES_WITH_FREE_RUBY.include?(exe)
687
257
  shebang = psg_free_ruby
688
258
  else
689
259
  shebang = psg_ruby