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,97 @@
1
+ # RPM Spec file for nginx-alternatives
2
+ # This is a stop-gap solution to having multiple compiles of nginx on
3
+ # the same server.
4
+ #
5
+ # This package is meant to be obsoleted by a future nginx package that
6
+ # will provide the same feature
7
+
8
+ %define perldir %(perl -MConfig -e 'print $Config{installarchlib}')
9
+
10
+ Summary: Alternatives aware nginx
11
+ Name: nginx-alternatives
12
+ Version: 0.0.1
13
+ Release: 3%{?dist}
14
+ License: MIT
15
+ Group: System Environment/Daemons
16
+ #Source0: %{name}-%{version}.tar.gz
17
+ Source0: README.%{name}
18
+ Requires: nginx
19
+ BuildArch: noarch
20
+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
21
+
22
+ %description
23
+ This package puts the nginx webserver binary under the control of the
24
+ /etc/alternative system.
25
+
26
+ This package is meant to be obsoleted by a future nginx package (which
27
+ will provide the same feature)
28
+
29
+ %prep
30
+ #%setup -q
31
+
32
+ %build
33
+ cp %{SOURCE0} .
34
+
35
+ %install
36
+ rm -rf $RPM_BUILD_ROOT
37
+ mkdir -p $RPM_BUILD_ROOT
38
+
39
+ %clean
40
+ rm -rf $RPM_BUILD_ROOT
41
+
42
+ %triggerin -- nginx
43
+ if [ ! -L /usr/sbin/nginx ] ; then
44
+ mv /usr/sbin/nginx /usr/sbin/nginx.base
45
+ mv %{perldir}/auto/nginx/nginx.so %{perldir}/auto/nginx/nginx_base.so
46
+ mv %{perldir}/nginx.pm %{perldir}/nginx_base.pm
47
+ mv %{_mandir}/man3/nginx.3pm.gz %{_mandir}/man3/nginx_base.3pm.gz
48
+
49
+ /usr/sbin/alternatives --install /usr/sbin/nginx nginx \
50
+ /usr/sbin/nginx.base 30 \
51
+ --slave %{perldir}/auto/nginx/nginx.so nginx.so \
52
+ %{perldir}/auto/nginx/nginx_base.so \
53
+ --slave %{perldir}/nginx.pm nginx.pm %{perldir}/nginx_base.pm \
54
+ --slave %{_mandir}/man3/nginx.3pm.gz nginx.man \
55
+ %{_mandir}/man3/nginx_base.3pm.gz
56
+ fi
57
+
58
+ # Given that other packages will depend on this one, it's 99% likely
59
+ # that this will have been reset back to base. Still good practice to
60
+ # put the expected binary back in place.
61
+ %define undo_link \
62
+ bin=`readlink -f /usr/sbin/nginx` \
63
+ so=`readlink -f %{perldir}/auto/nginx/nginx.so` \
64
+ pm=`readlink -f %{perldir}/nginx.pm` \
65
+ man=`readlink -f %{_mandir}/man3/nginx.3pm.gz` \
66
+ /usr/sbin/alternatives --remove nginx /usr/sbin/nginx.base \
67
+ /usr/sbin/alternatives --remove nginx $bin \
68
+ mv -f $bin /usr/sbin/nginx \
69
+ mv -f $so %{perldir}/auto/nginx/nginx.so \
70
+ mv -f $pm %{perldir}/nginx.pm \
71
+ mv -f $man %{_mandir}/man3/nginx.3pm.gz
72
+
73
+
74
+ %triggerun -- nginx
75
+ if [ -L /usr/sbin/nginx ] ; then
76
+ %undo_link
77
+ fi
78
+
79
+ # triggerun runs if either package is removed, so this isn't necessary
80
+ %postun
81
+ if [ $1 == 0 -a -L /usr/sbin/nginx ]; then
82
+ %undo_link
83
+ fi
84
+
85
+ %files
86
+ %defattr(-,root,root,-)
87
+ %doc README.%{name}
88
+
89
+ %changelog
90
+ * Sat Oct 30 2010 Erik Ogan <erik@stealthymonkeys.com> - 0.0.1-3
91
+ - Add slaves for the perl module
92
+
93
+ * Thu Oct 21 2010 Erik Ogan <erik@stealthymonkeys.com> - 0.0.1-2
94
+ - Use triggers to maintain the link if nginx package is upgraded
95
+
96
+ * Wed Oct 20 2010 Erik Ogan <erik@stealthymonkeys.com> - 0.0.1-1
97
+ - Initial build.
@@ -0,0 +1,91 @@
1
+ Summary: Phusion Passenger release RPM/Yum repository configuration
2
+ Name: passenger-release
3
+ Version: 3
4
+ Release: 4%{?dist}
5
+ License: MIT
6
+ Group: Group: System Environment/Base
7
+ URL: http://passenger.stealthymonkeys.com/
8
+ Source0: mirrors-passenger
9
+ Source1: RPM-GPG-KEY-stealthymonkeys
10
+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
11
+ BuildArch: noarch
12
+
13
+ %description
14
+ Phusion Passenger Yum/RPM configuration. This package contains the Yum
15
+ repository configuration to install & update Phusion Passenger, as
16
+ well as the GPG signing key to verify them.
17
+
18
+ %prep
19
+ #%setup -c
20
+
21
+ %{?el5:name='Red Hat Enterprise' version='5' path='rhel'}
22
+ %{?el6:name='Red Hat Enterprise' version='6' path='rhel'}
23
+
24
+ %{?fc13:name='Fedora Core' version='13' path='fedora'}
25
+ %{?fc14:name='Fedora Core' version='14' path='fedora'}
26
+
27
+ if [ -z "$name" ] ; then
28
+ echo "Please specify a distro to build for (f'rex: el5 or fc13)" >&2
29
+ exit 255
30
+ fi
31
+
32
+ %{__cat} <<EOF > passenger.repo
33
+ ### Name: Phusion Passenger RPM Repository for $name $version
34
+ ### URL: %{url}
35
+ [passenger]
36
+ name = $name \$releasever - Phusion Passenger
37
+ baseurl = %{url}$path/\$releasever/\$basearch
38
+ mirrorlist = %{url}$path/mirrors
39
+ #mirrorlist = file:///etc/yum.repos.d/mirrors-passenger
40
+ enabled = 1
41
+ gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-passenger
42
+ gpgcheck = 1
43
+
44
+ ### Name: Phusion Passenger RPM Repository for $name $version (TESTING)
45
+ ### URL: %{url}
46
+ [passenger-testing]
47
+ name = $name \$releasever - Phusion Passenger - TEST
48
+ baseurl = %{url}$path/\$releasever/\$basearch/testing/
49
+ enabled = 0
50
+ gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-passenger
51
+ gpgcheck = 0
52
+ EOF
53
+
54
+ for mirror in $(%{__cat} %{SOURCE0}); do
55
+ echo "$mirror/$path/\$releasever/\$ARCH/"
56
+ done > mirrors-passenger
57
+
58
+ %build
59
+
60
+ %install
61
+ rm -rf %{buildroot}
62
+ %{__install} -D -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-passenger
63
+ %{__install} -D -p -m 0644 passenger.repo %{buildroot}%{_sysconfdir}/yum.repos.d/passenger.repo
64
+
65
+
66
+
67
+ %clean
68
+ rm -rf %{buildroot}
69
+
70
+
71
+ %files
72
+ %defattr(-,root,root,-)
73
+ %doc mirrors-passenger
74
+ %{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-passenger
75
+ %{_sysconfdir}/yum.repos.d/passenger.repo
76
+
77
+
78
+
79
+ %changelog
80
+ * Wed Nov 24 2010 Erik Ogan <erik@stealthymonkeys.com> - 3-4
81
+ - Fix EL6 & FC14 version numbers.
82
+ - Fix the errant /en in the mirrors file
83
+
84
+ * Thu Oct 28 2010 Erik Ogan <erik@stealthymonkeys.com> - 3-3
85
+ - Typo in the gpgkey directives
86
+
87
+ * Thu Oct 28 2010 Erik Ogan <erik@stealthymonkeys.com> - 3-2
88
+ - Update the mirrorlist URL
89
+
90
+ * Tue Oct 26 2010 Erik Ogan <erik@stealthymonkeys.com> - 3-1
91
+ - Initial build.
@@ -0,0 +1,667 @@
1
+ # RPM Spec file for Phusion Passenger
2
+ #
3
+ # The latest version of this file (as well as supporting files,
4
+ # documentation, and scripts to help build it) can be found here:
5
+ #
6
+ # http://github.com/erikogan/rubygem-passenger
7
+ #
8
+ # (If you fork this project feel free to add your repo below, but please
9
+ # do not remove the URL above.)
10
+
11
+ %define gemname passenger
12
+ %if %{?passenger_version:0}%{?!passenger_version:1}
13
+ %define passenger_version 3.0.2
14
+ %endif
15
+ %if %{?passenger_release:0}%{?!passenger_release:1}
16
+ %define passenger_release 1%{?dist}
17
+ %endif
18
+ %define passenger_epoch 1
19
+
20
+ %if %{?nginx_version:0}%{?!nginx_version:1}
21
+ %define nginx_version 0.8.53
22
+ %endif
23
+ %define nginx_release %{passenger_version}_%{passenger_release}
24
+ %define nginx_user passenger
25
+ %define nginx_group %{nginx_user}
26
+ %define nginx_home %{_localstatedir}/lib/nginx
27
+ %define nginx_home_tmp %{nginx_home}/tmp
28
+ %define nginx_logdir %{_localstatedir}/log/nginx
29
+ %define nginx_confdir %{_sysconfdir}/nginx
30
+ %define nginx_datadir %{_datadir}/nginx
31
+ %define nginx_webroot %{nginx_datadir}/html
32
+
33
+ %define httpd_confdir %{_sysconfdir}/httpd/conf.d
34
+
35
+ # Macros on the command-line overrides these defaults. You should also
36
+ # make sure these match the binaries found in your PATH
37
+ %{?!ruby: %define ruby /usr/bin/ruby}
38
+ %{?!rake: %define rake /usr/bin/rake}
39
+ %{?!gem: %define gem /usr/bin/gem}
40
+
41
+ # Debug packages are currently broken. So don't even build them
42
+ %define debug_package %nil
43
+
44
+ %define ruby_sitelib %(%{ruby} -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
45
+
46
+ %define ruby_version_patch %(%{ruby} -e 'puts "#{RUBY_VERSION}#{defined?(RUBY_PATCHLEVEL) ? %q{.} + RUBY_PATCHLEVEL.to_s : nil}"')
47
+
48
+ # Does Gem::Version crash&burn on the version defined above? (RHEL might)
49
+ %define broken_gem_version %(%{ruby} -rrubygems -e 'begin ; Gem::Version.create "%{passenger_version}" ; rescue => e ; puts 1 ; exit ; end ; puts 0')
50
+
51
+ %if %{broken_gem_version}
52
+ # Strip any non-numeric version part
53
+ %define gemversion %(echo '%{passenger_version}'|sed -e 's/\\.[^.]*[^.0-9]\\+[^.]*//g')
54
+ %else
55
+ %define gemversion %{passenger_version}
56
+ %endif
57
+
58
+ # Invoke a shell to do a comparison, silly but it works across versions of RPM
59
+ %define gem_version_mismatch %([ '%{passenger_version}' != '%{gemversion}' ] && echo 1 || echo 0)
60
+
61
+ %define gemdir %(%{ruby} -rubygems -e 'puts Gem::dir' 2>/dev/null)
62
+ %define geminstdir %{gemdir}/gems/%{gemname}-%{gemversion}
63
+
64
+ %define perldir %(perl -MConfig -e 'print $Config{installvendorarch}')
65
+
66
+ # This will cause a chicken/egg problem where the dir isn't present yet
67
+ #% define gemnativedir % (%{ruby} -I%{_builddir}/%{gemname}-%{passenger_version}/lib -rphusion_passenger/platform_info/binary_compatibility -e 'puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_ids.join("-")')
68
+ # %define native_libs_release %{passenger_release}_% (%{ruby} -I%{_builddir}/%{gemname}-%{passenger_version}/lib -rphusion_passenger/platform_info/binary_compatibility -e 'puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_ids[0,2].join("_")')
69
+ %define native_libs_release %{passenger_release}_%{ruby_version_patch}
70
+
71
+ %{!?only_native_libs: %define only_native_libs 0}
72
+
73
+ # Really wish they'd standardize this
74
+ %define sharedir %{?fedora:%{_datarootdir}}%{?!fedora:%{_datadir}}
75
+
76
+ Summary: Easy and robust Ruby web application deployment
77
+ Name: rubygem-%{gemname}
78
+ Version: %{passenger_version}
79
+ Release: %{passenger_release}
80
+ Group: System Environment/Daemons
81
+ License: Modified BSD
82
+ URL: http://www.modrails.com/
83
+ Source0: %{gemname}-%{passenger_version}.tar.gz
84
+ Source1: nginx-%{nginx_version}.tar.gz
85
+ Source100: apache-passenger.conf.in
86
+ Source101: nginx-passenger.conf.in
87
+ Source200: rubygem-passenger.te
88
+ # The most recent nginx RPM no longer includes this plugin. Remove it from the
89
+ # SRPM
90
+ # # Ignore everything after the ?, it's meant to trick rpmbuild into
91
+ # # finding the correct file
92
+ # Source300: http://github.com/gnosek/nginx-upstream-fair/tarball/master?/nginx-upstream-fair.tar.gz
93
+ Patch0: passenger-force-native.patch
94
+ BuildRoot: %{_tmppath}/%{name}-%{passenger_version}-%{passenger_release}-root-%(%{__id_u} -n)
95
+ Requires: rubygems
96
+ Requires: rubygem(rake) >= 0.8.1
97
+ Requires: rubygem(fastthread) >= 1.0.1
98
+ Requires: rubygem(daemon_controller) >= 0.2.5
99
+ Requires: rubygem(file-tail)
100
+ Requires: rubygem(rack)
101
+ BuildRequires: ruby-devel
102
+ BuildRequires: httpd-devel
103
+ BuildRequires: rubygems
104
+ BuildRequires: rubygem(rake) >= 0.8.1
105
+ BuildRequires: rubygem(rack)
106
+ BuildRequires: rubygem(fastthread) >= 1.0.1
107
+ %if %{?fedora:1}%{?!fedora:0}
108
+ BuildRequires: libcurl-devel
109
+ BuildRequires: source-highlight
110
+ %else
111
+ BuildRequires: curl-devel
112
+ %endif
113
+ BuildRequires: doxygen
114
+ BuildRequires: asciidoc
115
+ BuildRequires: graphviz
116
+ # standaline build deps
117
+ %if %{?fedora:1}%{?!fedora:0}
118
+ BuildRequires: libev-devel
119
+ %endif
120
+ BuildRequires: rubygem(daemon_controller) >= 0.2.5
121
+ BuildRequires: rubygem(file-tail)
122
+ # native build deps
123
+ %if %{?fedora:1}%{?!fedora:0}
124
+ BuildRequires: selinux-policy
125
+ %else
126
+ BuildRequires: selinux-policy-devel
127
+ %endif
128
+ # nginx build deps
129
+ BuildRequires: pcre-devel
130
+ BuildRequires: zlib-devel
131
+ BuildRequires: openssl-devel
132
+ %if %{?fedora:1}%{?!fedora:0}
133
+ BuildRequires: perl-devel
134
+ %else
135
+ BuildRequires: perl
136
+ %endif
137
+ BuildRequires: perl(ExtUtils::Embed)
138
+ BuildRequires: libxslt-devel
139
+ BuildRequires: GeoIP-devel
140
+ BuildRequires: gd-devel
141
+ # Can't have a noarch package with an arch'd subpackage
142
+ #BuildArch: noarch
143
+ Provides: rubygem(%{gemname}) = %{passenger_version}
144
+ Epoch: %{passenger_epoch}
145
+
146
+ %description
147
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
148
+ of Ruby web applications, such as those built on the revolutionary
149
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
150
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
151
+
152
+ %if %{gem_version_mismatch}
153
+ **NOTE: Because the default Gem::Version doesn't accept the correct
154
+ version, it is installed as %{gemversion} instead of %{passenger_version}.
155
+ %endif
156
+
157
+ %if !%{only_native_libs}
158
+
159
+ %package native
160
+ Summary: Phusion Passenger native extensions
161
+ Group: System Environment/Daemons
162
+ Requires: %{name} = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
163
+ %if %{?fedora:1}%{?!fedora:0}
164
+ Requires: libev
165
+ %endif
166
+ Requires(post): policycoreutils, initscripts
167
+ Requires(preun): policycoreutils, initscripts
168
+ Requires(postun): policycoreutils
169
+ Epoch: %{passenger_epoch}
170
+ %description native
171
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
172
+ of Ruby web applications, such as those built on the revolutionary
173
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
174
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
175
+
176
+ This package contains the native code extensions for Apache & Nginx bindings
177
+
178
+ %endif #! only_native_libs
179
+
180
+ %package native-libs
181
+ Summary: Phusion Passenger native extensions
182
+ Group: System Environment/Daemons
183
+ Release: %{native_libs_release}
184
+ Epoch: %{passenger_epoch}
185
+ Requires: %{name}-native = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
186
+ Requires: ruby = %{ruby_version_patch}
187
+ Provides: rubygem-passenger-native-libs = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
188
+ %description native-libs
189
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
190
+ of Ruby web applications, such as those built on the revolutionary
191
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
192
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
193
+
194
+ This package contains the native shared library for Apache & Nginx
195
+ bindings, built against ruby sources. It has been separated so that
196
+ installing a new ruby interpreter only necessitates rebuilding this
197
+ package.
198
+
199
+ %if !%{only_native_libs}
200
+
201
+ %package -n passenger-standalone
202
+ Summary: Standalone Phusion Passenger Server
203
+ Group: System Environment/Daemons
204
+ Requires: %{name} = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
205
+ %if %{?fedora:1}%{?!fedora:0}
206
+ Requires: libev
207
+ %endif
208
+ Epoch: %{passenger_epoch}
209
+ Obsoletes: rubygem-passenger-standalone
210
+ Provides: rubygem-passenger-standalone
211
+ %description -n passenger-standalone
212
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
213
+ of Ruby web applications, such as those built on the revolutionary
214
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
215
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
216
+
217
+ This package contains the standalone Passenger server
218
+
219
+ %package -n mod_passenger
220
+ Summary: Apache Module for Phusion Passenger
221
+ Group: System Environment/Daemons
222
+ Requires: %{name}-native = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
223
+ #BuildArch: %_target_arch
224
+ Obsoletes: rubygem-passenger-apache
225
+ Epoch: %{passenger_epoch}
226
+ %description -n mod_passenger
227
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
228
+ of Ruby web applications, such as those built on the revolutionary
229
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
230
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
231
+
232
+ This package contains the pluggable Apache server module for Passenger.
233
+
234
+ %package -n nginx-passenger
235
+ Summary: nginx server with Phusion Passenger enabled
236
+ Group: System Environment/Daemons
237
+ Requires: %{name} = %{passenger_epoch}:%{passenger_version}
238
+ Version: %{nginx_version}
239
+ Release: %{passenger_version}_%{passenger_release}
240
+ Requires: %{name}-native-libs = %{passenger_epoch}:%{passenger_version}-%{passenger_release}
241
+ Requires: pcre
242
+ Requires: zlib
243
+ Requires: openssl
244
+ Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
245
+ Requires: GeoIP
246
+ Requires: gd
247
+ Requires: nginx-alternatives
248
+ Epoch: %{passenger_epoch}
249
+ %description -n nginx-passenger
250
+ Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment
251
+ of Ruby web applications, such as those built on the revolutionary
252
+ Ruby on Rails web framework, a breeze. It follows the usual Ruby on
253
+ Rails conventions, such as “Don’t-Repeat-Yourself”.
254
+
255
+ This package includes an nginx server with Passenger compiled in.
256
+
257
+ %endif # !only_native_libs
258
+
259
+ %define perlfileckinner $SIG{__WARN__} = sub {die @_};
260
+ %define perlfileck BEGIN { %perlfileckinner } ;
261
+ %define perlfileescd %(echo '%{perlfileck}' | sed -e 's/[$@]/\\\\&/g')
262
+
263
+ %prep
264
+ %setup -q -n %{gemname}-%{passenger_version} -b 1
265
+ # %setup -q -T -D -n nginx-%{nginx_version} -a 300
266
+ # # Fix the CWD
267
+ # %setup -q -T -D -n %{gemname}-%{passenger_version}
268
+ %patch0 -p1
269
+
270
+ # Rather than hard-coding the path into the patch, change it here so
271
+ # that it's consistent with the %{ruby} macro, which might be defined on
272
+ # the command-line (4 %'s = 2)
273
+ perl -pi -e '%{perlfileck} s{%%%%GEM_INSTALL_DIR%%%%}{%{geminstdir}};s{%%%%APACHE_INSTALLED_MOD%%%%}{%{_libdir}/httpd/modules/mod_passenger.so}' lib/phusion_passenger.rb ext/common/ResourceLocator.h
274
+
275
+ %if %{gem_version_mismatch}
276
+ %{warn:
277
+ ***
278
+ *** WARNING: Your Gem::Version crashes on '%{passenger_version},'
279
+ *** Falling back to use '%gemversion' internally
280
+ ***
281
+
282
+ }
283
+ # Use sed rather than a patch, so it's more resilliant to version changes
284
+ sed -i -e "s/\(^[ \t]VERSION_STRING *= *'[0-9]\+\.[0-9]\+\.[0-9]\+\)[^']\+/\1/" lib/phusion_passenger.rb
285
+ sed -i -e 's/^\(#define PASSENGER_VERSION "[0-9]\+\.[0-9]\+\.[0-9]\+\)[^"]\+/\1/' ext/common/Constants.h
286
+ %endif
287
+
288
+ # Fix the preferred version
289
+ perl -pi -e "s{(PREFERRED_NGINX_VERSION\s*=\s*(['\"]))[\d\.]+\2}{\${1}%{nginx_version}\$2}" lib/phusion_passenger.rb
290
+
291
+ # RPM finds these in shebangs and assumes they're requirements. Clean them up here rather than in the install-dir.
292
+ find test -type f -print0 | xargs -0 perl -pi -e '%{perlfileck} s{#!(/opt/ruby.*|/usr/bin/ruby1.8)}{%{ruby}}g'
293
+
294
+
295
+ %build
296
+ %if %{?fedora:1}%{?!fedora:0}
297
+ export USE_VENDORED_LIBEV=false
298
+ # This isn't honored
299
+ # export CFLAGS='%optflags -I/usr/include/libev'
300
+ export LIBEV_CFLAGS='-I/usr/include/libev'
301
+ export LIBEV_LIBS='-lev'
302
+ %endif
303
+
304
+ %if %{only_native_libs}
305
+ %{rake} native_support
306
+ %else
307
+ %{rake} package
308
+ %{rake} apache2
309
+
310
+ ### SELINUX
311
+ rm -rf selinux
312
+ mkdir selinux
313
+ cd selinux
314
+ cp %{SOURCE200} .
315
+ echo '%{geminstdir}/agents/((apache2|nginx)/)?Passenger.* system_u:object_r:httpd_exec_t:s0' > rubygem-passenger.fc
316
+ echo '%{_var}/log/passenger-analytics system_u:object_r:httpd_log_t:s0' >> rubygem-passenger.fc
317
+ touch rubygem-passenger.if
318
+ make -f %{sharedir}/selinux/devel/Makefile
319
+ cd ..
320
+
321
+ ### NGINX
322
+ cd ../nginx-%{nginx_version}
323
+
324
+ #export FAIRDIR=%{_builddir}/nginx-%{nginx_version}/gnosek-nginx-upstream-fair-*
325
+ # I'm not sure why this fails on RHEL but not Fedora. I guess GCC 4.4 is
326
+ # smarter about it than 4.1? It feels wrong to do this, but I don't see
327
+ # an easier way out.
328
+ %if %{?fedora:1}%{?!fedora:0}
329
+ %define nginx_ccopt %{optflags}
330
+ %else
331
+ %define nginx_ccopt %(echo "%{optflags}" | sed -e 's/SOURCE=2/& -Wno-unused/')
332
+ %endif
333
+
334
+ ### Stolen [and hacked] from the nginx spec file
335
+ export DESTDIR=%{buildroot}
336
+ ./configure \
337
+ --user=%{nginx_user} \
338
+ --group=%{nginx_group} \
339
+ --prefix=%{nginx_datadir} \
340
+ --sbin-path=%{_sbindir}/nginx.passenger \
341
+ --conf-path=%{nginx_confdir}/nginx.conf \
342
+ --error-log-path=%{nginx_logdir}/error.log \
343
+ --http-log-path=%{nginx_logdir}/access.log \
344
+ --http-client-body-temp-path=%{nginx_home_tmp}/client_body \
345
+ --http-proxy-temp-path=%{nginx_home_tmp}/proxy \
346
+ --http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
347
+ --http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \
348
+ --http-scgi-temp-path=%{nginx_home_tmp}/scgi \
349
+ --pid-path=%{_localstatedir}/run/nginx.pid \
350
+ --lock-path=%{_localstatedir}/lock/subsys/nginx \
351
+ --with-http_ssl_module \
352
+ --with-http_realip_module \
353
+ --with-http_addition_module \
354
+ --with-http_xslt_module \
355
+ --with-http_image_filter_module \
356
+ --with-http_geoip_module \
357
+ --with-http_sub_module \
358
+ --with-http_dav_module \
359
+ --with-http_flv_module \
360
+ --with-http_gzip_static_module \
361
+ --with-http_random_index_module \
362
+ --with-http_secure_link_module \
363
+ --with-http_degradation_module \
364
+ --with-http_stub_status_module \
365
+ --with-http_perl_module \
366
+ --with-mail \
367
+ --with-file-aio \
368
+ --with-mail_ssl_module \
369
+ --with-ipv6 \
370
+ --with-cc-opt="%{nginx_ccopt} $(pcre-config --cflags)" \
371
+ --with-ld-opt="-Wl,-E" # so the perl module finds its symbols
372
+
373
+ # THIS is ugly (yet now greatly simplified). It corrects the
374
+ # check-buildroot error on the string saved for 'nginx -V'
375
+ #
376
+ # In any case, fix it correctly later
377
+ perl -pi -e '%{perlfileck} s<%{buildroot}><>g;s<%{_builddir}><%%{_builddir}>g;' objs/ngx_auto_config.h
378
+
379
+ # Also do it for passenger-standalone (and I thought the above was ugly)
380
+ perl -pi.nohack -0777 -e 's!(^\s*run_command_with_throbber.*"Preparing Nginx...".*\n(\s*))(yield.*?\n)!${2}\@\@hack_success = false\n$1yield_result = $3${2}abort "nginx-hack failed" unless \@\@hack_success || system(*(%w{perl -pi -e} + ["%{perlfileescd} s<%{buildroot}><>g;s<%{_builddir}><%%{_builddir}>g;", "objs/ngx_auto_config.h"]))\n${2}\# Why is this running many times?\n${2}\@\@hack_success = true\n${2}yield_result\n!im' %{_builddir}/passenger-%{passenger_version}/lib/phusion_passenger/standalone/runtime_installer.rb
381
+
382
+ make %{?_smp_mflags}
383
+
384
+ cd -
385
+ %endif # !only_native_libs
386
+
387
+ %install
388
+ %if %{?fedora:1}%{?!fedora:0}
389
+ export USE_VENDORED_LIBEV=false
390
+ # This isn't honored
391
+ # export CFLAGS='%optflags -I/usr/include/libev'
392
+ export LIBEV_CFLAGS='-I/usr/include/libev'
393
+ export LIBEV_LIBS='-lev'
394
+ %endif
395
+
396
+ rm -rf %{buildroot}
397
+ mkdir -p %{buildroot}%{gemdir}
398
+
399
+ %if !%{only_native_libs}
400
+ %{gem} install --local --install-dir %{buildroot}%{gemdir} \
401
+ --force --rdoc pkg/%{gemname}-%{gemversion}.gem
402
+ mkdir -p %{buildroot}/%{_bindir}
403
+ mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
404
+ rmdir %{buildroot}%{gemdir}/bin
405
+ # Nothing there
406
+ # find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
407
+
408
+ mkdir -p %{buildroot}/%{_libdir}/httpd/modules
409
+ install -m 0644 ext/apache2/mod_passenger.so %{buildroot}/%{_libdir}/httpd/modules
410
+
411
+ mkdir -p %{buildroot}/%{nginx_datadir}
412
+ mkdir -p %{buildroot}/%{nginx_datadir}
413
+ mkdir -p %{buildroot}/%{nginx_confdir}
414
+ mkdir -p %{buildroot}/%{nginx_logdir}
415
+ mkdir -p %{buildroot}/%{httpd_confdir}
416
+ mkdir -p %{buildroot}/%{_var}/log/passenger-analytics
417
+
418
+ # I should probably figure out how to get these into the gem
419
+ cp -ra agents %{buildroot}/%{geminstdir}
420
+
421
+ # PASSENGER STANDALONE (this is going to recompile nginx)
422
+ %{ruby} ./bin/passenger package-runtime --nginx-version %{nginx_version} --nginx-tarball %{SOURCE1} %{buildroot}/%{_var}/lib/passenger-standalone
423
+ # Now unpack the tarballs it just created
424
+ # It's 2am, revisit this insanity in the light of morning
425
+ standalone_dir=$(bash -c 'ls -d $1 | tail -1' -- %{buildroot}/%{_var}/lib/passenger-standalone/%{passenger_version}-*)
426
+ native_dir=%{buildroot}/%{_var}/lib/passenger-standalone/natively-packaged
427
+
428
+ mkdir -p $standalone_dir/support
429
+ mkdir -p $standalone_dir/nginx-%{nginx_version}
430
+ tar -zx -C $standalone_dir/nginx-%{nginx_version} -f $standalone_dir/nginx-%{nginx_version}.tar.gz
431
+ tar -zx -C $standalone_dir/support -f $standalone_dir/support.tar.gz
432
+
433
+ # Hong Li says the binaries are relocatable, so we don't have to jump
434
+ # through hoops to change directories. Just move it.
435
+ mv $standalone_dir $native_dir
436
+ mv $native_dir/support/ext/ruby/*-linux $native_dir/support/ext/ruby/native
437
+
438
+ # Unhack
439
+ mv lib/phusion_passenger/standalone/runtime_installer.rb.nohack lib/phusion_passenger/standalone/runtime_installer.rb
440
+ install -m 0644 lib/phusion_passenger/standalone/runtime_installer.rb $native_dir/support/lib/phusion_passenger/standalone/runtime_installer.rb
441
+
442
+ # SELINUX
443
+ install -p -m 644 -D selinux/%{name}.pp %{buildroot}%{sharedir}/selinux/packages/%{name}/%{name}.pp
444
+
445
+ # NGINX
446
+ cd ../nginx-%{nginx_version}
447
+ make install DESTDIR=%{buildroot} INSTALLDIRS=vendor
448
+ cd -
449
+
450
+ %endif #!only_native_libs
451
+
452
+ ##### NATIVE LIBS INSTALL
453
+ mkdir -p %{buildroot}/%{geminstdir}/ext/ruby/native
454
+ cp -ra ext/ruby/*-linux/* %{buildroot}/%{geminstdir}/ext/ruby/native
455
+
456
+ %if !%{only_native_libs}
457
+ #### Clean up everything we don't care about
458
+ rm -rf %{buildroot}/usr/share/nginx %{buildroot}/%{nginx_confdir}
459
+ # # Assume the old version is good enough. Probably not wise.
460
+ # rm -rf %{buildroot}%{perldir} %{buildroot}%{_mandir}/man3/nginx.3pm*
461
+ rm -f %{buildroot}%{perldir}/{auto/nginx/.packlist,perllocal.pod}
462
+ # RHEL distinguishes these dirs
463
+ rm -f %{buildroot}%(perl -MConfig -e 'print $Config{installarchlib}')/perllocal.pod
464
+ mv %{buildroot}%{perldir}/auto/nginx/nginx{,_passenger}.bs
465
+ mv %{buildroot}%{perldir}/auto/nginx/nginx{,_passenger}.so
466
+ mv %{buildroot}%{perldir}/nginx{,_passenger}.pm
467
+ mv %{buildroot}%{_mandir}/man3/nginx.3pm{,_passenger}
468
+
469
+ install -p -d -m 0755 %{buildroot}/%{nginx_confdir}/conf.d
470
+ #install -m 0644 %{SOURCE100} %{buildroot}/%{httpd_confdir}/passenger.conf
471
+ #install -m 0644 %{SOURCE101} %{buildroot}/%{nginx_confdir}/conf.d/passenger.conf
472
+ perl -pe 's{%%ROOT}{%geminstdir}g;s{%%RUBY}{%ruby}g' %{SOURCE100} > %{buildroot}/%{httpd_confdir}/passenger.conf
473
+ perl -pe 's{%%ROOT}{%geminstdir}g;s{%%RUBY}{%ruby}g' %{SOURCE101} > %{buildroot}/%{nginx_confdir}/conf.d/passenger.conf
474
+
475
+ # CLEANUP
476
+ rm -f $native_dir/support/ext/ruby/native/mkmf.log
477
+ # Reversed logic from most other tests
478
+ %if %{?fedora:0}%{?!fedora:1}
479
+ rm -f $native_dir/support/ext/libev/config.log
480
+ %endif
481
+
482
+ # REMOVE THIS TO FORCE 'native-packaged' (it's still in doc)
483
+ rm %{buildroot}/%{geminstdir}/DEVELOPERS.TXT
484
+
485
+ # This is still needed
486
+ %if %{?fedora:1}%{?!fedora:0}
487
+ %define libevmunge %nil
488
+ %else
489
+ %define libevmunge $native_dir/support/ext/libev/config.status $native_dir/support/ext/libev/Makefile
490
+ %endif
491
+
492
+ perl -pi -e '%perlfileck s{%buildroot}{}g;s<%{_builddir}><%%{_builddir}>g' \
493
+ $native_dir/support/ext/ruby/native/Makefile %{libevmunge}
494
+
495
+ %define base_files base-package-files
496
+
497
+ ### BUILD FILE LIST (To remove files from the base package that will be installed by subpackages)
498
+ cat <<EOF > %{base_files}
499
+ %defattr(-, root, root, -)
500
+ %doc %{gemdir}/doc/%{gemname}-%{gemversion}
501
+ %doc README
502
+ %doc DEVELOPERS.TXT
503
+ %{_bindir}/passenger-install-apache2-module
504
+ %{_bindir}/passenger-install-nginx-module
505
+ %{_bindir}/passenger-config
506
+ %{_bindir}/passenger-status
507
+ %{_bindir}/passenger-memory-stats
508
+ %{_bindir}/passenger-make-enterprisey
509
+ %{gemdir}/cache/%{gemname}-%{gemversion}.gem
510
+ %{gemdir}/specifications/%{gemname}-%{gemversion}.gemspec
511
+ EOF
512
+
513
+ # This feels wrong (reordering arch & os) but if it helps....
514
+ # ...Going one step further and also stripping all the installed *.o files
515
+ # Move the file find here to catch the byte-compiled Python files
516
+ %define __spec_install_post \
517
+ %{?__debug_package:%{__debug_install_post}} \
518
+ %{__os_install_post} \
519
+ find $native_dir -name \*.o -o -name \*.so | xargs strip ; \
520
+ find %{buildroot}/%{geminstdir} \\( -type d \\( -name native -o -name agents \\) \\) -prune -o \\( -type f -print \\) | perl -pe 's{^%{buildroot}}{};s{^//}{/};s/([?|*'\\''\"])/\\\\$1/g;s{(^|\\n$)}{\"$&}g' >> %{base_files} \
521
+ %{__arch_install_post}
522
+
523
+ %post -n nginx-passenger
524
+ if [ $1 == 1 ]; then
525
+ /usr/sbin/alternatives --install /usr/sbin/nginx nginx \
526
+ /usr/sbin/nginx.passenger 50 \
527
+ --slave %{perldir}/auto/nginx/nginx.so nginx.so \
528
+ %{perldir}/auto/nginx/nginx_passenger.so \
529
+ --slave %{perldir}/auto/nginx/nginx.bs nginx.bs \
530
+ %{perldir}/auto/nginx/nginx_passenger.bs \
531
+ --slave %{perldir}/nginx.pm nginx.pm %{perldir}/nginx_passenger.pm \
532
+ --slave %{_mandir}/man3/nginx.3pm.gz nginx.man \
533
+ %{_mandir}/man3/nginx_passenger.3pm.gz
534
+ fi
535
+
536
+ %postun -n nginx-passenger
537
+ if [ $1 == 0 ]; then
538
+ /usr/sbin/alternatives --remove nginx /usr/sbin/nginx.passenger
539
+ fi
540
+
541
+ %post native
542
+ if [ "$1" -le "1" ] ; then # First install
543
+ semodule -i %{sharedir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || :
544
+ fixfiles -R %{name} restore
545
+ fixfiles -R %{name}-native restore
546
+ fi
547
+
548
+ %preun native
549
+ if [ "$1" -lt "1" ] ; then # Final removal
550
+ semodule -r rubygem_%{gemname} 2>/dev/null || :
551
+ fixfiles -R %{name} restore
552
+ fixfiles -R %{name}-native restore
553
+ fi
554
+
555
+ %postun native
556
+ if [ "$1" -ge "1" ] ; then # Upgrade
557
+ semodule -i %{sharedir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || :
558
+ fi
559
+ %endif # !only_native_libs
560
+
561
+ %clean
562
+ rm -rf %{buildroot}
563
+
564
+ %if !%{only_native_libs}
565
+ %files -f %{base_files}
566
+
567
+ %files native
568
+ %{geminstdir}/agents
569
+ %{sharedir}/selinux/packages/%{name}/%{name}.pp
570
+ %{_var}/log/passenger-analytics
571
+
572
+ %files -n passenger-standalone
573
+ %doc doc/Users\ guide\ Standalone.html
574
+ %doc doc/Users\ guide\ Standalone.txt
575
+ %{_bindir}/passenger
576
+ %{_var}/lib/passenger-standalone/natively-packaged/
577
+
578
+ %files -n mod_passenger
579
+ %doc doc/Users\ guide\ Apache.html
580
+ %doc doc/Users\ guide\ Apache.txt
581
+ %{_libdir}/httpd/modules/mod_passenger.so
582
+ %config %{httpd_confdir}/passenger.conf
583
+
584
+ %files -n nginx-passenger
585
+ %doc doc/Users\ guide\ Nginx.html
586
+ %doc doc/Users\ guide\ Nginx.txt
587
+ %config %{nginx_confdir}/conf.d/passenger.conf
588
+ /usr/sbin/nginx.passenger
589
+ %{perldir}/auto/nginx/nginx*
590
+ %{perldir}/nginx*
591
+ %{_mandir}/man3/nginx*
592
+ %endif # !only_native_libs
593
+
594
+ %files native-libs
595
+ # %{geminstdir}/ext/ruby/%{gemnativedir}
596
+ %{geminstdir}/ext/ruby/native
597
+
598
+
599
+ %changelog
600
+ * Thu Dec 16 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.2-1
601
+ - Bump to 3.0.2
602
+
603
+ * Mon Dec 13 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-4
604
+ - rename rubygem-passenger-standalone to passenger-standalone
605
+ - Add graphviz to the build requirements (for /usr/bin/dot)
606
+
607
+ * Thu Dec 2 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-3
608
+ - Stop double-packaging files from -native & -native-libs in the base package
609
+
610
+ * Tue Nov 30 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-2
611
+ - Remove (most of) the kludges to remove %%{builddir} from installed files.
612
+ - Blessed natively-packaged patch from Hong Li
613
+ - Migration to the more static directory structure
614
+
615
+ * Mon Nov 29 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.1-1
616
+ - Integration into passenger source
617
+ - Bump to 3.0.1
618
+
619
+ * Mon Nov 15 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-11
620
+ - Fix passenger-standalone
621
+
622
+ * Fri Nov 12 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-10
623
+ - Bump nginx to version 0.8.53 and build it by hand based on the newer
624
+ nginx specfile
625
+
626
+ * Sun Nov 7 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-9
627
+ - Add passenger-analytics directory, so the server doesn't try to create
628
+ it. (SELinux violation)
629
+
630
+ * Sun Oct 31 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-8
631
+ - Fix embedded Perl module
632
+
633
+ * Fri Oct 29 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-7
634
+ - Add back all the missing directives from nginx.spec (Perl is
635
+ untested and may be broken)
636
+
637
+ * Fri Oct 29 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-6
638
+ - Add upstream-fair load-balancer back to nginx
639
+ - Add the original CFLAGS back to nginx (with -Wno-unused kludge for RHEL5)
640
+
641
+ * Sat Oct 23 2010 Erik Ogan <erik@cloudshield.com> - 3.0.0-5
642
+ - RHEL/CentOS Ruby is too old to support RUBY_PATCHLEVEL
643
+
644
+ * Sat Oct 23 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-4
645
+ - --define 'only_native_libs 1' to rebuild native_support.so for a
646
+ different ruby engine.
647
+ - make sure native-libs release includes passenger release and ruby patch level
648
+ - remove the macros that rely on %%{_builddir} already being unpacked
649
+
650
+ * Fri Oct 22 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-3
651
+ - Break the passenger_native_support.so into its own package
652
+
653
+ * Thu Oct 21 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-2
654
+ - rename rubygem-passenger-apache => mod_passenger
655
+
656
+ * Thu Oct 21 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0-1
657
+ - Version bump to 3.0.0
658
+
659
+ * Wed Oct 18 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0.pre4-2
660
+ - use nginx-alternatives
661
+
662
+ * Sun Oct 17 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0.pre4-1
663
+ - Nginx suport
664
+
665
+ * Mon Oct 11 2010 Erik Ogan <erik@stealthymonkeys.com> - 3.0.0.pre4-0
666
+ - Test for Gem::Version issues with the version and work around it.
667
+ - Initial Spec File