tebako 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CMakeLists.txt +21 -29
  3. data/README.adoc +53 -28
  4. data/Rakefile +1 -1
  5. data/common.env +1 -1
  6. data/lib/tebako/cli.rb +23 -0
  7. data/lib/tebako/cli_helpers.rb +3 -3
  8. data/lib/tebako/packager/pass1.rb +3 -1
  9. data/lib/tebako/packager/pass2.rb +64 -274
  10. data/{tests-2/fixtures/gems-expressir/gems-expressir.rb → lib/tebako/packager/patch_helpers.rb} +30 -5
  11. data/lib/tebako/packager/patch_literals.rb +255 -0
  12. data/lib/tebako/version.rb +1 -1
  13. data/tebako.gemspec +1 -1
  14. data/version.txt +1 -1
  15. metadata +4 -62
  16. data/tests/scripts/cross-tests.sh +0 -34
  17. data/tests/scripts/functional-tests.sh +0 -335
  18. data/tests/test-00/test.rb +0 -4
  19. data/tests/test-01/tebako-test-run.rb +0 -5
  20. data/tests/test-09/tebako-test-0.0.1.gem +0 -0
  21. data/tests/test-11/bin/tebako-test-run.rb +0 -10
  22. data/tests/test-11/lib/tebako-test.rb +0 -20
  23. data/tests/test-11/tebako-test.gemspec +0 -15
  24. data/tests/test-12/tebako-test-a.gemspec +0 -15
  25. data/tests/test-12/tebako-test-b.gemspec +0 -15
  26. data/tests/test-13/bin/tebako-test-run.rb +0 -10
  27. data/tests/test-13/lib/tebako-test.rb +0 -20
  28. data/tests/test-13/tebako-test.gemspec +0 -15
  29. data/tests/test-15/Gemfile +0 -8
  30. data/tests/test-15/Rakefile +0 -4
  31. data/tests/test-15/bin/tebako-test-run.rb +0 -10
  32. data/tests/test-15/lib/tebako/bundle/test/version.rb +0 -9
  33. data/tests/test-15/lib/tebako/bundle/test.rb +0 -29
  34. data/tests/test-15/tebako-bundle-test.gemspec +0 -30
  35. data/tests/test-16/Gemfile +0 -8
  36. data/tests/test-16/Rakefile +0 -4
  37. data/tests/test-16/bin/tebako-test-run.rb +0 -10
  38. data/tests/test-16/lib/tebako/bundle/test/version.rb +0 -9
  39. data/tests/test-16/lib/tebako/bundle/test.rb +0 -29
  40. data/tests/test-16/tebako-bundle-test.gemspec +0 -24
  41. data/tests/test-18/Gemfile +0 -5
  42. data/tests/test-18/tebako-test-run.rb +0 -12
  43. data/tests/test-19/Gemfile +0 -6
  44. data/tests/test-19/tebako-test-run.rb +0 -11
  45. data/tests-2/fixtures/gems-bundler/Gemfile +0 -4
  46. data/tests-2/fixtures/gems-bundler/gems-bundler.rb +0 -34
  47. data/tests-2/fixtures/gems-byebug/Gemfile +0 -5
  48. data/tests-2/fixtures/gems-byebug/gems-byebug.rb +0 -31
  49. data/tests-2/fixtures/gems-expressir/Gemfile +0 -7
  50. data/tests-2/fixtures/gems-libmspack/Gemfile +0 -5
  51. data/tests-2/fixtures/gems-libmspack/gems-libmspack.rb +0 -91
  52. data/tests-2/fixtures/gems-sassc/Gemfile +0 -6
  53. data/tests-2/fixtures/gems-sassc/base_style/all.scss +0 -1
  54. data/tests-2/fixtures/gems-sassc/base_style/reset.scss +0 -100
  55. data/tests-2/fixtures/gems-sassc/gems-sassc.rb +0 -129
  56. data/tests-2/fixtures/gems-seven-zip/Gemfile +0 -7
  57. data/tests-2/fixtures/gems-seven-zip/gems-seven-zip.rb +0 -53
  58. data/tests-2/fixtures/launcher-coreincl/launcher-coreincl.rb +0 -29
  59. data/tests-2/fixtures/launcher-package/launcher-package.rb +0 -29
  60. data/tests-2/fixtures/launcher-pwd/launcher-pwd.rb +0 -28
  61. data/tests-2/fixtures/launcher-stdinredir/input.txt +0 -1
  62. data/tests-2/fixtures/launcher-stdinredir/launcher-stdinredir.rb +0 -31
  63. data/tests-2/fixtures/launcher-stdoutredir/launcher-stdoutredir.rb +0 -28
  64. data/tests-2/fixtures/patches-dir/level-1/level-2/file-1.txt +0 -1
  65. data/tests-2/fixtures/patches-dir/level-1/level-2/file-2.txt +0 -1
  66. data/tests-2/fixtures/patches-dir/level-1/level-2/file-3.txt +0 -1
  67. data/tests-2/fixtures/patches-dir/patches-dir.rb +0 -154
  68. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-1.txt +0 -1
  69. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-2.txt +0 -2
  70. data/tests-2/fixtures/patches-io-and-file/level-1/level-2/file-3.txt +0 -1
  71. data/tests-2/fixtures/patches-io-and-file/level-1/link-3 +0 -1
  72. data/tests-2/fixtures/patches-io-and-file/patches-io-and-file.rb +0 -87
  73. data/tests-2/fixtures/patches-main/patches-main.rb +0 -6
  74. data/tests-2/tebako-test.rb +0 -313
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97effadb1d79ead536d7307438fce1d4e41b352c9f202e34f6d37986f350215d
4
- data.tar.gz: c01f702f67e2bec7a2224ebc73aea1e0d583922936707c973e86cdb59cafea9a
3
+ metadata.gz: 573cd1ec24b37fafbebc82a0a8a11a4a1c05e22b6feeba1af89dc8670923c5e2
4
+ data.tar.gz: 03d3c8f200d209a6b419960f76f499c4ccad0a0b726cf8ba85a780fb6c6d3aa4
5
5
  SHA512:
6
- metadata.gz: 32f7c455cb6c3784cfd1892b06541c639dd43e9cc34711e40cfad0aabc0bad9b71e51046bf06acc5eb0ad5ed72614eed90f76357d310ce7aaaadc79158a2f561
7
- data.tar.gz: ba76a9795e68cd101d68dd5f0824ab73bd3afee6fe717194b46d83c3a670ac57102bc63b06cd15b49516cfaaa5b4a77ac3f7949b99b386fdd295d16e5ac8d15b
6
+ metadata.gz: 5a362b80444f6288964158034d58fd4e86749127f173d0f4d30445790d4a86481467b3b82e75a4d7398729633bdb537f0f146ff168d5893db57f155d0d16776c
7
+ data.tar.gz: 3da8e9e840d4bbf72f28c6b4e3b4c75bcdc076da51c000ef2e9a2d63121b8a694154be279d787694ee9728961e045a98e4f919740112c36579104b7d3565291e
data/CMakeLists.txt CHANGED
@@ -63,23 +63,6 @@ else(MINGW)
63
63
  set(FS_CURRENT ${FS_CURRENT_RAW})
64
64
  endif(MINGW)
65
65
 
66
- # External dependencies
67
- # ---------------------------------------------------------------------------------------------------
68
- # DwarFS dependencies:
69
- # ronn binutils-dev libarchive-dev libevent-dev libjemalloc-dev acl-dev \
70
- # libdouble-conversion-dev libiberty-dev liblz4-dev liblzma-dev libssl-dev \
71
- # libboost-context-dev libboost-filesystem-dev libboost-program-options-dev \
72
- # libboost-regex-dev libboost-system-dev libboost-thread-dev \
73
- # libunwind-dev libdwarf-dev libelf-dev libfmt-dev libfuse3-dev libgoogle-glog-dev \
74
- # bison flex fuse3 pkg-config libsodium-dev
75
- # ---------------------------------------------------------------------------------------------------
76
- # Ruby dependencies:
77
- # libffi-dev libgdbm-dev libyaml-dev libncurses-dev libreadline-dev
78
- # ---------------------------------------------------------------------------------------------------
79
- # For Rails testing only:
80
- # libsqlite3-dev
81
- # ---------------------------------------------------------------------------------------------------
82
-
83
66
  set(RUBY_DEBUG_BUILD OFF)
84
67
 
85
68
  include(ExternalProject)
@@ -191,6 +174,7 @@ elseif("${OSTYPE_TXT}" MATCHES "^msys*")
191
174
  set(RUBY_MAKEFILE "--file=GNUmakefile")
192
175
  elseif("${OSTYPE_TXT}" MATCHES "^darwin.*")
193
176
  set(IS_DARWIN ON)
177
+ set(BUILD_OPENSSL_ROOT_DIR "${BUILD_BREW_PREFIX}/opt/openssl@1.1")
194
178
  endif()
195
179
 
196
180
  # Various locations for external projects
@@ -210,8 +194,8 @@ set(DATA_RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
210
194
  # External projects
211
195
 
212
196
  if ("-${RUBY_VER}" STREQUAL "-" OR "-${RUBY_HASH}" STREQUAL "-")
213
- set(RUBY_VER "3.0.6")
214
- set(RUBY_HASH "6e6cbd490030d7910c0ff20edefab4294dfcd1046f0f8f47f78b597987ac683e")
197
+ set(RUBY_VER "3.1.4")
198
+ set(RUBY_HASH "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6")
215
199
  message(STATUS "Using default Ruby version ${RUBY_VER}")
216
200
  endif()
217
201
 
@@ -232,10 +216,6 @@ if(IS_MSYS)
232
216
  include(${CMAKE_SOURCE_DIR}/tools/cmake-scripts/setup-openssl.cmake)
233
217
  endif(IS_MSYS)
234
218
 
235
- if(WITH_OPENSSL_BUILD)
236
- def_ext_prj_g(OPENSSL "1.1.1s")
237
- endif(WITH_OPENSSL_BUILD)
238
-
239
219
  def_ext_prj_g(INCBIN "348e36b")
240
220
  def_ext_prj_g(DWARFS_WR "v0.3.4")
241
221
 
@@ -255,6 +235,11 @@ else()
255
235
  set(WITH_NCURSES_BUILD OFF)
256
236
  endif()
257
237
 
238
+ set(LIBYAML_RUBY_OPTION "")
239
+ if(${RUBY_VER} VERSION_LESS "3.2.0")
240
+ set(LIBYAML_RUBY_OPTION "--enable-bundled-libyaml")
241
+ endif(${RUBY_VER} VERSION_LESS "3.2.0")
242
+
258
243
  message("Configuration summary:")
259
244
  message(STATUS "ruby: v${RUBY_VER} at ${RUBY_SOURCE_DIR}")
260
245
  message(STATUS "bundler version: ${BUNDLER_VER} (${BUNDLER_ANNOTATION})")
@@ -267,6 +252,7 @@ if(WITH_NCURSES_BUILD)
267
252
  else()
268
253
  message(STATUS "ncurses: ${_LIBNCURSES}")
269
254
  endif(WITH_NCURSES_BUILD)
255
+
270
256
  message(STATUS "incbin: @${INCBIN_TAG} at ${INCBIN_SOURCE_DIR}")
271
257
  message(STATUS "dwarfs with tebako wrapper: @${DWARFS_WR_TAG} at ${DWARFS_WR_SOURCE_DIR}")
272
258
 
@@ -318,6 +304,7 @@ ExternalProject_Add(${INCBIN_PRJ}
318
304
  PREFIX ${DEPS}
319
305
  GIT_REPOSITORY https://github.com/graphitemaster/incbin.git
320
306
  GIT_TAG ${INCBIN_TAG}
307
+ BUILD_IN_SOURCE true
321
308
  CONFIGURE_COMMAND ""
322
309
  BUILD_COMMAND ""
323
310
  INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INCLUDE_DIR}/incbin
@@ -424,9 +411,14 @@ endif()
424
411
  set(C_FLAGS_DEST cppflags)
425
412
 
426
413
  if(IS_DARWIN)
427
- string(CONCAT RUBY_C_FLAGS ${RUBY_C_FLAGS} " -I${BUILD_BREW_PREFIX}/include -I/opt/openssl@1.1/include -I${BUILD_BREW_PREFIX}/opt/zlib/include")
428
- string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -L${BUILD_BREW_PREFIX}/lib -L${BUILD_BREW_PREFIX}/opt/openssl@1.1/lib -L${BUILD_BREW_PREFIX}/opt/zlib/lib")
429
- set(OPENSSL_RUBY_OPTION "--with-openssl-dir=${BUILD_BREW_PREFIX}/opt/openssl@1.1")
414
+ if(${RUBY_VER} VERSION_LESS "3.2.2")
415
+ set(OPENSSL_VER "1.1")
416
+ else(${RUBY_VER} VERSION_LESS "3.2.2")
417
+ set(OPENSSL_VER "3")
418
+ endif(${RUBY_VER} VERSION_LESS "3.2.2")
419
+ string(CONCAT RUBY_C_FLAGS ${RUBY_C_FLAGS} " -I${BUILD_BREW_PREFIX}/opt/openssl@${OPENSSL_VER}/include -I${BUILD_BREW_PREFIX}/opt/zlib/include -I${BUILD_BREW_PREFIX}/include")
420
+ string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -L${BUILD_BREW_PREFIX}/opt/openssl@${OPENSSL_VER}/lib -L${BUILD_BREW_PREFIX}/opt/zlib/lib -L${BUILD_BREW_PREFIX}/lib")
421
+ set(OPENSSL_RUBY_OPTION "--with-openssl-dir=${BUILD_BREW_PREFIX}/opt/openssl@${OPENSSL_VER}")
430
422
  set(C_FLAGS_DEST cflags)
431
423
  endif(IS_DARWIN)
432
424
 
@@ -440,7 +432,8 @@ endif(RB_W32)
440
432
 
441
433
  message(STATUS "Ruby build ${C_FLAGS_DEST}='${RUBY_C_FLAGS}'")
442
434
  message(STATUS "Ruby build LDFLAGS='${RUBY_L_FLAGS}'")
443
- message(STATUS "Openssl Ruby option='${OPENSSL_RUBY_OPTION}'")
435
+ message(STATUS "openssl Ruby option='${OPENSSL_RUBY_OPTION}'")
436
+ message(STATUS "libyaml Ruby option='${LIBYAML_RUBY_OPTION}'")
444
437
 
445
438
  ExternalProject_Add(${RUBY_PRJ}
446
439
  PREFIX ${DEPS}
@@ -450,8 +443,7 @@ ExternalProject_Add(${RUBY_PRJ}
450
443
  SOURCE_DIR ${RUBY_SOURCE_DIR}
451
444
  BUILD_IN_SOURCE true
452
445
  PATCH_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
453
- CONFIGURE_COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} \
454
- --enable-bundled-libyaml \
446
+ CONFIGURE_COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
455
447
  --without-gmp \
456
448
  --disable-dtrace \
457
449
  --disable-debug-env \
data/README.adoc CHANGED
@@ -40,9 +40,11 @@ The Tebako packager is tested on the following platforms:
40
40
  == Supported Ruby versions
41
41
 
42
42
  The Tebako packager supports the following versions of Ruby for packaging:
43
+
43
44
  * 2.7.7
44
45
  * 3.0.6
45
46
  * 3.1.4
47
+ * 3.2.2
46
48
 
47
49
  Support of specific version including minor release requires some effort, sometimes extensive
48
50
  but our goal is to be able to package all maintained Ruby releases.
@@ -88,13 +90,11 @@ apt-get install -y binutils-dev libarchive-dev libevent-dev libjemalloc-dev acl-
88
90
 
89
91
  === General
90
92
 
91
- Just clone this repository, install Ruby bundle and run `tebako setup` as follows.
93
+ Tebako is distributed as a Ruby gem
92
94
 
93
95
  [source,sh]
94
96
  ----
95
- git clone https://github.com/tamatebako/tebako
96
- bundle install
97
- tebako/exe/tebako setup
97
+ gem install tebako
98
98
  ----
99
99
 
100
100
  === Quick setup on Ubuntu 20.04 on Docker
@@ -122,9 +122,6 @@ apt-get install -y software-properties-common
122
122
  add-apt-repository -y ppa:ubuntu-toolchain-r/test
123
123
  apt-get install -y gcc-9 g++-9
124
124
 
125
- update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
126
- update-alternatives --set gcc /usr/bin/gcc-9
127
-
128
125
  apt-get install -y curl git ruby ruby-dev pkg-config bison flex make autoconf
129
126
  curl https://apt.kitware.com/kitware-archive.sh | bash
130
127
  apt-get install -y cmake
@@ -134,14 +131,10 @@ apt-get install -y binutils-dev libarchive-dev libevent-dev libjemalloc-dev acl-
134
131
  libboost-context-dev libboost-filesystem-dev libboost-program-options-dev \
135
132
  libboost-regex-dev libboost-system-dev libboost-thread-dev \
136
133
  libunwind-dev libdwarf-dev libelf-dev libfuse-dev libgoogle-glog-dev \
137
- libffi-dev libgdbm-dev libyaml-dev libncurses-dev libreadline-dev \
138
- libsqlite3-dev
134
+ libffi-dev libgdbm-dev libyaml-dev libncurses-dev libreadline-dev libfmt-dev
139
135
 
140
- apt-get install -y libfmt-dev
136
+ gem install tebako
141
137
 
142
- git clone https://github.com/tamatebako/tebako
143
- bundle install
144
- tebako/exe/tebako setup
145
138
  ----
146
139
 
147
140
  == Usage
@@ -167,14 +160,14 @@ itself takes minutes.
167
160
  You can manage setup of packaging environment manually; please refer to description of setup and clean
168
161
  cmmands below.
169
162
 
170
- [source,sh]
163
+ [source]
171
164
  ----
172
- <install-folder>/exe/tebako press \
173
- [-p |--prefix=<tebako-root-folder>] \
174
- [-R | --Ruby=<2.7.7|3.0.6|3.1.4>] \
165
+ tebako press \
166
+ [-p|--prefix=<tebako-root-folder>] \
167
+ [-R|--Ruby=<2.7.7|3.0.6|3.1.4|3.2.2>] \
175
168
  -r|--root=<project-root-folder> \
176
169
  -e|--entry-point=<entry-point> \
177
- [-o |--output=<packaged file name>] \
170
+ [-o|--output=<packaged file name>] \
178
171
  [-l|--log-level=<error|warn|debug|trace>]
179
172
  ----
180
173
 
@@ -200,7 +193,7 @@ point base name`)
200
193
  ====
201
194
  [source,sh]
202
195
  ----
203
- exe/tebako press \
196
+ tebako press \
204
197
  --root='~/projects/myproject' \
205
198
  --entry=start.rb \
206
199
  --output=/temp/myproject.tebako
@@ -217,11 +210,11 @@ directories differ and nultiple Ruby versions within single configuration
217
210
  This command is optional, tebako creates packaging environment automatically upon the first
218
211
  invocation of press command.
219
212
 
220
- [source,sh]
213
+ [source]
221
214
  ----
222
- <install-folder>/exe/tebako setup \
215
+ tebako setup \
223
216
  [-p |--prefix=<tebako-root-folder>] \
224
- [-R | --Ruby=<2.7.7|3.0.6|3.1.4>]
217
+ [-R |--Ruby=<2.7.7|3.0.6|3.1.4|3.2.2>]
225
218
  ----
226
219
 
227
220
  Where:
@@ -229,34 +222,66 @@ Where:
229
222
  * `<tebako-root-folder>`, the Tebako setup folder (optional, defaults to current
230
223
  folder)
231
224
 
232
- * `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.0.6)
233
-
234
-
225
+ * `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.4)
235
226
 
236
227
  ==== Clean
237
228
 
238
229
  This command deletes tebako artifacts created by setup and press commands.
239
230
  Normally you do not need to do it since tebako packager optimizes artifacts lifecycle on its own.
240
231
 
232
+ [source]
233
+ ----
234
+ tebako clean \
235
+ [-p|--prefix=<tebako-root-folder>]
236
+ ----
237
+
238
+ Where:
239
+
240
+ * `<tebako-root-folder>`, the Tebako setup folder (optional, defaults to current
241
+ folder)
242
+
243
+ [example]
244
+ ====
241
245
  [source,sh]
242
246
  ----
243
- exe/tebako press \
244
- [-p |--prefix=<tebako-root-folder>]
247
+ tebako clean --prefix='~/.tebako'
248
+ ----
249
+ ====
250
+
251
+ ==== Clean ruby
252
+
253
+ This command deletes tebako Ruby artifacts created by setup and press commands. Dwarfs libraries are not cleaned.
254
+ Normally you do not need to do it since tebako packager optimizes artifacts lifecycle on its own.
255
+
256
+ [source]
257
+ ----
258
+ tebako clean_ruby
259
+ [-p|--prefix=<tebako-root-folder>]
260
+ [-R|--Ruby=<2.7.7|3.0.6|3.1.4|3.2.2>]
245
261
  ----
246
262
 
247
263
  Where:
248
264
 
249
265
  * `<tebako-root-folder>`, the Tebako setup folder (optional, defaults to current
250
266
  folder)
267
+ * `Ruby` parameter defines Ruby version that will cleaned (optional, cleans all versions by default)
251
268
 
252
269
  [example]
253
270
  ====
254
271
  [source,sh]
255
272
  ----
256
- exe/tebako clean --root='~/projects/myproject'
273
+ tebako clean_ruby --prefix='~/.tebako'
257
274
  ----
258
275
  ====
259
276
 
277
+ ==== Build script hash
278
+ Hash command will calculate tebako script hash that may be used as a cache key in CI/CD environment like GitHub Actions
279
+
280
+ [source]
281
+ ----
282
+ tebako hash
283
+ ----
284
+
260
285
  === Exit codes
261
286
 
262
287
  [cols,"a,a"]
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ desc "Generate version.txt"
36
36
  task "generate_version_txt" do
37
37
  require_relative "lib/tebako/version"
38
38
  File.write(File.join(__dir__, "version.txt"), "#{Tebako::VERSION}\n")
39
- puts "Generate version.txt #{Tebako::VERSION} ==> #{File.join(__dir__, "version.txt")}"
39
+ puts "Generating version.txt #{Tebako::VERSION} --> #{File.join(__dir__, "version.txt")}"
40
40
  end
41
41
 
42
42
  task build: :generate_version_txt
data/common.env CHANGED
@@ -3,4 +3,4 @@ DEPS=deps
3
3
  INCBIN_TAG=348e36b
4
4
  DWARFS_WR_TAG=v0.3.4
5
5
  BUNDLER_VER=2.3.22
6
- RUBY_VER=3.0.6
6
+ RUBY_VER=3.1.4
data/lib/tebako/cli.rb 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 "digest"
29
30
  require "fileutils"
30
31
  require "thor"
31
32
  require "yaml"
@@ -49,6 +50,28 @@ module Tebako
49
50
  FileUtils.rm_rf([deps, output], secure: true)
50
51
  end
51
52
 
53
+ desc "clean_ruby", "Clean Ruby source from tebako packaging environment"
54
+ method_option :Ruby, type: :string, aliases: "-R", required: false,
55
+ enum: Tebako::CliHelpers::RUBY_VERSIONS.keys,
56
+ desc: "Ruby version to clean, all available versions by default"
57
+ def clean_ruby
58
+ puts "Cleaning Ruby sources from tebako packaging environment"
59
+ if options["Ruby"].nil?
60
+ nmr = "#{deps}/src/_ruby_*"
61
+ nms = "#{deps}/stash_*"
62
+ else
63
+ nmr = "#{deps}/src/_ruby_#{options["Ruby"]}*"
64
+ nms = "#{deps}/stash_#{options["Ruby"]}"
65
+ end
66
+ FileUtils.rm_rf(Dir.glob(nmr), secure: true)
67
+ FileUtils.rm_rf(Dir.glob(nms), secure: true)
68
+ end
69
+
70
+ desc "hash", "Print build script hash (ci cache key)"
71
+ def hash
72
+ print Digest::SHA256.hexdigest File.read File.join(__dir__, "../..", "CMakeLists.txt")
73
+ end
74
+
52
75
  desc "press", "Press tebako image"
53
76
  method_option :"entry-point", type: :string, aliases: ["-e", "--entry"], required: true,
54
77
  desc: "Ruby application entry point"
@@ -63,11 +63,11 @@ module Tebako
63
63
  RUBY_VERSIONS = {
64
64
  "2.7.7" => "e10127db691d7ff36402cfe88f418c8d025a3f1eea92044b162dd72f0b8c7b90",
65
65
  "3.0.6" => "6e6cbd490030d7910c0ff20edefab4294dfcd1046f0f8f47f78b597987ac683e",
66
- "3.1.4" => "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6"
67
- # "3.2.2" => "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
66
+ "3.1.4" => "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6",
67
+ "3.2.2" => "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
68
68
  }.freeze
69
69
 
70
- DEFAULT_RUBY_VERSION = "3.0.6"
70
+ DEFAULT_RUBY_VERSION = "3.1.4"
71
71
 
72
72
  def extend_ruby_version
73
73
  version = options["Ruby"].nil? ? DEFAULT_RUBY_VERSION : options["Ruby"]
@@ -25,6 +25,8 @@
25
25
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
+ require_relative "patch_helpers"
29
+
28
30
  # Tebako - an executable packager
29
31
  module Tebako
30
32
  module Packager
@@ -111,7 +113,7 @@ module Tebako
111
113
  # ....................................................
112
114
  # autoload :OpenSSL, "openssl"
113
115
  # 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"
116
+ patch_map.store("lib/rubygems/openssl.rb", RUBYGEM_OPENSSL_RB_PATCH) if PatchHelpers.ruby3x?(ruby_ver)
115
117
 
116
118
  patch_map
117
119
  end