tebako 0.7.2.rc2 → 0.7.2.rc4
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/CMakeLists.txt +10 -101
- data/README.adoc +13 -51
- data/common.env +1 -1
- data/exe/tebako-packager +9 -7
- data/lib/tebako/cli.rb +3 -3
- data/lib/tebako/cli_helpers.rb +35 -13
- data/lib/tebako/deploy_helper.rb +281 -0
- data/lib/tebako/error.rb +3 -1
- data/lib/tebako/packager/pass1.rb +7 -4
- data/lib/tebako/packager/patch_buildsystem.rb +3 -3
- data/lib/tebako/packager.rb +13 -34
- data/lib/tebako/version.rb +1 -1
- 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: 4bfa5dde3a184cd2689178ae837ee3a5eff510cecb0ed1385617d4d3f170c707
|
|
4
|
+
data.tar.gz: b67d902a82ff37050ff7c273b770e96b8be23c83c9056a4e5bc88c4936d2bbb8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce1166b1042a38f95db4f8190e5d2de55c7a62d40d3d4db990527c27199d23ffc5590af7ae094e0f8cafdfc5b0c2e9c7e3140fd6f8ad5d56dcfc8627b845a552
|
|
7
|
+
data.tar.gz: 398b4088288778241c404de5d68b1703d2ee42647060833b5c8c7b0b16f22223c92fe1abc7b6982b7124d57a95b732ee98a48e7ea9d913858c5ec0a396faffec
|
data/CMakeLists.txt
CHANGED
|
@@ -116,9 +116,7 @@ set(IS_MUSL OFF)
|
|
|
116
116
|
set(IS_MSYS OFF)
|
|
117
117
|
set(IS_DARWIN OFF)
|
|
118
118
|
set(RB_W32 OFF)
|
|
119
|
-
set(
|
|
120
|
-
set(NOKOGIRI_OPTION "--no-use-system-libraries")
|
|
121
|
-
set(RUBY_WITHOUT_EXT "dbm,win32,win32ole")
|
|
119
|
+
set(RUBY_WITHOUT_EXT "dbm,win32,win32ole,'-test-'")
|
|
122
120
|
set(RUBY_NAME "ruby")
|
|
123
121
|
set(RUBY_SUFFIX "")
|
|
124
122
|
set(EXE_SUFFIX "")
|
|
@@ -129,14 +127,11 @@ set(DWARFS_PRELOAD OFF)
|
|
|
129
127
|
|
|
130
128
|
if("${OSTYPE_TXT}" MATCHES "^linux-musl.*")
|
|
131
129
|
set(IS_MUSL ON)
|
|
132
|
-
set(FORCE_RUBY_PLATFORM "true")
|
|
133
130
|
elseif("${OSTYPE_TXT}" MATCHES "^msys*")
|
|
134
131
|
set(IS_MSYS ON)
|
|
135
|
-
set(FORCE_RUBY_PLATFORM "true")
|
|
136
|
-
set(NOKOGIRI_OPTION "--use-system-libraries")
|
|
137
132
|
# set(DWARFS_PRELOAD ON)
|
|
138
133
|
set(RB_W32 ON)
|
|
139
|
-
set(RUBY_WITHOUT_EXT "dbm,syslog,pty,gdbm,readline")
|
|
134
|
+
set(RUBY_WITHOUT_EXT "dbm,syslog,pty,gdbm,readline,'-test-'")
|
|
140
135
|
#set(RUBY_SUFFIX "w")
|
|
141
136
|
set(EXE_SUFFIX ".exe")
|
|
142
137
|
set(CMD_SUFFIX ".cmd")
|
|
@@ -216,7 +211,7 @@ if(DWARFS_PRELOAD)
|
|
|
216
211
|
list(GET LIBDWARFS_WR_VER_COMPONENTS 2 LIBDWARFS_WR_VER_PATCH)
|
|
217
212
|
set (LIBDWARFS_WR_VER_M ${LIBDWARFS_WR_VER_MAJOR}.${LIBDWARFS_WR_VER_MINOR}.${LIBDWARFS_WR_VER_PATCH})
|
|
218
213
|
else(DWARFS_PRELOAD)
|
|
219
|
-
def_ext_prj_g(DWARFS_WR "v0.5.
|
|
214
|
+
def_ext_prj_g(DWARFS_WR "v0.5.3")
|
|
220
215
|
endif(DWARFS_PRELOAD)
|
|
221
216
|
|
|
222
217
|
set(LIBYAML_RUBY_OPTION "")
|
|
@@ -274,7 +269,6 @@ message(STATUS "Building for Win32 Ruby (RB_W32): ${RB_W32}")
|
|
|
274
269
|
# ...................................................................
|
|
275
270
|
# Other options
|
|
276
271
|
|
|
277
|
-
message(STATUS "Force Ruby platform for Gems: ${FORCE_RUBY_PLATFORM}")
|
|
278
272
|
message(STATUS "Not building Ruby extensions: ${RUBY_WITHOUT_EXT}")
|
|
279
273
|
|
|
280
274
|
# ...................................................................
|
|
@@ -370,7 +364,6 @@ message(STATUS "Ruby build ${C_FLAGS_DEST}='${RUBY_C_FLAGS}'")
|
|
|
370
364
|
message(STATUS "Ruby build LDFLAGS='${RUBY_L_FLAGS}'")
|
|
371
365
|
message(STATUS "openssl Ruby option='${OPENSSL_RUBY_OPTION}'")
|
|
372
366
|
message(STATUS "libyaml Ruby option='${LIBYAML_RUBY_OPTION}'")
|
|
373
|
-
message(STATUS "nokogiri build option='${NOKOGIRI_OPTION}'")
|
|
374
367
|
|
|
375
368
|
ExternalProject_Add(${RUBY_PRJ}
|
|
376
369
|
PREFIX ${DEPS}
|
|
@@ -418,125 +411,41 @@ else (${SETUP_MODE})
|
|
|
418
411
|
list(LENGTH GEMFILES GFLENGTH)
|
|
419
412
|
list(LENGTH GEMS GLENGTH)
|
|
420
413
|
|
|
421
|
-
add_custom_target(clean_filesystem
|
|
422
|
-
COMMAND ruby ${EXE}/tebako-packager deploy ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${RUBY_STASH_DIR}
|
|
423
|
-
${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
|
|
424
|
-
${GFLENGTH} ${APP_NAME} ${RUBY_VER}
|
|
425
|
-
DEPENDS ${RUBY_PRJ}
|
|
426
|
-
)
|
|
427
|
-
|
|
428
414
|
if(GSLENGTH GREATER 0)
|
|
429
415
|
if(GSLENGTH GREATER 1)
|
|
430
416
|
message(FATAL_ERROR "Multiple gemspecs detected in ${FS_ROOT}")
|
|
431
417
|
else(GSLENGTH GREATER 1)
|
|
432
|
-
list(GET GEMSPECS 0 GEMSPEC)
|
|
433
|
-
list(LENGTH GEMFILES GFLENGTH)
|
|
434
418
|
if(GFLENGTH GREATER 0)
|
|
435
419
|
# Found xxx.gemspec and Gemfile
|
|
436
|
-
message("Collecting gem from gemspec ${GEMSPEC} and Gemfile")
|
|
437
420
|
set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
|
|
438
|
-
add_custom_target(source_filesystem
|
|
439
|
-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
|
440
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
|
|
441
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
442
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
|
|
443
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
444
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri ${NOKOGIRI_OPTION}
|
|
445
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
446
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
|
|
447
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
448
|
-
${TBD}/bundle${BAT_SUFFIX} install
|
|
449
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
450
|
-
${TBD}/bundle${BAT_SUFFIX} exec ${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
|
|
451
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
452
|
-
${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
|
|
453
|
-
COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
|
|
454
|
-
(${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist" &&
|
|
455
|
-
${CMAKE_COMMAND} -E false )
|
|
456
|
-
DEPENDS clean_filesystem
|
|
457
|
-
)
|
|
458
421
|
else(GFLENGTH GREATER 0)
|
|
459
422
|
# Found xxx.gemspec but no Gemfile
|
|
460
|
-
message("Collecting gem from gemspec ${GEMSPEC}")
|
|
461
423
|
set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
|
|
462
|
-
message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
|
|
463
|
-
add_custom_target(source_filesystem
|
|
464
|
-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
|
465
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
|
|
466
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
467
|
-
${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
|
|
468
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
469
|
-
${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
|
|
470
|
-
COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
|
|
471
|
-
(${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist" &&
|
|
472
|
-
${CMAKE_COMMAND} -E false )
|
|
473
|
-
DEPENDS clean_filesystem
|
|
474
|
-
)
|
|
475
424
|
endif(GFLENGTH GREATER 0)
|
|
476
425
|
endif(GSLENGTH GREATER 1)
|
|
477
426
|
elseif(GFLENGTH GREATER 0)
|
|
478
427
|
# Found Gemfile but no gemspec
|
|
479
|
-
message("Deploying Gemfile")
|
|
480
428
|
set(FS_ENTRY_POINT "/local/${FS_ENTRANCE}")
|
|
481
|
-
message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
|
|
482
|
-
add_custom_target(source_filesystem
|
|
483
|
-
COMMAND test -f ${FS_ROOT}/${FS_ENTRANCE} ||
|
|
484
|
-
(${CMAKE_COMMAND} -E echo "Entry point ${FS_ROOT}/${FS_ENTRANCE} does not exist or is not accessible" &&
|
|
485
|
-
${CMAKE_COMMAND} -E false )
|
|
486
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
|
|
487
|
-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
|
488
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
489
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
|
|
490
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
491
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri ${NOKOGIRI_OPTION}
|
|
492
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
493
|
-
${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
|
|
494
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
495
|
-
${TBD}/bundle${BAT_SUFFIX} install --jobs=${NCORES}
|
|
496
|
-
# COMMAND_EXPAND_LISTS
|
|
497
|
-
# [TODO] Open question - how to deploy a project to source filesystem
|
|
498
|
-
# ruby packer does bundle install --deployment --binstubs
|
|
499
|
-
# COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
500
|
-
# ${TBD}/bundle lock
|
|
501
|
-
# COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
502
|
-
# ${TBD}/bundle install --deployment --jobs=${NCORES}
|
|
503
|
-
DEPENDS clean_filesystem
|
|
504
|
-
)
|
|
505
429
|
elseif(GLENGTH GREATER 0)
|
|
506
430
|
# xxx.gem, no gemspec, no gemfile
|
|
507
|
-
list(GET GEMS 0 GEM)
|
|
508
431
|
if(GLENGTH GREATER 1)
|
|
509
432
|
message(FATAL_ERROR "Multiple gems detected in ${FS_ROOT}")
|
|
510
433
|
else(GLENGTH GREATER 1)
|
|
511
|
-
message("Installing Ruby gem from ${GEM}")
|
|
512
434
|
set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
|
|
513
|
-
message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
|
|
514
|
-
add_custom_target(source_filesystem
|
|
515
|
-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
|
516
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
|
517
|
-
${TBD}/gem${CMD_SUFFIX} install ${GEM} --verbose --no-document --install-dir ${TGD}
|
|
518
|
-
COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
|
|
519
|
-
(${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist or is not accessible" &&
|
|
520
|
-
${CMAKE_COMMAND} -E false )
|
|
521
|
-
DEPENDS clean_filesystem
|
|
522
|
-
)
|
|
523
435
|
endif(GLENGTH GREATER 1)
|
|
524
436
|
else()
|
|
525
437
|
# No gem, no gemspec, no gemfile
|
|
526
438
|
# Simple ruby script
|
|
527
|
-
message("Collecting simple Ruby script from ${FS_ROOT}")
|
|
528
439
|
set(FS_ENTRY_POINT "/local/${FS_ENTRANCE}")
|
|
529
|
-
message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
|
|
530
|
-
add_custom_target(source_filesystem
|
|
531
|
-
COMMAND test -f ${FS_ROOT}/${FS_ENTRANCE} ||
|
|
532
|
-
(${CMAKE_COMMAND} -E echo "Entry point ${FS_ROOT}/${FS_ENTRANCE} does not exist or is not accessible" &&
|
|
533
|
-
${CMAKE_COMMAND} -E false )
|
|
534
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
|
|
535
|
-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
|
536
|
-
DEPENDS clean_filesystem
|
|
537
|
-
)
|
|
538
440
|
endif()
|
|
539
441
|
|
|
442
|
+
add_custom_target(source_filesystem
|
|
443
|
+
COMMAND ruby ${EXE}/tebako-packager deploy ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${RUBY_STASH_DIR}
|
|
444
|
+
${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
|
|
445
|
+
${FS_ROOT} ${FS_ENTRANCE} ${FS_MOUNT_POINT} ${APP_NAME} ${RUBY_VER}
|
|
446
|
+
DEPENDS ${RUBY_PRJ}
|
|
447
|
+
)
|
|
448
|
+
|
|
540
449
|
# ...................................................................
|
|
541
450
|
# Packaged filesystem
|
|
542
451
|
|
data/README.adoc
CHANGED
|
@@ -150,55 +150,9 @@ There is no workaround for this issue as it lloks like is a limitation of the ma
|
|
|
150
150
|
|
|
151
151
|
=== General
|
|
152
152
|
|
|
153
|
-
Tebako is distributed as a Ruby gem
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
----
|
|
157
|
-
gem install tebako
|
|
158
|
-
----
|
|
159
|
-
|
|
160
|
-
=== Quick setup on Ubuntu 20.04 on Docker
|
|
161
|
-
|
|
162
|
-
Launch a container on the target platform:
|
|
163
|
-
|
|
164
|
-
[source,sh]
|
|
165
|
-
----
|
|
166
|
-
# For x86_64
|
|
167
|
-
docker run -it --platform linux/x86_64 ubuntu bash
|
|
168
|
-
|
|
169
|
-
# For Apple M1
|
|
170
|
-
docker run -it --platform linux/aarch64 ubuntu bash
|
|
171
|
-
----
|
|
172
|
-
|
|
173
|
-
In the container:
|
|
174
|
-
|
|
175
|
-
[source,sh]
|
|
176
|
-
----
|
|
177
|
-
export DEBIAN_FRONTEND=noninteractive
|
|
178
|
-
export TZ=Etc/UTC
|
|
179
|
-
|
|
180
|
-
apt-get update
|
|
181
|
-
apt-get install -y software-properties-common
|
|
182
|
-
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
183
|
-
apt-get install -y gcc-10 g++-10
|
|
184
|
-
|
|
185
|
-
apt-get install -y curl git ruby ruby-dev pkg-config bison flex make autoconf
|
|
186
|
-
curl https://apt.kitware.com/kitware-archive.sh | bash
|
|
187
|
-
apt-get install -y cmake
|
|
188
|
-
|
|
189
|
-
apt-get -y install sudo git curl build-essential pkg-config bison flex autoconf \
|
|
190
|
-
binutils-dev libevent-dev acl-dev libfmt-dev libjemalloc-dev libiberty-dev \
|
|
191
|
-
libdouble-conversion-dev liblz4-dev liblzma-dev libssl-dev libunwind-dev \
|
|
192
|
-
libboost-filesystem-dev libboost-program-options-dev libboost-system-dev \
|
|
193
|
-
libboost-iostreams-dev libboost-date-time-dev libboost-context-dev \
|
|
194
|
-
libboost-regex-dev libboost-thread-dev libbrotli-dev libdwarf-dev libelf-dev \
|
|
195
|
-
libgoogle-glog-dev libffi-dev libgdbm-dev libyaml-dev libncurses-dev \
|
|
196
|
-
libreadline-dev libutfcpp-dev libncurses-dev libreadline-dev gcc-10 g++-10 \
|
|
197
|
-
ruby-dev ruby-bundler
|
|
198
|
-
|
|
199
|
-
gem install tebako
|
|
200
|
-
|
|
201
|
-
----
|
|
153
|
+
Tebako is distributed as a Ruby gem.
|
|
154
|
+
Additionally, Docker containers for Ubuntu and Alpine Linux with a preinstalled Tebako packaging environment
|
|
155
|
+
are available at https://github.com/orgs/tamatebako/packages.
|
|
202
156
|
|
|
203
157
|
== Usage
|
|
204
158
|
|
|
@@ -248,7 +202,8 @@ tebako press \
|
|
|
248
202
|
-r|--root=<project-root-folder> \
|
|
249
203
|
-e|--entry-point=<entry-point> \
|
|
250
204
|
[-o|--output=<packaged file name>] \
|
|
251
|
-
[-l|--log-level=<error|warn|debug|trace>]
|
|
205
|
+
[-l|--log-level=<error|warn|debug|trace>] \
|
|
206
|
+
[-D|--devmode]
|
|
252
207
|
----
|
|
253
208
|
|
|
254
209
|
Where:
|
|
@@ -268,6 +223,9 @@ point base name`)
|
|
|
268
223
|
|
|
269
224
|
* `log-level`, the logging level for tebako built-in memory filesystem driver (optional, defaults to `error`)
|
|
270
225
|
|
|
226
|
+
* `devmode` flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
|
|
227
|
+
Please note that this mode is not intended for production use and should only be used during development.
|
|
228
|
+
|
|
271
229
|
[example]
|
|
272
230
|
====
|
|
273
231
|
[source,sh]
|
|
@@ -295,7 +253,8 @@ based on ```tebako setup``` output. Building cache based on ```tebako press``` m
|
|
|
295
253
|
----
|
|
296
254
|
tebako setup \
|
|
297
255
|
[-p |--prefix=<tebako-root-folder>] \
|
|
298
|
-
[-R |--Ruby=<2.7.8|3.0.7|3.1.4|3.1.5|3.1.6|3.2.3|3.2.4>]
|
|
256
|
+
[-R |--Ruby=<2.7.8|3.0.7|3.1.4|3.1.5|3.1.6|3.2.3|3.2.4>] \
|
|
257
|
+
[-D | --devmode]
|
|
299
258
|
----
|
|
300
259
|
|
|
301
260
|
Where:
|
|
@@ -304,6 +263,9 @@ Where:
|
|
|
304
263
|
|
|
305
264
|
* `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.6)
|
|
306
265
|
|
|
266
|
+
* `devmode` flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
|
|
267
|
+
Please note that this mode is not intended for production use and should only be used during development.
|
|
268
|
+
|
|
307
269
|
==== Clean
|
|
308
270
|
|
|
309
271
|
This command deletes tebako artifacts created by setup and press commands.
|
data/common.env
CHANGED
data/exe/tebako-packager
CHANGED
|
@@ -99,18 +99,20 @@ begin
|
|
|
99
99
|
# ARGV[4] -- DATA_SRC_DIR
|
|
100
100
|
# ARGV[5] -- DATA_PRE_DIR
|
|
101
101
|
# ARGV[6] -- DATA_BIN_DIR
|
|
102
|
-
# ARGV[7] --
|
|
103
|
-
# ARGV[8] --
|
|
104
|
-
# ARGV[9] --
|
|
105
|
-
|
|
102
|
+
# ARGV[7] -- FS_ROOT
|
|
103
|
+
# ARGV[8] -- FS_ENTRANCE
|
|
104
|
+
# ARGV[9] -- FS_MOUNT_POINT
|
|
105
|
+
# ARGV[10] -- APP_NAME
|
|
106
|
+
# ARGV[11] -- RUBY_VER
|
|
107
|
+
unless ARGV.length == 12
|
|
106
108
|
raise Tebako::Error,
|
|
107
|
-
"tebako-packager deploy command expects
|
|
109
|
+
"tebako-packager deploy command expects 12 arguments, #{ARGV.length} has been provided."
|
|
108
110
|
end
|
|
109
111
|
Tebako::Packager.init(ARGV[3], ARGV[4], ARGV[5], ARGV[6])
|
|
110
|
-
Tebako::Packager.create_implib(ARGV[2], ARGV[4], File.basename(ARGV[
|
|
112
|
+
Tebako::Packager.create_implib(ARGV[2], ARGV[4], File.basename(ARGV[10]), ARGV[11]) if ARGV[1] =~ /msys/
|
|
111
113
|
# Assume that "<TARGET_BIN_DIR (TBD)>" is <DATA_SRC_DIR>/bin"
|
|
112
114
|
# That shall match CMakeLists.txt settings
|
|
113
|
-
Tebako::Packager.deploy(ARGV[4], ARGV[
|
|
115
|
+
Tebako::Packager.deploy(ARGV[1], ARGV[4], ARGV[5], ARGV[11], ARGV[7], ARGV[8], ARGV[9])
|
|
114
116
|
|
|
115
117
|
else
|
|
116
118
|
raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
|
data/lib/tebako/cli.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Tebako
|
|
|
69
69
|
|
|
70
70
|
desc "hash", "Print build script hash (ci cache key)"
|
|
71
71
|
def hash
|
|
72
|
-
print Digest::SHA256.hexdigest File.read
|
|
72
|
+
print Digest::SHA256.hexdigest [File.read(File.join(source, "CMakeLists.txt")), Tebako::VERSION].join
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
desc "press", "Press tebako image"
|
|
@@ -84,7 +84,7 @@ module Tebako
|
|
|
84
84
|
enum: Tebako::CliRubies::RUBY_VERSIONS.keys,
|
|
85
85
|
desc: "Tebako package Ruby version, #{Tebako::CliRubies::DEFAULT_RUBY_VERSION} by default"
|
|
86
86
|
def press
|
|
87
|
-
|
|
87
|
+
version_cache_check unless options[:devmode]
|
|
88
88
|
|
|
89
89
|
puts press_announce
|
|
90
90
|
do_press
|
|
@@ -99,7 +99,7 @@ module Tebako
|
|
|
99
99
|
enum: Tebako::CliRubies::RUBY_VERSIONS.keys,
|
|
100
100
|
desc: "Tebako package Ruby version, #{Tebako::CliRubies::DEFAULT_RUBY_VERSION} by default."
|
|
101
101
|
def setup
|
|
102
|
-
|
|
102
|
+
version_cache_check unless options[:devmode]
|
|
103
103
|
|
|
104
104
|
puts "Setting up tebako packaging environment"
|
|
105
105
|
do_setup
|
data/lib/tebako/cli_helpers.rb
CHANGED
|
@@ -204,20 +204,42 @@ module Tebako
|
|
|
204
204
|
@version_key ||= "#{Tebako::VERSION} at #{source}"
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
-
def
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
207
|
+
def version_cache
|
|
208
|
+
version_file_path = File.join(prefix, E_VERSION_FILE)
|
|
209
|
+
file_version = File.open(version_file_path, &:readline).strip
|
|
210
|
+
|
|
211
|
+
file_version.match(/(?<version>.+) at (?<source>.+)/)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def version_cache_check
|
|
215
|
+
match_data = version_cache
|
|
216
|
+
|
|
217
|
+
return version_unknown unless match_data
|
|
218
|
+
|
|
219
|
+
if match_data[:version] != Tebako::VERSION
|
|
220
|
+
version_mismatch(match_data[:version])
|
|
221
|
+
elsif match_data[:source] != source
|
|
222
|
+
version_source_mismatch(match_data[:source])
|
|
219
223
|
end
|
|
220
|
-
|
|
224
|
+
rescue StandardError
|
|
225
|
+
version_unknown
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
def version_mismatch(cached_version)
|
|
229
|
+
puts "Tebako cache was created by a gem version #{cached_version} " \
|
|
230
|
+
"and cannot be used for gem version #{Tebako::VERSION}"
|
|
231
|
+
clean_cache
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def version_source_mismatch(cached_source)
|
|
235
|
+
puts "CMake cache was created for a different source directory '#{cached_source}' " \
|
|
236
|
+
"and cannot be used for '#{source}'"
|
|
237
|
+
clean_output
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def version_unknown
|
|
241
|
+
puts "CMake cache version was not recognized, cleaning up"
|
|
242
|
+
clean_cache
|
|
221
243
|
end
|
|
222
244
|
end
|
|
223
245
|
end
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2024 [Ribose Inc](https://www.ribose.com).
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
# This file is a part of tebako
|
|
6
|
+
#
|
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
|
8
|
+
# modification, are permitted provided that the following conditions
|
|
9
|
+
# are met:
|
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
18
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
19
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
|
20
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
21
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
22
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
23
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
24
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
25
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
26
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
|
|
28
|
+
require "fileutils"
|
|
29
|
+
require "find"
|
|
30
|
+
|
|
31
|
+
require_relative "error"
|
|
32
|
+
|
|
33
|
+
# Tebako - an executable packager
|
|
34
|
+
module Tebako
|
|
35
|
+
# Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
|
|
36
|
+
# These are the minimal versions required to provide linux-gnu / linux-musl differentiation by bundler
|
|
37
|
+
# Ruby 3.1+ default rubygems versions work correctly out of the box
|
|
38
|
+
BUNDLER_VERSION = "2.4.22"
|
|
39
|
+
RUBYGEMS_VERSION = "3.4.22"
|
|
40
|
+
|
|
41
|
+
# Tebako packaging support (deployer)
|
|
42
|
+
class DeployHelper # rubocop:disable Metrics/ClassLength
|
|
43
|
+
def initialize(fs_root, fs_entrance, fs_mount_point, target_dir, pre_dir)
|
|
44
|
+
@fs_root = fs_root
|
|
45
|
+
@fs_entrance = fs_entrance
|
|
46
|
+
@fs_mount_point = fs_mount_point
|
|
47
|
+
@target_dir = target_dir
|
|
48
|
+
@pre_dir = pre_dir
|
|
49
|
+
@verbose = ENV["VERBOSE"] == "yes" || ENV["VERBOSE"] == "true"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
attr_reader :bundler_command, :gem_command, :gem_home
|
|
53
|
+
|
|
54
|
+
def config(os_type, ruby_ver)
|
|
55
|
+
@ruby_ver = ruby_ver
|
|
56
|
+
@os_type = os_type
|
|
57
|
+
|
|
58
|
+
@tbd = File.join(@target_dir, "bin")
|
|
59
|
+
@tgd = @gem_home = File.join(@target_dir, "lib", "ruby", "gems", ruby_api_version)
|
|
60
|
+
@tld = File.join(@target_dir, "local")
|
|
61
|
+
|
|
62
|
+
lookup_files
|
|
63
|
+
configure_scenario
|
|
64
|
+
configure_commands
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def deploy
|
|
68
|
+
install_gem("tebako-runtime")
|
|
69
|
+
install_gem("bundler", Tebako::BUNDLER_VERSION) if needs_bundler?
|
|
70
|
+
|
|
71
|
+
deploy_solution
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def deploy_env
|
|
75
|
+
{ "GEM_HOME" => gem_home,
|
|
76
|
+
"GEM_PATH" => gem_home,
|
|
77
|
+
"TEBAKO_PASS_THROUGH" => "1" }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def install_gem(name, ver = nil)
|
|
81
|
+
puts " ... installing #{name} gem#{" version #{ver}" if ver}"
|
|
82
|
+
|
|
83
|
+
params = [@gem_command, "install", name.to_s]
|
|
84
|
+
params.push("-v", ver.to_s) if ver
|
|
85
|
+
["--no-document", "--install-dir", @tgd].each do |param|
|
|
86
|
+
params.push(param)
|
|
87
|
+
end
|
|
88
|
+
run_with_capture_v(params)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def ruby_api_version
|
|
92
|
+
@ruby_api_version ||= "#{@ruby_ver.split(".")[0..1].join(".")}.0"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def needs_bundler?
|
|
96
|
+
@gf_length.positive?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def update_rubygems
|
|
100
|
+
puts " ... updating rubygems to #{Tebako::RUBYGEMS_VERSION}"
|
|
101
|
+
run_with_capture_v([@gem_command, "update", "--no-doc", "--system", Tebako::RUBYGEMS_VERSION])
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def bundle_config
|
|
107
|
+
run_with_capture_v([@bundler_command, "config", "set", "--local", "build.ffi", "--disable-system-libffi"])
|
|
108
|
+
run_with_capture_v([@bundler_command, "config", "set", "--local", "build.nokogiri", @nokogiri_option])
|
|
109
|
+
run_with_capture_v([@bundler_command, "config", "set", "--local", "force_ruby_platform", @force_ruby_platform])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def check_entry_point(entry_point_root)
|
|
113
|
+
fs_entry_point = File.join(entry_point_root, @fs_entrance)
|
|
114
|
+
puts " ... target entry point will be at #{File.join(@fs_mount_point, fs_entry_point)}"
|
|
115
|
+
|
|
116
|
+
return if File.exist?(File.join(@target_dir, fs_entry_point))
|
|
117
|
+
|
|
118
|
+
raise Tebako::Error.new("Entry point #{fs_entry_point} does not exist or is not accessible", 106)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def collect_and_deploy_gem(gemspec)
|
|
122
|
+
puts " ... Collecting gem from gemspec #{gemspec}"
|
|
123
|
+
|
|
124
|
+
copy_files(@pre_dir)
|
|
125
|
+
|
|
126
|
+
Dir.chdir(@pre_dir) do
|
|
127
|
+
run_with_capture_v([@gem_command, "build", gemspec])
|
|
128
|
+
install_all_gems_or_fail
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
check_entry_point("bin")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def collect_and_deploy_gem_and_gemfile(gemspec)
|
|
135
|
+
puts " ... collecting gem from gemspec #{gemspec} and Gemfile"
|
|
136
|
+
|
|
137
|
+
copy_files(@pre_dir)
|
|
138
|
+
|
|
139
|
+
Dir.chdir(@pre_dir) do
|
|
140
|
+
bundle_config
|
|
141
|
+
puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
|
|
142
|
+
run_with_capture_v([@bundler_command, "install", "--jobs=#{ncores}"])
|
|
143
|
+
run_with_capture_v([@bundler_command, "exec", @gem_command, "build", gemspec])
|
|
144
|
+
install_all_gems_or_fail
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
check_entry_point("bin")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def configure_commands
|
|
151
|
+
@cmd_suffix = @os_type =~ /msys/ ? ".cmd" : ""
|
|
152
|
+
@bat_suffix = @os_type =~ /msys/ ? ".bat" : ""
|
|
153
|
+
|
|
154
|
+
@gem_command = File.join(@tbd, "gem#{@cmd_suffix}")
|
|
155
|
+
@bundler_command = File.join(@tbd, "bundle#{@bat_suffix}")
|
|
156
|
+
|
|
157
|
+
@force_ruby_platform = @os_type =~ /msys|linux-musl/ ? "true" : "false"
|
|
158
|
+
@nokogiri_option = @os_type =~ /msys/ ? "--use-system-libraries" : "--no-use-system-libraries"
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def configure_scenario
|
|
162
|
+
case @gs_length
|
|
163
|
+
when 0
|
|
164
|
+
configure_scenario_no_gemspec
|
|
165
|
+
when 1
|
|
166
|
+
@scenario = @gf_length.positive? ? :gemspec_and_gemfile : :gemspec
|
|
167
|
+
else
|
|
168
|
+
raise Tebako::Error, "Multiple Ruby gemspecs found in #{@fs_root}"
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def configure_scenario_no_gemspec
|
|
173
|
+
@scenario = if @gf_length.positive?
|
|
174
|
+
:gemfile
|
|
175
|
+
elsif @g_length.positive?
|
|
176
|
+
:gem
|
|
177
|
+
else
|
|
178
|
+
:simple_script
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def copy_files(dest)
|
|
183
|
+
FileUtils.mkdir_p(dest)
|
|
184
|
+
if Dir.exist?(@fs_root) && File.readable?(@fs_root)
|
|
185
|
+
begin
|
|
186
|
+
FileUtils.cp_r(File.join(@fs_root, "."), dest)
|
|
187
|
+
rescue StandardError
|
|
188
|
+
raise Tebako::Error.new("#{@fs_root} is not accessible or does not exist.", 107)
|
|
189
|
+
end
|
|
190
|
+
return
|
|
191
|
+
end
|
|
192
|
+
raise Tebako::Error.new("#{@fs_root} is not accessible or is not a directory.", 107)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def deploy_gem(gem)
|
|
196
|
+
puts " ... installing Ruby gem from #{gem}"
|
|
197
|
+
copy_files(@pre_dir)
|
|
198
|
+
Dir.chdir(@pre_dir) { install_gem(gem) }
|
|
199
|
+
check_entry_point("bin")
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def deploy_gemfile
|
|
203
|
+
puts " ... deploying Gemfile"
|
|
204
|
+
copy_files(@tld)
|
|
205
|
+
|
|
206
|
+
Dir.chdir(@tld) do
|
|
207
|
+
bundle_config
|
|
208
|
+
puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
|
|
209
|
+
run_with_capture_v([@bundler_command, "install", "--jobs=#{ncores}"])
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
check_entry_point("local")
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def deploy_simple_script
|
|
216
|
+
puts " ... collecting simple Ruby script from #{@fs_root}"
|
|
217
|
+
copy_files(@tld)
|
|
218
|
+
check_entry_point("local")
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def deploy_solution # rubocop:disable Metrics/MethodLength
|
|
222
|
+
case @scenario
|
|
223
|
+
when :simple_script
|
|
224
|
+
deploy_simple_script
|
|
225
|
+
when :gem
|
|
226
|
+
deploy_gem(Dir.glob(File.join(@fs_root, "*.gem")).first)
|
|
227
|
+
when :gemfile
|
|
228
|
+
deploy_gemfile
|
|
229
|
+
when :gemspec
|
|
230
|
+
collect_and_deploy_gem(Dir.glob(File.join(@fs_root, "*.gemspec")).first)
|
|
231
|
+
when :gemspec_and_gemfile
|
|
232
|
+
collect_and_deploy_gem_and_gemfile(Dir.glob(File.join(@fs_root, "*.gemspec")).first)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def install_all_gems_or_fail
|
|
237
|
+
gem_files = Dir.glob("*.gem").map { |file| File.expand_path(file) }
|
|
238
|
+
raise Tebako::Error, "No gem files found after build" if gem_files.empty?
|
|
239
|
+
|
|
240
|
+
gem_files.each { |gem_file| install_gem(gem_file) }
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def lookup_files
|
|
244
|
+
@gs_length = Dir.glob(File.join(@fs_root, "*.gemspec")).length
|
|
245
|
+
@gf_length = Dir.glob(File.join(@fs_root, "Gemfile")).length
|
|
246
|
+
@g_length = Dir.glob(File.join(@fs_root, "*.gem")).length
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def ncores
|
|
250
|
+
if RUBY_PLATFORM.include?("darwin")
|
|
251
|
+
out, st = Open3.capture2e("sysctl", "-n", "hw.ncpu")
|
|
252
|
+
else
|
|
253
|
+
out, st = Open3.capture2e("nproc", "--all")
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
@ncores ||= if st.exitstatus.zero?
|
|
257
|
+
out.strip.to_i
|
|
258
|
+
else
|
|
259
|
+
4
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def run_with_capture(args)
|
|
264
|
+
puts " ... @ #{args.join(" ")}"
|
|
265
|
+
out, st = Open3.capture2e(*args)
|
|
266
|
+
raise Tebako::Error, "Failed to run #{args.join(" ")} (#{st}):\n #{out}" unless st.exitstatus.zero?
|
|
267
|
+
|
|
268
|
+
out
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def run_with_capture_v(args)
|
|
272
|
+
if @verbose
|
|
273
|
+
args_v = args.dup
|
|
274
|
+
args_v.push("--verbose")
|
|
275
|
+
puts run_with_capture(args_v)
|
|
276
|
+
else
|
|
277
|
+
run_with_capture(args)
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
data/lib/tebako/error.rb
CHANGED
|
@@ -32,7 +32,9 @@ module Tebako
|
|
|
32
32
|
102 => "'tebako setup' build step failed",
|
|
33
33
|
103 => "'tebako press' configure step failed",
|
|
34
34
|
104 => "'tebako press' build step failed",
|
|
35
|
-
105 => "Failed to map MSys path to Windows"
|
|
35
|
+
105 => "Failed to map MSys path to Windows",
|
|
36
|
+
106 => "Entry point does not exist or is not accessible",
|
|
37
|
+
107 => "Project root does not exist or is not accessible"
|
|
36
38
|
}.freeze
|
|
37
39
|
|
|
38
40
|
class << self
|
|
@@ -88,9 +88,9 @@ module Tebako
|
|
|
88
88
|
SUBST
|
|
89
89
|
}.freeze
|
|
90
90
|
|
|
91
|
-
DARWIN_CONFIGURE_PATCH = {
|
|
92
|
-
|
|
93
|
-
}.freeze
|
|
91
|
+
# DARWIN_CONFIGURE_PATCH = {
|
|
92
|
+
# "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
|
|
93
|
+
# }.freeze
|
|
94
94
|
|
|
95
95
|
OPENSSL_EXTCONF_RB_SUBST = <<~SUBST
|
|
96
96
|
# Start of tebako patch
|
|
@@ -138,7 +138,10 @@ module Tebako
|
|
|
138
138
|
|
|
139
139
|
# ....................................................
|
|
140
140
|
# Fixing (bypassing) configure script bug where a variable is used before initialization
|
|
141
|
-
|
|
141
|
+
# On MacOS it generates bod EXTDLDFLAGS WITH -bundle_loader <missing parameter>
|
|
142
|
+
# However, it loooks likes EXTDLDFLAGS are just redundant for final Ruby linkage, so we are
|
|
143
|
+
# just removing it on pass 2 (at least for now)
|
|
144
|
+
# patch_map.store("configure", DARWIN_CONFIGURE_PATCH) if ostype =~ /darwin/
|
|
142
145
|
|
|
143
146
|
# ....................................................
|
|
144
147
|
# autoload :OpenSSL, "openssl"
|
|
@@ -53,7 +53,7 @@ module Tebako
|
|
|
53
53
|
|
|
54
54
|
TEMPLATE_MAKEFILE_IN_BASE_PATCH_PRE_3_1 =
|
|
55
55
|
"# -- Start of tebako patch --\n" \
|
|
56
|
-
"\t\t$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(
|
|
56
|
+
"\t\t$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) " \
|
|
57
57
|
"$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
|
|
58
58
|
"# -- End of tebako patch --"
|
|
59
59
|
|
|
@@ -63,13 +63,13 @@ module Tebako
|
|
|
63
63
|
|
|
64
64
|
TEMPLATE_MAKEFILE_IN_BASE_PATCH =
|
|
65
65
|
"# -- Start of tebako patch --\n" \
|
|
66
|
-
"\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(
|
|
66
|
+
"\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(MAINOBJ) " \
|
|
67
67
|
"$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
|
|
68
68
|
"# -- End of tebako patch --"
|
|
69
69
|
|
|
70
70
|
TEMPLATE_MAKEFILE_IN_BASE_PATCH_MSYS =
|
|
71
71
|
"# -- Start of tebako patch --\n" \
|
|
72
|
-
"\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(
|
|
72
|
+
"\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(RUBY_EXP) $(MAINOBJ) " \
|
|
73
73
|
"$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
|
|
74
74
|
"# -- End of tebako patch --"
|
|
75
75
|
|
data/lib/tebako/packager.rb
CHANGED
|
@@ -26,8 +26,11 @@
|
|
|
26
26
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
|
|
28
28
|
require "fileutils"
|
|
29
|
+
require "find"
|
|
30
|
+
require "pathname"
|
|
29
31
|
|
|
30
32
|
require_relative "error"
|
|
33
|
+
require_relative "deploy_helper"
|
|
31
34
|
require_relative "packager/pass1"
|
|
32
35
|
require_relative "packager/pass1a"
|
|
33
36
|
require_relative "packager/pass2"
|
|
@@ -59,12 +62,6 @@ module Tebako
|
|
|
59
62
|
thread_pthread.c
|
|
60
63
|
].freeze
|
|
61
64
|
|
|
62
|
-
# Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
|
|
63
|
-
# These are the minimal versions required to provide linux-gnu / linux-musl differentiation by bundler
|
|
64
|
-
# Ruby 3.1+ default rubygems versions work correctly out of the box
|
|
65
|
-
BUNDLER_VERSION = "2.4.22"
|
|
66
|
-
RUBYGEMS_VERSION = "3.4.22"
|
|
67
|
-
|
|
68
65
|
class << self
|
|
69
66
|
# Create implib
|
|
70
67
|
def create_implib(src_dir, package_src_dir, app_name, ruby_ver)
|
|
@@ -77,18 +74,18 @@ module Tebako
|
|
|
77
74
|
end
|
|
78
75
|
|
|
79
76
|
# Deploy
|
|
80
|
-
def deploy(target_dir, ruby_ver,
|
|
77
|
+
def deploy(os_type, target_dir, pre_dir, ruby_ver, fs_root, fs_entrance, fs_mount_point) # rubocop:disable Metrics/ParameterLists
|
|
81
78
|
puts "-- Running deploy script"
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
deploy_env = { "GEM_HOME" => gem_home, "GEM_PATH" => gem_home, "TEBAKO_PASS_THROUGH" => "1" }
|
|
80
|
+
deploy_helper = Tebako::DeployHelper.new(fs_root, fs_entrance, fs_mount_point, target_dir, pre_dir)
|
|
81
|
+
deploy_helper.config(os_type, ruby_ver)
|
|
87
82
|
|
|
88
|
-
PatchHelpers.with_env(deploy_env) do
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
PatchHelpers.with_env(deploy_helper.deploy_env) do
|
|
84
|
+
unless PatchHelpers.ruby31?(ruby_ver)
|
|
85
|
+
deploy_helper.update_rubygems
|
|
86
|
+
patch_after_rubygems_update(target_dir, deploy_helper.ruby_api_version)
|
|
87
|
+
end
|
|
88
|
+
deploy_helper.deploy
|
|
92
89
|
end
|
|
93
90
|
end
|
|
94
91
|
|
|
@@ -174,24 +171,10 @@ module Tebako
|
|
|
174
171
|
File.join(src_dir, "lib", "libx64-ucrt-ruby#{ruby_ver[0]}#{ruby_ver[2]}0.a")
|
|
175
172
|
end
|
|
176
173
|
|
|
177
|
-
def install_gem(target_dir, name, ver = nil)
|
|
178
|
-
puts " ... installing #{name} gem#{" version #{ver}" if ver}"
|
|
179
|
-
|
|
180
|
-
params = ["#{target_dir}/bin/gem", "install", name.to_s]
|
|
181
|
-
params.push("-v", ver.to_s) if ver
|
|
182
|
-
|
|
183
|
-
out, st = Open3.capture2e(*params)
|
|
184
|
-
raise Tebako::Error, "Failed to install #{name} (#{st}):\n #{out}" unless st.exitstatus.zero?
|
|
185
|
-
end
|
|
186
|
-
|
|
187
174
|
def do_patch(patch_map, root)
|
|
188
175
|
patch_map.each { |fname, mapping| PatchHelpers.patch_file("#{root}/#{fname}", mapping) }
|
|
189
176
|
end
|
|
190
177
|
|
|
191
|
-
def ruby_api_version(ruby_ver)
|
|
192
|
-
"#{ruby_ver.split(".")[0..1].join(".")}.0"
|
|
193
|
-
end
|
|
194
|
-
|
|
195
178
|
def ruby_version(tbd)
|
|
196
179
|
ruby_version = nil
|
|
197
180
|
PatchHelpers.with_env(DEPLOY_ENV) do
|
|
@@ -206,11 +189,7 @@ module Tebako
|
|
|
206
189
|
ruby_version
|
|
207
190
|
end
|
|
208
191
|
|
|
209
|
-
def
|
|
210
|
-
puts " ... updating rubygems to #{gem_ver}"
|
|
211
|
-
out, st = Open3.capture2e("#{target_dir}/bin/gem", "update", "--no-doc", "--system", gem_ver.to_s)
|
|
212
|
-
raise Tebako::Error, "Failed to update rubugems to #{gem_ver} (#{st}):\n #{out}" unless st.exitstatus.zero?
|
|
213
|
-
|
|
192
|
+
def patch_after_rubygems_update(target_dir, ruby_api_ver)
|
|
214
193
|
# Autoload cannot handle statically linked openssl extension
|
|
215
194
|
# Changing it to require seems to be the simplest solution
|
|
216
195
|
PatchHelpers.patch_file("#{target_dir}/lib/ruby/site_ruby/#{ruby_api_ver}/rubygems/openssl.rb",
|
data/lib/tebako/version.rb
CHANGED
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.7.2.
|
|
4
|
+
version: 0.7.2.rc4
|
|
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-07-
|
|
11
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -66,6 +66,7 @@ files:
|
|
|
66
66
|
- lib/tebako/cli.rb
|
|
67
67
|
- lib/tebako/cli_helpers.rb
|
|
68
68
|
- lib/tebako/cli_rubies.rb
|
|
69
|
+
- lib/tebako/deploy_helper.rb
|
|
69
70
|
- lib/tebako/error.rb
|
|
70
71
|
- lib/tebako/packager.rb
|
|
71
72
|
- lib/tebako/packager/pass1.rb
|