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
@@ -94,7 +94,7 @@ class Installer < PhusionPassenger::AbstractInstaller
94
94
  check_nginx_module_sources_available || exit(1)
95
95
  check_dependencies || exit(1)
96
96
  if needs_compiling_support_files?
97
- check_whether_we_can_write_to(PhusionPassenger.source_root) || exit(1)
97
+ check_whether_we_can_write_to(PhusionPassenger.build_system_dir) || exit(1)
98
98
  end
99
99
  check_whether_os_is_broken
100
100
  check_whether_system_has_enough_ram
@@ -112,6 +112,7 @@ class Installer < PhusionPassenger::AbstractInstaller
112
112
  exit(1)
113
113
  end
114
114
  nginx_prefix = ask_for_nginx_install_prefix
115
+ check_whether_other_nginx_installations_exist(nginx_prefix)
115
116
  if @extra_configure_flags == "none"
116
117
  extra_nginx_configure_flags = nil
117
118
  else
@@ -120,6 +121,7 @@ class Installer < PhusionPassenger::AbstractInstaller
120
121
  else
121
122
  nginx_source_dir = ask_for_nginx_source_dir
122
123
  nginx_prefix = ask_for_nginx_install_prefix
124
+ check_whether_other_nginx_installations_exist(nginx_prefix)
123
125
  extra_nginx_configure_flags = ask_for_extra_nginx_configure_flags(nginx_prefix)
124
126
  end
125
127
  check_whether_we_can_write_to(nginx_prefix) || exit(1)
@@ -172,6 +174,7 @@ private
172
174
  puts
173
175
  if interactive?
174
176
  puts "Use <space> to select."
177
+ puts "<dgray>If the menu doesn't display correctly, ensure that your terminal supports UTF-8.</dgray>"
175
178
  else
176
179
  puts "Override selection with --languages."
177
180
  end
@@ -216,7 +219,7 @@ private
216
219
  def compile_passenger_support_files
217
220
  new_screen
218
221
  puts "<banner>Compiling Passenger support files...</banner>"
219
- Dir.chdir(PhusionPassenger.source_root) do
222
+ Dir.chdir(PhusionPassenger.build_system_dir) do
220
223
  return sh("#{PlatformInfo.rake_command} nginx:clean nginx RELEASE=yes")
221
224
  end
222
225
  end
@@ -345,6 +348,27 @@ private
345
348
  end
346
349
  end
347
350
 
351
+ def check_whether_other_nginx_installations_exist(nginx_prefix)
352
+ check_for = [
353
+ "/usr/bin/nginx",
354
+ "/usr/sbin/nginx"
355
+ ]
356
+ existing_binary = nil
357
+ check_for.each do |filename|
358
+ if File.exist?(filename)
359
+ existing_binary = filename
360
+ break
361
+ end
362
+ end
363
+ if existing_binary
364
+ new_screen
365
+ render_template 'nginx/other_nginx_installations_exist',
366
+ :existing_binary => existing_binary,
367
+ :prefix => nginx_prefix
368
+ wait
369
+ end
370
+ end
371
+
348
372
  def ask_for_nginx_source_dir
349
373
  new_screen
350
374
  puts "<banner>Where is your Nginx source code located?</banner>"
@@ -234,7 +234,7 @@ task 'test:cxx' => dependencies do
234
234
  end
235
235
  sh "cd test && while #{command}; do echo -------------------------------------------; done"
236
236
  else
237
- sh "cd test && #{command}"
237
+ sh "cd test && exec #{command}"
238
238
  end
239
239
  end
240
240
 
@@ -27,29 +27,25 @@ task :doc => Packaging::ASCII_DOCS
27
27
  Packaging::ASCII_DOCS.each do |target|
28
28
  source = target.sub(/\.html$/, '.txt')
29
29
  file target => [source] + Dir["doc/users_guide_snippets/**/*"] do
30
- if PlatformInfo.find_command('mizuho')
31
- if target =~ /apache/i
32
- type = "apache"
33
- juvia_site_key = "5jpmkyjqlml8rktsfldfpbwth8ig7w9"
34
- elsif target =~ /nginx/i
35
- type = "nginx"
36
- juvia_site_key = "q0ptarhn8o9xanwomq8zkgewbtwffyz"
37
- elsif target =~ /standalone/i
38
- type = "standalone"
39
- juvia_site_key = "amggdy0k65hb4hbjg3dh7pnb9zd8dwy"
40
- else
41
- type = nil
42
- juvia_site_key = nil
43
- end
44
- command = "mizuho '#{source}'"
45
- command << " -a #{type}" if type
46
- if juvia_site_key
47
- command << " -c juvia --juvia-url http://juvia.phusion.nl --juvia-site-key #{juvia_site_key}"
48
- end
49
- sh(command)
30
+ if target =~ /apache/i
31
+ type = "apache"
32
+ juvia_site_key = "5jpmkyjqlml8rktsfldfpbwth8ig7w9"
33
+ elsif target =~ /nginx/i
34
+ type = "nginx"
35
+ juvia_site_key = "q0ptarhn8o9xanwomq8zkgewbtwffyz"
36
+ elsif target =~ /standalone/i
37
+ type = "standalone"
38
+ juvia_site_key = "amggdy0k65hb4hbjg3dh7pnb9zd8dwy"
50
39
  else
51
- sh "echo 'Mizuho required to build docs' > '#{target}'"
40
+ type = nil
41
+ juvia_site_key = nil
52
42
  end
43
+ command = "mizuho '#{source}'"
44
+ command << " -a #{type}" if type
45
+ if juvia_site_key
46
+ command << " -c juvia --juvia-url http://juvia.phusion.nl --juvia-site-key #{juvia_site_key}"
47
+ end
48
+ sh(command)
53
49
  end
54
50
 
55
51
  task :clean do
@@ -85,6 +81,8 @@ def create_markdown_compilation_task(target)
85
81
  end
86
82
  end
87
83
 
84
+ task :doc => target
85
+
88
86
  task :clean do
89
87
  if boolean_option('CLEAN_DOCS', true)
90
88
  sh "rm -f #{target}"
@@ -41,7 +41,7 @@ task 'test:integration:apache2' => dependencies do
41
41
  require 'shellwords'
42
42
  command << " -e #{Shellwords.escape(grep)}"
43
43
  end
44
- sh "cd test && #{command}"
44
+ sh "cd test && exec #{command}"
45
45
  end
46
46
  end
47
47
 
@@ -59,7 +59,7 @@ task 'test:integration:nginx' => dependencies do
59
59
  require 'shellwords'
60
60
  command << " -e #{Shellwords.escape(grep)}"
61
61
  end
62
- sh "cd test && #{command}"
62
+ sh "cd test && exec #{command}"
63
63
  end
64
64
  end
65
65
 
@@ -74,9 +74,7 @@ task 'test:integration:standalone' => dependencies do
74
74
  require 'shellwords'
75
75
  command << " -e #{Shellwords.escape(grep)}"
76
76
  end
77
- Dir.chdir("test") do
78
- ruby command
79
- end
77
+ sh "cd test && exec #{command}"
80
78
  end
81
79
  end
82
80
 
@@ -84,13 +82,42 @@ desc "Run native packaging tests"
84
82
  task 'test:integration:native_packaging' do
85
83
  if PlatformInfo.rspec.nil?
86
84
  abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
87
- else
88
- command = "#{PlatformInfo.rspec} -c -f s integration_tests/native_packaging_spec.rb"
89
- if boolean_option('SUDO')
90
- command = "#{PlatformInfo.ruby_sudo_command} -E #{command}"
85
+ end
86
+ command = "rspec -c -f s integration_tests/native_packaging_spec.rb"
87
+ if boolean_option('SUDO')
88
+ command = "#{PlatformInfo.ruby_sudo_command} -E #{command}"
89
+ end
90
+ if grep = string_option('E')
91
+ require 'shellwords'
92
+ command << " -e #{Shellwords.escape(grep)}"
93
+ end
94
+ case PlatformInfo.os_name
95
+ when "linux"
96
+ if PlatformInfo.linux_distro_tags.include?(:debian)
97
+ command = "env NATIVE_PACKAGING_METHOD=deb " +
98
+ "LOCATIONS_INI=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini " +
99
+ command
100
+ elsif PlatformInfo.linux_distro_tags.include?(:redhat)
101
+ command = "env NATIVE_PACKAGING_METHOD=rpm " +
102
+ "LOCATIONS_INI=/usr/lib/ruby/site_ruby/1.8/phusion_passenger/locations.ini " +
103
+ command
104
+ else
105
+ abort "Unsupported Linux distribution"
91
106
  end
92
- sh "cd test && #{command}"
107
+ when "macosx"
108
+ # The tests put /usr/bin and /usr/sbin first in PATH, causing /usr/bin/ruby to be used.
109
+ # We should run the tests in /usr/bin/ruby too, so that native_support is compiled for
110
+ # the same Ruby.
111
+ prefix = "env NATIVE_PACKAGING_METHOD=homebrew " +
112
+ "LOCATIONS_INI=/usr/local/Cellar/passenger/#{VERSION_STRING}/libexec/lib/phusion_passenger/locations.ini"
113
+ if PlatformInfo.in_rvm?
114
+ prefix << " rvm-exec system /usr/bin/ruby -S"
115
+ end
116
+ command = "#{prefix} #{command}"
117
+ else
118
+ abort "Unsupported operating system"
93
119
  end
120
+ sh "cd test && exec #{command}"
94
121
  end
95
122
 
96
123
  dependencies = [:apache2, NATIVE_SUPPORT_TARGET].compact
@@ -102,11 +129,11 @@ task 'test:restart' => dependencies do
102
129
  i = 1
103
130
  while true do
104
131
  puts "#{color_code_start}Test run #{i} (press Ctrl-C multiple times to abort)#{color_code_end}"
105
- command = "cd test && rspec -c -f s integration_tests/apache2_tests.rb"
132
+ command = "rspec -c -f s integration_tests/apache2_tests.rb"
106
133
  if grep = string_option('E')
107
134
  command << " -e #{Shellwords.escape(grep)}"
108
135
  end
109
- sh(command)
136
+ sh "cd test && exec #{command}"
110
137
  i += 1
111
138
  end
112
139
  end
@@ -145,6 +145,24 @@ task :contributors do
145
145
  puts "Updated CONTRIBUTORS"
146
146
  end
147
147
 
148
+ # Compile the WebHelper binary, used by Homebrew packaging.
149
+ task :webhelper => :nginx do
150
+ require 'tmpdir'
151
+ require 'logger'
152
+ PhusionPassenger.require_passenger_lib 'utils/download'
153
+ Dir.mktmpdir do |path|
154
+ Utils::Download.download("http://nginx.org/download/nginx-#{PREFERRED_NGINX_VERSION}.tar.gz",
155
+ "#{path}/nginx.tar.gz")
156
+ sh "cd '#{path}' && tar xzf nginx.tar.gz"
157
+ sh "cd '#{path}/nginx-#{PREFERRED_NGINX_VERSION}' && " +
158
+ "./configure --prefix=/tmp " +
159
+ "#{STANDALONE_NGINX_CONFIGURE_OPTIONS} " +
160
+ "--add-module='#{Dir.pwd}/ext/nginx' && " +
161
+ "make"
162
+ sh "cp '#{path}/nginx-#{PREFERRED_NGINX_VERSION}/objs/nginx' '#{OUTPUT_DIR}PassengerWebHelper'"
163
+ end
164
+ end
165
+
148
166
  dependencies = [
149
167
  COMMON_LIBRARY.link_objects,
150
168
  LIBBOOST_OXT,
@@ -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
  #
@@ -71,6 +71,34 @@ def word_wrap(text, max = 72)
71
71
  return text
72
72
  end
73
73
 
74
+ def is_open_source?
75
+ return !is_enterprise?
76
+ end
77
+
78
+ def is_enterprise?
79
+ return PACKAGE_NAME =~ /enterprise/
80
+ end
81
+
82
+ def enterprise_git_url
83
+ return "TODO"
84
+ end
85
+
86
+ def git_tag_prefix
87
+ if is_open_source?
88
+ return "release"
89
+ else
90
+ return "enterprise"
91
+ end
92
+ end
93
+
94
+ def git_tag
95
+ return "#{git_tag_prefix}-#{VERSION_STRING}"
96
+ end
97
+
98
+ def homebrew_dir
99
+ return "/tmp/homebrew"
100
+ end
101
+
74
102
 
75
103
  task :clobber => 'package:clean'
76
104
 
@@ -85,13 +113,9 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
85
113
  require 'uri'
86
114
  require 'net/http'
87
115
  require 'net/https'
88
- require 'digest/sha1'
89
116
  basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
90
117
  version = PhusionPassenger::VERSION_STRING
91
- is_enterprise = basename =~ /enterprise/
92
- is_open_source = !is_enterprise
93
118
  is_beta = !!version.split('.')[3]
94
- tag_prefix = is_open_source ? 'release' : 'enterprise'
95
119
 
96
120
  if !`git status --porcelain | grep -Ev '^\\?\\? '`.empty?
97
121
  STDERR.puts "-------------------"
@@ -112,14 +136,20 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
112
136
  abort "*** ERROR: Please 'brew install hub' first"
113
137
  end
114
138
 
115
- tag = "#{tag_prefix}-#{version}"
116
- sh "git tag -s #{tag} -u 0A212A8C -m 'Release #{version}'"
139
+ if boolean_option('HOMEBREW_UPDATE', true)
140
+ puts "Updating Homebrew formula..."
141
+ Rake::Task['package:update_homebrew'].invoke
142
+ else
143
+ puts "HOMEBREW_UPDATE set to false, not updating Homebrew formula."
144
+ end
145
+
146
+ sh "git tag -s #{git_tag} -u 0A212A8C -m 'Release #{version}'"
117
147
 
118
148
  puts "Proceed with pushing tag to remote Git repo and uploading the gem and signatures? [y/n]"
119
149
  if STDIN.readline == "y\n"
120
- sh "git push origin #{tag_prefix}-#{version}"
150
+ sh "git push origin #{git_tag}"
121
151
 
122
- if is_open_source
152
+ if is_open_source?
123
153
  sh "s3cmd -P put #{PKG_DIR}/passenger-#{version}.{gem,tar.gz,gem.asc,tar.gz.asc} s3://phusion-passenger/releases/"
124
154
  sh "gem push #{PKG_DIR}/passenger-#{version}.gem"
125
155
 
@@ -142,47 +172,24 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
142
172
  response.body
143
173
  end
144
174
 
145
- puts "Submitting Homebrew pull request..."
146
- sha1 = File.open("#{PKG_DIR}/passenger-#{version}.tar.gz", "rb") do |f|
147
- Digest::SHA1.hexdigest(f.read)
148
- end
149
- homebrew_dir = "/tmp/homebrew"
150
- sh "rm -rf #{homebrew_dir}"
151
- sh "git clone git@github.com:phusion/homebrew.git #{homebrew_dir}"
152
- sh "cd #{homebrew_dir} && git remote add Homebrew https://github.com/Homebrew/homebrew.git"
153
- sh "cd #{homebrew_dir} && git fetch Homebrew"
154
- sh "cd #{homebrew_dir} && git reset --hard Homebrew/master"
155
- formula = File.read("/tmp/homebrew/Library/Formula/passenger.rb")
156
- formula.gsub!(/passenger-.+?\.tar\.gz/, "passenger-#{version}.tar.gz") ||
157
- abort("Unable to substitute Homebrew formula tarball filename")
158
- formula.gsub!(/sha1 .*/, "sha1 '#{sha1}'") ||
159
- abort("Unable to substitute Homebrew formula SHA-1")
160
- necessary_dirs = ORIG_TARBALL_FILES.call.map{ |filename| filename.split("/").first }.uniq
161
- necessary_dirs -= PhusionPassenger::Packaging::HOMEBREW_EXCLUDE
162
- necessary_dirs += ["buildout"]
163
- necessary_dirs_str = word_wrap(necessary_dirs.inspect).split("\n").join("\n ")
164
- formula.sub!(/necessary_files = .*?\]/m, "necessary_files = Dir#{necessary_dirs_str}") ||
165
- abort("Unable to substitute file whitelist")
166
- File.open("/tmp/homebrew/Library/Formula/passenger.rb", "w") do |f|
167
- f.write(formula)
168
- end
169
- sh "cd #{homebrew_dir} && git commit -a -m 'passenger #{version}'"
170
- sh "cd #{homebrew_dir} && git push -f"
171
- sh "cd #{homebrew_dir} && hub pull-request 'Update passenger to version #{version}' -b Homebrew:master"
172
-
173
175
  puts "Initiating building of Debian packages"
174
176
  Rake::Task['package:initiate_debian_building'].invoke
175
177
 
176
178
  puts "Building OS X binaries..."
177
- sh "cd ../passenger_autobuilder && " +
178
- "git pull && " +
179
- "./autobuild-osx https://github.com/phusion/passenger.git passenger psg_autobuilder_chroot@juvia-helper.phusion.nl --tag=#{tag}"
179
+ Rake::Task['package:build_osx_binaries'].invoke
180
+
181
+ if boolean_option('HOMEBREW_DRY_RUN', false)
182
+ echo "HOMEBREW_DRY_RUN set, not submitting pull request. Please find the repo in /tmp/homebrew."
183
+ else
184
+ echo "Submitting Homebrew pull request..."
185
+ sh "cd #{homebrew_dir} && hub pull-request 'Update passenger to version #{version}' -b Homebrew:master"
186
+ end
187
+
180
188
  puts "--------------"
181
189
  puts "All done."
182
190
  else
183
191
  dir = "/u/apps/passenger_website/shared"
184
192
  subdir = string_option('NAME', version)
185
- git_url = `git config remote.origin.url`.strip
186
193
 
187
194
  sh "scp #{PKG_DIR}/#{basename}.{gem,tar.gz,gem.asc,tar.gz.asc} app@shell.phusion.nl:#{dir}/"
188
195
  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}/\"'"
@@ -202,15 +209,17 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
202
209
  puts "Initiating building of binaries"
203
210
  command = "cd /srv/passenger_autobuilder/app && " +
204
211
  "/tools/silence-unless-failed chpst -l /tmp/passenger_autobuilder.lock " +
205
- "./autobuild-with-pbuilder #{git_url} passenger-enterprise --tag=#{tag}"
212
+ "./autobuild-with-pbuilder #{enterprise_git_url} passenger-enterprise --tag=#{git_tag}"
206
213
  sh "ssh psg_autobuilder_run@juvia-helper.phusion.nl at now <<<'#{command}'"
207
214
 
208
215
  puts "Initiating building of Debian packages"
209
216
  Rake::Task['package:initiate_debian_building'].invoke
210
217
 
211
- sh "cd ../passenger_autobuilder && " +
212
- "git pull && " +
213
- "./autobuild-osx TODO passenger-enterprise psg_autobuilder_chroot@juvia-helper.phusion.nl --tag=#{tag}"
218
+ puts "Building OS X binaries..."
219
+ Rake::Task['package:build_osx_binaries'].invoke
220
+
221
+ puts "--------------"
222
+ puts "All done."
214
223
  end
215
224
  else
216
225
  puts "Did not upload anything."
@@ -252,13 +261,16 @@ task 'package:tarball' => Packaging::PREGENERATED_FILES do
252
261
  if ENV['OFFICIAL_RELEASE']
253
262
  File.open("#{PKG_DIR}/#{basename}/resources/release.txt", "w").close
254
263
  end
255
- sh "cd #{PKG_DIR} && tar -c #{basename} | gzip --best > #{basename}.tar.gz"
264
+ if PlatformInfo.os_name == "macosx"
265
+ sh "cd #{PKG_DIR}/#{basename} && find . -print0 | xargs -0 touch -t '201310270000'"
266
+ else
267
+ sh "cd #{PKG_DIR}/#{basename} && find . -print0 | xargs -0 touch -d '2013-10-27 00:00:00 UTC'"
268
+ end
269
+ sh "cd #{PKG_DIR} && tar -c #{basename} | gzip --no-name --best > #{basename}.tar.gz"
256
270
  sh "rm -rf #{PKG_DIR}/#{basename}"
257
271
  end
258
272
 
259
273
  task 'package:sign' do
260
- require 'phusion_passenger'
261
-
262
274
  if File.exist?(File.expand_path("~/.gnupg/gpg-agent.conf")) || ENV['GPG_AGENT_INFO']
263
275
  puts "It looks like you're using gpg-agent, so skipping automatically password caching."
264
276
  else
@@ -292,27 +304,75 @@ task 'package:sign' do
292
304
  end
293
305
  end
294
306
 
295
- task 'package:initiate_debian_building' do
296
- version = PhusionPassenger::VERSION_STRING
297
- is_enterprise = PhusionPassenger::PACKAGE_NAME =~ /enterprise/
298
- is_open_source = !is_enterprise
307
+ task 'package:update_homebrew' do
308
+ require 'digest/sha1'
309
+ version = VERSION_STRING
310
+ sha1 = File.open("#{PKG_DIR}/passenger-#{version}.tar.gz", "rb") do |f|
311
+ Digest::SHA1.hexdigest(f.read)
312
+ end
313
+ sh "rm -rf #{homebrew_dir}"
314
+ sh "git clone git@github.com:phusion/homebrew.git #{homebrew_dir}"
315
+ sh "cd #{homebrew_dir} && git remote add Homebrew https://github.com/Homebrew/homebrew.git"
316
+ sh "cd #{homebrew_dir} && git fetch Homebrew"
317
+ sh "cd #{homebrew_dir} && git reset --hard Homebrew/master"
318
+ formula = File.read("/tmp/homebrew/Library/Formula/passenger.rb")
319
+ formula.gsub!(/passenger-.+?\.tar\.gz/, "passenger-#{version}.tar.gz") ||
320
+ abort("Unable to substitute Homebrew formula tarball filename")
321
+ formula.gsub!(/sha1 .*/, "sha1 '#{sha1}'") ||
322
+ abort("Unable to substitute Homebrew formula SHA-1")
323
+ necessary_dirs = ORIG_TARBALL_FILES.call.map{ |filename| filename.split("/").first }.uniq
324
+ necessary_dirs -= Packaging::HOMEBREW_EXCLUDE
325
+ necessary_dirs += ["buildout"]
326
+ necessary_dirs_str = word_wrap(necessary_dirs.inspect).split("\n").join("\n ")
327
+ formula.sub!(/necessary_files = .*?\]/m, "necessary_files = Dir#{necessary_dirs_str}") ||
328
+ abort("Unable to substitute file whitelist")
329
+ File.open("/tmp/homebrew/Library/Formula/passenger.rb", "w") do |f|
330
+ f.write(formula)
331
+ end
332
+ sh "cd #{homebrew_dir} && git commit -a -m 'passenger #{version}'"
333
+ sh "cd #{homebrew_dir} && git push -f"
334
+ if boolean_option('HOMEBREW_TEST', true)
335
+ sh "cp /tmp/homebrew/Library/Formula/passenger.rb /usr/local/Library/Formula/passenger.rb"
336
+ if `brew info passenger` !~ /^Not installed$/
337
+ sh "brew uninstall passenger"
338
+ end
339
+ sh "cp #{PKG_DIR}/passenger-#{version}.tar.gz `brew --cache`/"
340
+ sh "brew install passenger"
341
+ Rake::Task['test:integration:native_packaging'].invoke
342
+ end
343
+ end
299
344
 
300
- if is_open_source
345
+ task 'package:initiate_debian_building' do
346
+ version = VERSION_STRING
347
+ if is_open_source?
301
348
  command = "cd /srv/passenger_apt_automation && " +
302
349
  "chpst -l /tmp/passenger_apt_automation.lock " +
303
350
  "/tools/silence-unless-failed " +
304
- "./new_release https://github.com/phusion/passenger.git passenger.repo passenger.apt release-#{version}"
351
+ "./new_release https://github.com/phusion/passenger.git passenger.repo passenger.apt #{git_tag}"
305
352
  else
306
- git_url = `git config remote.origin.url`.strip
307
353
  command = "cd /srv/passenger_apt_automation && " +
308
354
  "chpst -l /tmp/passenger_apt_automation.lock " +
309
355
  "/tools/silence-unless-failed " +
310
- "./new_release #{git_url} passenger-enterprise.repo passenger-enterprise.apt enterprise-#{version}"
356
+ "./new_release #{enterprise_git_url} passenger-enterprise.repo passenger-enterprise.apt #{git_tag}"
311
357
  end
312
358
 
313
359
  sh "ssh psg_apt_automation@juvia-helper.phusion.nl at now <<<'#{command}'"
314
360
  end
315
361
 
362
+ task 'package:build_osx_binaries' do
363
+ if is_open_source?
364
+ sh "cd ../passenger_autobuilder && " +
365
+ "git pull && " +
366
+ "./autobuild-osx https://github.com/phusion/passenger.git passenger " +
367
+ "psg_autobuilder_chroot@juvia-helper.phusion.nl --tag=#{git_tag}"
368
+ else
369
+ sh "cd ../passenger_autobuilder && " +
370
+ "git pull && " +
371
+ "./autobuild-osx #{enterprise_git_url} passenger-enterprise " +
372
+ "psg_autobuilder_chroot@juvia-helper.phusion.nl --tag=#{git_tag}"
373
+ end
374
+ end
375
+
316
376
  desc "Remove gem, tarball and signatures"
317
377
  task 'package:clean' do
318
378
  require 'phusion_passenger'