tebako 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CMakeLists.txt +0 -5
- data/README.adoc +0 -9
- data/lib/tebako/cli.rb +4 -4
- data/lib/tebako/cli_helpers.rb +41 -18
- data/lib/tebako/codegen.rb +18 -6
- data/lib/tebako/deploy_helper.rb +9 -4
- data/lib/tebako/options_manager.rb +9 -0
- data/lib/tebako/packager.rb +1 -0
- data/lib/tebako/stripper.rb +3 -4
- data/lib/tebako/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e602aace5a0b42b9e7599d3bb39c32a2bc6ec01f48ec885d5147c626d79fb3f
|
4
|
+
data.tar.gz: 845e5e0a63277d53d64a6ff867d88016f6a002234eb01c0538d97d4ff06ceedf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb6458e260860b68983529d397de867ead824edd5ccd9dc97a37ebd849fec2d8539e25ecfcc7fe1652b9afaef29a1dc189470d0840ec2b986da1a980e9f30f19
|
7
|
+
data.tar.gz: b16af1a8fa72fc86e04f64faf7a55be31b325defcbb801ee5bf02ee3551ed6a7bbea1df1920e93d0556963ac17487ed7787551d03d8147e959b9e6bfa00a4e15
|
data/CMakeLists.txt
CHANGED
@@ -91,8 +91,6 @@ set(IS_MSYS OFF)
|
|
91
91
|
set(IS_DARWIN OFF)
|
92
92
|
set(RB_W32 OFF)
|
93
93
|
set(RUBY_WITHOUT_EXT "dbm,win32,win32ole,-test-/*")
|
94
|
-
set(RUBY_NAME "ruby")
|
95
|
-
set(EXE_SUFFIX "")
|
96
94
|
set(DWARFS_PRELOAD OFF)
|
97
95
|
set(WITH_PATCHELF OFF)
|
98
96
|
|
@@ -108,7 +106,6 @@ elseif("${OSTYPE_TXT}" MATCHES "^msys*")
|
|
108
106
|
# set(DWARFS_PRELOAD ON)
|
109
107
|
set(RB_W32 ON)
|
110
108
|
set(RUBY_WITHOUT_EXT "dbm,syslog,pty,gdbm,readline,-test-/*")
|
111
|
-
set(EXE_SUFFIX ".exe")
|
112
109
|
elseif("${OSTYPE_TXT}" MATCHES "^darwin.*")
|
113
110
|
set(IS_DARWIN ON)
|
114
111
|
if(${RUBY_VER} VERSION_LESS "3.1.0")
|
@@ -162,7 +159,6 @@ if ("-${RUBY_VER}" STREQUAL "-" OR "-${RUBY_HASH}" STREQUAL "-")
|
|
162
159
|
message(FATAL_ERROR "Ruby version is not specified")
|
163
160
|
endif()
|
164
161
|
|
165
|
-
set(RUBY_NAME ruby)
|
166
162
|
set(RUBY_PRJ _ruby_${RUBY_VER})
|
167
163
|
set(RUBY_SOURCE_DIR ${DEPS}/src/${RUBY_PRJ})
|
168
164
|
set(RUBY_BINARY_DIR ${DEPS}/src/${RUBY_PRJ})
|
@@ -380,7 +376,6 @@ ExternalProject_Add(${RUBY_PRJ}
|
|
380
376
|
COMMAND ruby ${EXE}/tebako-packager pass1a ${RUBY_SOURCE_DIR}
|
381
377
|
BUILD_COMMAND make -j${NCORES}
|
382
378
|
INSTALL_COMMAND make install -j${NCORES}
|
383
|
-
COMMAND ${GNU_BASH} -c "chmod +x ${DEPS_BIN_DIR}/mkdwarfs${EXE_SUFFIX}"
|
384
379
|
COMMAND ${GNU_BASH} -c "ruby ${EXE}/tebako-packager pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}"
|
385
380
|
)
|
386
381
|
|
data/README.adoc
CHANGED
@@ -1131,15 +1131,6 @@ Here is a summary of the scenarios:
|
|
1131
1131
|
| Any
|
1132
1132
|
|
1133
1133
|
|
1134
|
-
| 5
|
1135
|
-
| Rails project
|
1136
|
-
| Deploy project to packaged filesystem using `bundle install`
|
1137
|
-
| `<mount_point>/local/<entry_point base name>`
|
1138
|
-
| No
|
1139
|
-
| One
|
1140
|
-
| Any
|
1141
|
-
|
1142
|
-
|
1143
1134
|
| Error
|
1144
1135
|
| Error: Two or more `*.gem` files present
|
1145
1136
|
| -
|
data/lib/tebako/cli.rb
CHANGED
@@ -53,7 +53,7 @@ module Tebako
|
|
53
53
|
desc: "tebako configuration file 'tebafile', '$PWD/.tebako.yml' by default"
|
54
54
|
desc "clean", "Clean tebako packaging environment"
|
55
55
|
def clean
|
56
|
-
(_, cm) = bootstrap
|
56
|
+
(_, cm) = bootstrap(clean: true)
|
57
57
|
cm.clean_cache
|
58
58
|
end
|
59
59
|
|
@@ -63,7 +63,7 @@ module Tebako
|
|
63
63
|
desc: "Ruby version to clean, all available versions by default"
|
64
64
|
def clean_ruby
|
65
65
|
puts "Cleaning Ruby sources from tebako packaging environment"
|
66
|
-
(om,) = bootstrap
|
66
|
+
(om,) = bootstrap(clean: true)
|
67
67
|
|
68
68
|
suffix = options["Ruby"].nil? ? "" : "_#{options["Ruby"]}"
|
69
69
|
nmr = "src/_ruby#{suffix}*"
|
@@ -139,11 +139,11 @@ module Tebako
|
|
139
139
|
end
|
140
140
|
|
141
141
|
no_commands do
|
142
|
-
def bootstrap
|
142
|
+
def bootstrap(clean: false)
|
143
143
|
options_manager = Tebako::OptionsManager.new(options)
|
144
144
|
cache_manager = Tebako::CacheManager.new(options_manager.deps, options_manager.source,
|
145
145
|
options_manager.output_folder)
|
146
|
-
cache_manager.version_cache_check unless options[:devmode]
|
146
|
+
cache_manager.version_cache_check unless options[:devmode] || clean
|
147
147
|
[options_manager, cache_manager]
|
148
148
|
end
|
149
149
|
|
data/lib/tebako/cli_helpers.rb
CHANGED
@@ -41,45 +41,52 @@ require_relative "packager_lite"
|
|
41
41
|
module Tebako
|
42
42
|
# Cli helpers
|
43
43
|
module CliHelpers
|
44
|
+
WARN = <<~WARN
|
45
|
+
|
46
|
+
******************************************************************************************************************
|
47
|
+
* *
|
48
|
+
* WARNING: You are packaging in-place, i.e.: tebako package will be placed inside application root. *
|
49
|
+
* It is not an error but we do not recommend it because it is a way to keep packaging old versions recrsively. *
|
50
|
+
* *
|
51
|
+
******************************************************************************************************************
|
52
|
+
|
53
|
+
WARN
|
54
|
+
|
44
55
|
def do_press(options_manager)
|
45
56
|
scenario_manager = Tebako::ScenarioManager.new(options_manager.root, options_manager.fs_entrance)
|
46
57
|
puts options_manager.press_announce(scenario_manager.msys?)
|
47
58
|
|
48
|
-
if options_manager.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if options_manager.mode == "both" || options_manager.mode == "application"
|
53
|
-
do_press_application(options_manager, scenario_manager)
|
59
|
+
if options_manager.package_within_root?
|
60
|
+
puts WARN
|
61
|
+
sleep 5
|
54
62
|
end
|
55
63
|
|
56
|
-
|
64
|
+
do_press_runtime(options_manager, scenario_manager)
|
65
|
+
do_press_application(options_manager, scenario_manager)
|
57
66
|
end
|
58
67
|
|
59
68
|
def do_press_application(options_manager, scenario_manager)
|
69
|
+
return unless %w[both application].include?(options_manager.mode)
|
70
|
+
|
60
71
|
packager = Tebako::PackagerLite.new(options_manager, scenario_manager)
|
61
72
|
packager.create_package
|
62
73
|
end
|
63
74
|
|
64
75
|
def do_press_runtime(options_manager, scenario_manager)
|
76
|
+
return unless %w[both runtime bundle].include?(options_manager.mode)
|
77
|
+
|
65
78
|
generate_files(options_manager, scenario_manager)
|
66
|
-
cfg_cmd = "cmake -DSETUP_MODE:BOOLEAN=OFF #{options_manager.cfg_options} #{options_manager.press_options}"
|
67
|
-
build_cmd = "cmake --build #{options_manager.output_folder} --target tebako --parallel #{Etc.nprocessors}"
|
68
79
|
merged_env = ENV.to_h.merge(options_manager.b_env)
|
69
|
-
Tebako.packaging_error(103) unless system(merged_env,
|
70
|
-
Tebako.packaging_error(104) unless system(merged_env,
|
71
|
-
true
|
80
|
+
Tebako.packaging_error(103) unless system(merged_env, press_cfg_cmd(options_manager))
|
81
|
+
Tebako.packaging_error(104) unless system(merged_env, press_build_cmd(options_manager))
|
72
82
|
end
|
73
83
|
|
74
84
|
def do_setup(options_manager)
|
75
85
|
puts "Setting up tebako packaging environment"
|
76
86
|
|
77
|
-
cfg_cmd = "cmake -DSETUP_MODE:BOOLEAN=ON #{options_manager.cfg_options}"
|
78
|
-
build_cmd = "cmake --build \"#{options_manager.output_folder}\" --target setup --parallel #{Etc.nprocessors}"
|
79
87
|
merged_env = ENV.to_h.merge(options_manager.b_env)
|
80
|
-
Tebako.packaging_error(101) unless system(merged_env,
|
81
|
-
Tebako.packaging_error(102) unless system(merged_env,
|
82
|
-
true
|
88
|
+
Tebako.packaging_error(101) unless system(merged_env, setup_cfg_cmd(options_manager))
|
89
|
+
Tebako.packaging_error(102) unless system(merged_env, setup_build_cmd(options_manager))
|
83
90
|
end
|
84
91
|
|
85
92
|
def generate_files(options_manager, scenario_manager)
|
@@ -91,7 +98,7 @@ module Tebako
|
|
91
98
|
Tebako::Codegen.generate_tebako_fs_cpp(options_manager, scenario_manager)
|
92
99
|
Tebako::Codegen.generate_deploy_rb(options_manager, scenario_manager)
|
93
100
|
|
94
|
-
return unless
|
101
|
+
return unless %w[both runtime].include?(options_manager.mode)
|
95
102
|
|
96
103
|
Tebako::Codegen.generate_stub_rb(options_manager)
|
97
104
|
end
|
@@ -107,5 +114,21 @@ module Tebako
|
|
107
114
|
puts e.message
|
108
115
|
{}
|
109
116
|
end
|
117
|
+
|
118
|
+
def press_build_cmd(options_manager)
|
119
|
+
"cmake --build #{options_manager.output_folder} --target tebako --parallel #{Etc.nprocessors}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def press_cfg_cmd(options_manager)
|
123
|
+
"cmake -DSETUP_MODE:BOOLEAN=OFF #{options_manager.cfg_options} #{options_manager.press_options}"
|
124
|
+
end
|
125
|
+
|
126
|
+
def setup_build_cmd(options_manager)
|
127
|
+
"cmake --build \"#{options_manager.output_folder}\" --target setup --parallel #{Etc.nprocessors}"
|
128
|
+
end
|
129
|
+
|
130
|
+
def setup_cfg_cmd(options_manager)
|
131
|
+
"cmake -DSETUP_MODE:BOOLEAN=ON #{options_manager.cfg_options}"
|
132
|
+
end
|
110
133
|
end
|
111
134
|
end
|
data/lib/tebako/codegen.rb
CHANGED
@@ -62,12 +62,14 @@ module Tebako
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def deploy_mk(opt, scm)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
65
|
+
<<~SUBST
|
66
|
+
begin
|
67
|
+
#{deploy_mk_inner(opt, scm)}
|
68
|
+
rescue Tebako::Error => e
|
69
|
+
puts "tebako-packager failed: \#{e.message} [\#{e.error_code}]"
|
70
|
+
exit(e.error_code)
|
71
|
+
end
|
72
|
+
SUBST
|
71
73
|
end
|
72
74
|
|
73
75
|
def deploy_mk_bundle(opt, scm)
|
@@ -79,6 +81,15 @@ module Tebako
|
|
79
81
|
SUBST
|
80
82
|
end
|
81
83
|
|
84
|
+
def deploy_mk_inner(opt, scm)
|
85
|
+
case opt.mode
|
86
|
+
when "bundle"
|
87
|
+
deploy_mk_bundle(opt, scm)
|
88
|
+
when /runtime|both/
|
89
|
+
deploy_mk_stub(opt)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
82
93
|
def deploy_mk_stub(opt)
|
83
94
|
<<~SUBST
|
84
95
|
Tebako::Packager.deploy("#{opt.data_src_dir}", "#{opt.data_pre_dir}",
|
@@ -101,6 +112,7 @@ module Tebako
|
|
101
112
|
|
102
113
|
def deploy_rq
|
103
114
|
<<~SUBST
|
115
|
+
require "#{File.join(__dir__, "error.rb")}"
|
104
116
|
require "#{File.join(__dir__, "package_descriptor.rb")}"
|
105
117
|
require "#{File.join(__dir__, "packager.rb")}"
|
106
118
|
require "#{File.join(__dir__, "ruby_version.rb")}"
|
data/lib/tebako/deploy_helper.rb
CHANGED
@@ -25,6 +25,7 @@
|
|
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 "bundler"
|
28
29
|
require "fileutils"
|
29
30
|
require "find"
|
30
31
|
|
@@ -49,7 +50,7 @@ module Tebako
|
|
49
50
|
@fs_entrance = fs_entrance
|
50
51
|
@target_dir = target_dir
|
51
52
|
@pre_dir = pre_dir
|
52
|
-
@verbose =
|
53
|
+
@verbose = %w[yes true].include?(ENV.fetch("VERBOSE", nil))
|
53
54
|
@ncores = BuildHelpers.ncores
|
54
55
|
end
|
55
56
|
|
@@ -92,7 +93,7 @@ module Tebako
|
|
92
93
|
|
93
94
|
params = [@gem_command, "install", name.to_s]
|
94
95
|
params.push("-v", ver.to_s) if ver
|
95
|
-
["--no-document", "--install-dir", @tgd].each do |param|
|
96
|
+
["--no-document", "--install-dir", @tgd, "--bindir", @tbd].each do |param|
|
96
97
|
params.push(param)
|
97
98
|
end
|
98
99
|
BuildHelpers.run_with_capture_v(params)
|
@@ -141,11 +142,15 @@ module Tebako
|
|
141
142
|
end
|
142
143
|
|
143
144
|
def collect_and_deploy_gem(gemspec)
|
144
|
-
puts " ...
|
145
|
+
puts " ... collecting gem from gemspec #{gemspec}"
|
145
146
|
|
146
147
|
copy_files(@pre_dir)
|
147
148
|
|
148
149
|
Dir.chdir(@pre_dir) do
|
150
|
+
# spec = Bundler.load_gemspec(gemspec)
|
151
|
+
# puts spec.executables.first unless spec.executables.empty?
|
152
|
+
# puts spec.bindir
|
153
|
+
|
149
154
|
BuildHelpers.run_with_capture_v([@gem_command, "build", gemspec])
|
150
155
|
install_all_gems_or_fail
|
151
156
|
end
|
@@ -200,7 +205,7 @@ module Tebako
|
|
200
205
|
begin
|
201
206
|
FileUtils.cp_r(File.join(@fs_root, "."), dest)
|
202
207
|
rescue StandardError
|
203
|
-
raise Tebako::Error.new("#{@fs_root}
|
208
|
+
raise Tebako::Error.new("#{@fs_root} does not exist or is not accessible.", 107)
|
204
209
|
end
|
205
210
|
return
|
206
211
|
end
|
@@ -185,6 +185,15 @@ module Tebako
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
+
def package_within_root?
|
189
|
+
package_path = Pathname.new(package.chomp("/"))
|
190
|
+
root_path = Pathname.new(root.chomp("/"))
|
191
|
+
package_path.ascend do |path|
|
192
|
+
return true if path == root_path
|
193
|
+
end
|
194
|
+
false
|
195
|
+
end
|
196
|
+
|
188
197
|
def prefix
|
189
198
|
@prefix ||= if @options["prefix"].nil?
|
190
199
|
handle_nil_prefix
|
data/lib/tebako/packager.rb
CHANGED
@@ -108,6 +108,7 @@ module Tebako
|
|
108
108
|
|
109
109
|
def mkdwarfs(deps_bin_dir, data_bin_file, data_src_dir, descriptor = nil)
|
110
110
|
puts "-- Running mkdwarfs script"
|
111
|
+
FileUtils.chmod("a+x", Dir.glob(File.join(deps_bin_dir, "mkdwarfs*")))
|
111
112
|
params = [File.join(deps_bin_dir, "mkdwarfs"), "-o", data_bin_file, "-i", data_src_dir, "--no-progress"]
|
112
113
|
params << "--header" << descriptor if descriptor
|
113
114
|
BuildHelpers.run_with_capture_v(params)
|
data/lib/tebako/stripper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2024 [Ribose Inc](https://www.ribose.com).
|
3
|
+
# Copyright (c) 2024-2025 [Ribose Inc](https://www.ribose.com).
|
4
4
|
# All rights reserved.
|
5
5
|
# This file is a part of tebako
|
6
6
|
#
|
@@ -36,7 +36,8 @@ module Tebako
|
|
36
36
|
module Stripper
|
37
37
|
DELETE_EXTENSIONS = %w[o lo obj a la lib].freeze
|
38
38
|
BIN_FILES = %w[
|
39
|
-
bundle bundler rbs erb gem irb racc racc2y
|
39
|
+
bundle bundler rbs erb gem irb racc racc2y
|
40
|
+
rake rdoc ri y2racc rdbg syntax_suggest typeprof
|
40
41
|
].freeze
|
41
42
|
CMD_SUFFIX = ".cmd"
|
42
43
|
BAT_SUFFIX = ".bat"
|
@@ -44,8 +45,6 @@ module Tebako
|
|
44
45
|
class << self
|
45
46
|
# Strip
|
46
47
|
# Removes build artefacts, strip shared objects
|
47
|
-
# [TODO] We probably need debug option/flag to say whether we shall delete ruby binaries
|
48
|
-
# from memfs or not. For debugging purposes it is very handy to have it here
|
49
48
|
def strip(scm, src_dir)
|
50
49
|
puts " ... stripping the output"
|
51
50
|
strip_bs(src_dir)
|
data/lib/tebako/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2023-
|
3
|
+
# Copyright (c) 2023-2025 [Ribose Inc](https://www.ribose.com).
|
4
4
|
# All rights reserved.
|
5
5
|
# This file is a part of tebako
|
6
6
|
#
|
@@ -26,5 +26,5 @@
|
|
26
26
|
# POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
28
|
module Tebako
|
29
|
-
VERSION = "0.12.
|
29
|
+
VERSION = "0.12.1"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tebako
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|