tebako 0.8.7 → 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 +175 -36
- data/common.env +1 -1
- data/lib/tebako/cli_helpers.rb +8 -2
- data/lib/tebako/packager/patch_libraries.rb +8 -6
- 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
|
@@ -98,6 +98,78 @@ with debug information unstripped. You can opt to run 'strip -S' manually, it mo
|
|
|
98
98
|
|
|
99
99
|
NOTE: Our goal is to support all maintained Ruby releases, including minor versions.
|
|
100
100
|
|
|
101
|
+
|
|
102
|
+
== Package portability
|
|
103
|
+
|
|
104
|
+
=== General
|
|
105
|
+
|
|
106
|
+
Tebako packages are designed to be "forward portable" across different operating
|
|
107
|
+
systems and architectures to allow for easy distribution and deployment.
|
|
108
|
+
|
|
109
|
+
Forward portability means that a package created on a specific platform can be
|
|
110
|
+
executed on a newer version of the same platform.
|
|
111
|
+
|
|
112
|
+
=== macOS
|
|
113
|
+
|
|
114
|
+
macOS packages are forward portable across different macOS versions.
|
|
115
|
+
|
|
116
|
+
[example]
|
|
117
|
+
A Tebako executable package built on macOS 12 (Monterey) can be executed on
|
|
118
|
+
macOS 14 (Sonoma), but not vice versa.
|
|
119
|
+
|
|
120
|
+
`x86_64` macOS packages can be run on Apple M (ARM) systems.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
=== Linux distributions using `musl`
|
|
124
|
+
|
|
125
|
+
Packages built for the
|
|
126
|
+
https://musl.libc.org[`musl` implementation of the C standard library]
|
|
127
|
+
(such as https://alpinelinux.org[Alpine Linux]) are forward portable.
|
|
128
|
+
|
|
129
|
+
[example]
|
|
130
|
+
A Tebako executable package built on Alpine 3.17 can be executed on Alpine 3.19.
|
|
131
|
+
|
|
132
|
+
Usage of the
|
|
133
|
+
https://github.com/tamatebako/tebako-ci-containers[Tebako Docker containers] for
|
|
134
|
+
packaging is encouraged since it eliminates the effort needed for toolchain
|
|
135
|
+
setup and configuration.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
=== Linux distributions using `glibc`
|
|
139
|
+
|
|
140
|
+
Packages built for the
|
|
141
|
+
https://sourceware.org/glibc[`glibc` implementation of the C standard library]
|
|
142
|
+
are forward portable if the `--patchelf` experimental option is enabled.
|
|
143
|
+
|
|
144
|
+
The `--patchelf` option allows these packages to be portable to Linux GNU
|
|
145
|
+
distributions with GLIBC version 2.31 and above.
|
|
146
|
+
|
|
147
|
+
[example]
|
|
148
|
+
A Tebako executable package built on Ubuntu 20.04 with `--patchelf` option can
|
|
149
|
+
be executed on Rocky Linux 9.
|
|
150
|
+
|
|
151
|
+
Usage of the
|
|
152
|
+
https://github.com/tamatebako/tebako-ci-containers[Tebako Docker containers] for
|
|
153
|
+
packaging is encouraged since it eliminates the effort needed for toolchain
|
|
154
|
+
setup and configuration.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
.Minimum versions of GLIBC Linux distributions that support Tebako packages with forward portability
|
|
158
|
+
[cols="3", options="header"]
|
|
159
|
+
|===
|
|
160
|
+
| Distribution | Minimal supported version | GLIBC version
|
|
161
|
+
|
|
162
|
+
| Ubuntu | 20.04 (Focal Fossa) | GLIBC 2.31
|
|
163
|
+
| Debian | 11 (Bullseye) | GLIBC 2.31
|
|
164
|
+
| Rocky Linux | 9 | GLIBC 2.34
|
|
165
|
+
| Fedora | 33 | GLIBC 2.32
|
|
166
|
+
| CentOS | 9 | GLIBC 2.34
|
|
167
|
+
| Red Hat Enterprise Linux (RHEL) | 9 | GLIBC 2.34
|
|
168
|
+
| Oracle Linux | 9 | GLIBC 2.34
|
|
169
|
+
|
|
170
|
+
|===
|
|
171
|
+
|
|
172
|
+
|
|
101
173
|
== Future plans
|
|
102
174
|
|
|
103
175
|
* Downloading new DwarFS images to be stored in the local home directory
|
|
@@ -105,7 +177,6 @@ NOTE: Our goal is to support all maintained Ruby releases, including minor versi
|
|
|
105
177
|
* Supporting a COW mechanism that the newly written files are stored
|
|
106
178
|
in a separate image that can be loaded on top of the read-only file systems.
|
|
107
179
|
|
|
108
|
-
|
|
109
180
|
== FAQ
|
|
110
181
|
|
|
111
182
|
=== Why use Tebako?
|
|
@@ -591,7 +662,7 @@ $ pacman -S git tar bison flex toolchain make cmake
|
|
|
591
662
|
|
|
592
663
|
|
|
593
664
|
|
|
594
|
-
==
|
|
665
|
+
== Packaging
|
|
595
666
|
|
|
596
667
|
=== Tebako root folder (aka prefix) selection
|
|
597
668
|
|
|
@@ -861,39 +932,6 @@ options:
|
|
|
861
932
|
|
|
862
933
|
Please note that the options provided on the command line have preference over tebafile settings.
|
|
863
934
|
|
|
864
|
-
=== Image extraction
|
|
865
|
-
|
|
866
|
-
Tebako provides an option to an extract its DwarFS filesystem from a package to
|
|
867
|
-
a local folder for verification or execution.
|
|
868
|
-
|
|
869
|
-
[source,sh]
|
|
870
|
-
----
|
|
871
|
-
$ <tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
|
872
|
-
----
|
|
873
|
-
|
|
874
|
-
Where,
|
|
875
|
-
|
|
876
|
-
`<root folder for extracted filesystem>`::
|
|
877
|
-
The root folder for the extracted filesystem (optional, defaults to `source_filesystem`)
|
|
878
|
-
|
|
879
|
-
[example]
|
|
880
|
-
====
|
|
881
|
-
Extracting Tebako content from the `metanorma` package:
|
|
882
|
-
|
|
883
|
-
[source,sh]
|
|
884
|
-
----
|
|
885
|
-
metanorma --tebako-extract temp-image
|
|
886
|
-
----
|
|
887
|
-
====
|
|
888
|
-
|
|
889
|
-
The `--tebako-extract` option actually runs the following Ruby script:
|
|
890
|
-
|
|
891
|
-
[source,ruby]
|
|
892
|
-
----
|
|
893
|
-
require 'fileutils'
|
|
894
|
-
FileUtils.copy_entry '<in-memory filesystem root>', ARGV[2] || 'source_filesystem'
|
|
895
|
-
----
|
|
896
|
-
|
|
897
935
|
=== Exit codes
|
|
898
936
|
|
|
899
937
|
The Tebako CLI exits with different exit codes to indicate the status of the
|
|
@@ -1009,9 +1047,110 @@ Here is a summary of the scenarios:
|
|
|
1009
1047
|
|
|
1010
1048
|
|===
|
|
1011
1049
|
|
|
1012
|
-
|
|
1013
1050
|
These scenarios determine how the project is packaged and where the entry point is located within the packaged filesystem.
|
|
1014
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.
|
|
1015
1154
|
|
|
1016
1155
|
== Trivia: origin of name
|
|
1017
1156
|
|
data/common.env
CHANGED
data/lib/tebako/cli_helpers.rb
CHANGED
|
@@ -56,7 +56,7 @@ module Tebako
|
|
|
56
56
|
@cfg_options ||=
|
|
57
57
|
"-DCMAKE_BUILD_TYPE=Release -DRUBY_VER:STRING=\"#{ruby_ver}\" -DRUBY_HASH:STRING=\"#{ruby_hash}\" " \
|
|
58
58
|
"-DDEPS:STRING=\"#{deps}\" -G \"#{m_files}\" -B \"#{output_folder}\" -S \"#{source}\" " \
|
|
59
|
-
"
|
|
59
|
+
"#{remove_glibc_private} -DTEBAKO_VERSION:STRING=\"#{Tebako::VERSION}\""
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def clean_cache
|
|
@@ -87,6 +87,7 @@ module Tebako
|
|
|
87
87
|
merged_env = ENV.to_h.merge(b_env)
|
|
88
88
|
Tebako.packaging_error(103) unless system(merged_env, cfg_cmd)
|
|
89
89
|
Tebako.packaging_error(104) unless system(merged_env, build_cmd)
|
|
90
|
+
true
|
|
90
91
|
end
|
|
91
92
|
|
|
92
93
|
def do_setup
|
|
@@ -95,6 +96,7 @@ module Tebako
|
|
|
95
96
|
merged_env = ENV.to_h.merge(b_env)
|
|
96
97
|
Tebako.packaging_error(101) unless system(merged_env, cfg_cmd)
|
|
97
98
|
Tebako.packaging_error(102) unless system(merged_env, build_cmd)
|
|
99
|
+
true
|
|
98
100
|
end
|
|
99
101
|
|
|
100
102
|
def ensure_version_file
|
|
@@ -175,7 +177,11 @@ module Tebako
|
|
|
175
177
|
end
|
|
176
178
|
|
|
177
179
|
def remove_glibc_private
|
|
178
|
-
@remove_glibc_private ||=
|
|
180
|
+
@remove_glibc_private ||= if RUBY_PLATFORM.end_with?("linux") || RUBY_PLATFORM.end_with?("linux-gnu")
|
|
181
|
+
"-DREMOVE_GLIBC_PRIVATE=#{options["patchelf"] ? "ON" : "OFF"}"
|
|
182
|
+
else
|
|
183
|
+
""
|
|
184
|
+
end
|
|
179
185
|
end
|
|
180
186
|
|
|
181
187
|
def handle_nil_prefix
|
|
@@ -36,20 +36,22 @@ module Tebako
|
|
|
36
36
|
# rubocop:disable Style/WordArray
|
|
37
37
|
DARWIN_BREW_LIBS = [
|
|
38
38
|
["zlib", "z"], ["gdbm", "gdbm"], ["readline", "readline"], ["libffi", "ffi"],
|
|
39
|
-
["ncurses", "ncurses"], ["
|
|
40
|
-
["
|
|
39
|
+
["ncurses", "ncurses"], ["lz4", "lz4"], ["xz", "lzma"], ["libyaml", "yaml"],
|
|
40
|
+
["boost", "boost_chrono"], ["double-conversion", "double-conversion"]
|
|
41
41
|
].freeze
|
|
42
42
|
|
|
43
43
|
DARWIN_BREW_LIBS_PRE_31 = [["openssl@1.1", "ssl"], ["openssl@1.1", "crypto"]].freeze
|
|
44
44
|
|
|
45
45
|
DARWIN_BREW_LIBS_31 = [["openssl@3", "ssl"], ["openssl@3", "crypto"]].freeze
|
|
46
46
|
|
|
47
|
-
DARWIN_DEP_LIBS_1 = ["folly", "fsst", "metadata_thrift", "thrift_light", "xxhash",
|
|
48
|
-
DARWIN_DEP_LIBS_2 = ["glog", "gflags", "brotlienc", "brotlidec", "brotlicommon"].freeze
|
|
47
|
+
DARWIN_DEP_LIBS_1 = ["folly", "fsst", "metadata_thrift", "thrift_light", "xxhash", "zstd"].freeze
|
|
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
|