passenger 4.0.5 → 4.0.6

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 (162) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.travis.yml +1 -2
  3. data/CONTRIBUTING.md +20 -5
  4. data/CONTRIBUTORS +67 -0
  5. data/LICENSE +1 -1
  6. data/NEWS +48 -0
  7. data/Rakefile +2 -2
  8. data/bin/passenger-config +18 -0
  9. data/bin/passenger-install-apache2-module +2 -0
  10. data/bin/passenger-install-nginx-module +11 -12
  11. data/bin/passenger-memory-stats +2 -0
  12. data/bin/passenger-status +152 -69
  13. data/build/agents.rb +1 -5
  14. data/build/basics.rb +26 -13
  15. data/build/cplusplus_support.rb +9 -0
  16. data/build/debian.rb +129 -0
  17. data/build/documentation.rb +6 -2
  18. data/build/integration_tests.rb +13 -2
  19. data/build/misc.rb +16 -0
  20. data/build/packaging.rb +67 -51
  21. data/build/preprocessor.rb +314 -0
  22. data/build/test_basics.rb +1 -0
  23. data/{debian → debian.template}/README.Debian +0 -0
  24. data/{debian → debian.template}/changelog +131 -0
  25. data/debian.template/compat +1 -0
  26. data/debian.template/control +71 -0
  27. data/debian.template/copyright +385 -0
  28. data/debian.template/libapache2-mod-passenger.install +3 -0
  29. data/{debian → debian.template}/libapache2-mod-passenger.postinst +0 -0
  30. data/{debian → debian.template}/libapache2-mod-passenger.prerm +0 -0
  31. data/debian.template/locations.ini +12 -0
  32. data/debian.template/passenger.conf +4 -0
  33. data/{debian → debian.template}/passenger.load +0 -0
  34. data/debian.template/patches/series +0 -0
  35. data/debian.template/repack.sh +42 -0
  36. data/debian.template/ruby-passenger-dev.install +3 -0
  37. data/debian.template/ruby-passenger-doc.install +2 -0
  38. data/debian.template/ruby-passenger.docs +4 -0
  39. data/debian.template/ruby-passenger.install +11 -0
  40. data/debian.template/ruby-passenger.manpages +4 -0
  41. data/debian.template/rules.template +35 -0
  42. data/debian.template/source/format +1 -0
  43. data/debian.template/watch +3 -0
  44. data/dev/run_travis.sh +46 -46
  45. data/doc/Architectural overview.html +2 -2
  46. data/doc/Packaging.html +27 -18
  47. data/doc/Packaging.txt.md +27 -18
  48. data/doc/Security of user switching support.html +2 -2
  49. data/doc/Users guide Apache.html +881 -95
  50. data/doc/Users guide Apache.idmap.txt +48 -6
  51. data/doc/Users guide Apache.txt +13 -1
  52. data/doc/Users guide Nginx.html +1063 -190
  53. data/doc/Users guide Nginx.idmap.txt +89 -45
  54. data/doc/Users guide Nginx.txt +45 -0
  55. data/doc/Users guide Standalone.html +7 -7
  56. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +1 -0
  57. data/doc/users_guide_snippets/environment_variables.txt +221 -0
  58. data/doc/users_guide_snippets/installation.txt +66 -17
  59. data/doc/users_guide_snippets/support_information.txt +3 -3
  60. data/doc/users_guide_snippets/tips.txt +352 -40
  61. data/ext/common/Account.h +4 -3
  62. data/ext/common/AccountsDatabase.h +6 -6
  63. data/ext/common/AgentsStarter.h +1 -13
  64. data/ext/common/ApplicationPool2/DirectSpawner.h +4 -4
  65. data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
  66. data/ext/common/ApplicationPool2/Group.h +9 -4
  67. data/ext/common/ApplicationPool2/Implementation.cpp +6 -1
  68. data/ext/common/ApplicationPool2/Options.h +65 -37
  69. data/ext/common/ApplicationPool2/Pool.h +91 -41
  70. data/ext/common/ApplicationPool2/Process.h +6 -6
  71. data/ext/common/ApplicationPool2/SmartSpawner.h +14 -14
  72. data/ext/common/ApplicationPool2/Socket.h +1 -1
  73. data/ext/common/ApplicationPool2/Spawner.h +24 -16
  74. data/ext/common/ApplicationPool2/SpawnerFactory.h +9 -1
  75. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  76. data/ext/common/Constants.h +1 -1
  77. data/ext/common/Logging.cpp +12 -7
  78. data/ext/common/MessageServer.h +7 -12
  79. data/ext/common/MultiLibeio.cpp +5 -5
  80. data/ext/common/ResourceLocator.h +2 -6
  81. data/ext/common/ServerInstanceDir.h +37 -10
  82. data/ext/common/UnionStation.h +10 -10
  83. data/ext/common/Utils.cpp +30 -4
  84. data/ext/common/Utils.h +7 -0
  85. data/ext/common/Utils/BlockingQueue.h +2 -2
  86. data/ext/common/Utils/Lock.h +2 -2
  87. data/ext/common/Utils/MessagePassing.h +2 -2
  88. data/ext/common/Utils/Timer.h +4 -4
  89. data/ext/common/agents/HelperAgent/AgentOptions.h +2 -0
  90. data/ext/common/agents/HelperAgent/Main.cpp +57 -16
  91. data/ext/common/agents/HelperAgent/RequestHandler.h +4 -1
  92. data/ext/common/agents/LoggingAgent/AdminController.h +91 -0
  93. data/ext/common/agents/LoggingAgent/LoggingServer.h +46 -29
  94. data/ext/common/agents/LoggingAgent/Main.cpp +43 -16
  95. data/ext/common/agents/LoggingAgent/RemoteSender.h +7 -7
  96. data/ext/common/agents/Watchdog/AgentWatcher.cpp +11 -11
  97. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +3 -1
  98. data/ext/common/agents/Watchdog/Main.cpp +62 -0
  99. data/ext/libeio/config.guess +206 -167
  100. data/ext/libeio/config.sub +142 -68
  101. data/ext/libev/config.guess +304 -290
  102. data/ext/libev/config.sub +198 -77
  103. data/ext/nginx/config +4 -0
  104. data/ext/nginx/ngx_http_passenger_module.c +1 -0
  105. data/ext/oxt/implementation.cpp +4 -4
  106. data/lib/phusion_passenger.rb +14 -5
  107. data/lib/phusion_passenger/abstract_installer.rb +41 -0
  108. data/lib/phusion_passenger/admin_tools/server_instance.rb +48 -39
  109. data/lib/phusion_passenger/message_client.rb +31 -7
  110. data/lib/phusion_passenger/native_support.rb +35 -12
  111. data/lib/phusion_passenger/packaging.rb +16 -2
  112. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +6 -31
  113. data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +3 -1
  115. data/lib/phusion_passenger/request_handler.rb +1 -1
  116. data/lib/phusion_passenger/standalone/command.rb +6 -6
  117. data/lib/phusion_passenger/standalone/main.rb +23 -8
  118. data/lib/phusion_passenger/standalone/package_runtime_command.rb +9 -5
  119. data/lib/phusion_passenger/standalone/runtime_installer.rb +9 -10
  120. data/lib/phusion_passenger/standalone/start_command.rb +20 -4
  121. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +19 -0
  122. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +22 -0
  123. data/resources/templates/standalone/config.erb +3 -2
  124. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +4 -4
  125. data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -1
  126. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +7 -7
  127. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +9 -9
  128. data/test/cxx/EventedBufferedInputTest.cpp +17 -17
  129. data/test/cxx/RequestHandlerTest.cpp +5 -5
  130. data/test/cxx/ServerInstanceDirTest.cpp +3 -1
  131. data/test/cxx/TestSupport.h +4 -4
  132. data/test/cxx/UnionStationTest.cpp +3 -1
  133. data/test/cxx/UtilsTest.cpp +2 -0
  134. data/test/integration_tests/apache2_tests.rb +2 -2
  135. data/test/integration_tests/native_packaging_spec.rb +170 -0
  136. data/test/ruby/spec_helper.rb +0 -1
  137. data/test/stub/apache2/httpd.conf.erb +1 -1
  138. data/test/stub/nginx/nginx.conf.erb +1 -0
  139. data/test/support/apache2_controller.rb +1 -1
  140. data/test/support/placebo-preloader.rb +1 -1
  141. data/test/support/test_helper.rb +5 -2
  142. metadata +32 -26
  143. metadata.gz.asc +7 -7
  144. data/debian/compat +0 -1
  145. data/debian/control +0 -49
  146. data/debian/copyright +0 -20
  147. data/debian/libapache2-mod-passenger.install +0 -1
  148. data/debian/passenger-common.install +0 -4
  149. data/debian/passenger.conf +0 -4
  150. data/debian/prerm +0 -2
  151. data/debian/rules +0 -37
  152. data/debian/watch +0 -3
  153. data/dev/googlecode_upload.py +0 -265
  154. data/ext/common/agents/HelperAgent/BacktracesServer.h +0 -60
  155. data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +0 -8
  156. data/test/stub/rails3.1/app/assets/javascripts/application.js +0 -9
  157. data/test/stub/rails3.2/app/assets/javascripts/application.js +0 -15
  158. data/test/stub/rails_apps/2.3/mycook/public/javascripts/application.js +0 -2
  159. data/test/stub/rails_apps/2.3/mycook/public/javascripts/controls.js +0 -963
  160. data/test/stub/rails_apps/2.3/mycook/public/javascripts/dragdrop.js +0 -973
  161. data/test/stub/rails_apps/2.3/mycook/public/javascripts/effects.js +0 -1128
  162. data/test/stub/rails_apps/2.3/mycook/public/javascripts/prototype.js +0 -4320
@@ -60,7 +60,6 @@ dependencies = [
60
60
  'ext/common/agents/HelperAgent/RequestHandler.h',
61
61
  'ext/common/agents/HelperAgent/RequestHandler.cpp',
62
62
  'ext/common/agents/HelperAgent/ScgiRequestParser.h',
63
- 'ext/common/agents/HelperAgent/BacktracesServer.h',
64
63
  'ext/common/Constants.h',
65
64
  'ext/common/StaticString.h',
66
65
  'ext/common/Account.h',
@@ -177,8 +176,5 @@ file AGENT_OUTPUT_DIR + 'EnvPrinter' => 'ext/common/agents/EnvPrinter.c' do
177
176
  end
178
177
 
179
178
  task 'common:clean' do
180
- ['PassengerWatchdog', 'PassengerHelperAgent', 'PassengerLoggingAgent', 'SpawnPreparer', 'EnvPrinter'].each do |agent|
181
- sh "rm -rf #{AGENT_OUTPUT_DIR}#{agent} #{AGENT_OUTPUT_DIR}#{agent}.o #{AGENT_OUTPUT_DIR}#{agent}.dSYM"
182
- end
183
- sh "rm -rf agents"
179
+ sh "rm -rf #{AGENT_OUTPUT_DIR}"
184
180
  end
@@ -23,6 +23,7 @@
23
23
 
24
24
  require 'rubygems'
25
25
  require 'pathname'
26
+ require 'fileutils'
26
27
  require 'phusion_passenger'
27
28
  PhusionPassenger.locate_directories
28
29
  require 'phusion_passenger/packaging'
@@ -82,12 +83,20 @@ def boolean_option(name, default_value = false)
82
83
  end
83
84
  end
84
85
 
86
+ def maybe_wrap_in_ccache(command)
87
+ if boolean_option('USE_CCACHE', false)
88
+ return "ccache #{command}"
89
+ else
90
+ return command
91
+ end
92
+ end
93
+
85
94
  #################################################
86
95
 
87
96
  if string_option('OUTPUT_DIR')
88
97
  OUTPUT_DIR = string_option('OUTPUT_DIR') + "/"
89
98
  else
90
- OUTPUT_DIR = ""
99
+ OUTPUT_DIR = "buildout/"
91
100
  end
92
101
 
93
102
  verbose true if !boolean_option('REALLY_QUIET')
@@ -102,18 +111,21 @@ if boolean_option('STDERR_TO_STDOUT')
102
111
  end
103
112
 
104
113
  if boolean_option('CACHING', true) && !boolean_option('RELEASE')
105
- if OUTPUT_DIR.empty?
106
- PlatformInfo.cache_dir = File.expand_path("cache", File.dirname(__FILE__))
107
- else
108
- PlatformInfo.cache_dir = OUTPUT_DIR + "cache"
109
- end
114
+ PlatformInfo.cache_dir = OUTPUT_DIR + "cache"
115
+ FileUtils.mkdir_p(PlatformInfo.cache_dir)
110
116
  end
111
117
 
112
118
  #################################################
113
119
 
120
+ PACKAGE_NAME = PhusionPassenger::PACKAGE_NAME
121
+ PACKAGE_VERSION = PhusionPassenger::VERSION_STRING
122
+ PACKAGE_SIGNING_KEY = "0x0A212A8C"
123
+ MAINTAINER_NAME = "Phusion"
124
+ MAINTAINER_EMAIL = "info@phusion.nl"
125
+
114
126
  OPTIMIZE = boolean_option("OPTIMIZE")
115
- CC = string_option("CC", "gcc")
116
- CXX = string_option("CXX", "g++")
127
+ CC = maybe_wrap_in_ccache(string_option("CC", "gcc"))
128
+ CXX = maybe_wrap_in_ccache(string_option("CXX", "g++"))
117
129
  LIBEXT = PlatformInfo.library_extension
118
130
  USE_DMALLOC = boolean_option('USE_DMALLOC')
119
131
  USE_EFENCE = boolean_option('USE_EFENCE')
@@ -164,13 +176,14 @@ EXTRA_LDFLAGS = string_option('EXTRA_LDFLAGS', '').gsub("\n", " ")
164
176
 
165
177
 
166
178
  AGENT_OUTPUT_DIR = string_option('AGENT_OUTPUT_DIR', OUTPUT_DIR + "agents") + "/"
167
- COMMON_OUTPUT_DIR = string_option('COMMON_OUTPUT_DIR', OUTPUT_DIR + "libout/common") + "/"
168
- APACHE2_OUTPUT_DIR = string_option('APACHE2_OUTPUT_DIR', OUTPUT_DIR + "libout/apache2") + "/"
169
- LIBEV_OUTPUT_DIR = string_option('LIBEV_OUTPUT_DIR', OUTPUT_DIR + "libout/libev") + "/"
170
- LIBEIO_OUTPUT_DIR = string_option('LIBEIO_OUTPUT_DIR', OUTPUT_DIR + "libout/libeio") + "/"
179
+ COMMON_OUTPUT_DIR = string_option('COMMON_OUTPUT_DIR', OUTPUT_DIR + "common") + "/"
180
+ APACHE2_OUTPUT_DIR = string_option('APACHE2_OUTPUT_DIR', OUTPUT_DIR + "apache2") + "/"
181
+ LIBEV_OUTPUT_DIR = string_option('LIBEV_OUTPUT_DIR', OUTPUT_DIR + "libev") + "/"
182
+ LIBEIO_OUTPUT_DIR = string_option('LIBEIO_OUTPUT_DIR', OUTPUT_DIR + "libeio") + "/"
171
183
  ruby_extension_archdir = PlatformInfo.ruby_extension_binary_compatibility_id
172
184
  RUBY_EXTENSION_OUTPUT_DIR = string_option('RUBY_EXTENSION_OUTPUT_DIR',
173
- OUTPUT_DIR + "libout/ruby/" + ruby_extension_archdir) + "/"
185
+ OUTPUT_DIR + "ruby/" + ruby_extension_archdir) + "/"
186
+ PKG_DIR = string_option('PKG_DIR', "pkg")
174
187
 
175
188
 
176
189
  # Whether to use the vendored libev or the system one.
@@ -38,6 +38,15 @@ def run_compiler(*command)
38
38
  "https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04" +
39
39
  "</b>"
40
40
  fail(PhusionPassenger::Utils::AnsiColors.ansi_colorize(msg))
41
+ elsif $? && $?.termsig == 9
42
+ msg = "<b>" +
43
+ "-----------------------------------------------\n" +
44
+ "Your compiler was killed by the operating system. This " +
45
+ "probably means that it ran out of memory. To solve " +
46
+ "this problem, try increasing your swap space: " +
47
+ "https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04" +
48
+ "</b>"
49
+ fail(PhusionPassenger::Utils::AnsiColors.ansi_colorize(msg))
41
50
  else
42
51
  fail "Command failed with status (#{$? ? $?.exitstatus : 1}): [#{show_command}]"
43
52
  end
@@ -0,0 +1,129 @@
1
+ # encoding: utf-8
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 Phusion
4
+ #
5
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ require 'build/preprocessor'
26
+
27
+ ALL_DISTRIBUTIONS = ["raring", "precise", "lucid"]
28
+ DEBIAN_NAME = "ruby-passenger"
29
+ DEBIAN_EPOCH = 1
30
+ DEBIAN_ORIG_TARBALL_FILES = lambda { PhusionPassenger::Packaging.debian_orig_tarball_files }
31
+
32
+ def create_debian_package_dir(distribution)
33
+ require 'time'
34
+
35
+ variables = {
36
+ :distribution => distribution
37
+ }
38
+
39
+ root = "#{PKG_DIR}/#{distribution}"
40
+ sh "rm -rf #{root}"
41
+ sh "mkdir -p #{root}"
42
+ recursive_copy_files(DEBIAN_ORIG_TARBALL_FILES.call, root)
43
+ recursive_copy_files(Dir["debian.template/**/*"], root,
44
+ true, variables)
45
+ sh "mv #{root}/debian.template #{root}/debian"
46
+ changelog = File.read("#{root}/debian/changelog")
47
+ changelog =
48
+ "#{DEBIAN_NAME} (#{DEBIAN_EPOCH}:#{PACKAGE_VERSION}-1~#{distribution}1) #{distribution}; urgency=low\n" +
49
+ "\n" +
50
+ " * Package built.\n" +
51
+ "\n" +
52
+ " -- #{MAINTAINER_NAME} <#{MAINTAINER_EMAIL}> #{Time.now.rfc2822}\n\n" +
53
+ changelog
54
+ File.open("#{root}/debian/changelog", "w") do |f|
55
+ f.write(changelog)
56
+ end
57
+ end
58
+
59
+ task 'debian:orig_tarball' => Packaging::PREGENERATED_FILES do
60
+ if File.exist?("#{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz")
61
+ puts "WARNING: Debian orig tarball #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz already exists. " +
62
+ "It will not be regenerated. If you are sure that the orig tarball is outdated, please delete it " +
63
+ "and rerun this task."
64
+ else
65
+ sh "rm -rf #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
66
+ sh "mkdir -p #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
67
+ recursive_copy_files(DEBIAN_ORIG_TARBALL_FILES.call, "#{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}")
68
+ sh "cd #{PKG_DIR} && tar -c #{DEBIAN_NAME}_#{PACKAGE_VERSION} | gzip --best > #{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz"
69
+ end
70
+ end
71
+
72
+ desc "Build Debian source and binary package(s) for local testing"
73
+ task 'debian:dev' do
74
+ sh "rm -f #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz"
75
+ Rake::Task["debian:clean"].invoke
76
+ Rake::Task["debian:orig_tarball"].invoke
77
+ case distro = string_option('DISTRO', 'current')
78
+ when 'current'
79
+ distributions = [File.read("/etc/lsb-release").scan(/^DISTRIB_CODENAME=(.+)/).first.first]
80
+ when 'all'
81
+ distributions = ALL_DISTRIBUTIONS
82
+ else
83
+ distributions = distro.split(',')
84
+ end
85
+ distributions.each do |distribution|
86
+ create_debian_package_dir(distribution)
87
+ sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
88
+ end
89
+ distributions.each do |distribution|
90
+ sh "cd #{PKG_DIR}/#{distribution} && debuild -F -us -uc"
91
+ end
92
+ end
93
+
94
+ desc "Build Debian source packages to be uploaded to repositories"
95
+ task 'debian:production' => 'debian:orig_tarball' do
96
+ if boolean_option('USE_CCACHE', false)
97
+ # The resulting Debian rules file must not set USE_CCACHE.
98
+ abort "USE_CCACHE must be returned off when running the debian:production task."
99
+ end
100
+ if filename = string_option('GPG_PASSPHRASE_FILE')
101
+ filename = File.expand_path(filename)
102
+ if !File.exist?(filename)
103
+ abort "GPG passphrase file #{filename} does not exist!"
104
+ end
105
+ if File.stat(filename).mode != 0100600
106
+ abort "The GPG passphrase file #{filename} must be chmodded 0600!"
107
+ end
108
+ gpg_options = "-p'gpg --passphrase-file #{filename} --no-use-agent'"
109
+ end
110
+
111
+ ALL_DISTRIBUTIONS.each do |distribution|
112
+ create_debian_package_dir(distribution)
113
+ sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
114
+ end
115
+ ALL_DISTRIBUTIONS.each do |distribution|
116
+ sh "cd #{PKG_DIR}/#{distribution} && debuild -S -sa #{gpg_options} -k#{PACKAGE_SIGNING_KEY}"
117
+ end
118
+ end
119
+
120
+ desc "Clean Debian packaging products, except for orig tarball"
121
+ task 'debian:clean' do
122
+ files = Dir["#{PKG_DIR}/*.{changes,build,deb,dsc,upload}"]
123
+ sh "rm -f #{files.join(' ')}"
124
+ sh "rm -rf #{PKG_DIR}/dev"
125
+ ALL_DISTRIBUTIONS.each do |distribution|
126
+ sh "rm -rf #{PKG_DIR}/#{distribution}"
127
+ end
128
+ sh "rm -rf #{PKG_DIR}/*.debian.tar.gz"
129
+ end
@@ -53,7 +53,9 @@ Packaging::ASCII_DOCS.each do |target|
53
53
  end
54
54
 
55
55
  task :clean do
56
- sh "rm -f '#{target}'"
56
+ if boolean_option('CLEAN_DOCS', true)
57
+ sh "rm -f '#{target}'"
58
+ end
57
59
  end
58
60
  end
59
61
 
@@ -84,7 +86,9 @@ def create_markdown_compilation_task(target)
84
86
  end
85
87
 
86
88
  task :clean do
87
- sh "rm -f #{target}"
89
+ if boolean_option('CLEAN_DOCS', true)
90
+ sh "rm -f #{target}"
91
+ end
88
92
  end
89
93
  end
90
94
 
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010 Phusion
2
+ # Copyright (c) 2010-2013 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -51,8 +51,19 @@ task 'test:integration:nginx' => dependencies do
51
51
  end
52
52
  end
53
53
 
54
+ desc "Run native packaging tests"
55
+ task 'test:integration:native_packaging' do
56
+ if PlatformInfo.rspec.nil?
57
+ abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
58
+ else
59
+ Dir.chdir("test") do
60
+ ruby "#{PlatformInfo.rspec} -c -f s integration_tests/native_packaging_spec.rb"
61
+ end
62
+ end
63
+ end
64
+
54
65
  dependencies = [:apache2, NATIVE_SUPPORT_TARGET].compact
55
- desc "Run the 'restart' integration test infinitely, and abort if/when it fails"
66
+ desc "Run the 'apache2' integration test infinitely, and abort if/when it fails"
56
67
  task 'test:restart' => dependencies do
57
68
  Dir.chdir("test") do
58
69
  color_code_start = "\e[33m\e[44m\e[1m"
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # Phusion Passenger - https://www.phusionpassenger.com/
2
3
  # Copyright (c) 2010-2013 Phusion
3
4
  #
@@ -156,6 +157,21 @@ task :news_as_markdown do
156
157
  puts contents
157
158
  end
158
159
 
160
+ desc "Update CONTRIBUTORS file"
161
+ task :contributors do
162
+ entries = `git log --format='%aN' | sort -u`.split("\n")
163
+ entries.delete "Hongli Lai"
164
+ entries.delete "Hongli Lai (Phusion"
165
+ entries.delete "Ninh Bui"
166
+ entries.push "Ninh Bui (Phusion)"
167
+ entries.delete "Tinco Andringa"
168
+ entries.push "Tinco Andringa (Phusion)"
169
+ File.open("CONTRIBUTORS", "w") do |f|
170
+ f.puts(entries.sort{ |a, b| a.downcase <=> b.downcase }.join("\n"))
171
+ end
172
+ puts "Updated CONTRIBUTORS"
173
+ end
174
+
159
175
  dependencies = [
160
176
  COMMON_LIBRARY.link_objects,
161
177
  LIBBOOST_OXT,
@@ -21,6 +21,32 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
+ ORIG_TARBALL_FILES = lambda { PhusionPassenger::Packaging.files }
25
+
26
+ def recursive_copy_files(files, destination_dir, preprocess = false, variables = {})
27
+ require 'fileutils' if !defined?(FileUtils)
28
+ files.each_with_index do |filename, i|
29
+ dir = File.dirname(filename)
30
+ if !File.exist?("#{destination_dir}/#{dir}")
31
+ FileUtils.mkdir_p("#{destination_dir}/#{dir}")
32
+ end
33
+ if !File.directory?(filename)
34
+ if preprocess && filename =~ /\.template$/
35
+ real_filename = filename.sub(/\.template$/, '')
36
+ FileUtils.install(filename, "#{destination_dir}/#{real_filename}", :preserve => true)
37
+ Preprocessor.new.start(filename, "#{destination_dir}/#{real_filename}",
38
+ variables)
39
+ else
40
+ FileUtils.install(filename, "#{destination_dir}/#{filename}", :preserve => true)
41
+ end
42
+ end
43
+ printf "\r[%5d/%5d] [%3.0f%%] Copying files...", i + 1, files.size, i * 100.0 / files.size
44
+ STDOUT.flush
45
+ end
46
+ printf "\r[%5d/%5d] [%3.0f%%] Copying files...\n", files.size, files.size, 100
47
+ end
48
+
49
+
24
50
  task :clobber => 'package:clean'
25
51
 
26
52
  desc "Build, sign & upload gem & tarball"
@@ -37,9 +63,15 @@ task 'package:release' => ['package:gem', 'package:tarball', 'package:sign'] do
37
63
  is_beta = !!version.split('.')[3]
38
64
  tag_prefix = is_open_source ? 'release' : 'enterprise'
39
65
 
66
+ if !`git status --porcelain | grep -Ev '^\\?\\? '`.empty?
67
+ STDERR.puts "-------------------"
68
+ abort "*** ERROR: There are uncommitted files. See 'git status'"
69
+ end
70
+
40
71
  begin
41
72
  website_config = YAML.load_file(File.expand_path("~/.passenger_website.yml"))
42
73
  rescue Errno::ENOENT
74
+ STDERR.puts "-------------------"
43
75
  abort "*** ERROR: Please put the Phusion Passenger website admin " +
44
76
  "password in ~/.passenger_website.yml:\n" +
45
77
  "admin_password: ..."
@@ -52,8 +84,7 @@ task 'package:release' => ['package:gem', 'package:tarball', 'package:sign'] do
52
84
  sh "git push origin #{tag_prefix}-#{version}"
53
85
 
54
86
  if is_open_source
55
- sh "scp pkg/#{basename}.{gem.asc,tar.gz.asc} app@shell.phusion.nl:/u/apps/signatures/phusion-passenger/"
56
- sh "./dev/googlecode_upload.py -p phusion-passenger -s 'Phusion Passenger #{version}' pkg/passenger-#{version}.tar.gz"
87
+ sh "s3cmd -P put pkg/passenger-#{version}.{gem,tar.gz,gem.asc,tar.gz.asc} s3://phusion-passenger/releases/"
57
88
  sh "gem push pkg/passenger-#{version}.gem"
58
89
  puts "Updating version number on website..."
59
90
  if is_beta
@@ -100,20 +131,7 @@ task 'package:tarball' => Packaging::PREGENERATED_FILES do
100
131
  basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
101
132
  sh "rm -rf pkg/#{basename}"
102
133
  sh "mkdir -p pkg/#{basename}"
103
- files = Dir[*PhusionPassenger::Packaging::GLOB] -
104
- Dir[*PhusionPassenger::Packaging::EXCLUDE_GLOB]
105
- files.each_with_index do |filename, i|
106
- dir = File.dirname(filename)
107
- if !File.exist?("pkg/#{basename}/#{dir}")
108
- FileUtils.mkdir_p("pkg/#{basename}/#{dir}")
109
- end
110
- if !File.directory?(filename)
111
- FileUtils.install(filename, "pkg/#{basename}/#{filename}")
112
- end
113
- printf "\r[%5d/%5d] [%3.0f%%] Copying files...", i, files.size, i * 100.0 / files.size
114
- STDOUT.flush
115
- end
116
- puts
134
+ recursive_copy_files(ORIG_TARBALL_FILES.call, "pkg/#{basename}")
117
135
  sh "cd pkg && tar -c #{basename} | gzip --best > #{basename}.tar.gz"
118
136
  sh "rm -rf pkg/#{basename}"
119
137
  end
@@ -162,57 +180,64 @@ task 'package:clean' do
162
180
  end
163
181
 
164
182
  desc "Create a fakeroot, useful for building native packages"
165
- task :fakeroot => [:apache2, :nginx] + Packaging::ASCII_DOCS do
183
+ task :fakeroot => [:apache2, :nginx, :doc] do
166
184
  require 'rbconfig'
167
185
  require 'fileutils'
168
- include Config
186
+ include RbConfig
169
187
  fakeroot = "pkg/fakeroot"
170
188
 
171
189
  # We don't use CONFIG['archdir'] and the like because we want
172
190
  # the files to be installed to /usr, and the Ruby interpreter
173
191
  # on the packaging machine might be in /usr/local.
174
192
  fake_rubylibdir = "#{fakeroot}/usr/lib/ruby/vendor_ruby"
175
- fake_libdir = "#{fakeroot}/usr/lib/phusion-passenger"
193
+ fake_libdir = "#{fakeroot}/usr/lib/passenger"
176
194
  fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
177
195
  fake_agents_dir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
178
196
  fake_helper_scripts_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
179
- fake_resources_dir = "#{fakeroot}/usr/share/phusion-passenger"
180
- fake_include_dir = "#{fakeroot}/usr/share/phusion-passenger/include"
197
+ fake_resources_dir = "#{fakeroot}/usr/share/passenger"
198
+ fake_include_dir = "#{fakeroot}/usr/share/passenger/include"
181
199
  fake_docdir = "#{fakeroot}/usr/share/doc/#{GLOBAL_NAMESPACE_DIRNAME}"
182
200
  fake_bindir = "#{fakeroot}/usr/bin"
183
201
  fake_sbindir = "#{fakeroot}/usr/sbin"
184
202
  fake_apache2_module_dir = "#{fakeroot}/usr/lib/apache2/modules"
185
203
  fake_apache2_module = "#{fake_apache2_module_dir}/mod_passenger.so"
186
- fake_ruby_extension_source_dir = "#{fakeroot}/usr/share/phusion-passenger/ruby_extension_source"
204
+ fake_ruby_extension_source_dir = "#{fakeroot}/usr/share/passenger/ruby_extension_source"
187
205
 
188
206
  sh "rm -rf #{fakeroot}"
189
207
  sh "mkdir -p #{fakeroot}"
190
208
 
209
+ # Ruby sources
191
210
  sh "mkdir -p #{fake_rubylibdir}"
192
211
  sh "cp #{PhusionPassenger.ruby_libdir}/phusion_passenger.rb #{fake_rubylibdir}/"
193
212
  sh "cp -R #{PhusionPassenger.ruby_libdir}/phusion_passenger #{fake_rubylibdir}/"
194
213
 
214
+ # Phusion Passenger common libraries
195
215
  sh "mkdir -p #{fake_libdir}"
196
216
  sh "cp -R #{PhusionPassenger.lib_dir}/common #{fake_libdir}/"
197
217
  sh "rm -rf #{fake_libdir}/common/libboost_oxt"
198
218
 
219
+ # Ruby extension binaries
199
220
  sh "mkdir -p #{fake_native_support_dir}"
200
221
  native_support_archdir = PlatformInfo.ruby_extension_binary_compatibility_id
201
222
  sh "mkdir -p #{fake_native_support_dir}"
202
- sh "cp -R libout/ruby/#{native_support_archdir}/*.#{LIBEXT} #{fake_native_support_dir}/"
223
+ sh "cp -R buildout/ruby/#{native_support_archdir}/*.#{LIBEXT} #{fake_native_support_dir}/"
203
224
 
225
+ # Agents
204
226
  sh "mkdir -p #{fake_agents_dir}"
205
227
  sh "cp -R #{PhusionPassenger.agents_dir}/* #{fake_agents_dir}/"
206
228
  sh "rm -rf #{fake_agents_dir}/*.dSYM"
207
229
  sh "rm -rf #{fake_agents_dir}/*/*.dSYM"
208
230
  sh "rm -rf #{fake_agents_dir}/*.o"
209
231
 
232
+ # Helper scripts
210
233
  sh "mkdir -p #{fake_helper_scripts_dir}"
211
234
  sh "cp -R #{PhusionPassenger.helper_scripts_dir}/* #{fake_helper_scripts_dir}/"
212
235
 
236
+ # Resources
213
237
  sh "mkdir -p #{fake_resources_dir}"
214
238
  sh "cp -R resources/* #{fake_resources_dir}/"
215
239
 
240
+ # Headers necessary for building the Nginx module
216
241
  sh "mkdir -p #{fake_include_dir}"
217
242
  # Infer headers that the Nginx module needs
218
243
  headers = []
@@ -222,67 +247,58 @@ task :fakeroot => [:apache2, :nginx] + Packaging::ASCII_DOCS do
222
247
  end
223
248
  end
224
249
  headers.each do |header|
225
- target = "#{fake_include_dir}/#{header[1]}"
250
+ target = "#{fake_include_dir}/common/#{header[1]}"
226
251
  dir = File.dirname(target)
227
252
  if !File.directory?(dir)
228
253
  sh "mkdir -p #{dir}"
229
254
  end
230
255
  sh "cp #{header[0]} #{target}"
231
256
  end
257
+
258
+ # Nginx module sources
259
+ sh "mkdir -p #{fake_resources_dir}/ngx_http_passenger_module"
260
+ sh "cp ext/nginx/* #{fake_resources_dir}/ngx_http_passenger_module/"
232
261
 
262
+ # Documentation
233
263
  sh "mkdir -p #{fake_docdir}"
234
- Packaging::ASCII_DOCS.each do |docfile|
235
- sh "cp", docfile, "#{fake_docdir}/"
236
- end
264
+ sh "cp doc/*.html #{fake_docdir}/"
237
265
  sh "cp -R doc/images #{fake_docdir}/"
238
266
 
267
+ # User binaries
239
268
  sh "mkdir -p #{fake_bindir}"
240
269
  Packaging::USER_EXECUTABLES.each do |exe|
241
270
  sh "cp bin/#{exe} #{fake_bindir}/"
242
271
  end
243
272
 
273
+ # Superuser binaries
244
274
  sh "mkdir -p #{fake_sbindir}"
245
275
  Packaging::SUPER_USER_EXECUTABLES.each do |exe|
246
276
  sh "cp bin/#{exe} #{fake_sbindir}/"
247
277
  end
248
278
 
279
+ # Apache 2 module
249
280
  sh "mkdir -p #{fake_apache2_module_dir}"
250
281
  sh "cp #{APACHE2_MODULE} #{fake_apache2_module_dir}/"
251
282
 
283
+ # Ruby extension sources
252
284
  sh "mkdir -p #{fake_ruby_extension_source_dir}"
253
285
  sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
254
286
 
255
287
  puts "Creating #{fake_rubylibdir}/phusion_passenger/locations.ini"
256
288
  File.open("#{fake_rubylibdir}/phusion_passenger/locations.ini", "w") do |f|
289
+ f.puts "[locations]"
257
290
  f.puts "natively_packaged=true"
258
291
  f.puts "bin=/usr/bin"
259
- f.puts "agents=/usr/lib/phusion-passenger/agents"
260
- f.puts "libdir=/usr/lib/phusion-passenger"
261
- f.puts "helper_scripts=/usr/share/phusion-passenger/helper-scripts"
262
- f.puts "resources=/usr/share/phusion-passenger"
263
- f.puts "includedir=/usr/share/phusion-passenger/include"
264
- f.puts "doc=/usr/share/doc/phusion-passenger"
292
+ f.puts "agents=/usr/lib/passenger/agents"
293
+ f.puts "libdir=/usr/lib/passenger"
294
+ f.puts "helper_scripts=/usr/share/passenger/helper-scripts"
295
+ f.puts "resources=/usr/share/passenger"
296
+ f.puts "includedir=/usr/share/passenger/include"
297
+ f.puts "doc=/usr/share/doc/passenger"
265
298
  f.puts "rubylibdir=/usr/lib/ruby/vendor_ruby"
266
299
  f.puts "apache2_module=/usr/lib/apache2/modules/mod_passenger.so"
267
- f.puts "ruby_extension_source=/usr/share/phusion-passenger/ruby_extension_source"
300
+ f.puts "ruby_extension_source=/usr/share/passenger/ruby_extension_source"
268
301
  end
269
302
 
270
303
  sh "find #{fakeroot} -name .DS_Store -print0 | xargs -0 rm -f"
271
304
  end
272
-
273
- desc "Create a Debian package"
274
- task 'package:debian' do
275
- checkbuilddeps = PlatformInfo.find_command("dpkg-checkbuilddeps")
276
- debuild = PlatformInfo.find_command("debuild")
277
- if !checkbuilddeps || !debuild
278
- # devscripts requires dpkg-dev which contains dpkg-checkbuilddeps.
279
- abort "Please run `apt-get install devscripts` first."
280
- end
281
-
282
- if !system(checkbuilddeps)
283
- STDERR.puts
284
- abort "Please install aforementioned build dependencies first."
285
- end
286
-
287
- sh "debuild"
288
- end