tebako 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 947ddeae8f5a9459277f7c6e254a91f51fc918814d0fa6cf29b746b4920a70b5
4
- data.tar.gz: f4a69bc6c2bc30472ab3671eb95b24c41c3e335d946b91014b7f9566c5744fb9
3
+ metadata.gz: 97effadb1d79ead536d7307438fce1d4e41b352c9f202e34f6d37986f350215d
4
+ data.tar.gz: c01f702f67e2bec7a2224ebc73aea1e0d583922936707c973e86cdb59cafea9a
5
5
  SHA512:
6
- metadata.gz: 756c567674b257ffa0f3ba8f6633084350ab3719d5f532404cc0c2303f952f77fe1f6ad08a741bb68ffb2e8a91e1d5b4c9c24839f833ab3beda18da10d5adcb4
7
- data.tar.gz: 9ad9dccb6509c33bf3403f3aada58270d29784912f1850934dd5ffc44f8cd124f028940bccbe8d01e5d2d60fda20e6cb95372ddb2984d9163150c0ac7a9dd153
6
+ metadata.gz: 32f7c455cb6c3784cfd1892b06541c639dd43e9cc34711e40cfad0aabc0bad9b71e51046bf06acc5eb0ad5ed72614eed90f76357d310ce7aaaadc79158a2f561
7
+ data.tar.gz: ba76a9795e68cd101d68dd5f0824ab73bd3afee6fe717194b46d83c3a670ac57102bc63b06cd15b49516cfaaa5b4a77ac3f7949b99b386fdd295d16e5ac8d15b
data/CMakeLists.txt CHANGED
@@ -201,8 +201,7 @@ set(DEPS_LIB_DIR ${DEPS}/lib)
201
201
  set(DEPS_BIN_DIR ${DEPS}/bin)
202
202
  set(DEPS_SBIN_DIR ${DEPS}/sbin)
203
203
 
204
- set(PATCHES ${CMAKE_CURRENT_SOURCE_DIR}/patches)
205
- set(LIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/tebako)
204
+ set(EXE ${CMAKE_CURRENT_SOURCE_DIR}/exe)
206
205
 
207
206
  # Project resources that are used during CMake configuration stage
208
207
  set(DATA_RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
@@ -450,7 +449,7 @@ ExternalProject_Add(${RUBY_PRJ}
450
449
  DOWNLOAD_NO_PROGRESS true
451
450
  SOURCE_DIR ${RUBY_SOURCE_DIR}
452
451
  BUILD_IN_SOURCE true
453
- PATCH_COMMAND ruby ${LIB}/packager.rb pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
452
+ PATCH_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
454
453
  CONFIGURE_COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} \
455
454
  --enable-bundled-libyaml \
456
455
  --without-gmp \
@@ -465,7 +464,7 @@ ExternalProject_Add(${RUBY_PRJ}
465
464
  LDFLAGS=\"${RUBY_L_FLAGS}\""
466
465
  BUILD_COMMAND make ${RUBY_MAKEFILE}
467
466
  INSTALL_COMMAND make ${RUBY_MAKEFILE} install
468
- COMMAND ruby ${LIB}/packager.rb pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}
467
+ COMMAND ruby ${EXE}/tebako-packager pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}
469
468
  )
470
469
 
471
470
  add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ})
@@ -497,7 +496,7 @@ else (${SETUP_MODE})
497
496
  list(LENGTH GEMS GLENGTH)
498
497
 
499
498
  add_custom_target(clean_filesystem
500
- COMMAND ruby ${LIB}/packager.rb deploy ${RUBY_STASH_DIR} ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
499
+ COMMAND ruby ${EXE}/tebako-packager deploy ${RUBY_STASH_DIR} ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
501
500
  DEPENDS ${RUBY_PRJ}
502
501
  )
503
502
  if(GSLENGTH GREATER 0)
data/README.adoc CHANGED
@@ -5,8 +5,8 @@ image:https://github.com/tamatebako/tebako/actions/workflows/alpine.yml/badge.sv
5
5
  image:https://github.com/tamatebako/tebako/actions/workflows/macos.yml/badge.svg["MacOS amd64", link="https://github.com/tamatebako/tebako/actions/workflows/macos.yml"]
6
6
  image:https://github.com/tamatebako/tebako/actions/workflows/lint.yml/badge.svg["lint", link="https://github.com/tamatebako/tebako/actions/workflows/lint.yml"]
7
7
 
8
- image:https://api.cirrus-ci.com/github/tamatebako/tebako.svg?branch=main&task=ubuntu-aarch64["Ubuntu aarch64", link="https://cirrus-ci.com/github/tamatebako/tebako"]
9
8
  image:https://api.cirrus-ci.com/github/tamatebako/tebako.svg?branch=main&task=macos-arm64["MacOS arm64", link="https://cirrus-ci.com/github/tamatebako/tebako"]
9
+ image:https://api.cirrus-ci.com/github/tamatebako/tebako.svg?branch=main&task=ubuntu-aarch64["Ubuntu aarch64", link="https://cirrus-ci.com/github/tamatebako/tebako"]
10
10
 
11
11
  == Purpose
12
12
 
data/Rakefile CHANGED
@@ -31,3 +31,13 @@ require "rubocop/rake_task"
31
31
  RuboCop::RakeTask.new
32
32
 
33
33
  task default: %i[rubocop]
34
+
35
+ desc "Generate version.txt"
36
+ task "generate_version_txt" do
37
+ require_relative "lib/tebako/version"
38
+ File.write(File.join(__dir__, "version.txt"), "#{Tebako::VERSION}\n")
39
+ puts "Generate version.txt #{Tebako::VERSION} ==> #{File.join(__dir__, "version.txt")}"
40
+ end
41
+
42
+ task build: :generate_version_txt
43
+ task release: :generate_version_txt
data/exe/tebako CHANGED
@@ -26,6 +26,7 @@
26
26
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
27
  # POSSIBILITY OF SUCH DAMAGE.
28
28
 
29
- require_relative "../lib/cli"
29
+ require_relative "../lib/tebako"
30
+ require_relative "../lib/tebako/cli"
30
31
 
31
- Tebako::TebakoCli.start
32
+ Tebako::Cli.start
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright (c) 2023 [Ribose Inc](https://www.ribose.com).
5
+ # All rights reserved.
6
+ # This file is a part of tebako
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ # 1. Redistributions of source code must retain the above copyright
12
+ # notice, this list of conditions and the following disclaimer.
13
+ # 2. Redistributions in binary form must reproduce the above copyright
14
+ # notice, this list of conditions and the following disclaimer in the
15
+ # documentation and/or other materials provided with the distribution.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
21
+ # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
+ # POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ require_relative "../lib/tebako/packager"
30
+
31
+ begin
32
+ unless ARGV.length.positive?
33
+ raise Tebako::Error, "tebako-packager needs at least 1 argument (command), none has been provided."
34
+ end
35
+
36
+ case ARGV[0]
37
+ when "pass1"
38
+ # ARGV[0] -- command
39
+ # ARGV[1] -- OSTYPE
40
+ # ARGV[2] -- RUBY_SOURCE_DIR
41
+ # ARGV[3] -- FS_MOUNT_POINT
42
+ # ARGV[4] -- DATA_SRC_DIR
43
+ # ARGV[5] -- RUBY_VER
44
+ unless ARGV.length == 6
45
+ raise Tebako::Error,
46
+ "tebako-packager pass1 command expects 6 arguments, #{ARGV.length} has been provided."
47
+ end
48
+
49
+ Tebako::Packager.pass1(ARGV[1], ARGV[2], ARGV[3], ARGV[4], ARGV[5])
50
+ when "stash"
51
+ # ARGV[0] -- command
52
+ # ARGV[1] -- DATA_SRC_DIR
53
+ # ARGV[2] -- RUBY_STASH_DIR
54
+ unless ARGV.length == 3
55
+ raise Tebako::Error,
56
+ "tebako-packager stash command expects 3 arguments, #{ARGV.length} has been provided."
57
+ end
58
+
59
+ Tebako::Packager.stash(ARGV[1], ARGV[2])
60
+ when "pass2"
61
+ # ARGV[0] -- command
62
+ # ARGV[1] -- OSTYPE
63
+ # ARGV[2] -- RUBY_SOURCE_DIR
64
+ # ARGV[3] -- DEPS_LIB_DIR
65
+ # ARGV[4] -- DATA_SRC_DIR
66
+ # ARGV[5] -- RUBY_STASH_DIR
67
+ # ARGV[6] -- RUBY_VER
68
+ unless ARGV.length == 7
69
+ raise Tebako::Error,
70
+ "tebako-packager pass2 command expects 7 arguments, #{ARGV.length} has been provided."
71
+ end
72
+
73
+ Tebako::Packager.stash(ARGV[4], ARGV[5])
74
+ Tebako::Packager.pass2(ARGV[1], ARGV[2], ARGV[3], ARGV[6])
75
+ when "deploy"
76
+ # ARGV[0] -- command
77
+ # ARGV[1] -- FS_STASH_DIR
78
+ # ARGV[2] -- DATA_SRC_DIR
79
+ # ARGV[3] -- DATA_PRE_DIR
80
+ # ARGV[4] -- DATA_BIN_DIR
81
+ unless ARGV.length == 5
82
+ raise Tebako::Error,
83
+ "tebako-packager deploy command expects 5 arguments, #{ARGV.length} has been provided."
84
+ end
85
+ Tebako::Packager.deploy(ARGV[1], ARGV[2], ARGV[3], ARGV[4])
86
+ else
87
+ raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
88
+ end
89
+ rescue Tebako::Error => e
90
+ puts "tebako-packager failed: #{e.message} [#{e.error_code}]"
91
+ exit(e.error_code)
92
+ end
93
+
94
+ exit(0)
data/lib/tebako/cli.rb CHANGED
@@ -32,14 +32,13 @@ require "yaml"
32
32
 
33
33
  require_relative "cli_helpers"
34
34
  require_relative "error"
35
- require_relative "version"
36
35
 
37
36
  # Tebako - an executable packager
38
37
  # Implementation of tebako command-line interface
39
38
  module Tebako
40
39
  OPTIONS_FILE = ".tebako.yml"
41
40
  # Tebako packager front-end
42
- class TebakoCli < Thor
41
+ class Cli < Thor
43
42
  package_name "Tebako"
44
43
  class_option :prefix, type: :string, aliases: "-p", required: false,
45
44
  desc: "A path to tebako packaging environment, '~/.tebako' ('$HOME/.tebako') by default"
@@ -64,7 +63,7 @@ module Tebako
64
63
  def press
65
64
  puts press_announce
66
65
  do_press
67
- rescue TebakoError => e
66
+ rescue Tebako::Error => e
68
67
  puts "Tebako script failed: #{e.message} [#{e.error_code}]"
69
68
  exit e.error_code
70
69
  end
@@ -76,7 +75,7 @@ module Tebako
76
75
  def setup
77
76
  puts "Setting up tebako packaging environment"
78
77
  do_setup
79
- rescue TebakoError => e
78
+ rescue Tebako::Error => e
80
79
  puts "Tebako script failed: #{e.message} [#{e.error_code}]"
81
80
  exit e.error_code
82
81
  end
@@ -92,15 +91,8 @@ module Tebako
92
91
  return original_options unless File.exist?(OPTIONS_FILE)
93
92
 
94
93
  defaults = ::YAML.load_file(OPTIONS_FILE) || {}
95
- puts defaults.merge(original_options)
96
94
  Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
97
95
  end
98
-
99
- def generate
100
- FileUtils.mkdir_p(prefix)
101
- File.write(File.join(prefix, "version.txt"), "#{Tebako::VERSION}\n")
102
- puts("all: ")
103
- end
104
96
  end
105
97
 
106
98
  private
@@ -113,8 +105,6 @@ module Tebako
113
105
  end
114
106
 
115
107
  def do_setup
116
- FileUtils.mkdir_p(prefix)
117
- File.write(File.join(prefix, "version.txt"), "#{Tebako::VERSION}\n")
118
108
  packaging_error(101) unless system(b_env, "cmake -DSETUP_MODE:BOOLEAN=ON #{cfg_options}")
119
109
  packaging_error(102) unless system(b_env,
120
110
  "cmake --build #{output} --target setup --parallel #{Etc.nprocessors}")
@@ -36,7 +36,7 @@ require_relative "version"
36
36
  # Tebako - an executable packager
37
37
  # Command-line interface methods
38
38
  module Tebako
39
- # TebakoCli methods
39
+ # Cli methods
40
40
  module CliHelpers
41
41
  def b_env
42
42
  u_flags = if RbConfig::CONFIG["host_os"] =~ /darwin/
@@ -72,8 +72,10 @@ module Tebako
72
72
  def extend_ruby_version
73
73
  version = options["Ruby"].nil? ? DEFAULT_RUBY_VERSION : options["Ruby"]
74
74
  unless RUBY_VERSIONS.key?(version)
75
- raise TebakoError.new "Ruby version #{version} is not supported yet, exiting",
76
- 253
75
+ raise Tebako::Error.new(
76
+ "Ruby version #{version} is not supported yet, exiting",
77
+ 253
78
+ )
77
79
  end
78
80
 
79
81
  @extend_ruby_version ||= [version, RUBY_VERSIONS[version]]
@@ -87,6 +89,7 @@ module Tebako
87
89
  end
88
90
  end
89
91
 
92
+ # rubocop:disable Metrics/MethodLength
90
93
  def m_files
91
94
  @m_files ||= case RbConfig::CONFIG["host_os"]
92
95
  when /linux/, /darwin/
@@ -94,9 +97,13 @@ module Tebako
94
97
  when /msys/
95
98
  "Ninja"
96
99
  else
97
- raise TebakoError.new "#{RbConfig::CONFIG["host_os"]} is not supported yet, exiting", 254
100
+ raise Tebako::Error.new(
101
+ "#{RbConfig::CONFIG["host_os"]} is not supported yet, exiting",
102
+ 254
103
+ )
98
104
  end
99
105
  end
106
+ # rubocop:enable Metrics/MethodLength
100
107
 
101
108
  def output
102
109
  @output ||= File.join(prefix, "output")
@@ -120,7 +127,7 @@ module Tebako
120
127
  def packaging_error(code)
121
128
  msg = PACKAGING_ERRORS[code]
122
129
  msg = "Unknown packaging error" if msg.nil?
123
- raise TebakoError.new msg, code
130
+ raise Tebako::Error.new msg, code
124
131
  end
125
132
 
126
133
  def prefix
data/lib/tebako/error.rb CHANGED
@@ -29,7 +29,7 @@
29
29
  # Tebako error class
30
30
  module Tebako
31
31
  # Tebako error class
32
- class TebakoError < StandardError
32
+ class Error < StandardError
33
33
  def initialize(msg = "Unspecified error", code = 255)
34
34
  @error_code = code
35
35
  super(msg)
@@ -27,128 +27,130 @@
27
27
 
28
28
  # Tebako - an executable packager
29
29
  module Tebako
30
- # Ruby patching definitions (pass1)
31
- module Pass1
32
- TOOL_RBINSTALL_RB_PATCH = {
33
- " next if files.empty?" => "# tebako patched next if files.empty?"
34
- }.freeze
35
-
36
- RUBYGEM_OPENSSL_RB_PATCH = {
37
- 'autoload :OpenSSL, "openssl"' => "require \"openssl\"\nautoload :OpenSSL, \"openssl\""
38
- }.freeze
39
-
40
- EXT_SETUP_PATCH = {
41
- "#option nodynamic" => "option nodynamic"
42
- }.freeze
43
-
44
- EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH = {
45
- "#include \"ruby/ruby.h\"" => <<~SUBST
46
- #include "ruby/ruby.h"
47
-
48
- /* -- Start of tebako patch -- */
49
- #ifndef HAVE_RB_SYM2STR
50
- #define HAVE_RB_SYM2STR 1
51
- #endif
52
-
53
- #ifndef HAVE_RB_ARRAY_CONST_PTR
54
- #define HAVE_RB_ARRAY_CONST_PTR 1
55
- #endif
56
-
57
- #ifndef HAVE_RB_RATIONAL_NUM
58
- #define HAVE_RB_RATIONAL_NUM 1
59
- #endif
60
-
61
- #ifndef HAVE_RB_RATIONAL_DEN
62
- #define HAVE_RB_RATIONAL_DEN 1
63
- #endif
64
-
65
- #ifndef HAVE_RB_COMPLEX_REAL
66
- #define HAVE_RB_COMPLEX_REAL
67
- #endif
68
-
69
- #ifndef HAVE_RB_COMPLEX_IMAG
70
- #define HAVE_RB_COMPLEX_IMAG
71
- #endif
72
- /* -- End of tebako patch -- */
73
-
74
- SUBST
75
- }.freeze
76
-
77
- CONFIGURE_PATCH = {
78
- "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
79
- }.freeze
80
-
81
- class << self
82
- def get_patch_map(ostype, mount_point, ruby_ver)
83
- patch_map = {
84
- # ....................................................
85
- # It won't install gems with no files defined in spec
86
- # However if
87
- # -- we are installing a default gem from extension
88
- # -- extension is build statically
89
- # there may be no files install in addition to spec
90
- # Example: io/wait extension (and others)
91
- "tool/rbinstall.rb" => TOOL_RBINSTALL_RB_PATCH,
30
+ module Packager
31
+ # Ruby patching definitions (pass1)
32
+ module Pass1
33
+ TOOL_RBINSTALL_RB_PATCH = {
34
+ " next if files.empty?" => "# tebako patched next if files.empty?"
35
+ }.freeze
36
+
37
+ RUBYGEM_OPENSSL_RB_PATCH = {
38
+ 'autoload :OpenSSL, "openssl"' => "require \"openssl\"\nautoload :OpenSSL, \"openssl\""
39
+ }.freeze
40
+
41
+ EXT_SETUP_PATCH = {
42
+ "#option nodynamic" => "option nodynamic"
43
+ }.freeze
44
+
45
+ EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH = {
46
+ "#include \"ruby/ruby.h\"" => <<~SUBST
47
+ #include "ruby/ruby.h"
48
+
49
+ /* -- Start of tebako patch -- */
50
+ #ifndef HAVE_RB_SYM2STR
51
+ #define HAVE_RB_SYM2STR 1
52
+ #endif
53
+
54
+ #ifndef HAVE_RB_ARRAY_CONST_PTR
55
+ #define HAVE_RB_ARRAY_CONST_PTR 1
56
+ #endif
57
+
58
+ #ifndef HAVE_RB_RATIONAL_NUM
59
+ #define HAVE_RB_RATIONAL_NUM 1
60
+ #endif
61
+
62
+ #ifndef HAVE_RB_RATIONAL_DEN
63
+ #define HAVE_RB_RATIONAL_DEN 1
64
+ #endif
65
+
66
+ #ifndef HAVE_RB_COMPLEX_REAL
67
+ #define HAVE_RB_COMPLEX_REAL
68
+ #endif
69
+
70
+ #ifndef HAVE_RB_COMPLEX_IMAG
71
+ #define HAVE_RB_COMPLEX_IMAG
72
+ #endif
73
+ /* -- End of tebako patch -- */
92
74
 
75
+ SUBST
76
+ }.freeze
77
+
78
+ CONFIGURE_PATCH = {
79
+ "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
80
+ }.freeze
81
+
82
+ class << self
83
+ def get_patch_map(ostype, mount_point, ruby_ver)
84
+ patch_map = {
85
+ # ....................................................
86
+ # It won't install gems with no files defined in spec
87
+ # However if
88
+ # -- we are installing a default gem from extension
89
+ # -- extension is build statically
90
+ # there may be no files install in addition to spec
91
+ # Example: io/wait extension (and others)
92
+ "tool/rbinstall.rb" => TOOL_RBINSTALL_RB_PATCH,
93
+
94
+ # ....................................................
95
+ # This is something that I cannnot explain
96
+ # (this patch does not seem related to static compilation)
97
+ "ext/bigdecimal/bigdecimal.h" => EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH,
98
+
99
+ # ....................................................
100
+ # Allow only packaged gems (from within memfs)
101
+ "lib/rubygems/path_support.rb" => rubygems_path_support_patch(mount_point),
102
+
103
+ # ....................................................
104
+ # Disable dynamic extensions
105
+ "ext/Setup" => EXT_SETUP_PATCH
106
+ }
93
107
  # ....................................................
94
- # This is something that I cannnot explain
95
- # (this patch does not seem related to static compilation)
96
- "ext/bigdecimal/bigdecimal.h" => EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH,
108
+ # Fixing (bypassing) configure script bug where a variable is used before initialization
109
+ patch_map.store("configure", CONFIGURE_PATCH) if ostype =~ /darwin/
97
110
 
98
111
  # ....................................................
99
- # Allow only packaged gems (from within memfs)
100
- "lib/rubygems/path_support.rb" => rubygems_path_support_patch(mount_point),
112
+ # autoload :OpenSSL, "openssl"
113
+ # fails to deal with a default gem from statically linked extension
114
+ patch_map.store("lib/rubygems/openssl.rb", RUBYGEM_OPENSSL_RB_PATCH) if ruby_ver[0] == "3"
101
115
 
102
- # ....................................................
103
- # Disable dynamic extensions
104
- "ext/Setup" => EXT_SETUP_PATCH
105
- }
106
- # ....................................................
107
- # Fixing (bypassing) configure script bug where a variable is used before initialization
108
- patch_map.store("configure", CONFIGURE_PATCH) if ostype =~ /darwin/
109
-
110
- # ....................................................
111
- # autoload :OpenSSL, "openssl"
112
- # fails to deal with a default gem from statically linked extension
113
- patch_map.store("lib/rubygems/openssl.rb", RUBYGEM_OPENSSL_RB_PATCH) if ruby_ver[0] == "3"
114
-
115
- patch_map
116
- end
116
+ patch_map
117
+ end
117
118
 
118
- private
119
+ private
119
120
 
120
- def rubygems_path_support_patch_one(mount_point)
121
- <<~SUBST
122
- @home = env["GEM_HOME"] || Gem.default_dir
123
- # -- Start of tebako patch --
124
- unless env["TEBAKO_PASS_THROUGH"]
125
- @home = Gem.default_dir unless @home.index("#{mount_point}") == 0
126
- end
127
- # -- End of tebako patch --
121
+ def rubygems_path_support_patch_one(mount_point)
122
+ <<~SUBST
123
+ @home = env["GEM_HOME"] || Gem.default_dir
124
+ # -- Start of tebako patch --
125
+ unless env["TEBAKO_PASS_THROUGH"]
126
+ @home = Gem.default_dir unless @home.index("#{mount_point}") == 0
127
+ end
128
+ # -- End of tebako patch --
128
129
 
129
- SUBST
130
- end
130
+ SUBST
131
+ end
131
132
 
132
- def rubygems_path_support_patch_two(mount_point)
133
- <<~SUBST
133
+ def rubygems_path_support_patch_two(mount_point)
134
+ <<~SUBST
134
135
 
135
- @path = split_gem_path env["GEM_PATH"], @home
136
- # -- Start of tebako patch --
137
- unless env["TEBAKO_PASS_THROUGH"]
138
- @path.keep_if do |xpath|
139
- xpath.index("#{mount_point}") == 0
136
+ @path = split_gem_path env["GEM_PATH"], @home
137
+ # -- Start of tebako patch --
138
+ unless env["TEBAKO_PASS_THROUGH"]
139
+ @path.keep_if do |xpath|
140
+ xpath.index("#{mount_point}") == 0
141
+ end
140
142
  end
141
- end
142
- # -- End of tebako patch --
143
+ # -- End of tebako patch --
143
144
 
144
- SUBST
145
- end
145
+ SUBST
146
+ end
146
147
 
147
- def rubygems_path_support_patch(mount_point)
148
- {
149
- ' @home = env["GEM_HOME"] || Gem.default_dir' => rubygems_path_support_patch_one(mount_point),
150
- ' @path = split_gem_path env["GEM_PATH"], @home' => rubygems_path_support_patch_two(mount_point)
151
- }
148
+ def rubygems_path_support_patch(mount_point)
149
+ {
150
+ ' @home = env["GEM_HOME"] || Gem.default_dir' => rubygems_path_support_patch_one(mount_point),
151
+ ' @path = split_gem_path env["GEM_PATH"], @home' => rubygems_path_support_patch_two(mount_point)
152
+ }
153
+ end
152
154
  end
153
155
  end
154
156
  end