passenger 4.0.48 → 4.0.49
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +36 -2
- data/.travis.yml +1 -1
- data/CHANGELOG +16 -0
- data/Rakefile +0 -1
- data/build/apache2.rb +4 -4
- data/build/common_library.rb +18 -18
- data/build/cplusplus_support.rb +2 -2
- data/build/documentation.rb +1 -1
- data/build/integration_tests.rb +12 -4
- data/build/misc.rb +12 -7
- data/build/packaging.rb +14 -14
- data/build/preprocessor.rb +10 -10
- data/build/rake_extensions.rb +11 -11
- data/build/ruby_extension.rb +2 -2
- data/dev/ci/inituidgid +24 -0
- data/dev/ci/run_jenkins.sh +57 -0
- data/dev/ci/run_rpm_tests.sh +77 -0
- data/dev/{run_travis.sh → ci/run_travis.sh} +60 -4
- data/doc/Users guide Nginx.txt +2 -2
- data/doc/users_guide_snippets/environment_variables.txt +0 -2
- data/doc/users_guide_snippets/tips.txt +20 -1
- data/ext/apache2/Bucket.cpp +18 -18
- data/ext/apache2/Bucket.h +4 -4
- data/ext/apache2/Configuration.cpp +7 -7
- data/ext/apache2/Configuration.hpp +43 -43
- data/ext/apache2/DirectoryMapper.h +5 -5
- data/ext/apache2/Hooks.cpp +142 -142
- data/ext/apache2/MergeDirConfig.cpp +40 -40
- data/ext/common/Account.h +17 -17
- data/ext/common/AccountsDatabase.h +9 -9
- data/ext/common/AgentsStarter.cpp +2 -2
- data/ext/common/AgentsStarter.h +40 -40
- data/ext/common/ApplicationPool2/Common.h +10 -6
- data/ext/common/ApplicationPool2/ComponentInfo.h +2 -2
- data/ext/common/ApplicationPool2/DirectSpawner.h +17 -17
- data/ext/common/ApplicationPool2/DummySpawner.h +5 -5
- data/ext/common/ApplicationPool2/Group.h +54 -38
- data/ext/common/ApplicationPool2/Implementation.cpp +76 -49
- data/ext/common/ApplicationPool2/Options.h +98 -91
- data/ext/common/ApplicationPool2/Pool.h +70 -69
- data/ext/common/ApplicationPool2/Process.h +21 -21
- data/ext/common/ApplicationPool2/Session.h +11 -11
- data/ext/common/ApplicationPool2/SmartSpawner.h +60 -60
- data/ext/common/ApplicationPool2/Socket.h +19 -19
- data/ext/common/ApplicationPool2/Spawner.h +64 -72
- data/ext/common/ApplicationPool2/SpawnerFactory.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +41 -41
- data/ext/common/BackgroundEventLoop.cpp +1 -1
- data/ext/common/BackgroundEventLoop.h +2 -2
- data/ext/common/Constants.h +1 -1
- data/ext/common/EventedBufferedInput.h +5 -5
- data/ext/common/EventedClient.h +51 -51
- data/ext/common/EventedMessageServer.h +39 -39
- data/ext/common/EventedServer.h +32 -32
- data/ext/common/Exceptions.h +23 -23
- data/ext/common/FileDescriptor.h +18 -18
- data/ext/common/Logging.cpp +1 -1
- data/ext/common/MessageClient.h +27 -27
- data/ext/common/MessageReadersWriters.h +79 -79
- data/ext/common/MessageServer.h +59 -59
- data/ext/common/RandomGenerator.h +12 -12
- data/ext/common/ResourceLocator.h +8 -8
- data/ext/common/SafeLibev.h +54 -25
- data/ext/common/ServerInstanceDir.h +31 -31
- data/ext/common/StaticString.h +50 -48
- data/ext/common/Utils.cpp +73 -78
- data/ext/common/Utils.h +6 -6
- data/ext/common/Utils/Base64.cpp +3 -3
- data/ext/common/Utils/Base64.h +7 -7
- data/ext/common/Utils/BlockingQueue.h +9 -9
- data/ext/common/Utils/BufferedIO.h +17 -17
- data/ext/common/Utils/CachedFileStat.hpp +16 -16
- data/ext/common/Utils/Dechunker.h +25 -25
- data/ext/common/Utils/FileChangeChecker.h +10 -10
- data/ext/common/Utils/MemZeroGuard.h +5 -5
- data/ext/common/Utils/MemoryBarrier.h +1 -1
- data/ext/common/Utils/MessageIO.h +61 -61
- data/ext/common/Utils/ProcessMetricsCollector.h +40 -40
- data/ext/common/Utils/ScopeGuard.h +7 -7
- data/ext/common/Utils/SpeedMeter.h +1 -1
- data/ext/common/Utils/StrIntUtils.cpp +13 -13
- data/ext/common/Utils/StrIntUtils.h +3 -3
- data/ext/common/Utils/StringScanning.h +5 -5
- data/ext/common/Utils/SystemMetricsCollector.h +2 -2
- data/ext/common/Utils/SystemTime.h +10 -10
- data/ext/common/Utils/Template.h +2 -2
- data/ext/common/Utils/Timer.h +6 -6
- data/ext/common/Utils/VariantMap.h +29 -29
- data/ext/common/agents/Base.cpp +19 -19
- data/ext/common/agents/HelperAgent/AgentOptions.h +1 -1
- data/ext/common/agents/HelperAgent/FileBackedPipe.h +6 -6
- data/ext/common/agents/HelperAgent/Main.cpp +44 -43
- data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
- data/ext/common/agents/HelperAgent/RequestHandler.h +29 -28
- data/ext/common/agents/HelperAgent/ScgiRequestParser.h +56 -50
- data/ext/common/agents/LoggingAgent/AdminController.h +8 -8
- data/ext/common/agents/LoggingAgent/DataStoreId.h +17 -17
- data/ext/common/agents/LoggingAgent/FilterSupport.h +167 -167
- data/ext/common/agents/LoggingAgent/LoggingServer.h +122 -122
- data/ext/common/agents/LoggingAgent/Main.cpp +7 -7
- data/ext/common/agents/LoggingAgent/RemoteSender.h +54 -54
- data/ext/common/agents/SpawnPreparer.cpp +4 -4
- data/ext/common/agents/TempDirToucher.c +2 -2
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +47 -47
- data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +7 -7
- data/ext/common/agents/Watchdog/Main.cpp +22 -22
- data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +9 -9
- data/ext/libeio/eio.c +1 -1
- data/ext/nginx/Configuration.c +30 -30
- data/ext/nginx/Configuration.h +1 -1
- data/ext/nginx/ContentHandler.c +54 -54
- data/ext/nginx/ContentHandler.h +3 -3
- data/ext/nginx/StaticContentHandler.c +2 -2
- data/ext/nginx/ngx_http_passenger_module.c +21 -21
- data/ext/oxt/detail/backtrace_enabled.hpp +1 -1
- data/ext/oxt/detail/context.hpp +1 -1
- data/ext/oxt/detail/spin_lock_darwin.hpp +4 -4
- data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -3
- data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
- data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/ext/oxt/dynamic_thread_group.hpp +18 -18
- data/ext/oxt/implementation.cpp +9 -8
- data/ext/oxt/macros.hpp +2 -2
- data/ext/oxt/system_calls.cpp +11 -11
- data/ext/oxt/system_calls.hpp +13 -13
- data/ext/oxt/thread.hpp +22 -14
- data/ext/ruby/passenger_native_support.c +55 -55
- data/lib/phusion_passenger.rb +24 -24
- data/lib/phusion_passenger/common_library.rb +2 -0
- data/lib/phusion_passenger/loader_shared_helpers.rb +18 -18
- data/lib/phusion_passenger/packaging.rb +9 -4
- data/lib/phusion_passenger/platform_info/apache.rb +45 -31
- data/lib/phusion_passenger/platform_info/compiler.rb +11 -11
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler/thread_handler.rb +8 -8
- data/lib/phusion_passenger/standalone/app_finder.rb +16 -16
- data/lib/phusion_passenger/standalone/command.rb +22 -22
- data/packaging/rpm/LICENSE.txt +19 -0
- data/packaging/rpm/Makefile +13 -0
- data/packaging/rpm/README.md +41 -0
- data/packaging/rpm/Vagrantfile +38 -0
- data/{rpm/Vagrantfile → packaging/rpm/Vagrantfile.centos} +0 -0
- data/packaging/rpm/build +170 -0
- data/packaging/rpm/create_project +41 -0
- data/packaging/rpm/git_update +88 -0
- data/packaging/rpm/image/Dockerfile +37 -0
- data/packaging/rpm/image/Gemfile +3 -0
- data/packaging/rpm/image/Gemfile.lock +12 -0
- data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +19 -0
- data/packaging/rpm/image/amazon2014-i386.cfg +96 -0
- data/packaging/rpm/image/amazon2014-x86_64.cfg +96 -0
- data/packaging/rpm/image/site-defaults.cfg +168 -0
- data/packaging/rpm/internal/build_tasks.rb +238 -0
- data/packaging/rpm/internal/dummygpg +11 -0
- data/packaging/rpm/internal/exec_build +42 -0
- data/packaging/rpm/internal/get_distro_arch +14 -0
- data/packaging/rpm/internal/get_distro_id +10 -0
- data/packaging/rpm/internal/git_update +27 -0
- data/packaging/rpm/internal/inituidgid +17 -0
- data/packaging/rpm/internal/my_init +344 -0
- data/packaging/rpm/internal/python27 +3 -0
- data/packaging/rpm/internal/repo_update +46 -0
- data/packaging/rpm/internal/setuser +26 -0
- data/packaging/rpm/internal/tracking_helper +40 -0
- data/packaging/rpm/jenkins_release +99 -0
- data/packaging/rpm/lib/build_tasks_support.rb +402 -0
- data/packaging/rpm/lib/preprocessor.rb +341 -0
- data/packaging/rpm/nginx_spec/404.html +119 -0
- data/packaging/rpm/nginx_spec/50x.html +119 -0
- data/packaging/rpm/nginx_spec/index.html +116 -0
- data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +13 -0
- data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade +13 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade.8 +151 -0
- data/packaging/rpm/nginx_spec/nginx.conf +131 -0
- data/packaging/rpm/nginx_spec/nginx.init +144 -0
- data/packaging/rpm/nginx_spec/nginx.logrotate +13 -0
- data/packaging/rpm/nginx_spec/nginx.service +15 -0
- data/packaging/rpm/nginx_spec/nginx.spec.template +559 -0
- data/packaging/rpm/nginx_spec/nginx.sysconfig +4 -0
- data/packaging/rpm/nginx_spec/passenger.conf +9 -0
- data/packaging/rpm/nginx_spec/poweredby.png +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/apache-passenger.conf.in +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/config.json +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.logrotate +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger.spec.template +58 -31
- data/{rpm → packaging/rpm/passenger_spec}/passenger_dynamic_thread_group.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/passenger_tests_default_config_example.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -0
- data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -0
- data/packaging/rpm/repo_update +114 -0
- data/packaging/rpm/setup-system +60 -0
- data/packaging/rpm/shell +10 -0
- data/resources/templates/standalone/config.erb +3 -1
- data/test/config.json.rpm-automation +1 -1
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +11 -11
- data/test/cxx/ApplicationPool2/OptionsTest.cpp +5 -5
- data/test/cxx/ApplicationPool2/PoolTest.cpp +129 -89
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +15 -15
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +22 -22
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +11 -11
- data/test/cxx/ScgiRequestParserTest.cpp +75 -61
- data/test/cxx/UtilsTest.cpp +86 -85
- data/test/gdbinit.example +3 -0
- data/test/integration_tests/nginx_tests.rb +3 -3
- data/test/integration_tests/source_packaging_test.rb +3 -1
- data/test/stub/nginx/nginx.conf.erb +8 -1
- data/test/support/nginx_controller.rb +7 -7
- metadata +62 -17
- metadata.gz.asc +7 -7
- data/build/rpm.rb +0 -128
- data/dev/rpmtool +0 -21
- data/dev/test_rpm_packaging.sh +0 -28
- data/rpm/get_distro_id.py +0 -4
@@ -0,0 +1,341 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
# Copyright (c) 2013 Phusion
|
4
|
+
#
|
5
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require 'erb'
|
26
|
+
|
27
|
+
# Implements a simple preprocessor language which combines elements in the C
|
28
|
+
# preprocessor with ERB:
|
29
|
+
#
|
30
|
+
# Today
|
31
|
+
# #if @today == :fine
|
32
|
+
# is a fine day.
|
33
|
+
# #elif @today == :good
|
34
|
+
# is a good day.
|
35
|
+
# #else
|
36
|
+
# is a sad day.
|
37
|
+
# #endif
|
38
|
+
# Let's go walking.
|
39
|
+
# Today is <%= Time.now %>.
|
40
|
+
#
|
41
|
+
# When run with...
|
42
|
+
#
|
43
|
+
# Preprocessor.new.start('input.txt', 'output.txt', :today => :fine)
|
44
|
+
#
|
45
|
+
# ...will produce:
|
46
|
+
#
|
47
|
+
# Today
|
48
|
+
# is a fine day.
|
49
|
+
# Let's go walking.
|
50
|
+
# Today is 2013-08-11 22:37:06 +0200.
|
51
|
+
#
|
52
|
+
# Highlights:
|
53
|
+
#
|
54
|
+
# * #if blocks can be nested.
|
55
|
+
# * Expressions are Ruby expressions, evaluated within the binding of a
|
56
|
+
# Preprocessor::Evaluator object.
|
57
|
+
# * Text inside #if/#elif/#else are automatically unindented.
|
58
|
+
# * ERB compatible.
|
59
|
+
class Preprocessor
|
60
|
+
def initialize
|
61
|
+
require 'erb' if !defined?(ERB)
|
62
|
+
@indentation_size = 4
|
63
|
+
@debug = boolean_option('DEBUG')
|
64
|
+
end
|
65
|
+
|
66
|
+
def start(filename, output_filename, variables = {})
|
67
|
+
if output_filename
|
68
|
+
temp_output_filename = "#{output_filename}._new"
|
69
|
+
output = File.open(temp_output_filename, 'w')
|
70
|
+
else
|
71
|
+
output = STDOUT
|
72
|
+
end
|
73
|
+
the_binding = create_binding(variables)
|
74
|
+
context = []
|
75
|
+
@filename = filename
|
76
|
+
@lineno = 1
|
77
|
+
@indentation = 0
|
78
|
+
|
79
|
+
each_line(filename, the_binding) do |line|
|
80
|
+
debug("context=#{context.inspect}, line=#{line.inspect}")
|
81
|
+
|
82
|
+
name, args_string, cmd_indentation = recognize_command(line)
|
83
|
+
case name
|
84
|
+
when "if"
|
85
|
+
case context.last
|
86
|
+
when nil, :if_true, :else_true
|
87
|
+
check_indentation(cmd_indentation)
|
88
|
+
result = the_binding.eval(args_string, filename, @lineno)
|
89
|
+
context.push(result ? :if_true : :if_false)
|
90
|
+
inc_indentation
|
91
|
+
when :if_false, :else_false, :if_ignore
|
92
|
+
check_indentation(cmd_indentation)
|
93
|
+
inc_indentation
|
94
|
+
context.push(:if_ignore)
|
95
|
+
else
|
96
|
+
terminate "#if is not allowed in this context"
|
97
|
+
end
|
98
|
+
when "elif"
|
99
|
+
case context.last
|
100
|
+
when :if_true
|
101
|
+
dec_indentation
|
102
|
+
check_indentation(cmd_indentation)
|
103
|
+
inc_indentation
|
104
|
+
context[-1] = :if_false
|
105
|
+
when :if_false
|
106
|
+
dec_indentation
|
107
|
+
check_indentation(cmd_indentation)
|
108
|
+
inc_indentation
|
109
|
+
result = the_binding.eval(args_string, filename, @lineno)
|
110
|
+
context[-1] = result ? :if_true : :if_false
|
111
|
+
when :else_true, :else_false
|
112
|
+
terminate "#elif is not allowed after #else"
|
113
|
+
when :if_ignore
|
114
|
+
dec_indentation
|
115
|
+
check_indentation(cmd_indentation)
|
116
|
+
inc_indentation
|
117
|
+
else
|
118
|
+
terminate "#elif is not allowed outside #if block"
|
119
|
+
end
|
120
|
+
when "else"
|
121
|
+
case context.last
|
122
|
+
when :if_true
|
123
|
+
dec_indentation
|
124
|
+
check_indentation(cmd_indentation)
|
125
|
+
inc_indentation
|
126
|
+
context[-1] = :else_false
|
127
|
+
when :if_false
|
128
|
+
dec_indentation
|
129
|
+
check_indentation(cmd_indentation)
|
130
|
+
inc_indentation
|
131
|
+
context[-1] = :else_true
|
132
|
+
when :else_true, :else_false
|
133
|
+
terminate "it is not allowed to have multiple #else clauses in one #if block"
|
134
|
+
when :if_ignore
|
135
|
+
dec_indentation
|
136
|
+
check_indentation(cmd_indentation)
|
137
|
+
inc_indentation
|
138
|
+
else
|
139
|
+
terminate "#else is not allowed outside #if block"
|
140
|
+
end
|
141
|
+
when "endif"
|
142
|
+
case context.last
|
143
|
+
when :if_true, :if_false, :else_true, :else_false, :if_ignore
|
144
|
+
dec_indentation
|
145
|
+
check_indentation(cmd_indentation)
|
146
|
+
context.pop
|
147
|
+
else
|
148
|
+
terminate "#endif is not allowed outside #if block"
|
149
|
+
end
|
150
|
+
when "DEBHELPER"
|
151
|
+
output.puts(line)
|
152
|
+
when "", nil
|
153
|
+
# Either a comment or not a preprocessor command.
|
154
|
+
case context.last
|
155
|
+
when nil, :if_true, :else_true
|
156
|
+
output.puts(unindent(line))
|
157
|
+
else
|
158
|
+
# Check indentation but do not output.
|
159
|
+
unindent(line)
|
160
|
+
end
|
161
|
+
else
|
162
|
+
terminate "Unrecognized preprocessor command ##{name.inspect}"
|
163
|
+
end
|
164
|
+
|
165
|
+
@lineno += 1
|
166
|
+
end
|
167
|
+
ensure
|
168
|
+
if output_filename && output
|
169
|
+
output.close
|
170
|
+
stat = File.stat(filename)
|
171
|
+
File.chmod(stat.mode, temp_output_filename)
|
172
|
+
File.chown(stat.uid, stat.gid, temp_output_filename) rescue nil
|
173
|
+
File.rename(temp_output_filename, output_filename)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
private
|
178
|
+
UBUNTU_DISTRIBUTIONS = {
|
179
|
+
"lucid" => "10.04",
|
180
|
+
"maverick" => "10.10",
|
181
|
+
"natty" => "11.04",
|
182
|
+
"oneiric" => "11.10",
|
183
|
+
"precise" => "12.04",
|
184
|
+
"quantal" => "12.10",
|
185
|
+
"raring" => "13.04",
|
186
|
+
"saucy" => "13.10",
|
187
|
+
"trusty" => "14.04"
|
188
|
+
}
|
189
|
+
DEBIAN_DISTRIBUTIONS = {
|
190
|
+
"squeeze" => "20110206",
|
191
|
+
"wheezy" => "20130504",
|
192
|
+
"jessie" => "20140000"
|
193
|
+
}
|
194
|
+
REDHAT_ENTERPRISE_DISTRIBUTIONS = {
|
195
|
+
"el6" => "el6.0"
|
196
|
+
}
|
197
|
+
AMAZON_DISTRIBUTIONS = {
|
198
|
+
"amazon" => "amazon"
|
199
|
+
}
|
200
|
+
|
201
|
+
# Provides the DSL that's accessible within.
|
202
|
+
class Evaluator
|
203
|
+
def _infer_distro_table(name)
|
204
|
+
if UBUNTU_DISTRIBUTIONS.has_key?(name)
|
205
|
+
return UBUNTU_DISTRIBUTIONS
|
206
|
+
elsif DEBIAN_DISTRIBUTIONS.has_key?(name)
|
207
|
+
return DEBIAN_DISTRIBUTIONS
|
208
|
+
elsif REDHAT_ENTERPRISE_DISTRIBUTIONS.has_key?(name)
|
209
|
+
return REDHAT_ENTERPRISE_DISTRIBUTIONS
|
210
|
+
elsif AMAZON_DISTRIBUTIONS.has_key?(name)
|
211
|
+
return AMAZON_DISTRIBUTIONS
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def is_distribution?(expr)
|
216
|
+
if @distribution.nil?
|
217
|
+
raise "The :distribution variable must be set"
|
218
|
+
else
|
219
|
+
if expr =~ /^(>=|>|<=|<|==|\!=)[\s]*(.+)/
|
220
|
+
comparator = $1
|
221
|
+
name = $2
|
222
|
+
else
|
223
|
+
raise "Invalid expression #{expr.inspect}"
|
224
|
+
end
|
225
|
+
|
226
|
+
table1 = _infer_distro_table(@distribution)
|
227
|
+
table2 = _infer_distro_table(name)
|
228
|
+
raise "Distribution name #{@distribution.inspect} not recognized" if !table1
|
229
|
+
raise "Distribution name #{name.inspect} not recognized" if !table2
|
230
|
+
return false if table1 != table2
|
231
|
+
v1 = table1[@distribution]
|
232
|
+
v2 = table2[name]
|
233
|
+
|
234
|
+
case comparator
|
235
|
+
when ">"
|
236
|
+
return v1 > v2
|
237
|
+
when ">="
|
238
|
+
return v1 >= v2
|
239
|
+
when "<"
|
240
|
+
return v1 < v2
|
241
|
+
when "<="
|
242
|
+
return v1 <= v2
|
243
|
+
when "=="
|
244
|
+
return v1 == v2
|
245
|
+
when "!="
|
246
|
+
return v1 != v2
|
247
|
+
else
|
248
|
+
raise "BUG"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def each_line(filename, the_binding)
|
255
|
+
data = File.open(filename, 'r') do |f|
|
256
|
+
erb = ERB.new(f.read, nil, "-")
|
257
|
+
erb.filename = filename
|
258
|
+
erb.result(the_binding)
|
259
|
+
end
|
260
|
+
data.each_line do |line|
|
261
|
+
yield line.chomp
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def recognize_command(line)
|
266
|
+
if line =~ /^([\s\t]*)#(.+)/
|
267
|
+
indentation_str = $1
|
268
|
+
command = $2
|
269
|
+
|
270
|
+
# Declare tabs as equivalent to 4 spaces. This is necessary for
|
271
|
+
# Makefiles in which the use of tabs is required.
|
272
|
+
indentation_str.gsub!("\t", " ")
|
273
|
+
|
274
|
+
name = command.scan(/^\w+/).first
|
275
|
+
# Ignore shebangs and comments.
|
276
|
+
return if name.nil?
|
277
|
+
|
278
|
+
args_string = command.sub(/^#{Regexp.escape(name)}[\s\t]*/, '')
|
279
|
+
return [name, args_string, indentation_str.to_s.size]
|
280
|
+
else
|
281
|
+
return nil
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
def create_binding(variables)
|
286
|
+
object = Evaluator.new
|
287
|
+
variables.each_pair do |key, val|
|
288
|
+
object.send(:instance_variable_set, "@#{key}", val)
|
289
|
+
end
|
290
|
+
return object.instance_eval do
|
291
|
+
binding
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def inc_indentation
|
296
|
+
@indentation += @indentation_size
|
297
|
+
end
|
298
|
+
|
299
|
+
def dec_indentation
|
300
|
+
@indentation -= @indentation_size
|
301
|
+
end
|
302
|
+
|
303
|
+
def check_indentation(expected)
|
304
|
+
if expected != @indentation
|
305
|
+
terminate "wrong indentation: found #{expected} characters, should be #{@indentation}"
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
def unindent(line)
|
310
|
+
line =~ /^([\s\t]*)/
|
311
|
+
# Declare tabs as equivalent to 4 spaces. This is necessary for
|
312
|
+
# Makefiles in which the use of tabs is required.
|
313
|
+
found = $1.to_s.gsub("\t", " ").size
|
314
|
+
|
315
|
+
if found >= @indentation
|
316
|
+
# Tab-friendly way to remove indentation.
|
317
|
+
remaining = @indentation
|
318
|
+
line = line.dup
|
319
|
+
while remaining > 0
|
320
|
+
if line[0..0] == " "
|
321
|
+
remaining -= 1
|
322
|
+
else
|
323
|
+
# This is a tab.
|
324
|
+
remaining -= 4
|
325
|
+
end
|
326
|
+
line.slice!(0, 1)
|
327
|
+
end
|
328
|
+
return line
|
329
|
+
else
|
330
|
+
terminate "wrong indentation: found #{found} characters, should be at least #{@indentation}"
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
def debug(message)
|
335
|
+
puts "DEBUG:#{@lineno}: #{message}" if @debug
|
336
|
+
end
|
337
|
+
|
338
|
+
def terminate(message)
|
339
|
+
abort "*** ERROR: #{@filename} line #{@lineno}: #{message}"
|
340
|
+
end
|
341
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
4
|
+
<head>
|
5
|
+
<title>The page is not found</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
7
|
+
<style type="text/css">
|
8
|
+
/*<![CDATA[*/
|
9
|
+
body {
|
10
|
+
background-color: #fff;
|
11
|
+
color: #000;
|
12
|
+
font-size: 0.9em;
|
13
|
+
font-family: sans-serif,helvetica;
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
:link {
|
18
|
+
color: #c00;
|
19
|
+
}
|
20
|
+
:visited {
|
21
|
+
color: #c00;
|
22
|
+
}
|
23
|
+
a:hover {
|
24
|
+
color: #f50;
|
25
|
+
}
|
26
|
+
h1 {
|
27
|
+
text-align: center;
|
28
|
+
margin: 0;
|
29
|
+
padding: 0.6em 2em 0.4em;
|
30
|
+
background-color: #294172;
|
31
|
+
color: #fff;
|
32
|
+
font-weight: normal;
|
33
|
+
font-size: 1.75em;
|
34
|
+
border-bottom: 2px solid #000;
|
35
|
+
}
|
36
|
+
h1 strong {
|
37
|
+
font-weight: bold;
|
38
|
+
font-size: 1.5em;
|
39
|
+
}
|
40
|
+
h2 {
|
41
|
+
text-align: center;
|
42
|
+
background-color: #3C6EB4;
|
43
|
+
font-size: 1.1em;
|
44
|
+
font-weight: bold;
|
45
|
+
color: #fff;
|
46
|
+
margin: 0;
|
47
|
+
padding: 0.5em;
|
48
|
+
border-bottom: 2px solid #294172;
|
49
|
+
}
|
50
|
+
h3 {
|
51
|
+
text-align: center;
|
52
|
+
background-color: #ff0000;
|
53
|
+
padding: 0.5em;
|
54
|
+
color: #fff;
|
55
|
+
}
|
56
|
+
hr {
|
57
|
+
display: none;
|
58
|
+
}
|
59
|
+
.content {
|
60
|
+
padding: 1em 5em;
|
61
|
+
}
|
62
|
+
.alert {
|
63
|
+
border: 2px solid #000;
|
64
|
+
}
|
65
|
+
|
66
|
+
img {
|
67
|
+
border: 2px solid #fff;
|
68
|
+
padding: 2px;
|
69
|
+
margin: 2px;
|
70
|
+
}
|
71
|
+
a:hover img {
|
72
|
+
border: 2px solid #294172;
|
73
|
+
}
|
74
|
+
.logos {
|
75
|
+
margin: 1em;
|
76
|
+
text-align: center;
|
77
|
+
}
|
78
|
+
/*]]>*/
|
79
|
+
</style>
|
80
|
+
</head>
|
81
|
+
|
82
|
+
<body>
|
83
|
+
<h1><strong>nginx error!</strong></h1>
|
84
|
+
|
85
|
+
<div class="content">
|
86
|
+
|
87
|
+
<h3>The page you are looking for is not found.</h3>
|
88
|
+
|
89
|
+
<div class="alert">
|
90
|
+
<h2>Website Administrator</h2>
|
91
|
+
<div class="content">
|
92
|
+
<p>Something has triggered missing webpage on your
|
93
|
+
website. This is the default 404 error page for
|
94
|
+
<strong>nginx</strong> that is distributed with
|
95
|
+
Fedora. It is located
|
96
|
+
<tt>/usr/share/nginx/html/404.html</tt></p>
|
97
|
+
|
98
|
+
<p>You should customize this error page for your own
|
99
|
+
site or edit the <tt>error_page</tt> directive in
|
100
|
+
the <strong>nginx</strong> configuration file
|
101
|
+
<tt>/etc/nginx/nginx.conf</tt>.</p>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div class="logos">
|
107
|
+
<a href="http://nginx.net/"><img
|
108
|
+
src="nginx-logo.png"
|
109
|
+
alt="[ Powered by nginx ]"
|
110
|
+
width="121" height="32" /></a>
|
111
|
+
|
112
|
+
<a href="http://fedoraproject.org/"><img
|
113
|
+
src="poweredby.png"
|
114
|
+
alt="[ Powered by Fedora ]"
|
115
|
+
width="88" height="31" /></a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
</body>
|
119
|
+
</html>
|