Skip to content

Commit

Permalink
Add patches to remove old executable of racc in Ruby 2.7
Browse files Browse the repository at this point in the history
They take along with unexpected dependency since they contain wrong
shebang. In addition, they are already removed at upstream.

See also:
* https://bugs.ruby-lang.org/issues/15982
* ruby/racc#123
* https://src.fedoraproject.org/rpms/ruby/c/baf046a6a4d17fa309c9d20fa3db949f6c24aacf?branch=master
* #24

Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Apr 10, 2020
1 parent 5f3bc3c commit 2a37bf3
Show file tree
Hide file tree
Showing 4 changed files with 682 additions and 0 deletions.
13 changes: 13 additions & 0 deletions td-agent/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,18 @@ class BuildTask
render_template(dest_path, template_file_path, config, {mode: 0755})
end

def apply_ruby_patches
return if BUNDLED_RUBY_PATCHES.nil?
BUNDLED_RUBY_PATCHES.each do |patch|
patch_name, version_condition = patch
dependency = Gem::Dependency.new('', version_condition)
if dependency.match?('', BUNDLED_RUBY_VERSION)
patch_path = File.join(__dir__, "patches", patch_name)
sh("patch", "-p1", "--input=#{patch_path}")
end
end
end

def build_ruby_from_source
tarball = @download_task.file_ruby_source
ruby_source_dir = tarball.sub(/\.tar\.gz$/, '')
Expand All @@ -439,6 +451,7 @@ class BuildTask
"--disable-install-doc",
]
cd(ruby_source_dir) do
apply_ruby_patches
sh("./configure #{configure_opts.join(' ')}")
sh("make", "install", "-j#{Etc.nprocessors}", "DESTDIR=#{STAGING_DIR}")

Expand Down
5 changes: 5 additions & 0 deletions td-agent/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#BUNDLED_RUBY_VERSION = "2.7.0"
#BUNDLED_RUBY_SOURCE_SHA256SUM = "8c99aa93b5e2f1bc8437d1bbbefd27b13e7694025331f77245d0c068ef1f8cbe"

BUNDLED_RUBY_PATCHES = [
["ruby-2.7/0001-Removed-the-old-executables-of-racc.patch", ["~> 2.7.0"]],
["ruby-2.7/0002-Fixup-a6864f6d2f39bcd1ff04516591cc18d4027ab186.patch", ["~> 2.7.0"]],
]

# https://rubyinstaller.org/downloads/ (7-ZIP ARCHIVES)
BUNDLED_RUBY_INSTALLER_X64_VERSION = "2.4.9-1"
BUNDLED_RUBY_INSTALLER_X64_SHA256SUM = "b822c5b87e8baf8526c07496efa8fce595a75c82c7ebe549448958116a4dcb91"
Expand Down
Loading

0 comments on commit 2a37bf3

Please sign in to comment.