passenger 4.0.10 → 4.0.13

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 (224) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +66 -0
  3. data/.travis.yml +2 -5
  4. data/CONTRIBUTORS +2 -1
  5. data/NEWS +24 -0
  6. data/README.md +5 -10
  7. data/bin/passenger +1 -0
  8. data/bin/passenger-config +29 -3
  9. data/bin/passenger-install-nginx-module +1 -1
  10. data/build/basics.rb +8 -2
  11. data/build/debian.rb +22 -0
  12. data/build/integration_tests.rb +16 -2
  13. data/build/misc.rb +3 -0
  14. data/build/packaging.rb +77 -29
  15. data/build/preprocessor.rb +13 -10
  16. data/build/test_basics.rb +6 -0
  17. data/debian.template/locations.ini.template +13 -0
  18. data/debian.template/ruby-passenger-dev.install.template +3 -0
  19. data/debian.template/ruby-passenger-doc.install.template +2 -0
  20. data/debian.template/ruby-passenger.install.template +12 -0
  21. data/debian.template/rules.template +1 -0
  22. data/dev/run_travis.sh +46 -14
  23. data/doc/Architectural overview.html +25 -34
  24. data/doc/Packaging.html +31 -23
  25. data/doc/Packaging.txt.md +32 -23
  26. data/doc/Security of user switching support.html +16 -18
  27. data/doc/Users guide Apache.html +231 -239
  28. data/doc/Users guide Nginx.html +219 -227
  29. data/doc/Users guide Standalone.html +12 -15
  30. data/doc/users_guide_snippets/installation.txt +3 -2
  31. data/ext/common/ApplicationPool2/Implementation.cpp +6 -16
  32. data/ext/common/Constants.h +1 -1
  33. data/ext/common/ResourceLocator.h +6 -6
  34. data/ext/common/UnionStation.h +11 -15
  35. data/ext/common/Utils/ProcessMetricsCollector.h +7 -4
  36. data/ext/common/agents/HelperAgent/AgentOptions.h +6 -0
  37. data/ext/common/agents/HelperAgent/Main.cpp +5 -0
  38. data/ext/common/agents/HelperAgent/RequestHandler.h +9 -1
  39. data/ext/common/agents/LoggingAgent/Main.cpp +4 -0
  40. data/ext/common/agents/Watchdog/Main.cpp +7 -0
  41. data/ext/nginx/config +1 -1
  42. data/ext/oxt/Readme.txt +15 -0
  43. data/helper-scripts/download_binaries/extconf.rb +83 -0
  44. data/lib/phusion_passenger.rb +78 -80
  45. data/lib/phusion_passenger/abstract_installer.rb +22 -8
  46. data/lib/phusion_passenger/console_text_template.rb +1 -1
  47. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -1
  48. data/lib/phusion_passenger/native_support.rb +22 -9
  49. data/lib/phusion_passenger/packaging.rb +7 -2
  50. data/lib/phusion_passenger/platform_info.rb +28 -1
  51. data/lib/phusion_passenger/platform_info/apache.rb +246 -26
  52. data/lib/phusion_passenger/platform_info/apache_detector.rb +232 -0
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +4 -0
  54. data/lib/phusion_passenger/platform_info/linux.rb +7 -0
  55. data/lib/phusion_passenger/public_api.rb +11 -2
  56. data/lib/phusion_passenger/standalone/command.rb +11 -14
  57. data/lib/phusion_passenger/standalone/runtime_installer.rb +313 -275
  58. data/lib/phusion_passenger/standalone/runtime_locator.rb +163 -0
  59. data/lib/phusion_passenger/standalone/start_command.rb +38 -46
  60. data/lib/phusion_passenger/utils/json.rb +329 -0
  61. data/lib/phusion_passenger/utils/tmpio.rb +1 -0
  62. data/passenger.gemspec +4 -0
  63. data/resources/mime.types +1 -0
  64. data/resources/oss-binaries.phusionpassenger.com.crt +84 -0
  65. data/resources/release.txt +0 -0
  66. data/resources/templates/standalone/download_tool_missing.txt.erb +18 -0
  67. data/rpm/README.rdoc +117 -0
  68. data/rpm/config/apache-passenger.conf.in +19 -0
  69. data/rpm/config/nginx-passenger.conf.in +10 -0
  70. data/rpm/config/rubygem-passenger.te +10 -0
  71. data/rpm/doc/README.nginx-alternatives +5 -0
  72. data/rpm/doc/example_yum_repository_htaccess +5 -0
  73. data/rpm/doc/footer.shtml +12 -0
  74. data/rpm/doc/header.shtml +156 -0
  75. data/rpm/nginx-alternatives.spec +97 -0
  76. data/rpm/passenger-release.spec +91 -0
  77. data/rpm/passenger.spec +667 -0
  78. data/rpm/patches/passenger-force-native.patch +63 -0
  79. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +33 -0
  80. data/rpm/release/build-release.sh +35 -0
  81. data/rpm/release/build.rb +301 -0
  82. data/rpm/release/create-mirrors.sh +16 -0
  83. data/rpm/release/mirrors +1 -0
  84. data/rpm/release/mock-repo/comps.xml +21 -0
  85. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  86. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  87. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  88. data/rpm/release/mocksetup-first.sh +102 -0
  89. data/rpm/release/mocksetup.sh +67 -0
  90. data/test/integration_tests/apache2_tests.rb +1 -1
  91. data/test/integration_tests/downloaded_binaries_tests.rb +76 -0
  92. data/test/integration_tests/native_packaging_spec.rb +38 -6
  93. data/test/integration_tests/source_packaging_test.rb +198 -0
  94. data/test/integration_tests/standalone_tests.rb +275 -0
  95. data/test/ruby/admin_tools_spec.rb +1 -1
  96. data/test/ruby/rails4.0/loader_spec.rb +28 -0
  97. data/test/ruby/rails4.0/preloader_spec.rb +34 -0
  98. data/test/ruby/spec_helper.rb +5 -1
  99. data/test/ruby/standalone/runtime_installer_spec.rb +399 -0
  100. data/test/ruby/standalone/runtime_locator_spec.rb +214 -0
  101. data/test/stub/apache2/httpd.conf.erb +18 -1
  102. data/test/stub/rack/tmp/.gitignore +0 -0
  103. data/test/stub/rails2.3/log/.gitignore +1 -0
  104. data/test/stub/rails2.3/public/.gitignore +1 -0
  105. data/test/stub/rails2.3/tmp/cache/.gitignore +1 -0
  106. data/test/stub/rails2.3/tmp/pids/.gitignore +1 -0
  107. data/test/stub/rails2.3/tmp/sessions/.gitignore +1 -0
  108. data/test/stub/rails2.3/tmp/sockets/.gitignore +1 -0
  109. data/test/stub/rails3.0/.gitignore +4 -0
  110. data/test/stub/rails3.0/Gemfile +1 -1
  111. data/test/stub/rails3.0/Gemfile.lock +1 -1
  112. data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
  113. data/test/stub/rails3.0/log/.gitignore +0 -0
  114. data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
  115. data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
  116. data/test/stub/rails3.1/.gitignore +15 -0
  117. data/test/stub/rails3.1/Gemfile +1 -1
  118. data/test/stub/rails3.1/Gemfile.lock +1 -1
  119. data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
  120. data/test/stub/rails3.1/app/models/.gitkeep +0 -0
  121. data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
  122. data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
  123. data/test/stub/rails3.1/log/.gitkeep +0 -0
  124. data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
  125. data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
  126. data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
  127. data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
  128. data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
  129. data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
  130. data/test/stub/rails3.2/.gitignore +15 -0
  131. data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
  132. data/test/stub/rails3.2/app/models/.gitkeep +0 -0
  133. data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
  134. data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
  135. data/test/stub/rails3.2/log/.gitkeep +0 -0
  136. data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
  137. data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
  138. data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
  139. data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
  140. data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
  141. data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
  142. data/test/stub/rails4.0/.gitignore +16 -0
  143. data/test/stub/rails4.0/Gemfile +45 -0
  144. data/test/stub/rails4.0/Gemfile.lock +126 -0
  145. data/test/stub/rails4.0/README.rdoc +28 -0
  146. data/test/stub/rails4.0/Rakefile +6 -0
  147. data/test/stub/rails4.0/app/assets/images/.keep +0 -0
  148. data/test/stub/rails4.0/app/assets/javascripts/application.js +16 -0
  149. data/test/stub/rails4.0/app/assets/stylesheets/application.css +13 -0
  150. data/test/stub/rails4.0/app/controllers/application_controller.rb +5 -0
  151. data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
  152. data/test/stub/rails4.0/app/helpers/application_helper.rb +2 -0
  153. data/test/stub/rails4.0/app/mailers/.keep +0 -0
  154. data/test/stub/rails4.0/app/models/.keep +0 -0
  155. data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
  156. data/test/stub/rails4.0/app/views/layouts/application.html.erb +14 -0
  157. data/test/stub/rails4.0/bin/bundle +3 -0
  158. data/test/stub/rails4.0/bin/rails +4 -0
  159. data/test/stub/rails4.0/bin/rake +4 -0
  160. data/test/stub/rails4.0/config.ru +4 -0
  161. data/test/stub/rails4.0/config/application.rb +23 -0
  162. data/test/stub/rails4.0/config/boot.rb +4 -0
  163. data/test/stub/rails4.0/config/database.yml +25 -0
  164. data/test/stub/rails4.0/config/environment.rb +5 -0
  165. data/test/stub/rails4.0/config/environments/development.rb +29 -0
  166. data/test/stub/rails4.0/config/environments/production.rb +80 -0
  167. data/test/stub/rails4.0/config/environments/test.rb +36 -0
  168. data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +7 -0
  169. data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +4 -0
  170. data/test/stub/rails4.0/config/initializers/inflections.rb +16 -0
  171. data/test/stub/rails4.0/config/initializers/mime_types.rb +5 -0
  172. data/test/stub/rails4.0/config/initializers/passenger.rb +1 -0
  173. data/test/stub/rails4.0/config/initializers/secret_token.rb +12 -0
  174. data/test/stub/rails4.0/config/initializers/session_store.rb +3 -0
  175. data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +14 -0
  176. data/test/stub/rails4.0/config/locales/en.yml +23 -0
  177. data/test/stub/rails4.0/config/routes.rb +57 -0
  178. data/test/stub/rails4.0/db/seeds.rb +7 -0
  179. data/test/stub/rails4.0/lib/assets/.keep +0 -0
  180. data/test/stub/rails4.0/lib/tasks/.keep +0 -0
  181. data/test/stub/rails4.0/log/.keep +0 -0
  182. data/test/stub/rails4.0/public/404.html +58 -0
  183. data/test/stub/rails4.0/public/422.html +58 -0
  184. data/test/stub/rails4.0/public/500.html +57 -0
  185. data/test/stub/rails4.0/public/favicon.ico +0 -0
  186. data/test/stub/rails4.0/public/robots.txt +5 -0
  187. data/test/stub/rails4.0/test/controllers/.keep +0 -0
  188. data/test/stub/rails4.0/test/fixtures/.keep +0 -0
  189. data/test/stub/rails4.0/test/helpers/.keep +0 -0
  190. data/test/stub/rails4.0/test/integration/.keep +0 -0
  191. data/test/stub/rails4.0/test/mailers/.keep +0 -0
  192. data/test/stub/rails4.0/test/models/.keep +0 -0
  193. data/test/stub/rails4.0/test/test_helper.rb +15 -0
  194. data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
  195. data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
  196. data/test/stub/rails_apps/1.2/empty/.gitignore +3 -0
  197. data/test/stub/rails_apps/1.2/empty/app/models/.gitignore +0 -0
  198. data/test/stub/rails_apps/1.2/empty/db/.gitignore +0 -0
  199. data/test/stub/rails_apps/1.2/empty/public/.htaccess +40 -0
  200. data/test/stub/rails_apps/1.2/empty/public/stylesheets/.gitignore +0 -0
  201. data/test/stub/rails_apps/2.0/empty/.gitignore +3 -0
  202. data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
  203. data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
  204. data/test/stub/rails_apps/2.0/empty/public/.htaccess +40 -0
  205. data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
  206. data/test/stub/rails_apps/2.2/empty/.gitignore +3 -0
  207. data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
  208. data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
  209. data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
  210. data/test/stub/rails_apps/2.3/empty/.gitignore +3 -0
  211. data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
  212. data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
  213. data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
  214. data/test/stub/rails_apps/2.3/mycook/public/.htaccess +42 -0
  215. data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
  216. data/test/stub/wsgi/tmp/.gitignore +0 -0
  217. data/test/valgrind-osx.supp +7 -0
  218. metadata +162 -8
  219. metadata.gz.asc +7 -7
  220. data/debian.template/locations.ini +0 -12
  221. data/debian.template/ruby-passenger-dev.install +0 -3
  222. data/debian.template/ruby-passenger-doc.install +0 -2
  223. data/debian.template/ruby-passenger.install +0 -11
  224. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +0 -19
@@ -0,0 +1,63 @@
1
+ diff --git a/lib/phusion_passenger.rb b/lib/phusion_passenger.rb
2
+ index e747477..27e82f1 100644
3
+ --- a/lib/phusion_passenger.rb
4
+ +++ b/lib/phusion_passenger.rb
5
+ @@ -94,12 +94,12 @@ module PhusionPassenger
6
+ # Not available when natively packaged.
7
+ NATIVE_SUPPORT_DIR = File.join(SOURCE_ROOT, "ext", "ruby")
8
+ else
9
+ - SOURCE_ROOT = NATIVELY_PACKAGED_SOURCE_ROOT
10
+ - DOCDIR = NATIVELY_PACKAGED_DOCDIR
11
+ - RESOURCES_DIR = NATIVELY_PACKAGED_RESOURCES_DIR
12
+ - AGENTS_DIR = NATIVELY_PACKAGED_AGENTS_DIR
13
+ - HELPER_SCRIPTS_DIR = NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR
14
+ - APACHE2_MODULE = NATIVELY_PACKAGED_APACHE2_MODULE
15
+ + SOURCE_ROOT = '%%GEM_INSTALL_DIR%%'
16
+ + DOCDIR = "#{SOURCE_ROOT}/doc"
17
+ + RESOURCES_DIR = "#{SOURCE_ROOT}/resources"
18
+ + HELPER_SCRIPTS_DIR = "#{SOURCE_ROOT}/helper-scripts"
19
+ + APACHE2_MODULE = '%%APACHE_INSTALLED_MOD%%'
20
+ + NATIVE_SUPPORT_DIR = "#{SOURCE_ROOT}/ext/ruby"
21
+ end
22
+
23
+
24
+ diff --git a/lib/phusion_passenger/native_support.rb b/lib/phusion_passenger/native_support.rb
25
+ index f1edf1c..4312d01 100644
26
+ --- a/lib/phusion_passenger/native_support.rb
27
+ +++ b/lib/phusion_passenger/native_support.rb
28
+ @@ -38,10 +38,7 @@ class NativeSupportLoader
29
+
30
+ private
31
+ def archdir
32
+ - @archdir ||= begin
33
+ - require 'phusion_passenger/platform_info/binary_compatibility'
34
+ - PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")
35
+ - end
36
+ + @archdir ||= 'native'
37
+ end
38
+
39
+ def libext
40
+ diff --git a/ext/common/ResourceLocator.h b/ext/common/ResourceLocator.h
41
+ index 5f65804..e585d1a 100644
42
+ --- a/ext/common/ResourceLocator.h
43
+ +++ b/ext/common/ResourceLocator.h
44
+ @@ -64,13 +64,13 @@ public:
45
+ !fileExists(root + "/DEVELOPERS.TXT");
46
+
47
+ if (nativelyPackaged) {
48
+ - agentsDir = "/usr/lib/phusion-passenger/agents";
49
+ - helperScriptsDir = "/usr/share/phusion-passenger/helper-scripts";
50
+ - resourcesDir = "/usr/share/phusion-passenger";
51
+ - docDir = "/usr/share/doc/phusion-passenger";
52
+ + agentsDir = "%%GEM_INSTALL_DIR%%/agents";
53
+ + helperScriptsDir = "%%GEM_INSTALL_DIR%%/helper-scripts";
54
+ + resourcesDir = "%%GEM_INSTALL_DIR%%";
55
+ + docDir = "%%GEM_INSTALL_DIR%%/doc";
56
+ rubyLibDir = "";
57
+ - compilableSourceDir = "/usr/share/phusion-passenger/compilable-source";
58
+ - apache2Module = "/usr/lib/apache2/modules/mod_passenger.so";
59
+ + compilableSourceDir = "%%GEM_INSTALL_DIR%%";
60
+ + apache2Module = "%%APACHE_INSTALLED_MOD%%";
61
+ } else {
62
+ agentsDir = root + "/agents";
63
+ helperScriptsDir = root + "/helper-scripts";
@@ -0,0 +1,33 @@
1
+ GPG Signing key for rpms@stealthymonkeys.com
2
+
3
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
4
+ Version: GnuPG v1.4.10 (Darwin)
5
+
6
+ mQENBEzHVv8BCAC1nWHsSRdv7bsZYFJLfwXPMxm5oR3OD/lldIKvJXcz6G/STaB8
7
+ FL0vshaaHd2MR8vvn70hByLEjT6YK0e5BvjTspozRFW+k/Sqlj6AjNpLPPaig4GP
8
+ rlaILL42ZrzXmC8UoxBrxJr4mrQn7nKVJDV5I1pPeZYK3kJD5yOwNDW+pGcRSeyw
9
+ idTfBmazzBlLUKX/wFp4X/KNE8NJqaR5HyFPakcTNMIq6hl0pi+zfzEpulykmrJX
10
+ 7jCm1meiVyR1avtfpNRAGQWIJEhqXxBliyUFA3B+AorxKWe3Km7+499w8FdilBHB
11
+ JrJU+FgUBYQ24h2HLD81dgx4NxSIVnFr02TLABEBAAG0NkVyaWsgT2dhbiAoUlBN
12
+ IHNpZ25pbmcga2V5KSA8cnBtc0BzdGVhbHRoeW1vbmtleXMuY29tPokBPgQTAQgA
13
+ KAUCTMdW/wIbAwsLCQgHCg0MCwMCBAYVCgkICwMFFgIDAQACHgECF4AACgkQPo92
14
+ smVzqwlSnAf9G875hB1bE3FYf22YNMIkxSCTTnY/Yw/8c76xJQVEB2+Mx9V7wmiE
15
+ 75pIhL/GrqEpKMtCGK/pYy6Cvd1+VXRX40pqVHZCdkTGHWjtxTL0RunNGEueDXBb
16
+ g1Qs810fIKM/7iqpc6bOx49B8F/jTzk8w8/iK3OMHjd4wLJf6CKmdC25O44KX3Ii
17
+ QpGCzm1sV505TT4MFvO13VDg7XK/Xq+3q5w094ryDXidL3quGJTfvOWaE5/g5Bgh
18
+ ISyO3W3Ak9MfRCzOK5eWao+ZZ2eow0tai5EEhuzakvX7dRNlIhvabjucar585lLP
19
+ uP5h06nDSMXzD7PMnAF65g70gMungXLITLkBDQRMx1b/AQgArX1+UzcPYUbXj6nT
20
+ H+iiRlegG/jPwkYRBwKZkG8Bme4GlTsR6uLDZR4K8zg9DckgbtFjBBpZ1WSWpqOD
21
+ r7suhVAiL/Qev+Gk3H2Q12/4s6OBY0z8N//2UAa/h4R9DIMdP3jdhgP0XK0hmCiH
22
+ z6ZRp3e0t4fZqP4wTfktSGaCzWZL/cG1d/4yclXKHQ8CnLcGf2xE2VhAFObajcHX
23
+ sY2XWfPr7r+4PYjJ+S1lTMT4R+do8gxXDXq5ixN1TuAH5yGB2G2YzVNfFa5bXZFl
24
+ cFnGXNJn3h3tHf9yT9D+yAq37lkqaZ8oByxmNvNi9HYQr8zo+9ztOOFcGgFTlPUT
25
+ MLsk8QARAQABiQEfBBgBCAAJBQJMx1b/AhsMAAoJED6PdrJlc6sJIO0IAJgr2IrG
26
+ WVMPRaU3vVSSC6gkdvn6bIhQuHqdTpw1HFyw/3nRGiPrAH0jmUSojPmTifTpx2Yv
27
+ lsf5vkZjOUvyTB2yDU/pTO8nAarDDyVZv/KWRMruboxFUbqryN/hN747akfZGqt5
28
+ 0aAAfLukQQQ6TmDMEpy3AQKJITZnDylMw7J84UgGcL+iNeU7ogbW+H618gIhl0Sy
29
+ eyZLwwC4sEDXEiRfS0o4JJnOjVshOfNE4tDDjVuLSQ3LW2hwaYJELBJls/ns44Nw
30
+ BQTzTiSbDhOiSTGZr/IwXyRgBhbGfx9AvvPkqOIrKPY6kB+khAYiDdPunbSSg2I3
31
+ BSuPuk9DJp+2Gsc=
32
+ =pVe5
33
+ -----END PGP PUBLIC KEY BLOCK-----
@@ -0,0 +1,35 @@
1
+ #!/bin/sh -e
2
+
3
+ BUILD_VERBOSITY=${BUILD_VERBOSITY:-0}
4
+ [ $BUILD_VERBOSITY -ge 3 ] && set -x
5
+
6
+ reldir=`dirname $0`
7
+ stage=./stage-release
8
+ rm -rf $stage
9
+ mkdir -p $stage/{SRPMS,SOURCES}
10
+ ln -s `readlink -f $reldir/mirrors` $stage/SOURCES/mirrors-passenger
11
+ ln -s `readlink -f $reldir/RPM-GPG-KEY-stealthymonkeys` $stage/SOURCES
12
+
13
+ rpmbuild-md5 --define "_topdir $stage" --define 'dist %nil' -bs passenger-release.spec
14
+ rm -rf $stage/{SOURCES,BUILD*,RPMS,SPECS}
15
+ srpm=`ls -1t $stage/SRPMS/*rpm | head -1`
16
+
17
+ for ver in {epel-5,fedora-{13,14}}
18
+ do
19
+ echo --------- $ver
20
+ xdir=$stage/`echo $ver | tr '-' '/'`/x86_64
21
+ idir=`echo $xdir | sed -e 's/x86_64/i386/'`
22
+ mock -r passenger-$ver-x86_64 $srpm
23
+ mkdir -p $xdir $idir
24
+ cp /var/lib/mock/passenger-$ver-x86_64/result/*noarch.rpm $xdir
25
+ cp /var/lib/mock/passenger-$ver-x86_64/result/*noarch.rpm $idir
26
+ cd $xdir/..
27
+ short=`ls -1t x86_64/*rpm | head -1 | perl -pe 's{.*/(.*)-[^-]+-[^-]+(.noarch.rpm)}{\1\2}'`
28
+ ln -s x86_64/*rpm $short
29
+ cd -
30
+ done
31
+
32
+ mv $stage/epel $stage/rhel
33
+ # Don't resign symlinks
34
+ # -- arguably this should be done once for each file, since they're copied
35
+ rpm --addsign `find $stage -type f`
@@ -0,0 +1,301 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'ftools'
5
+ require 'optparse'
6
+
7
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
8
+
9
+ require 'phusion_passenger'
10
+
11
+ CFGLIMIT=%w{fedora-{13,14} epel-5}
12
+
13
+ stage_dir='./stage'
14
+
15
+ mock_base_dir = '/var/lib/mock'
16
+ mock_repo_dir = "#{mock_base_dir}/passenger-build-repo"
17
+ mock_etc_dir='/etc/mock'
18
+ #mock_etc_dir='/tmp/mock'
19
+
20
+ # If rpmbuild-md5 is installed, use it for the SRPM, so EPEL machines can read it.
21
+ rpmbuild = '/usr/bin/rpmbuild' + (File.exist?('/usr/bin/rpmbuild-md5') ? '-md5' : '')
22
+ rpmtopdir = `rpm -E '%_topdir'`.chomp
23
+ rpmarch = `rpm -E '%_arch'`.chomp
24
+
25
+ @verbosity = 0
26
+
27
+ @can_build = {
28
+ 'i386' => %w{i586 i686},
29
+ 'i686' => %w{i586 i686},
30
+ 'ppc' => %w{},
31
+ 'ppc64' => %w{ppc},
32
+ 's390x' => %w{},
33
+ 'sparc' => %w{},
34
+ 'sparc64' => %w{sparc},
35
+ 'x86_64' => %w{i386 i586 i686},
36
+ }
37
+
38
+ #@can_build.keys.each {|k| @can_build[k].push k}
39
+ @can_build = @can_build[rpmarch.to_s == '' ? 'x86_64' : rpmarch]
40
+ @can_build.push rpmarch
41
+
42
+ bindir=File.dirname(File.expand_path __FILE__)
43
+
44
+ configs = Dir["#{mock_etc_dir}/{#{CFGLIMIT.join ','}}*"].map {|f| f.gsub(%r{.*/([^.]*).cfg}, '\1')}
45
+
46
+ def limit_configs(configs, limits)
47
+ tree = configs.inject({}) do |m,c|
48
+ (distro,version,arch) = c.split /-/
49
+ next m unless @can_build.include?(arch)
50
+ [
51
+ # Rather than construct this list programatically, just spell it out
52
+ '',
53
+ distro,
54
+ "#{distro}-#{version}",
55
+ "#{distro}-#{version}-#{arch}",
56
+ "#{distro}--#{arch}",
57
+ "--#{arch}",
58
+ # doubtful these will be used, but for completeness
59
+ "-#{version}",
60
+ "-#{version}-#{arch}",
61
+ ].each do |pattern|
62
+ unless m[pattern]
63
+ m[pattern] = []
64
+ end
65
+ m[pattern].push c
66
+ end
67
+ m
68
+ end
69
+ tree.default = []
70
+ # Special case for no arguments
71
+ limits = [nil] if limits.empty?
72
+ # By splitting and rejoining we normalize the distro--, etc. cases.
73
+ return limits.map do |l|
74
+ parts = l.to_s.split(/-/).map {|v| v == '*' ? nil : v}
75
+ if parts[2] && !@can_build.include?(parts[2])
76
+ abort "ERROR: Cannot build '#{parts[2]}' packages on '#{rpmarch}'"
77
+ end
78
+ tree[parts.join '-']
79
+ end.flatten
80
+ end
81
+
82
+ def noisy_system(*args)
83
+ puts(args.join(' ')) if @verbosity > 0
84
+ system(*args)
85
+ end
86
+
87
+
88
+ ############################################################################
89
+ options = {}
90
+ OptionParser.new do |opts|
91
+ opts.banner = "Usage: #{$0} [options] [distro-version-arch] [distro-version] [distro--arch] [*--arch]"
92
+
93
+ opts.on("-v", "--[no-]verbose", "Run verbosely. Add more -v's to increase @verbosity") do |v|
94
+ @verbosity += v ? 1 : -1
95
+ end
96
+
97
+ opts.on('-s', '--single', 'Only build a single distro-rev-arch set (for this machine)') do |v|
98
+ options[:single] = true
99
+ end
100
+
101
+ # Do these with options, because the order matters
102
+ opts.on('-b', '--mock-base-dir DIR', "Mock's base directory. Default: #{mock_base_dir}") do |v|
103
+ #mock_repo_dir = v
104
+ options[:mock_base_dir] = v
105
+ end
106
+
107
+ opts.on('-m', '--mock-repo-dir DIR', "Directory for special mock yum repository. Default: #{mock_repo_dir}") do |v|
108
+ #mock_repo_dir = v
109
+ options[:mock_repo_dir] = v
110
+ end
111
+
112
+ opts.on("-c", "--mock-config-dir DIR", "Directory for mock configuration. Default: #{mock_etc_dir}") do |v|
113
+ if File.directory?(v)
114
+ mock_etc_dir=v
115
+ else
116
+ abort "No such directory: #{v}"
117
+ end
118
+ end
119
+
120
+ opts.on('-d', '--stage-dir DIR', "Staging directory. Default: #{stage_dir}") do |v|
121
+ stage_dir = v
122
+ end
123
+
124
+ opts.on('-e', '--extra-packages DIR', "Directory for extra packages to install.") do |v|
125
+ options[:extra_packages] = v
126
+ end
127
+
128
+ opts.on('-r', '--include-release', "Also build passenger-release packages") do
129
+ options[:release] = true
130
+ end
131
+
132
+ opts.on_tail("-h", "--help", "Show this message") do
133
+ puts opts
134
+ exit
135
+ end
136
+ end.parse!
137
+
138
+ if options.key?(:mock_base_dir) || options.key?(:mock_repo_dir)
139
+ if options.key?(:mock_base_dir)
140
+ mock_base_dir = options[:mock_base_dir]
141
+ mock_repo_dir = "#{mock_base_dir}/passenger-build-repo"
142
+ end
143
+ if options.key?(:mock_repo_dir)
144
+ mock_repo_dir = options[:mock_repo_dir]
145
+ unless mock_repo_dir[0] == '/'[0]
146
+ mock_repo_dir = "#{mock_base_dir}/#{mock_repo_dir}"
147
+ end
148
+ end
149
+ end
150
+
151
+ limit = ARGV
152
+ if options.key?(:single)
153
+ # This can probably be simplified
154
+ limit = [`rpm --queryformat '%{name}\t%{version}' -qf /etc/redhat-release`.sub(/(\w+)-release\t(\d+)/,'\1-\2').sub(/^(rhel|centos|sl)-/,'epel-') + "-#{`rpm -E '%{_host_cpu}'`.strip}"]
155
+ end
156
+
157
+ configs = limit_configs(configs, limit)
158
+
159
+ if configs.empty?
160
+ abort "Can't find a set of configs for '#{ARGV[0]}' (hint try 'fedora' or 'fedora-14' or even 'fedora-14-x86_64')"
161
+ end
162
+
163
+ puts "BUILD:\n " + configs.join("\n ") if @verbosity >= 2
164
+
165
+ # Too much of what follows expects this. Revisit it later.
166
+ Dir.chdir(File.join(File.dirname(__FILE__), '..'))
167
+
168
+ FileUtils.rm_rf(stage_dir, :verbose => @verbosity > 0)
169
+ FileUtils.mkdir_p(stage_dir, :verbose => @verbosity > 0)
170
+
171
+ ENV['BUILD_VERBOSITY'] = @verbosity.to_s
172
+
173
+ # Check the ages of the configs for validity
174
+ mtime = File.mtime("#{bindir}/mocksetup.sh")
175
+ if configs.any? {|c| mtime > File.mtime("#{mock_etc_dir}/passenger-#{c}.cfg") rescue true }
176
+ unless noisy_system("#{bindir}/mocksetup.sh", mock_repo_dir, mock_etc_dir)
177
+ abort <<EndErr
178
+ Unable to run "#{bindir}/mocksetup.sh #{mock_repo_dir}". It is likely that you
179
+ need to run this command as root the first time, but if you have already done
180
+ that, it could also be that the current user (or this shell) is not in the
181
+ 'mock' group.
182
+ EndErr
183
+ end
184
+ end
185
+
186
+ srcdir=`rpm -E '%{_sourcedir}'`.chomp
187
+
188
+ FileUtils.ln_sf(Dir["#{Dir.getwd}/{config/,patches/,release/RPM-GPG}*"], srcdir, :verbose => @verbosity > 0)
189
+
190
+ # Force the default versions in the spec file to be the ones in the source so a given SRPM doesn't need a --define to set versions.
191
+ specdir="/tmp/#{`whoami`.strip}-specfile-#{Process.pid}"
192
+ FileUtils.rm_rf(specdir, :verbose => @verbosity > 0)
193
+ begin
194
+ FileUtils.mkdir_p(specdir, :verbose => @verbosity > 0)
195
+ FileUtils.cp('passenger.spec', specdir, :verbose => @verbosity > 0)
196
+ # + must be escaped, but * doesn't? And people wonder why I hate sed.
197
+ abort "Can't edit specfile" unless noisy_system('sed', '-i',
198
+ '-e', "s/^\\(\\([[:space:]]*\\)%define[[:space:]]\\+passenger_version[[:space:]]\\)\\+[0-9.]\\+.*/\\2# From Passenger Source\\n\\1#{PhusionPassenger::VERSION_STRING}/",
199
+ '-e', "s/^\\(\\([[:space:]]*\\)%define[[:space:]]\\+nginx_version[[:space:]]\\)\\+[0-9.]\\+.*/\\2# From Passenger Source\\n\\1#{PhusionPassenger::PREFERRED_NGINX_VERSION}/",
200
+ "#{specdir}/passenger.spec")
201
+ # No dist for SRPM
202
+ unless noisy_system(rpmbuild, *((@verbosity > 0 ? [] : %w{--quiet}) + ['--define', 'dist %nil', '-bs', "#{specdir}/passenger.spec"]))
203
+ abort "No SRPM was built. See above for the error"
204
+ end
205
+ ensure
206
+ FileUtils.rm_rf(specdir, :verbose => @verbosity > 0)
207
+ end
208
+
209
+ srpm="rubygem-passenger-#{PhusionPassenger::VERSION_STRING}-#{`grep '%define passenger_release' passenger.spec | awk '{print $3}'`.strip}.src.rpm".sub(/%\{[^}]+\}/, '')
210
+
211
+ FileUtils.mkdir_p(stage_dir + '/SRPMS', :verbose => @verbosity > 0)
212
+
213
+ FileUtils.cp("#{rpmtopdir}/SRPMS/#{srpm}", "#{stage_dir}/SRPMS", :verbose => @verbosity > 0)
214
+
215
+ if options[:release]
216
+ # It's not EXACTLY equivalent, is it? (REALLY doesn't want to symlink to a different name)
217
+ # FileUtils.ln_sf(Dir["#{Dir.getwd}/release/mirrors"], "#{srcdir}/mirrors-passenger", :verbose => @verbosity > 0)
218
+ FileUtils.ln_sf(Dir["#{Dir.getwd}/release/mirrors"], srcdir, :verbose => @verbosity > 0)
219
+ FileUtils.rm_f( "#{srcdir}/mirrors-passenger", :verbose => @verbosity > 0)
220
+ FileUtils.mv("#{srcdir}/mirrors", "#{srcdir}/mirrors-passenger", :force => true, :verbose => @verbosity > 0)
221
+ unless noisy_system(rpmbuild, *((@verbosity > 0 ? [] : %w{--quiet}) + ['--define', 'dist %nil', '-bs', "passenger-release.spec"]))
222
+ abort "No passenger-release SRPM was built. See above for the error"
223
+ end
224
+ rel_version = `grep '^Version:' passenger-release.spec | awk '{print $2}'`.to_i
225
+ rel_release = `grep '^Release:' passenger-release.spec | awk '{print $2}'`.to_i
226
+ @rel_srpm = "passenger-release-#{rel_version}-#{rel_release}.src.rpm"
227
+ FileUtils.cp("#{rpmtopdir}/SRPMS/passenger-release-#{rel_version}-#{rel_release}.src.rpm",
228
+ "#{stage_dir}/SRPMS", :verbose => @verbosity > 0)
229
+ end
230
+
231
+ mockvolume = @verbosity >= 2 ? %w{-v} : @verbosity < 0 ? %w{-q} : []
232
+
233
+ @release_cache = {}
234
+
235
+ configs.each do |cfg|
236
+ puts "---------------------- Building #{cfg}" if @verbosity >= 0
237
+ pcfg = 'passenger-' + cfg
238
+
239
+ idir = './pkg'
240
+
241
+ unless options.key?(:single)
242
+ idir = File.join stage_dir, cfg.split(/-/)
243
+ end
244
+
245
+ # Move *mockvolume to the end, since it causes Ruby to cry in the middle
246
+ # Alt sol'n: *(foo + ['bar'] )
247
+ unless noisy_system('mock', '-r', pcfg, "#{stage_dir}/SRPMS/#{srpm}", *mockvolume)
248
+ abort "Mock failed. See above for details"
249
+ end
250
+ FileUtils.mkdir_p(idir, :verbose => @verbosity > 0)
251
+ FileUtils.cp(Dir["#{mock_base_dir}/#{pcfg}/result/*.rpm"],
252
+ idir, :verbose => @verbosity > 0)
253
+ if options.key?(:extra_packages)
254
+ FileUtils.cp(Dir["#{options[:extra_packages]}/*.rpm"], idir, :verbose => @verbosity > 0)
255
+ end
256
+
257
+ if options[:release]
258
+ cache_key = cfg.split(/-/).first(2).join('-')
259
+ # There is little sense in rebuilding a noarch package over & over
260
+ if @release_cache[cache_key]
261
+ FileUtils.cp(@release_cache[cache_key], idir, :verbose => @verbosity > 0)
262
+ else
263
+ unless noisy_system('mock', '-r', pcfg, "#{stage_dir}/SRPMS/#{@rel_srpm}", *mockvolume)
264
+ abort "Release Mock failed. See above for details"
265
+ end
266
+
267
+ FileUtils.cp(Dir["#{mock_base_dir}/#{pcfg}/result/*.rpm"],
268
+ idir, :verbose => @verbosity > 0)
269
+ @release_cache[cache_key] = Dir["#{idir}/passenger-release*noarch.rpm"].last
270
+ end
271
+ end
272
+
273
+ FileUtils.rm_f(Dir["#{idir}/*.src.rpm"], :verbose => @verbosity > 1)
274
+ end
275
+
276
+ unless options.key?(:single)
277
+ if File.directory?("#{stage_dir}/epel")
278
+ FileUtils.mv "#{stage_dir}/epel", "#{stage_dir}/rhel", :verbose => @verbosity > 0
279
+ end
280
+ end
281
+
282
+ if options[:release]
283
+ Dir["#{stage_dir}/*/*"].each do |distro_version|
284
+ next unless File.directory?(distro_version)
285
+ arch = Dir["#{distro_version}/{#{@can_build.sort.join ','}}"].last
286
+ pkg = Dir["#{arch}/passenger-release*rpm"].last
287
+ pkg = pkg.split(/#{File::SEPARATOR}/).last(2)
288
+ FileUtils.ln_sf(File.join(pkg), "#{distro_version}/passenger-release.noarch.rpm", :verbose => @verbosity > 0)
289
+ end
290
+ end
291
+
292
+ unless `rpm -E '%{?_gpg_name}'`.strip == ''
293
+ signor=`rpm -E '%{_gpg_name}'`.strip
294
+ key=`gpg --list-key #{signor} | grep '^pub' | awk '{print $2}' | cut -d/ -f2`
295
+ # Don't re-sign packages already signed by your key
296
+ files=Dir["#{options.key?(:single) ? 'pkg' : stage_dir}/**/*.rpm"].select do |rpm|
297
+ !File.symlink?(rpm) && (`rpm --checksig #{rpm}` !~ /#{key}/)
298
+ end
299
+
300
+ noisy_system('rpm', '--addsign', *files)
301
+ end
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ dir=`dirname $0`
4
+ mirrors="$dir/mirrors"
5
+
6
+ echo "D: $dir"
7
+
8
+ for path in fedora rhel
9
+ do
10
+ for mirror in $(cat $mirrors); do
11
+ if [ "${mirror:(-1)}" != "/" ] ; then
12
+ mirror="$mirror/"
13
+ fi
14
+ echo "$mirror$path/\$releasever/\$basearch/"
15
+ done > $path/mirrors
16
+ done