tebako 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CMakeLists.txt +5 -15
- data/README.adoc +237 -75
- data/common.env +1 -1
- data/lib/tebako/cli.rb +34 -11
- data/lib/tebako/cli_helpers.rb +25 -9
- data/lib/tebako/codegen.rb +95 -10
- data/lib/tebako/deploy_helper.rb +1 -1
- data/lib/tebako/options_manager.rb +89 -12
- data/lib/tebako/package_descriptor.rb +143 -0
- data/lib/tebako/packager.rb +12 -18
- data/lib/tebako/packager_lite.rb +78 -0
- data/lib/tebako/scenario_manager.rb +1 -1
- data/lib/tebako/version.rb +1 -1
- data/src/tebako-main.cpp +46 -30
- metadata +4 -2
data/lib/tebako/version.rb
CHANGED
data/src/tebako-main.cpp
CHANGED
@@ -53,9 +53,20 @@
|
|
53
53
|
#include <tebako/tebako-version.h>
|
54
54
|
#include <tebako/tebako-main.h>
|
55
55
|
#include <tebako/tebako-fs.h>
|
56
|
-
#include <tebako/tebako-cmdline
|
56
|
+
#include <tebako/tebako-cmdline.h>
|
57
57
|
|
58
58
|
static int running_miniruby = 0;
|
59
|
+
static tebako::cmdline_args* args = nullptr;
|
60
|
+
static std::vector<char> package;
|
61
|
+
|
62
|
+
static void tebako_clean(void)
|
63
|
+
{
|
64
|
+
unmount_root_memfs();
|
65
|
+
if (args) {
|
66
|
+
delete args;
|
67
|
+
args = nullptr;
|
68
|
+
}
|
69
|
+
}
|
59
70
|
|
60
71
|
extern "C" int tebako_main(int* argc, char*** argv)
|
61
72
|
{
|
@@ -70,26 +81,41 @@ extern "C" int tebako_main(int* argc, char*** argv)
|
|
70
81
|
running_miniruby = -1;
|
71
82
|
}
|
72
83
|
else {
|
84
|
+
std::string mount_point = tebako::fs_mount_point;
|
85
|
+
std::string entry_point = tebako::fs_entry_point;
|
86
|
+
std::optional<std::string> cwd;
|
87
|
+
if (tebako::package_cwd != nullptr) {
|
88
|
+
cwd = tebako::package_cwd;
|
89
|
+
}
|
90
|
+
const void* data = &gfsData[0];
|
91
|
+
size_t size = gfsSize;
|
92
|
+
|
73
93
|
try {
|
74
|
-
|
94
|
+
args = new tebako::cmdline_args(*argc, (const char**)*argv);
|
95
|
+
args->parse_arguments();
|
96
|
+
if (args->with_application()) {
|
97
|
+
args->process_package();
|
98
|
+
auto descriptor = args->get_descriptor();
|
99
|
+
package = std::move(args->get_package());
|
100
|
+
if (descriptor.has_value()) {
|
101
|
+
mount_point = descriptor->get_mount_point().c_str();
|
102
|
+
entry_point = descriptor->get_entry_point().c_str();
|
103
|
+
cwd = descriptor->get_cwd();
|
104
|
+
data = package.data();
|
105
|
+
size = package.size();
|
106
|
+
}
|
107
|
+
}
|
75
108
|
|
109
|
+
fsret = mount_root_memfs(data, size, tebako::fs_log_level, nullptr, nullptr, nullptr, nullptr, "auto");
|
76
110
|
if (fsret == 0) {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
// printf("Mountpoint: %s\n", mp.c_str());
|
84
|
-
// }
|
85
|
-
tebako::process_mountpoints(mountpoints);
|
86
|
-
std::tie(*argc, *argv) = tebako::build_arguments(parsed_argv, tebako::fs_mount_point, tebako::fs_entry_point);
|
87
|
-
ret = 0;
|
88
|
-
}
|
111
|
+
args->process_mountpoints();
|
112
|
+
args->build_arguments(mount_point.c_str(), entry_point.c_str());
|
113
|
+
*argc = args->get_argc();
|
114
|
+
*argv = args->get_argv();
|
115
|
+
ret = 0;
|
116
|
+
atexit(tebako_clean);
|
89
117
|
}
|
90
|
-
atexit(unmount_root_memfs);
|
91
118
|
}
|
92
|
-
|
93
119
|
catch (std::exception e) {
|
94
120
|
printf("Failed to process command line: %s\n", e.what());
|
95
121
|
}
|
@@ -99,9 +125,9 @@ extern "C" int tebako_main(int* argc, char*** argv)
|
|
99
125
|
ret = -1;
|
100
126
|
}
|
101
127
|
|
102
|
-
if (
|
103
|
-
if (tebako_chdir(
|
104
|
-
printf("Failed to chdir to '%s' : %s\n",
|
128
|
+
if (cwd.has_value()) {
|
129
|
+
if (tebako_chdir(cwd->c_str()) != 0) {
|
130
|
+
printf("Failed to chdir to '%s' : %s\n", cwd->c_str(), strerror(errno));
|
105
131
|
ret = -1;
|
106
132
|
}
|
107
133
|
}
|
@@ -110,17 +136,7 @@ extern "C" int tebako_main(int* argc, char*** argv)
|
|
110
136
|
if (ret != 0) {
|
111
137
|
try {
|
112
138
|
printf("Tebako initialization failed\n");
|
113
|
-
|
114
|
-
delete new_argv;
|
115
|
-
new_argv = nullptr;
|
116
|
-
}
|
117
|
-
if (argv_memory) {
|
118
|
-
delete argv_memory;
|
119
|
-
argv_memory = nullptr;
|
120
|
-
}
|
121
|
-
if (fsret == 0) {
|
122
|
-
unmount_root_memfs();
|
123
|
-
}
|
139
|
+
tebako_clean();
|
124
140
|
}
|
125
141
|
catch (...) {
|
126
142
|
// Nested error, no recovery :(
|
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.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/tebako/deploy_helper.rb
|
172
172
|
- lib/tebako/error.rb
|
173
173
|
- lib/tebako/options_manager.rb
|
174
|
+
- lib/tebako/package_descriptor.rb
|
174
175
|
- lib/tebako/packager.rb
|
175
176
|
- lib/tebako/packager/pass1.rb
|
176
177
|
- lib/tebako/packager/pass1a.rb
|
@@ -180,6 +181,7 @@ files:
|
|
180
181
|
- lib/tebako/packager/patch_libraries.rb
|
181
182
|
- lib/tebako/packager/patch_literals.rb
|
182
183
|
- lib/tebako/packager/patch_main.rb
|
184
|
+
- lib/tebako/packager_lite.rb
|
183
185
|
- lib/tebako/ruby_builder.rb
|
184
186
|
- lib/tebako/ruby_version.rb
|
185
187
|
- lib/tebako/scenario_manager.rb
|