summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /www-apache/passenger/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'www-apache/passenger/files')
-rw-r--r--www-apache/passenger/files/2.2.15-gentoo-multilib-strict.patch33
-rw-r--r--www-apache/passenger/files/2.2.4-gentoo.patch42
-rw-r--r--www-apache/passenger/files/30_mod_passenger-2.0.1.conf63
-rw-r--r--www-apache/passenger/files/30_mod_passenger-4.0.0.conf63
-rw-r--r--www-apache/passenger/files/30_mod_passenger-5.0.0.conf63
-rw-r--r--www-apache/passenger/files/passenger-3.0.0-gentoo.patch34
-rw-r--r--www-apache/passenger/files/passenger-3.0.0-ldflags.patch13
-rw-r--r--www-apache/passenger/files/passenger-3.0.12-ldflags.patch10
-rw-r--r--www-apache/passenger/files/passenger-3.0.21-temp-file-usage.patch140
-rw-r--r--www-apache/passenger/files/passenger-3.0.8-gentoo.patch35
-rw-r--r--www-apache/passenger/files/passenger-4.0.10-gentoo.patch48
-rw-r--r--www-apache/passenger/files/passenger-4.0.18-gentoo.patch39
-rw-r--r--www-apache/passenger/files/passenger-4.0.21-gentoo.patch40
-rw-r--r--www-apache/passenger/files/passenger-4.0.33-gentoo.patch30
-rw-r--r--www-apache/passenger/files/passenger-4.0.49-gentoo.patch30
-rw-r--r--www-apache/passenger/files/passenger-5.0.4-gentoo.patch30
16 files changed, 713 insertions, 0 deletions
diff --git a/www-apache/passenger/files/2.2.15-gentoo-multilib-strict.patch b/www-apache/passenger/files/2.2.15-gentoo-multilib-strict.patch
new file mode 100644
index 000000000000..ff6cefc7dfdd
--- /dev/null
+++ b/www-apache/passenger/files/2.2.15-gentoo-multilib-strict.patch
@@ -0,0 +1,33 @@
+diff -Nuar passenger-2.2.15.orig/Rakefile passenger-2.2.15/Rakefile
+--- passenger-2.2.15.orig/Rakefile 2010-11-05 03:19:02.000000000 +0000
++++ passenger-2.2.15/Rakefile 2010-11-05 03:23:45.000000000 +0000
+@@ -744,7 +744,7 @@
+ extdir = "#{libdir}/#{CONFIG['arch']}"
+ bindir = "#{fakeroot}/usr/bin"
+ docdir = "#{fakeroot}/usr/share/doc/passenger-#{PACKAGE_VERSION}"
+- libexecdir = "#{fakeroot}/usr/lib/phusion_passenger"
++ libexecdir = "#{fakeroot}/usr/libexec/phusion_passenger"
+
+ sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+diff -Nuar passenger-2.2.15.orig/ext/common/Utils.cpp passenger-2.2.15/ext/common/Utils.cpp
+--- passenger-2.2.15.orig/ext/common/Utils.cpp 2010-06-24 11:53:02.000000000 +0000
++++ passenger-2.2.15/ext/common/Utils.cpp 2010-11-05 03:22:39.000000000 +0000
+@@ -113,7 +113,7 @@
+ return path;
+ } else {
+ path.assign(root);
+- path.append("lib/phusion_passenger/passenger-spawn-server");
++ path.append("libexec/phusion_passenger/passenger-spawn-server");
+ return path;
+ }
+ return path;
+@@ -152,7 +152,7 @@
+ return path;
+ } else {
+ path.assign(root);
+- path.append("lib/phusion_passenger/ApplicationPoolServerExecutable");
++ path.append("libexec/phusion_passenger/ApplicationPoolServerExecutable");
+ return path;
+ }
+ }
diff --git a/www-apache/passenger/files/2.2.4-gentoo.patch b/www-apache/passenger/files/2.2.4-gentoo.patch
new file mode 100644
index 000000000000..cd51913b9099
--- /dev/null
+++ b/www-apache/passenger/files/2.2.4-gentoo.patch
@@ -0,0 +1,42 @@
+--- Rakefile.~1~ 2009-05-19 11:48:28.236986307 +0200
++++ Rakefile 2009-05-19 11:50:53.000000000 +0200
+@@ -38,11 +38,7 @@
+
+ CXX = "g++"
+ LIBEXT = PlatformInfo.library_extension
+-if OPTIMIZE
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -O2 -DBOOST_DISABLE_ASSERTS"
+-else
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS"
+-end
++OPTIMIZATION_FLAGS = "#{ENV['CXXFLAGS']} -DNDEBUG"
+
+ # Extra compiler flags that should always be passed to the C/C++ compiler.
+ # Should be included last in the command string.
+@@ -733,15 +729,15 @@
+ task :fakeroot => [:apache2, :native_support, :doc] do
+ require 'rbconfig'
+ include Config
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- libdir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}"
++ libdir = "#{fakeroot}/#{CONFIG['sitedir']}/#{CONFIG['ruby_version']}"
+ extdir = "#{libdir}/#{CONFIG['arch']}"
+ bindir = "#{fakeroot}/usr/bin"
+- docdir = "#{fakeroot}/usr/share/doc/phusion_passenger"
++ docdir = "#{fakeroot}/usr/share/doc/passenger-#{PACKAGE_VERSION}"
+ libexecdir = "#{fakeroot}/usr/lib/phusion_passenger"
+
+ sh "rm -rf #{fakeroot}"
+@@ -757,7 +753,6 @@
+ sh "cp bin/* #{bindir}/"
+
+ sh "mkdir -p #{libexecdir}"
+- sh "cp ext/apache2/mod_passenger.so #{libexecdir}/"
+ sh "mv #{fakeroot}/usr/bin/passenger-spawn-server #{libexecdir}/"
+ sh "cp ext/apache2/ApplicationPoolServerExecutable #{libexecdir}/"
+
diff --git a/www-apache/passenger/files/30_mod_passenger-2.0.1.conf b/www-apache/passenger/files/30_mod_passenger-2.0.1.conf
new file mode 100644
index 000000000000..0bd79143309e
--- /dev/null
+++ b/www-apache/passenger/files/30_mod_passenger-2.0.1.conf
@@ -0,0 +1,63 @@
+<IfDefine PASSENGER>
+LoadModule passenger_module modules/mod_passenger.so
+
+# The location to the Phusion Passenger root directory. This configuration
+# option is essential to Phusion Passenger. The correct value is given by the
+# installer, and should usually not be changed manually.
+PassengerRoot /usr
+
+# This option allows one to specify how much information Phusion Passenger
+# should write to the Apache error log file. A higher log level value means
+# that more information will be logged.
+#
+# Possible values are:
+#
+# 0: Show only errors and warnings.
+# 1: Show the most important debugging information. This might be useful for
+# system administrators who are trying to figure out the cause of a
+# problem.
+# 2: Show more debugging information. This is typically only useful for
+# developers.
+# 3: Show even more debugging information.
+PassengerLogLevel 0
+
+# This option allows one to specify the Ruby interpreter to use.
+PassengerRuby /usr/bin/ruby
+
+# Whether Passenger should automatically detect whether a virtual host's
+# document root is a Ruby on Rails application.
+RailsAutoDetect On
+
+# The maximum number of Ruby on Rails application instances that may be
+# simultaneously active. A larger number results in higher memory usage, but
+# improved ability to handle concurrent HTTP clients.
+PassengerMaxPoolSize 20
+
+# The maximum number of seconds that a Ruby on Rails application instance may
+# be idle. That is, if an application instance hasn't done anything after the
+# given number of seconds, then it will be shutdown in order to conserve
+# memory.
+PassengerPoolIdleTime 120
+
+# The maximum number of application instances that may be simultaneously active
+# for a single application. This helps to make sure that a single application
+# will not occupy all available slots in the application pool.
+#
+# This value must be less than PassengerMaxPoolSize. A value of 0 means that
+# there is no limit placed on the number of instances a single application may
+# use, i.e. only the global limit of PassengerMaxPoolSize will be enforced.
+PassengerMaxInstancesPerApp 0
+
+# When the PassengerUserSwitching option is enabled a Rails application is started
+# as the owner of the file config/environment.rb. So if
+# /home/webapps/foo/config/environment.rb is owned by joe, then Passenger will
+# launch the corresponding Rails application as joe as well.
+PassengerUserSwitching On
+
+# Under no circumstances will Rails applications be run as root. If
+# environment.rb is owned by root or by an unknown user, then the Rails
+# application will run as the user specified by PassengerDefaultUser.
+PassengerDefaultUser apache
+</IfDefine>
+
+# vim: ts=4 filetype=apache
diff --git a/www-apache/passenger/files/30_mod_passenger-4.0.0.conf b/www-apache/passenger/files/30_mod_passenger-4.0.0.conf
new file mode 100644
index 000000000000..f218b59ca412
--- /dev/null
+++ b/www-apache/passenger/files/30_mod_passenger-4.0.0.conf
@@ -0,0 +1,63 @@
+<IfDefine PASSENGER>
+LoadModule passenger_module modules/mod_passenger.so
+
+# The location to the Phusion Passenger root directory. This configuration
+# option is essential to Phusion Passenger. The correct value is given by the
+# installer, and should usually not be changed manually.
+PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
+
+# This option allows one to specify how much information Phusion Passenger
+# should write to the Apache error log file. A higher log level value means
+# that more information will be logged.
+#
+# Possible values are:
+#
+# 0: Show only errors and warnings.
+# 1: Show the most important debugging information. This might be useful for
+# system administrators who are trying to figure out the cause of a
+# problem.
+# 2: Show more debugging information. This is typically only useful for
+# developers.
+# 3: Show even more debugging information.
+PassengerLogLevel 0
+
+# This option specifies the default global version of Ruby to use.
+PassengerDefaultRuby /usr/bin/ruby
+
+# This option allows one to specify the Ruby interpreter to use for
+# specific instances.
+# PassengerRuby /usr/bin/ruby
+
+# The maximum number of Ruby on Rails application instances that may be
+# simultaneously active. A larger number results in higher memory usage, but
+# improved ability to handle concurrent HTTP clients.
+PassengerMaxPoolSize 20
+
+# The maximum number of seconds that a Ruby on Rails application instance may
+# be idle. That is, if an application instance hasn't done anything after the
+# given number of seconds, then it will be shutdown in order to conserve
+# memory.
+PassengerPoolIdleTime 120
+
+# The maximum number of application instances that may be simultaneously active
+# for a single application. This helps to make sure that a single application
+# will not occupy all available slots in the application pool.
+#
+# This value must be less than PassengerMaxPoolSize. A value of 0 means that
+# there is no limit placed on the number of instances a single application may
+# use, i.e. only the global limit of PassengerMaxPoolSize will be enforced.
+PassengerMaxInstancesPerApp 0
+
+# When the PassengerUserSwitching option is enabled a Rails application is started
+# as the owner of the file config/environment.rb. So if
+# /home/webapps/foo/config/environment.rb is owned by joe, then Passenger will
+# launch the corresponding Rails application as joe as well.
+PassengerUserSwitching On
+
+# Under no circumstances will Rails applications be run as root. If
+# environment.rb is owned by root or by an unknown user, then the Rails
+# application will run as the user specified by PassengerDefaultUser.
+PassengerDefaultUser apache
+</IfDefine>
+
+# vim: ts=4 filetype=apache
diff --git a/www-apache/passenger/files/30_mod_passenger-5.0.0.conf b/www-apache/passenger/files/30_mod_passenger-5.0.0.conf
new file mode 100644
index 000000000000..f218b59ca412
--- /dev/null
+++ b/www-apache/passenger/files/30_mod_passenger-5.0.0.conf
@@ -0,0 +1,63 @@
+<IfDefine PASSENGER>
+LoadModule passenger_module modules/mod_passenger.so
+
+# The location to the Phusion Passenger root directory. This configuration
+# option is essential to Phusion Passenger. The correct value is given by the
+# installer, and should usually not be changed manually.
+PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
+
+# This option allows one to specify how much information Phusion Passenger
+# should write to the Apache error log file. A higher log level value means
+# that more information will be logged.
+#
+# Possible values are:
+#
+# 0: Show only errors and warnings.
+# 1: Show the most important debugging information. This might be useful for
+# system administrators who are trying to figure out the cause of a
+# problem.
+# 2: Show more debugging information. This is typically only useful for
+# developers.
+# 3: Show even more debugging information.
+PassengerLogLevel 0
+
+# This option specifies the default global version of Ruby to use.
+PassengerDefaultRuby /usr/bin/ruby
+
+# This option allows one to specify the Ruby interpreter to use for
+# specific instances.
+# PassengerRuby /usr/bin/ruby
+
+# The maximum number of Ruby on Rails application instances that may be
+# simultaneously active. A larger number results in higher memory usage, but
+# improved ability to handle concurrent HTTP clients.
+PassengerMaxPoolSize 20
+
+# The maximum number of seconds that a Ruby on Rails application instance may
+# be idle. That is, if an application instance hasn't done anything after the
+# given number of seconds, then it will be shutdown in order to conserve
+# memory.
+PassengerPoolIdleTime 120
+
+# The maximum number of application instances that may be simultaneously active
+# for a single application. This helps to make sure that a single application
+# will not occupy all available slots in the application pool.
+#
+# This value must be less than PassengerMaxPoolSize. A value of 0 means that
+# there is no limit placed on the number of instances a single application may
+# use, i.e. only the global limit of PassengerMaxPoolSize will be enforced.
+PassengerMaxInstancesPerApp 0
+
+# When the PassengerUserSwitching option is enabled a Rails application is started
+# as the owner of the file config/environment.rb. So if
+# /home/webapps/foo/config/environment.rb is owned by joe, then Passenger will
+# launch the corresponding Rails application as joe as well.
+PassengerUserSwitching On
+
+# Under no circumstances will Rails applications be run as root. If
+# environment.rb is owned by root or by an unknown user, then the Rails
+# application will run as the user specified by PassengerDefaultUser.
+PassengerDefaultUser apache
+</IfDefine>
+
+# vim: ts=4 filetype=apache
diff --git a/www-apache/passenger/files/passenger-3.0.0-gentoo.patch b/www-apache/passenger/files/passenger-3.0.0-gentoo.patch
new file mode 100644
index 000000000000..695b9d542e98
--- /dev/null
+++ b/www-apache/passenger/files/passenger-3.0.0-gentoo.patch
@@ -0,0 +1,34 @@
+--- build/config.rb.~1~ 2010-10-01 12:22:34.000000000 +0200
++++ build/config.rb 2010-11-02 10:56:25.309314070 +0100
+@@ -17,11 +17,7 @@
+ OPTIMIZE = boolean_option("OPTIMIZE")
+ CC = string_option("CC", "gcc")
+ CXX = string_option("CXX", "g++")
+-if OPTIMIZE
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -O2 -DBOOST_DISABLE_ASSERTS".strip
+-else
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS".strip
+-end
++OPTIMIZATION_FLAGS = "#{ENV['CXXFLAGS']}"
+
+ # Extra compiler flags that should always be passed to the C/C++ compiler.
+ # Should be included last in the command string, even after PlatformInfo.portability_cflags.
+--- build/packaging.rb.~1~ 2010-10-10 20:52:03.000000000 +0200
++++ build/packaging.rb 2010-11-02 11:03:56.944938507 +0100
+@@ -87,13 +87,13 @@
+ require 'rbconfig'
+ require 'fileutils'
+ include Config
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- fake_libdir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}"
+- fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
++ fake_libdir = "#{fakeroot}/#{CONFIG['sitedir']}/#{CONFIG['ruby_version']}"
++ fake_native_support_dir = "#{fakeroot}/#{CONFIG['sitedir']}/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
+ fake_agents_dir = "#{fakeroot}#{NATIVELY_PACKAGED_AGENTS_DIR}"
+ fake_helper_scripts_dir = "#{fakeroot}#{NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR}"
+ fake_docdir = "#{fakeroot}#{NATIVELY_PACKAGED_DOCDIR}"
diff --git a/www-apache/passenger/files/passenger-3.0.0-ldflags.patch b/www-apache/passenger/files/passenger-3.0.0-ldflags.patch
new file mode 100644
index 000000000000..dd378addf7a5
--- /dev/null
+++ b/www-apache/passenger/files/passenger-3.0.0-ldflags.patch
@@ -0,0 +1,13 @@
+--- build/config.rb.~1~ 2010-11-07 11:46:22.257690348 +0100
++++ build/config.rb 2010-11-07 12:41:40.601438803 +0100
+@@ -25,7 +25,7 @@
+
+ # Extra linker flags that should always be passed to the linker.
+ # Should be included last in the command string, even after PlatformInfo.portability_ldflags.
+-EXTRA_LDFLAGS = ""
++EXTRA_LDFLAGS = "#{ENV['LDFLAGS']}"
+
+ # Whether to use the vendored libev or the system one.
+-USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
+\ No newline at end of file
++USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
diff --git a/www-apache/passenger/files/passenger-3.0.12-ldflags.patch b/www-apache/passenger/files/passenger-3.0.12-ldflags.patch
new file mode 100644
index 000000000000..de724eff30a8
--- /dev/null
+++ b/www-apache/passenger/files/passenger-3.0.12-ldflags.patch
@@ -0,0 +1,10 @@
+--- build/config.rb.~1~ 2010-11-07 11:46:22.257690348 +0100
++++ build/config.rb 2010-11-07 12:41:40.601438803 +0100
+@@ -25,6 +25,6 @@
+
+ # Extra linker flags that should always be passed to the linker.
+ # Should be included last in the command string, even after PlatformInfo.portability_ldflags.
+-EXTRA_LDFLAGS = ""
++EXTRA_LDFLAGS = "#{ENV['LDFLAGS']}"
+
+ # Whether to use the vendored libev or the system one.
diff --git a/www-apache/passenger/files/passenger-3.0.21-temp-file-usage.patch b/www-apache/passenger/files/passenger-3.0.21-temp-file-usage.patch
new file mode 100644
index 000000000000..54f227f78c6b
--- /dev/null
+++ b/www-apache/passenger/files/passenger-3.0.21-temp-file-usage.patch
@@ -0,0 +1,140 @@
+--- passenger-release-3.0.21.orig/ext/common/LoggingAgent/Main.cpp 2013-05-29 07:09:31.000000000 -0500
++++ passenger-release-3.0.21.orig/ext/common/LoggingAgent/Main.cpp 2013-07-18 09:35:47.514433743 -0500
+@@ -265,11 +265,6 @@ main(int argc, char *argv[]) {
+ ev::sig sigtermWatcher(eventLoop);
+ ev::sig sigquitWatcher(eventLoop);
+
+- if (feedbackFdAvailable()) {
+- feedbackFdWatcher.set<&feedbackFdBecameReadable>();
+- feedbackFdWatcher.start(FEEDBACK_FD, ev::READ);
+- writeArrayMessage(FEEDBACK_FD, "initialized", NULL);
+- }
+ sigintWatcher.set<&caughtExitSignal>();
+ sigintWatcher.start(SIGINT);
+ sigtermWatcher.set<&caughtExitSignal>();
+@@ -281,6 +276,11 @@ main(int argc, char *argv[]) {
+ /********** Initialized! Enter main loop... **********/
+
+ P_DEBUG("Logging agent online, listening at " << socketAddress);
++ if (feedbackFdAvailable()) {
++ feedbackFdWatcher.set<&feedbackFdBecameReadable>();
++ feedbackFdWatcher.start(FEEDBACK_FD, ev::READ);
++ writeArrayMessage(FEEDBACK_FD, "initialized", NULL);
++ }
+ ev_loop(eventLoop, 0);
+ return exitCode;
+ } catch (const tracable_exception &e) {
+--- passenger-release-3.0.21.orig/ext/common/ServerInstanceDir.h 2013-05-29 07:09:31.000000000 -0500
++++ passenger-release-3.0.21.orig/ext/common/ServerInstanceDir.h 2013-07-18 09:38:54.431808622 -0500
+@@ -30,6 +30,7 @@
+ #include <oxt/backtrace.hpp>
+
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <dirent.h>
+ #include <unistd.h>
+ #include <pwd.h>
+@@ -38,6 +39,7 @@
+ #include <cstring>
+ #include <string>
+
++#include <Logging.h>
+ #include "Exceptions.h"
+ #include "Utils.h"
+ #include "Utils/StrIntUtils.h"
+@@ -217,7 +219,69 @@ private:
+ * rights though, because we want admin tools to be able to list the available
+ * generations no matter what user they're running as.
+ */
+- makeDirTree(path, "u=rwxs,g=rx,o=rx");
++ if (owner) {
++ switch (getFileType(path)) {
++ case FT_NONEXISTANT:
++ createDirectory(path);
++ break;
++ case FT_DIRECTORY:
++ verifyDirectoryPermissions(path);
++ break;
++ default:
++ throw RuntimeException("'" + path + "' already exists, and is not a directory");
++ }
++ } else if (getFileType(path) != FT_DIRECTORY) {
++ throw RuntimeException("Server instance directory '" + path +
++ "' does not exist");
++ }
++ }
++
++ void createDirectory(const string &path) const {
++ // We do not use makeDirTree() here. If an attacker creates a directory
++ // just before we do, then we want to abort because we want the directory
++ // to have specific permissions.
++ if (mkdir(path.c_str(), parseModeString("u=rwx,g=rx,o=rx")) == -1) {
++ int e = errno;
++ throw FileSystemException("Cannot create server instance directory '" +
++ path + "'", e, path);
++ }
++ // verifyDirectoryPermissions() checks for the owner/group so we must make
++ // sure the server instance directory has that owner/group, even when the
++ // parent directory has setgid on.
++ if (chown(path.c_str(), geteuid(), getegid()) == -1) {
++ int e = errno;
++ throw FileSystemException("Cannot change the permissions of the server "
++ "instance directory '" + path + "'", e, path);
++ }
++ }
++
++ /**
++ * When reusing an existing server instance directory, check permissions
++ * so that an attacker cannot pre-create a directory with too liberal
++ * permissions.
++ */
++ void verifyDirectoryPermissions(const string &path) {
++ TRACE_POINT();
++ struct stat buf;
++
++ if (stat(path.c_str(), &buf) == -1) {
++ int e = errno;
++ throw FileSystemException("Cannot stat() " + path, e, path);
++ } else if (buf.st_mode != (S_IFDIR | parseModeString("u=rwx,g=rx,o=rx"))) {
++ throw RuntimeException("Tried to reuse existing server instance directory " +
++ path + ", but it has wrong permissions");
++ } else if (buf.st_uid != geteuid() || buf.st_gid != getegid()) {
++ /* The server instance directory is always created by the Watchdog. Its UID/GID never
++ * changes because:
++ * 1. Disabling user switching only lowers the privilege of the HelperAgent.
++ * 2. For the UID/GID to change, the web server must be completely restarted
++ * (not just graceful reload) so that the control process can change its UID/GID.
++ * This causes the PID to change, so that an entirely new server instance
++ * directory is created.
++ */
++ throw RuntimeException("Tried to reuse existing server instance directory " +
++ path + ", but it has wrong owner and group");
++ }
+ }
+
+ bool isDirectory(const string &dir, struct dirent *entry) const {
+--- passenger-release-3.0.21.orig/NEWS 2013-05-29 07:09:31.000000000 -0500
++++ passenger-release-3.0.21.orig/NEWS 2013-07-18 08:58:30.943558375 -0500
+@@ -8,6 +8,7 @@ Release 3.0.21
+ * Catch exceptions raised by Rack application objects.
+ * Fix for CVE-2013-2119. Details can be found in the announcement for version 4.0.5.
+ * Version 3.0.20 was pulled because its fixes were incomplete.
++ * Fix for CVE-2013-4136. Details can be found in the announcement for version 4.0.8.
+
+
+ Release 3.0.19
+--- passenger-release-3.0.21.orig/test/cxx/ServerInstanceDirTest.cpp 2013-05-29 07:09:31.000000000 -0500
++++ passenger-release-3.0.21.orig/test/cxx/ServerInstanceDirTest.cpp 2013-07-18 09:09:50.898433782 -0500
+@@ -73,9 +73,11 @@ namespace tut {
+ }
+
+ TEST_METHOD(5) {
+- // The destructor doesnn't remove the server instance directory if it
++ // The destructor doesn't remove the server instance directory if it
+ // wasn't created with the ownership flag or if it's been detached.
+ string path, path2;
++ makeDirTree(parentDir + "/passenger-test.1234");
++ makeDirTree(parentDir + "/passenger-test.5678");
+ {
+ ServerInstanceDir dir(1234, parentDir, false);
+ ServerInstanceDir dir2(5678, parentDir);
diff --git a/www-apache/passenger/files/passenger-3.0.8-gentoo.patch b/www-apache/passenger/files/passenger-3.0.8-gentoo.patch
new file mode 100644
index 000000000000..6ca33dd32812
--- /dev/null
+++ b/www-apache/passenger/files/passenger-3.0.8-gentoo.patch
@@ -0,0 +1,35 @@
+--- build/config.rb.~1~ 2010-10-01 12:22:34.000000000 +0200
++++ build/config.rb 2010-11-02 10:56:25.309314070 +0100
+@@ -17,12 +17,8 @@
+ OPTIMIZE = boolean_option("OPTIMIZE")
+ CC = string_option("CC", "gcc")
+ CXX = string_option("CXX", "g++")
+ # TODO: consider -fcommon
+-if OPTIMIZE
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -O2 -DBOOST_DISABLE_ASSERTS".strip
+-else
+- OPTIMIZATION_FLAGS = "#{PlatformInfo.debugging_cflags} -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS".strip
+-end
++OPTIMIZATION_FLAGS = "#{ENV['CXXFLAGS']} -DBOOST_DISABLE_ASSERTS".strip
+
+ # Extra compiler flags that should always be passed to the C/C++ compiler.
+ # Should be included last in the command string, even after PlatformInfo.portability_cflags.
+--- build/packaging.rb.~1~ 2010-10-10 20:52:03.000000000 +0200
++++ build/packaging.rb 2010-11-02 11:03:56.944938507 +0100
+@@ -87,13 +87,13 @@
+ require 'rbconfig'
+ require 'fileutils'
+ include Config
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- fake_libdir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}"
+- fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
++ fake_libdir = "#{fakeroot}/#{CONFIG['sitedir']}/#{CONFIG['ruby_version']}"
++ fake_native_support_dir = "#{fakeroot}/#{CONFIG['sitedir']}/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
+ fake_agents_dir = "#{fakeroot}#{NATIVELY_PACKAGED_AGENTS_DIR}"
+ fake_helper_scripts_dir = "#{fakeroot}#{NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR}"
+ fake_docdir = "#{fakeroot}#{NATIVELY_PACKAGED_DOCDIR}"
diff --git a/www-apache/passenger/files/passenger-4.0.10-gentoo.patch b/www-apache/passenger/files/passenger-4.0.10-gentoo.patch
new file mode 100644
index 000000000000..808f988c7a72
--- /dev/null
+++ b/www-apache/passenger/files/passenger-4.0.10-gentoo.patch
@@ -0,0 +1,48 @@
+--- build/packaging.rb.~1~ 2013-07-09 10:10:02.000000000 +0200
++++ build/packaging.rb 2013-07-17 10:25:33.287663252 +0200
+@@ -184,7 +184,7 @@
+ require 'rbconfig'
+ require 'fileutils'
+ include RbConfig
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+--- build/packaging.rb.~1~ 2013-07-17 13:06:40.199882060 +0200
++++ build/packaging.rb 2013-07-17 13:18:31.444209611 +0200
+@@ -189,9 +189,9 @@
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- fake_rubylibdir = "#{fakeroot}/usr/lib/ruby/vendor_ruby"
++ fake_rubylibdir = "#{fakeroot}#{CONFIG['vendordir']}"
+ fake_libdir = "#{fakeroot}/usr/lib/passenger"
+- fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
++ fake_native_support_dir = "#{fakeroot}#{CONFIG['archdir']}"
+ fake_agents_dir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
+ fake_helper_scripts_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
+ fake_resources_dir = "#{fakeroot}/usr/share/passenger"
+--- build/packaging.rb.~1~ 2013-07-17 13:19:21.434826846 +0200
++++ build/packaging.rb 2013-07-17 13:21:42.954912287 +0200
+@@ -276,10 +276,6 @@
+ sh "cp bin/#{exe} #{fake_sbindir}/"
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{fake_apache2_module_dir}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_dir}/"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
+--- build/packaging.rb.~1~ 2013-07-17 13:25:51.440038844 +0200
++++ build/packaging.rb 2013-07-17 13:33:30.151365870 +0200
+@@ -203,7 +203,6 @@
+ fake_apache2_module = "#{fake_apache2_module_dir}/mod_passenger.so"
+ fake_ruby_extension_source_dir = "#{fakeroot}/usr/share/passenger/ruby_extension_source"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
diff --git a/www-apache/passenger/files/passenger-4.0.18-gentoo.patch b/www-apache/passenger/files/passenger-4.0.18-gentoo.patch
new file mode 100644
index 000000000000..7eb7c3392062
--- /dev/null
+++ b/www-apache/passenger/files/passenger-4.0.18-gentoo.patch
@@ -0,0 +1,39 @@
+--- build/packaging.rb.~1~ 2013-09-14 10:09:56.000000000 +0200
++++ build/packaging.rb 2013-10-05 15:03:51.474846961 +0200
+@@ -306,14 +306,14 @@
+ require 'rbconfig'
+ require 'fileutils'
+ include RbConfig
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- fake_rubylibdir = "#{fakeroot}/usr/lib/ruby/vendor_ruby"
++ fake_rubylibdir = "#{fakeroot}#{CONFIG['vendordir']}"
+ fake_libdir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}"
+- fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
++ fake_native_support_dir = "#{fakeroot}#{CONFIG['archdir']}"
+ fake_agents_dir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
+ fake_helper_scripts_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
+ fake_resources_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}"
+@@ -326,7 +326,6 @@
+ fake_ruby_extension_source_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
+ fake_nginx_module_source_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
+@@ -405,10 +404,6 @@
+ end
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{fake_apache2_module_dir}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_dir}/"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
diff --git a/www-apache/passenger/files/passenger-4.0.21-gentoo.patch b/www-apache/passenger/files/passenger-4.0.21-gentoo.patch
new file mode 100644
index 000000000000..30c6ea1b15cd
--- /dev/null
+++ b/www-apache/passenger/files/passenger-4.0.21-gentoo.patch
@@ -0,0 +1,40 @@
+--- build/packaging.rb.~1~ 2013-09-14 10:09:56.000000000 +0200
++++ build/packaging.rb 2013-10-05 15:03:51.474846961 +0200
+@@ -306,15 +306,15 @@
+ require 'rbconfig'
+ require 'fileutils'
+ include RbConfig
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+
+ # We don't use CONFIG['archdir'] and the like because we want
+ # the files to be installed to /usr, and the Ruby interpreter
+ # on the packaging machine might be in /usr/local.
+- fake_rubylibdir = "#{fakeroot}/usr/lib/ruby/vendor_ruby"
++ fake_rubylibdir = "#{fakeroot}#{CONFIG['vendordir']}"
+ fake_nodelibdir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/node"
+ fake_libdir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}"
+- fake_native_support_dir = "#{fakeroot}/usr/lib/ruby/#{CONFIG['ruby_version']}/#{CONFIG['arch']}"
++ fake_native_support_dir = "#{fakeroot}#{CONFIG['archdir']}"
+ fake_agents_dir = "#{fakeroot}/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
+ fake_helper_scripts_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
+ fake_resources_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}"
+@@ -326,7 +326,6 @@
+ fake_ruby_extension_source_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
+ fake_nginx_module_source_dir = "#{fakeroot}/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
+@@ -405,10 +404,6 @@
+ end
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{fake_apache2_module_dir}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_dir}/"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
diff --git a/www-apache/passenger/files/passenger-4.0.33-gentoo.patch b/www-apache/passenger/files/passenger-4.0.33-gentoo.patch
new file mode 100644
index 000000000000..843082b44b90
--- /dev/null
+++ b/www-apache/passenger/files/passenger-4.0.33-gentoo.patch
@@ -0,0 +1,30 @@
+--- build/packaging.rb.~1~ 2014-01-09 07:02:51.715076000 +0100
++++ build/packaging.rb 2014-01-09 07:25:14.182743725 +0100
+@@ -361,7 +361,7 @@
+ psg_ruby_extension_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
+ psg_nginx_module_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
+
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+ fake_rubylibdir = "#{fakeroot}#{psg_rubylibdir}"
+ fake_nodelibdir = "#{fakeroot}#{psg_nodelibdir}"
+ fake_libdir = "#{fakeroot}#{psg_libdir}"
+@@ -379,7 +379,6 @@
+
+ native_packaging_method = ENV['NATIVE_PACKAGING_METHOD'] || "deb"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
+@@ -464,10 +463,6 @@
+ end
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{File.dirname(fake_apache2_module_path)}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_path}"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
diff --git a/www-apache/passenger/files/passenger-4.0.49-gentoo.patch b/www-apache/passenger/files/passenger-4.0.49-gentoo.patch
new file mode 100644
index 000000000000..8365fbd20fb5
--- /dev/null
+++ b/www-apache/passenger/files/passenger-4.0.49-gentoo.patch
@@ -0,0 +1,30 @@
+--- build/packaging.rb.~1~ 2013-10-27 00:00:00.000000000 +0200
++++ build/packaging.rb 2014-08-23 08:35:20.372738004 +0200
+@@ -429,7 +429,7 @@
+ psg_ruby_extension_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
+ psg_nginx_module_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
+
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+ fake_rubylibdir = "#{fakeroot}#{psg_rubylibdir}"
+ fake_nodelibdir = "#{fakeroot}#{psg_nodelibdir}"
+ fake_libdir = "#{fakeroot}#{psg_libdir}"
+@@ -447,7 +447,6 @@
+
+ native_packaging_method = ENV['NATIVE_PACKAGING_METHOD'] || "deb"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
+@@ -532,10 +531,6 @@
+ end
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{File.dirname(fake_apache2_module_path)}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_path}"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"
diff --git a/www-apache/passenger/files/passenger-5.0.4-gentoo.patch b/www-apache/passenger/files/passenger-5.0.4-gentoo.patch
new file mode 100644
index 000000000000..713deb070324
--- /dev/null
+++ b/www-apache/passenger/files/passenger-5.0.4-gentoo.patch
@@ -0,0 +1,30 @@
+--- build/packaging.rb.orig 2015-03-14 06:52:27.284475606 +0100
++++ build/packaging.rb 2015-03-14 06:52:35.128268388 +0100
+@@ -513,7 +513,7 @@
+ psg_ruby_extension_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
+ psg_nginx_module_source_dir = "#{fs_datadir}/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
+
+- fakeroot = "pkg/fakeroot"
++ fakeroot = ENV['DISTDIR']
+ fake_rubylibdir = "#{fakeroot}#{psg_rubylibdir}"
+ fake_nodelibdir = "#{fakeroot}#{psg_nodelibdir}"
+ fake_libdir = "#{fakeroot}#{psg_libdir}"
+@@ -531,7 +531,6 @@
+
+ packaging_method = ENV['NATIVE_PACKAGING_METHOD'] || ENV['PACKAGING_METHOD'] || "deb"
+
+- sh "rm -rf #{fakeroot}"
+ sh "mkdir -p #{fakeroot}"
+
+ # Ruby sources
+@@ -622,10 +621,6 @@
+ end
+ end
+
+- # Apache 2 module
+- sh "mkdir -p #{File.dirname(fake_apache2_module_path)}"
+- sh "cp #{APACHE2_MODULE} #{fake_apache2_module_path}"
+-
+ # Ruby extension sources
+ sh "mkdir -p #{fake_ruby_extension_source_dir}"
+ sh "cp -R #{PhusionPassenger.ruby_extension_source_dir}/* #{fake_ruby_extension_source_dir}"