tebako 0.8.8 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.clang-format +4 -0
- data/CMakeLists.txt +5 -1
- data/README.adoc +103 -35
- data/common.env +1 -1
- data/lib/tebako/packager/patch_libraries.rb +4 -2
- data/lib/tebako/version.rb +1 -1
- data/src/tebako-main.cpp +87 -119
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70cd276a2d74a3086661f5782913bde506b242fed8528c8f17464a532d48853a
|
4
|
+
data.tar.gz: 9fbc81cbba0eeaf6e031bebee172bdb7cfe95bc8bf8994c73f83f9ba65a04dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fecf0012bb0a77a3404378b5dcba60d94776a7a0ece2b207d5bf8b94e21fb59aa81f8dfb9a577b0db4e4a743f6ba40a128ee520cb91db07d303e73477b21c21
|
7
|
+
data.tar.gz: 00136a6bb18176f4dfa9f475aec00295b2d1c31cc2663cd99528a4d10e324048debf4346f6640742f8e8d62eb0341c4c00830cec80605155f4489142f98fbc9b
|
data/.clang-format
ADDED
data/CMakeLists.txt
CHANGED
@@ -209,7 +209,7 @@ string(CONCAT RUBY_API_VER ${RUBY_VER_BASE} ".0")
|
|
209
209
|
# list(GET LIBDWARFS_WR_VER_COMPONENTS 2 LIBDWARFS_WR_VER_PATCH)
|
210
210
|
# set (LIBDWARFS_WR_VER_M ${LIBDWARFS_WR_VER_MAJOR}.${LIBDWARFS_WR_VER_MINOR}.${LIBDWARFS_WR_VER_PATCH})
|
211
211
|
#else(DWARFS_PRELOAD)
|
212
|
-
def_ext_prj_g(DWARFS_WR "v0.
|
212
|
+
def_ext_prj_g(DWARFS_WR "v0.7.1")
|
213
213
|
#endif(DWARFS_PRELOAD)
|
214
214
|
|
215
215
|
def_ext_prj_g(PATCHELF "65e14792061c298f1d2bc44becd48a10cbf0bc81")
|
@@ -436,6 +436,10 @@ else (${SETUP_MODE})
|
|
436
436
|
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
|
437
437
|
)
|
438
438
|
|
439
|
+
set(CMAKE_CXX_STANDARD 20)
|
440
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
441
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
442
|
+
|
439
443
|
file(GLOB GEMSPECS LIST_DIRECTORIES false ${FS_ROOT}/*.gemspec)
|
440
444
|
file(GLOB GEMFILES LIST_DIRECTORIES false ${FS_ROOT}/Gemfile)
|
441
445
|
file(GLOB GEMS LIST_DIRECTORIES false ${FS_ROOT}/*.gem)
|
data/README.adoc
CHANGED
@@ -662,7 +662,7 @@ $ pacman -S git tar bison flex toolchain make cmake
|
|
662
662
|
|
663
663
|
|
664
664
|
|
665
|
-
==
|
665
|
+
== Packaging
|
666
666
|
|
667
667
|
=== Tebako root folder (aka prefix) selection
|
668
668
|
|
@@ -932,39 +932,6 @@ options:
|
|
932
932
|
|
933
933
|
Please note that the options provided on the command line have preference over tebafile settings.
|
934
934
|
|
935
|
-
=== Image extraction
|
936
|
-
|
937
|
-
Tebako provides an option to an extract its DwarFS filesystem from a package to
|
938
|
-
a local folder for verification or execution.
|
939
|
-
|
940
|
-
[source,sh]
|
941
|
-
----
|
942
|
-
$ <tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
943
|
-
----
|
944
|
-
|
945
|
-
Where,
|
946
|
-
|
947
|
-
`<root folder for extracted filesystem>`::
|
948
|
-
The root folder for the extracted filesystem (optional, defaults to `source_filesystem`)
|
949
|
-
|
950
|
-
[example]
|
951
|
-
====
|
952
|
-
Extracting Tebako content from the `metanorma` package:
|
953
|
-
|
954
|
-
[source,sh]
|
955
|
-
----
|
956
|
-
metanorma --tebako-extract temp-image
|
957
|
-
----
|
958
|
-
====
|
959
|
-
|
960
|
-
The `--tebako-extract` option actually runs the following Ruby script:
|
961
|
-
|
962
|
-
[source,ruby]
|
963
|
-
----
|
964
|
-
require 'fileutils'
|
965
|
-
FileUtils.copy_entry '<in-memory filesystem root>', ARGV[2] || 'source_filesystem'
|
966
|
-
----
|
967
|
-
|
968
935
|
=== Exit codes
|
969
936
|
|
970
937
|
The Tebako CLI exits with different exit codes to indicate the status of the
|
@@ -1080,9 +1047,110 @@ Here is a summary of the scenarios:
|
|
1080
1047
|
|
1081
1048
|
|===
|
1082
1049
|
|
1083
|
-
|
1084
1050
|
These scenarios determine how the project is packaged and where the entry point is located within the packaged filesystem.
|
1085
1051
|
|
1052
|
+
== Run-time options
|
1053
|
+
|
1054
|
+
Generally Tebako package passes command line options to the packaged application
|
1055
|
+
|
1056
|
+
[example]
|
1057
|
+
====
|
1058
|
+
For example, if the package was created with the following command
|
1059
|
+
|
1060
|
+
[source,sh]
|
1061
|
+
----
|
1062
|
+
tebako press \
|
1063
|
+
--root='~/projects/myproject' \
|
1064
|
+
--entry=start.rb \
|
1065
|
+
--output=/temp/myproject.tebako
|
1066
|
+
----
|
1067
|
+
running
|
1068
|
+
|
1069
|
+
[source,sh]
|
1070
|
+
----
|
1071
|
+
/temp/myproject.tebako --option --parameter value
|
1072
|
+
----
|
1073
|
+
|
1074
|
+
will be translated by Tebako bootstrap code to
|
1075
|
+
|
1076
|
+
[source,sh]
|
1077
|
+
----
|
1078
|
+
myproject --option --parameter value
|
1079
|
+
----
|
1080
|
+
====
|
1081
|
+
|
1082
|
+
However there are several command-line parameters that are intercepted processed by Tebako bootstrap code as follows
|
1083
|
+
|
1084
|
+
=== Image extraction (--tebako-extract option)
|
1085
|
+
|
1086
|
+
Tebako provides an option to an extract its DwarFS filesystem from a package to
|
1087
|
+
a local folder for verification or execution.
|
1088
|
+
|
1089
|
+
[source,sh]
|
1090
|
+
----
|
1091
|
+
$ <tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
1092
|
+
----
|
1093
|
+
|
1094
|
+
Where,
|
1095
|
+
|
1096
|
+
`<root folder for extracted filesystem>`::
|
1097
|
+
The root folder for the extracted filesystem (optional, defaults to `source_filesystem`)
|
1098
|
+
|
1099
|
+
[example]
|
1100
|
+
====
|
1101
|
+
Extracting Tebako content from the `metanorma` package:
|
1102
|
+
|
1103
|
+
[source,sh]
|
1104
|
+
----
|
1105
|
+
metanorma --tebako-extract temp-image
|
1106
|
+
----
|
1107
|
+
====
|
1108
|
+
|
1109
|
+
The `--tebako-extract` option actually runs the following Ruby script:
|
1110
|
+
|
1111
|
+
[source,ruby]
|
1112
|
+
----
|
1113
|
+
require 'fileutils'
|
1114
|
+
FileUtils.copy_entry '<in-memory filesystem root>', ARGV[2] || 'source_filesystem'
|
1115
|
+
----
|
1116
|
+
|
1117
|
+
=== Mounting Host Folder to Tebako Memfs (`--tebako-mount` option)
|
1118
|
+
|
1119
|
+
Some programs unconditionally use folders located under the application root, and when processed by Tebako
|
1120
|
+
or similar tools, these folders are included in the packaging.
|
1121
|
+
|
1122
|
+
For example, there is no configuration option to change where Rails expects the `tmp` folder to be.
|
1123
|
+
The location is hardcoded in multiple places within the Rails codebase, residing under the application root,
|
1124
|
+
and as a result, it gets included in the read-only Tebako memfs. Although patches have been proposed
|
1125
|
+
(e.g., https://github.com/rails/rails/issues/39583), there is currently no way to change the paths for
|
1126
|
+
temporary files, caches, and sockets.
|
1127
|
+
|
1128
|
+
To address this limitation in Rails and similar issues in other applications, Tebako provides an option
|
1129
|
+
to mount a host folder to the memfs tree.
|
1130
|
+
|
1131
|
+
When using Tebako, consider the packaging scenario mentioned above, as it defines the layout of the application
|
1132
|
+
tree. The `--tebako-extract` option may be useful for understanding the placement of files and folders.
|
1133
|
+
|
1134
|
+
[example]
|
1135
|
+
====
|
1136
|
+
The following command starts a `rails.tebako` package with `$PWD/tmp` mounted as `local/tmp` in the memfs.
|
1137
|
+
Any remaining command-line parameters are passed to the application.
|
1138
|
+
[source,sh]
|
1139
|
+
----
|
1140
|
+
rails.tebako --tebako-mount local/tmp:$PWD/tmp server
|
1141
|
+
----
|
1142
|
+
====
|
1143
|
+
|
1144
|
+
The `--tebako-mount` option has the following syntax:
|
1145
|
+
[source,sh]
|
1146
|
+
----
|
1147
|
+
--tebako-mount <memfs path>:<host path>
|
1148
|
+
----
|
1149
|
+
|
1150
|
+
The `--tebako-mount` option can be repeated multiple times to mount more than one object. The `memfs path`
|
1151
|
+
is relative to the memfs root, and it is recommended to use absolute paths for host objects. Both directories
|
1152
|
+
and files can be mounted in this way. Tebako allows overlaying existing memfs objects, so there are no significant
|
1153
|
+
limitations.
|
1086
1154
|
|
1087
1155
|
== Trivia: origin of name
|
1088
1156
|
|
data/common.env
CHANGED
@@ -48,8 +48,10 @@ module Tebako
|
|
48
48
|
DARWIN_DEP_LIBS_2 = ["glog", "gflags", "brotlienc", "brotlidec", "brotlicommon", "fmt"].freeze
|
49
49
|
# rubocop:enable Style/WordArray
|
50
50
|
|
51
|
+
LIBTEBAKOFS = "-Wl,--push-state,--whole-archive -l:libtebako-fs.a -Wl,--pop-state"
|
52
|
+
|
51
53
|
COMMON_LINUX_LIBRARIES = [
|
52
|
-
"-l:libdwarfs-wr.a",
|
54
|
+
LIBTEBAKOFS, "-l:libdwarfs-wr.a", "-l:libdwarfs.a", "LIBCOMPRESSION",
|
53
55
|
"-l:libfolly.a", "-l:libfsst.a", "-l:libmetadata_thrift.a", "-l:libthrift_light.a",
|
54
56
|
"-l:libxxhash.a", "-l:libfmt.a", "-l:libdouble-conversion.a", "-l:libglog.a",
|
55
57
|
"-l:libgflags.a", "-l:libevent.a"
|
@@ -80,7 +82,7 @@ module Tebako
|
|
80
82
|
MSYS_LIBRARIES = [
|
81
83
|
"-l:liblz4.a", "-l:libz.a", "-l:libzstd.a", "-l:liblzma.a",
|
82
84
|
"-l:libncurses.a", "-l:libunwind.a", "-l:liblzma.a", "-l:libiberty.a",
|
83
|
-
"LIBYAML", "-l:libffi.a",
|
85
|
+
"LIBYAML", "-l:libffi.a", "-l:libboost_chrono-mt.a", # "-l:libboost_system-mt.a",
|
84
86
|
"-l:libstdc++.a", "-l:libdl.a", "-static-libgcc", "-static-libstdc++",
|
85
87
|
"-l:libssl.a", "-l:libcrypto.a", "-l:libz.a", "-l:libwinpthread.a",
|
86
88
|
"-lcrypt32", "-lshlwapi", "-lwsock32", "-liphlpapi",
|
data/lib/tebako/version.rb
CHANGED
data/src/tebako-main.cpp
CHANGED
@@ -35,146 +35,114 @@
|
|
35
35
|
#include <sys/stat.h>
|
36
36
|
#include <fcntl.h>
|
37
37
|
|
38
|
-
|
39
38
|
#include <string>
|
40
39
|
#include <cstdint>
|
40
|
+
#include <vector>
|
41
|
+
#include <stdexcept>
|
42
|
+
#include <tuple>
|
41
43
|
|
42
44
|
#ifdef _WIN32
|
43
|
-
|
44
|
-
|
45
|
+
#include <winsock2.h>
|
46
|
+
#include <windows.h>
|
45
47
|
#endif
|
46
48
|
|
47
|
-
|
48
49
|
#include <tebako/tebako-config.h>
|
49
50
|
#include <tebako/tebako-io.h>
|
50
51
|
|
51
52
|
#include <tebako/tebako-version.h>
|
52
53
|
#include <tebako/tebako-main.h>
|
53
54
|
#include <tebako/tebako-fs.h>
|
55
|
+
#include <tebako/tebako-cmdline-helpers.h>
|
54
56
|
|
55
57
|
static int running_miniruby = 0;
|
56
58
|
|
57
|
-
extern "C" int tebako_main(int* argc, char*** argv)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
//
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
}
|
130
|
-
atexit(drop_fs);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
catch (...) {
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
if (!tebako_is_running_miniruby()) {
|
138
|
-
if (getcwd(tebako::original_cwd, sizeof(tebako::original_cwd)) == NULL) {
|
139
|
-
printf("Failed to get current directory: %s\n", strerror(errno));
|
140
|
-
return -1;
|
141
|
-
}
|
142
|
-
|
143
|
-
if (tebako::needs_cwd) {
|
144
|
-
if (tebako_chdir(tebako::package_cwd) != 0) {
|
145
|
-
printf("Failed to chdir to '%s' : %s\n", tebako::package_cwd, strerror(errno));
|
146
|
-
ret = -1;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
if (ret != 0) {
|
152
|
-
try {
|
153
|
-
printf("Tebako initialization failed\n");
|
154
|
-
if (new_argv) delete new_argv;
|
155
|
-
if (argv_memory) delete argv_memory;
|
156
|
-
if (fsret == 0) {
|
157
|
-
drop_fs();
|
158
|
-
}
|
159
|
-
}
|
160
|
-
catch (...) {
|
161
|
-
// Nested error, no recovery :(
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
return ret;
|
59
|
+
extern "C" int tebako_main(int* argc, char*** argv)
|
60
|
+
{
|
61
|
+
int ret = -1, fsret = -1;
|
62
|
+
char** new_argv = nullptr;
|
63
|
+
char* argv_memory = nullptr;
|
64
|
+
|
65
|
+
if (strstr((*argv)[0], "miniruby") != nullptr) {
|
66
|
+
// Ruby build script is designed in such a way that this patch is also applied towards miniruby
|
67
|
+
// Just pass through in such case
|
68
|
+
ret = 0;
|
69
|
+
running_miniruby = -1;
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
try {
|
73
|
+
fsret = load_fs(&gfsData[0], gfsSize, tebako::fs_log_level, nullptr /* cachesize*/, nullptr /* workers */,
|
74
|
+
nullptr /* mlock */, nullptr /* decompress_ratio*/, nullptr /* image_offset */
|
75
|
+
);
|
76
|
+
|
77
|
+
if (fsret == 0) {
|
78
|
+
if ((*argc > 1) && strcmp((*argv)[1], "--tebako-extract") == 0) {
|
79
|
+
ret = tebako::build_arguments_for_extract(argc, argv, tebako::fs_mount_point);
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
auto [mountpoints, parsed_argv] = tebako::parse_arguments(*argc, *argv);
|
83
|
+
// for (auto& mp : mountpoints) {
|
84
|
+
// printf("Mountpoint: %s\n", mp.c_str());
|
85
|
+
// }
|
86
|
+
tebako::process_mountpoints(mountpoints);
|
87
|
+
std::tie(*argc, *argv) = tebako::build_arguments(parsed_argv, tebako::fs_mount_point, tebako::fs_entry_point);
|
88
|
+
ret = 0;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
atexit(drop_fs);
|
92
|
+
}
|
93
|
+
|
94
|
+
catch (std::exception e) {
|
95
|
+
printf("Failed to process command line: %s\n", e.what());
|
96
|
+
}
|
97
|
+
|
98
|
+
if (getcwd(tebako::original_cwd, sizeof(tebako::original_cwd)) == nullptr) {
|
99
|
+
printf("Failed to get current directory: %s\n", strerror(errno));
|
100
|
+
ret = -1;
|
101
|
+
}
|
102
|
+
|
103
|
+
if (tebako::needs_cwd) {
|
104
|
+
if (tebako_chdir(tebako::package_cwd) != 0) {
|
105
|
+
printf("Failed to chdir to '%s' : %s\n", tebako::package_cwd, strerror(errno));
|
106
|
+
ret = -1;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
if (ret != 0) {
|
112
|
+
try {
|
113
|
+
printf("Tebako initialization failed\n");
|
114
|
+
if (new_argv) {
|
115
|
+
delete new_argv;
|
116
|
+
new_argv = nullptr;
|
117
|
+
}
|
118
|
+
if (argv_memory) {
|
119
|
+
delete argv_memory;
|
120
|
+
argv_memory = nullptr;
|
121
|
+
}
|
122
|
+
if (fsret == 0) {
|
123
|
+
drop_fs();
|
124
|
+
}
|
125
|
+
}
|
126
|
+
catch (...) {
|
127
|
+
// Nested error, no recovery :(
|
128
|
+
}
|
129
|
+
}
|
130
|
+
return ret;
|
166
131
|
}
|
167
132
|
|
168
|
-
extern "C" const char* tebako_mount_point(void)
|
169
|
-
|
133
|
+
extern "C" const char* tebako_mount_point(void)
|
134
|
+
{
|
135
|
+
return tebako::fs_mount_point;
|
170
136
|
}
|
171
137
|
|
172
|
-
extern "C" const char* tebako_original_pwd(void)
|
173
|
-
|
138
|
+
extern "C" const char* tebako_original_pwd(void)
|
139
|
+
{
|
140
|
+
return tebako::original_cwd;
|
174
141
|
}
|
175
142
|
|
176
|
-
extern "C" int tebako_is_running_miniruby(void)
|
177
|
-
|
143
|
+
extern "C" int tebako_is_running_miniruby(void)
|
144
|
+
{
|
145
|
+
return running_miniruby;
|
178
146
|
}
|
179
147
|
|
180
148
|
#ifdef RB_W32_PRE_33
|
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.9.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-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -148,6 +148,7 @@ executables:
|
|
148
148
|
extensions: []
|
149
149
|
extra_rdoc_files: []
|
150
150
|
files:
|
151
|
+
- ".clang-format"
|
151
152
|
- CMakeLists.txt
|
152
153
|
- Gemfile
|
153
154
|
- README.adoc
|