tebako 0.12.15 → 0.12.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ca5253989e3915a15d811d014547ffadc66d4ddc7b4981ba2670f16479b0e2e
4
- data.tar.gz: 17c0075bf2f3dd8eabfd10c492afc1982123d0cafac113ff9b519493119ecdb2
3
+ metadata.gz: 90a79cb3c7cf5d46a64d7337c96dfeff2b2c1aa0bcc73ba6ef19a260fff8d2e8
4
+ data.tar.gz: 32dd49b7bca79dc56611dbc08c838bd211fd75c99b99d81df72f4962237ccc4e
5
5
  SHA512:
6
- metadata.gz: b6f8340c839065cd63eb9bf6491b1b51061e55bd5f2648d94137b42d10e9fc9e00ce739c3f68c66d84174981fedcd364a0bd2e86dba7fad159f080e3e6e55090
7
- data.tar.gz: 4134e0c4e5cede91de0bcd9afff617d30c83bdd7729d67d81544b52df308e34a7226f018ef35eb54689771ab89c4a27ea1a80740603080dd9e8962bec261402d
6
+ metadata.gz: 9e8b56db99c71dc148ab2596cf9338babd50784f2a98a9361e101af8734801ccaa72d580575ebad7599faed6f66e0100fdf4c0f045d857581d0af58a194b1c0a
7
+ data.tar.gz: 0d63898d6c18e696a44fb31a15c76821b0dabbf9ccc69ea98437d2962a522eecec40ddd9277a3680cf3a23e2a8f8882c750e74e930f1e20224f25ed7d59e9f61
data/CMakeLists.txt CHANGED
@@ -436,7 +436,7 @@ if (${SETUP_MODE})
436
436
 
437
437
  add_dependencies(tebako-fs packaged_filesystem)
438
438
 
439
- add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER} ${DEPS_BIN_DIR}/patchelf ${WITH_PATCHELF})
439
+ add_custom_target(tebako COMMAND ${CMAKE_COMMAND} -E true)
440
440
  add_dependencies(tebako setup tebako-fs)
441
441
 
442
442
  endif(${SETUP_MODE})
data/README.adoc CHANGED
@@ -580,21 +580,22 @@ The following instructions work for:
580
580
 
581
581
  We use Homebrew to install the necessary packages on macOS.
582
582
 
583
+ Tebako provides a `Brewfile` at the repository root that you can install all
584
+ dependencies using the `brew bundle` command.
585
+
583
586
  [source,sh]
584
587
  ----
585
- brew update
586
- brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib \
587
- ncurses double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz \
588
- libyaml openssl@3
589
- brew bundle
588
+ $ brew bundle
590
589
  ----
591
590
 
592
- Additionaly tebako repository includes `Brewfile` that can be used with
593
- `brew bundle` command.
591
+ Alternatively, you can install the packages manually.
594
592
 
595
593
  [source,sh]
596
594
  ----
597
- brew bundle
595
+ $ brew update
596
+ $ brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib \
597
+ ncurses double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz \
598
+ libyaml openssl@3
598
599
  ----
599
600
 
600
601
  ====== Bison 3+
@@ -703,9 +704,8 @@ $ pacman -S git tar bison flex toolchain make cmake
703
704
  [[root-folder-selection]]
704
705
  === Tebako root folder (aka prefix) selection
705
706
 
706
- The Tebako prefix determines the base directory for the Tebako setup.
707
-
708
- It is an essential part of configuring how Tebako operates within your system.
707
+ The Tebako prefix determines the base directory for the tebako packaging environment. It contain build artifacts for
708
+ Tebako run-time, libraries and other components and is an essential part of configuring how Tebako operates within your system.
709
709
 
710
710
  The selection of the Tebako prefix follows a specific order of precedence to
711
711
  ensure flexibility and ease of use:
@@ -727,12 +727,14 @@ If no prefix is specified and the `TEBAKO_DIR` environment variable is not set,
727
727
  Tebako defaults to using a directory named `.tebako` in the user's home
728
728
  directory.
729
729
 
730
-
731
730
  Path Expansion: Regardless of the method used to set the Tebako prefix, Tebako
732
731
  expands the provided path to an absolute path. This expansion includes resolving
733
732
  relative paths based on the current working directory and expanding user
734
733
  directory shortcuts like `~`.
735
734
 
735
+ Please do not use Tebako prefix under your application root (`--root` parameter). It is not an error
736
+ but it will cause Tebako to place all build-time artifacts to tebako package dramatically increasing its size.
737
+ You do not need it unless under very special circumstances like tebako packaging tebako itself.
736
738
 
737
739
  === Commands
738
740
 
@@ -766,7 +768,7 @@ tebako press \
766
768
  [-R|--Ruby=<ruby-version>] \
767
769
  [-o|--output=<packaged-file-name>] \
768
770
  [-l|--log-level=<error|warn|debug|trace>] \
769
- [-c|--cwd=<package current working directory>]
771
+ [-c|--cwd=<package-current-working-directory>] \
770
772
  [-D|--devmode] \
771
773
  [-P|--patchelf] \
772
774
  [-m|--mode=<bundle|both|application|runtime>] \
@@ -776,56 +778,70 @@ tebako press \
776
778
 
777
779
  Where:
778
780
 
779
- `<tebako-root-folder>`::
781
+ `--entry-point=<entry-point>`::
782
+ an executable file (binary executable or script) that shall be started when
783
+ packaged file is called. This parameter is not required if the operation mode is `runtime`.
784
+
785
+ `--prefix=<tebako-root-folder>`::
780
786
  the Tebako root folder (see details: <<root-folder-selection>>)
781
787
 
782
- `Ruby`::
788
+ `--Ruby=<ruby-version>`::
783
789
  this parameter defines Ruby version that will be packaged (optional, defaults to
784
790
  `3.3.7`)
785
791
 
786
- `project-root`::
792
+ `--root=<project-root-folder>`::
787
793
  a folder at the host source file system where project files are located.
788
794
  This parameter is not required if the operation mode is `runtime`.
789
795
 
790
- `entry-point`::
791
- an executable file (binary executable or script) that shall be started when
792
- packaged file is called. This parameter is not required if the operation mode is `runtime`.
793
-
794
- `output`::
796
+ `--output=<packaged-file-name>`::
795
797
  (optional)
796
798
  the output file name.
797
799
  +
798
- Defaults to `<current folder>/<entry point base name>`.
799
- +
800
- On Windows output file will have `exe` extension.
801
- If the application is to be a separate file (`both` or `application` mode), it
802
- will have the same name with the `.tebako` extension.
800
+ On Windows, the output file is automatically appended the `.exe` extension.
801
+
802
+ ** If the `-o` option is not specified:
803
+
804
+ *** in `runtime` mode, the runtime package is created at `tebako-runtime`.
805
+ *** in `application` mode, the application package is created at `<current-folder>/<entry-point-base-name>`.
806
+ *** in `bundle` mode, the bundled package is created at `<current-folder>/<entry-point-base-name>`.
807
+ *** in `both` mode, the runtime package is created at `<current-folder>/<entry-point-base-name>`,
808
+ and the application package is created at `<current-folder>/<entry-point-base-name>.tebako`.
809
+
810
+ ** If the `-o` option is specified:
803
811
 
804
- `log-level`::
805
- logging level for the Tebako built-in memory filesystem driver
812
+ *** in `runtime` mode, the runtime package is named according to the `-o` option.
813
+ *** in `application` mode, the application package is named according to the `-o` option.
814
+ *** in `bundle` mode, the bundled package is named according to the `-o` option.
815
+ *** in `both` mode, the runtime package is named according to the `-o` option,
816
+ and the application package is named according to the `-o` option with the `.tebako` extension.
817
+
818
+
819
+ `--log-level=<error|warn|debug|trace>`::
806
820
  (optional, defaults to `error`)
821
+ logging level for the Tebako built-in memory filesystem driver.
807
822
 
808
- `cwd`::
823
+ `--cwd=<package-current-working-directory>`::
809
824
  (optional)
810
- a folder within Tebako memfs where the packaged application will start. This folder should be specified relative to the memfs root.
825
+ A folder within Tebako memfs where the packaged application will start. This
826
+ folder should be specified relative to the memfs root.
811
827
  +
812
828
  If not provided, the application will start within the current folder of the
813
829
  host (i.e., at `$PWD`).
814
830
  +
815
831
  This argument is required because it is not possible to change the directory to
816
832
  a memfs folder until the package is started, as opposed to any host folder that
817
- can be set as the current directory before Tebako package invocation. Tebako
833
+ can be set as the current directory before Tebako package invocation. Tebako
818
834
  saves the original working directory in a global Ruby variable
819
835
  `$tebako_original_pwd`.
820
836
 
821
- `devmode`:: flag that activates development mode, in which Tebako's cache and
837
+ `--devmode`:: flag that activates development mode, in which Tebako's cache and
822
838
  packaging consistency checks are relaxed.
823
839
 
824
- `patchelf`::
840
+ `--patchelf`::
825
841
  Allows forward-compatibility of Tebako packages with Linux GNU distributions.
826
842
  +
827
843
  Specifically, this is a flag that removes a reference to the `GLIBC_PRIVATE`
828
- version of `libpthread` from a Tebako package. This allows Linux GNU packages
844
+ version of `libpthread` from a Tebako package. This allows Linux GNU packages
829
845
  to run against versions of `libpthread` that differ from the version used for
830
846
  packaging.
831
847
  +
@@ -836,32 +852,34 @@ For example, a package created at Ubuntu 20 system can be used on Ubuntu 22.
836
852
  +
837
853
  NOTE: The feature is exeprimental, we may consider another approach in the future.
838
854
 
839
- `mode`::
840
- output mode for tebako package (optional, defaults to `bundle`).
855
+ `--mode=<mode>`::
856
+ (optional, defaults to `bundle`)
857
+ Package output mode, determines whether the runtime and/or application are
858
+ to be separately packaged.
841
859
 
842
- `bundle`::: place runtime and application to a single file
843
- `both`::: create both run-rime and application
844
- `application`::: create appplication only
845
- `runtime`::: create runtime only
860
+ `bundle`::: Create a single package bundling both the runtime and application. The output file is named according to the `-o` option.
861
+ `both`::: Create separate packages for the runtime and application. Outputs two separate files: one for the runtime at the location specified at the `-o {filename}` and one for the application at `{filename}.package`.
862
+ `application`::: Create the application package only. The output file is named according to the `-o` option.
863
+ `runtime`::: Create the runtime package only. The output file is named according to the `-o` option.
846
864
 
847
- `ref`::
865
+ `--ref`::
848
866
  (optional)
849
867
  Defaults to `tebako-runtime`.
850
868
  When a Tebako application package is created on Windows, it is linked against a
851
869
  Tebako runtime file name. The `ref` parameter allows to specify the name of the
852
870
  runtime file.
853
871
  +
854
- NOTE: The `ref` option specificies the name of the runtime -- the runtime file
872
+ NOTE: The `--ref` option specifies the name of the runtime -- the runtime file
855
873
  can be recreated or changed but not renamed.
856
874
 
857
- `tebafile`::
875
+ `--tebafile=<path>`::
858
876
  the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
859
877
  Please refer to the separate section below for description of the tebafile.
860
878
  +
861
879
  NOTE: Development mode is *not intended for production use* and should only be
862
880
  used during development.
863
881
  +
864
- NOTE: `entry-point` and `project-root-folder` are required parameters and may be
882
+ NOTE: `--entry-point` and `--project-root-folder` are required parameters and may be
865
883
  provided either via command-line or in the tebafile.
866
884
 
867
885
  [example]
@@ -903,16 +921,18 @@ $ tebako setup \
903
921
 
904
922
  Where:
905
923
 
906
- `<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
924
+ `--prefix=<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
907
925
 
908
- `Ruby`:: parameter defines package Ruby version (optional). This version is used in conjuction with requirements
909
- from the Gemfile as explained below in 'Package Ruby version selection rules' section.
926
+ `--Ruby=<ruby-version>`::
927
+ parameter defines package Ruby version (optional).
928
+ This version is used in conjunction with requirements from the `Gemfile` as
929
+ explained below in <<ruby-and-bundler-versions>>.
910
930
 
911
- `tebafile`::
931
+ `--tebafile=<path>`::
912
932
  the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
913
933
  Please refer to the separate section below for tebafile description.
914
934
 
915
- `devmode`:: flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
935
+ `--devmode`:: flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
916
936
  Please note that this mode is not intended for production use and should only be used during development.
917
937
 
918
938
  ==== Clean
@@ -931,9 +951,9 @@ $ tebako clean \
931
951
 
932
952
  Where:
933
953
 
934
- `<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
954
+ `--prefix=<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
935
955
 
936
- `tebafile`::
956
+ `--tebafile=<path>`::
937
957
  the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
938
958
  Please refer to the separate section below for tebafile description.
939
959
 
@@ -968,13 +988,14 @@ $ tebako clean_ruby
968
988
 
969
989
  Where:
970
990
 
971
- `<tebako-root-folder>`::
991
+ `--prefix=<tebako-root-folder>`::
972
992
  the Tebako setup folder (optional, defaults to current folder)
973
993
 
974
- `Ruby`::
975
- defines Ruby version that will cleaned (optional, cleans all versions by default)
994
+ `--Ruby=<ruby-version>`::
995
+ (optional, cleans all versions by default)
996
+ defines Ruby version that will be cleaned.
976
997
 
977
- `tebafile`::
998
+ `--tebafile=<path>`::
978
999
  the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
979
1000
  Please refer to the separate section below for tebafile description.
980
1001
 
@@ -1036,11 +1057,11 @@ samller order means higher proirity.
1036
1057
  | Order | Mode | Option source | Applicability
1037
1058
 
1038
1059
  | 1 | All | Command-line | All options
1039
- | 2 | All |Tebako configuration file | All option except ``--tebafile`` (you can not specify new tebafile in a tebafile)
1040
- .2+| 3 .2+| All .2+| Environment variable | TEBAKO_PREFIX to set ``--prefix`` option
1041
- | LG_VADDR to set ``--with-lg-vaddr`` jemalloc parameter
1042
- .2+| 4 | ``runtime`` | Tebako defaults | All options except ``--entry-point`` and ``--root`` that are mandatory
1043
- | ``bundle``, ``both``, ``application`` | Tebako defaults | All options
1060
+ | 2 | All |Tebako configuration file | All option except `--tebafile` (you can not specify new tebafile in a tebafile)
1061
+ .2+| 3 .2+| All .2+| Environment variable | TEBAKO_PREFIX to set `--prefix` option
1062
+ | LG_VADDR to set `--with-lg-vaddr` jemalloc parameter
1063
+ .2+| 4 | `runtime` | Tebako defaults | All options except `--entry-point` and `--root` that are mandatory
1064
+ | `bundle`, `both`, `application` | Tebako defaults | All options
1044
1065
 
1045
1066
  |===
1046
1067
 
@@ -1075,6 +1096,7 @@ operation. The following table lists the possible exit codes and their meanings.
1075
1096
  | 116 | Ruby version does not satify Gemfile requirements
1076
1097
  |===
1077
1098
 
1099
+ [[ruby-and-bundler-versions]]
1078
1100
  == Ruby and bundler versions selection
1079
1101
 
1080
1102
  During packaging tebako creates its own Ruby execution environment that is independent from the host Ruby environment.
@@ -1226,52 +1248,155 @@ myproject --option --parameter value
1226
1248
  However there are several command-line parameters that are intercepted processed
1227
1249
  by Tebako bootstrap code as described below.
1228
1250
 
1229
- === Running tebako image by tebako runtime (`--tebako-run` option)
1230
1251
 
1231
- Tebako provides an option to an extract its DwarFS filesystem from a package to
1232
- a local folder for verification or execution.
1252
+ === Creating a bundle package
1253
+
1254
+ Tebako provides a method to create and manage a bundle package, which simplifies
1255
+ the process of packaging dependencies along with the application.
1233
1256
 
1234
1257
  [source,sh]
1235
1258
  ----
1236
- $ <tebako-runtime> --tebako-run [<tebako application>]
1259
+ $ tebako bundle create -o <bundle-package> -r <project-root-folder> [-R <ruby-version>]
1237
1260
  ----
1238
1261
 
1239
- Where,
1262
+ To run the bundle package, use the following command:
1263
+
1264
+ [source,sh]
1265
+ ----
1266
+ $ <bundle-package>
1267
+ ----
1268
+
1269
+ [example]
1270
+ ====
1271
+ [source,sh]
1272
+ ----
1273
+ $ tebako bundle create -o myproject-bundle -r ~/projects/myproject -R 3.4.1
1274
+ # => creates `myproject-bundle`, a bundle package for Ruby 3.4.1
1275
+ $ myproject-bundle
1276
+ # => runs the bundle package
1277
+ ----
1278
+ ====
1279
+
1280
+ === Creating separate runtime and application packages
1281
+
1282
+ Tebako allows creating separate runtime and application packages that can be used
1283
+ to run a Tebako application package.
1284
+
1285
+ [source,sh]
1286
+ ----
1287
+ $ tebako press -m both \
1288
+ -o <tebako-runtime-package> \
1289
+ -e <entry-point> \
1290
+ -r <project-root-folder> \
1291
+ [-R <ruby-version>]
1292
+ ----
1293
+
1294
+ The resulting packages will be generated in the current directory as:
1295
+
1296
+ * Tebako runtime package at the `-o` location, i.e. `<tebako-runtime-package>`.
1297
+ * Tebako application package. The name of the application package will be the
1298
+ same as the runtime package with the `.package` extension.
1299
+
1300
+
1301
+ === Creating a Tebako runtime package
1302
+
1303
+ Tebako allows creating a Tebako runtime package that can be used to run a Tebako
1304
+ application package.
1240
1305
 
1241
- `<tebako runtime>`::
1242
- The tebako runtime in ```runtime``` or ```both``` mode
1306
+ [source,sh]
1307
+ ----
1308
+ $ tebako press -m runtime -o <tebako-runtime-package> [-R <ruby-version>]
1309
+ ----
1310
+
1311
+ [example]
1312
+ ====
1313
+ [source,sh]
1314
+ ----
1315
+ $ tebako press -o tebako-ruby-3.4.1 -R 3.4.1
1316
+ # => creates `tebako-ruby-3.4.1`, a Tebako runtime package for Ruby 3.4.1
1317
+ ----
1318
+ ====
1319
+
1320
+ === Creating a Tebako application package
1243
1321
 
1244
- `<tebako application>`::
1245
- The tebako application package created in ```application``` or ```both``` mode
1322
+ Tebako allows creating a Tebako application package that can be run with a
1323
+ Tebako runtime package.
1324
+
1325
+ [source,sh]
1326
+ ----
1327
+ $ tebako press -m application \
1328
+ -o <tebako-application-package> \
1329
+ -e <entry-point> \
1330
+ -r <project-root-folder> \
1331
+ [-R <ruby-version>]
1332
+ ----
1246
1333
 
1247
1334
  [example]
1248
1335
  ====
1249
- Creating separate runtime and application and running it:
1336
+ [source,sh]
1337
+ ----
1338
+ $ tebako press -m application \
1339
+ -o tebako-application-package \
1340
+ -e start.rb \
1341
+ -r ~/projects/myproject \
1342
+ -R 3.4.1
1343
+ # => creates `tebako-application-package`, a Tebako application package for Ruby 3.4.1
1344
+ ----
1345
+ ====
1346
+
1347
+
1348
+ === Running Tebako application using a Tebako runtime (`--tebako-run` option)
1349
+
1350
+ The Tebako application package can be executed by a Tebako runtime package.
1250
1351
 
1251
1352
  [source,sh]
1252
1353
  ----
1253
- tebako press -m runtime -o tebako-runtime
1254
- tebako press -m application -o tebako-application -e hello.rb -r test
1255
- tabako-runtime --tebako-run tebako-application Maxim
1354
+ $ <tebako-runtime-package> --tebako-run [<tebako-application-package>]
1256
1355
  ----
1257
- where hello.rb is the Ruby application
1356
+
1357
+ Where,
1358
+
1359
+ `<tebako-runtime-package>`::
1360
+ The Tebako runtime package file created using in `runtime` or `both` mode.
1361
+
1362
+ `<tebako-application-package>`::
1363
+ The Tebako application package created in `application` or `both` mode.
1364
+
1365
+ [example]
1366
+ ====
1367
+ Given a Ruby application at `hello.rb`:
1368
+
1258
1369
  [source,Ruby]
1259
1370
  ----
1260
- # frozen_string_literal: true
1261
-
1262
1371
  puts "Hello, #{ARGV[0]}!"
1263
1372
  ----
1264
- And expected output from ```tabako-runtime --tebako-run tebako-application Maxim``` is
1373
+
1374
+ Create separate runtime and application packages:
1375
+
1376
+ [source,sh]
1377
+ ----
1378
+ tebako press -m runtime -o tebako-runtime-package
1379
+ tebako press -m application -o tebako-application-package -e hello.rb -r test
1380
+ ----
1381
+
1382
+ Run the application using the pre-packaged runtime:
1383
+
1265
1384
  [source,sh]
1266
1385
  ----
1267
- Hello, Maxim!
1386
+ tebako-runtime-package --tebako-run tebako-application-package Maxim
1268
1387
  ----
1269
1388
 
1389
+ The expected output is:
1390
+
1391
+ [source]
1392
+ ----
1393
+ Hello, Maxim!
1394
+ ----
1270
1395
  ====
1271
1396
 
1272
1397
  === Image extraction (`--tebako-extract` option)
1273
1398
 
1274
- Tebako provides an option to an extract its DwarFS filesystem from a package to
1399
+ Tebako provides an option to extract its DwarFS filesystem from a package to
1275
1400
  a local folder for verification or execution.
1276
1401
 
1277
1402
  [source,sh]
data/exe/tebako-packager CHANGED
@@ -67,21 +67,6 @@ begin
67
67
  Tebako::Packager.pass1a(ARGV[2])
68
68
  Tebako::Packager.stash(ARGV[4], ARGV[5], ARGV[2], ruby_ver)
69
69
  Tebako::Packager.pass2(ARGV[1], ARGV[2], ARGV[3], ruby_ver)
70
-
71
- when "finalize"
72
- # ARGV[0] -- command
73
- # ARGV[1] -- RUBY_SOURCE_DIR
74
- # ARGV[2] -- APP_NAME
75
- # ARGV[3] -- RUBY_VER
76
- # ARGV[4] -- patchelf executable
77
- # ARGV[5] -- WITH_PATHELF
78
- unless ARGV.length == 6
79
- raise Tebako::Error,
80
- "tebako-packager finalize command expects 6 arguments, #{ARGV.length} has been provided."
81
- end
82
- ruby_ver = Tebako::RubyVersion.new(ARGV[3])
83
- with_patchelf = ARGV[5].casecmp("ON").zero? || ARGV[5].casecmp("YES").zero?
84
- Tebako::Packager.finalize(ARGV[1], ARGV[2], ruby_ver, with_patchelf ? ARGV[4] : nil)
85
70
  else
86
71
  raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
87
72
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2023-2024 [Ribose Inc](https://www.ribose.com).
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
  #
@@ -55,18 +55,36 @@ module Tebako
55
55
 
56
56
  WARN
57
57
 
58
+ WARN2 = <<~WARN
59
+
60
+ ******************************************************************************************************************
61
+ * *
62
+ * WARNING: You are creating packaging environment inside application root. *
63
+ * It is not an error but it means that all build-time artifacts will ne included in tebako package. *
64
+ * You do not need it unless under very special circumstances like tebako packaging tebako itself. *
65
+ * *
66
+ * Please consider removing your exisitng `--prefix` folder abd use another one that points outside of `--root` *
67
+ * like tebako press --r ~/projects/myproject -e start.rb -o /temp/myproject.tebako -p ~/.tebako *
68
+ * *
69
+ ******************************************************************************************************************
70
+
71
+ WARN
72
+
73
+ def check_warnings(options_manager)
74
+ return unless options_manager.mode != "runtime"
75
+
76
+ puts WARN if options_manager.package_within_root?
77
+ puts WARN2 if options_manager.prefix_within_root?
78
+ sleep 5
79
+ end
80
+
58
81
  def do_press(options_manager)
59
82
  scenario_manager = Tebako::ScenarioManager.new(options_manager.root, options_manager.fs_entrance)
60
83
  scenario_manager.configure_scenario
61
84
  options_manager.process_gemfile(scenario_manager.gemfile_path) if scenario_manager.with_gemfile
62
-
85
+ check_warnings(options_manager)
63
86
  puts options_manager.press_announce(scenario_manager.msys?)
64
87
 
65
- if options_manager.package_within_root?
66
- puts WARN
67
- sleep 5
68
- end
69
-
70
88
  do_press_runtime(options_manager, scenario_manager)
71
89
  do_press_application(options_manager, scenario_manager)
72
90
  end
@@ -85,6 +103,7 @@ module Tebako
85
103
  merged_env = ENV.to_h.merge(scenario_manager.b_env)
86
104
  Tebako.packaging_error(103) unless system(merged_env, press_cfg_cmd(options_manager))
87
105
  Tebako.packaging_error(104) unless system(merged_env, press_build_cmd(options_manager))
106
+ finalize(options_manager, scenario_manager)
88
107
  end
89
108
 
90
109
  def do_setup(options_manager)
@@ -108,6 +127,13 @@ module Tebako
108
127
  Tebako::Codegen.generate_stub_rb(options_manager)
109
128
  end
110
129
 
130
+ def finalize(options_manager, scenario_manager)
131
+ use_patchelf = options_manager.patchelf? && scenario_manager.linux_gnu?
132
+ patchelf = use_patchelf ? "#{options_manager.deps_bin_dir}/patchelf" : nil
133
+ Tebako::Packager.finalize(options_manager.ruby_src_dir, options_manager.package,
134
+ options_manager.rv, patchelf, options_manager.output_type_first)
135
+ end
136
+
111
137
  def options_from_tebafile(tebafile)
112
138
  ::YAML.load_file(tebafile)["options"] || {}
113
139
  rescue Psych::SyntaxError => e
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2023-2024 [Ribose Inc](https://www.ribose.com).
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
  #
@@ -117,6 +117,15 @@ module Tebako
117
117
  @deps_lib_dir ||= File.join(deps, "lib")
118
118
  end
119
119
 
120
+ def folder_within_root?(folder)
121
+ folder_path = Pathname.new(folder.chomp("/"))
122
+ root_path = Pathname.new(root.chomp("/"))
123
+ folder_path.ascend do |path|
124
+ return true if path == root_path
125
+ end
126
+ false
127
+ end
128
+
120
129
  def fs_current
121
130
  fs_current = Dir.pwd
122
131
  if @scmb.msys?
@@ -154,9 +163,17 @@ module Tebako
154
163
  @output_folder ||= File.join(prefix, "o")
155
164
  end
156
165
 
166
+ def output_type_first
167
+ @output_type_first ||= %w[both runtime].include?(mode) ? "runtime package" : "package"
168
+ end
169
+
170
+ def output_type_second
171
+ "application package"
172
+ end
173
+
157
174
  def package
158
175
  package = if @options["output"].nil?
159
- File.join(Dir.pwd, File.basename(fs_entrance, ".*"))
176
+ File.join(Dir.pwd, mode == "runtime" ? "tebako-runtime" : File.basename(fs_entrance, ".*"))
160
177
  else
161
178
  @options["output"]&.gsub("\\", "/")
162
179
  end
@@ -168,12 +185,11 @@ module Tebako
168
185
  end
169
186
 
170
187
  def package_within_root?
171
- package_path = Pathname.new(package.chomp("/"))
172
- root_path = Pathname.new(root.chomp("/"))
173
- package_path.ascend do |path|
174
- return true if path == root_path
175
- end
176
- false
188
+ folder_within_root?(package)
189
+ end
190
+
191
+ def patchelf?
192
+ @options["patchelf"]
177
193
  end
178
194
 
179
195
  def prefix
@@ -186,6 +202,10 @@ module Tebako
186
202
  end
187
203
  end
188
204
 
205
+ def prefix_within_root?
206
+ folder_within_root?(prefix)
207
+ end
208
+
189
209
  def press_announce(is_msys)
190
210
  case mode
191
211
  when "application"
@@ -93,17 +93,17 @@ module Tebako
93
93
  patch_map.each { |fname, mapping| PatchHelpers.patch_file("#{root}/#{fname}", mapping) }
94
94
  end
95
95
 
96
- def finalize(src_dir, app_name, ruby_ver, patchelf)
96
+ def finalize(src_dir, app_name, ruby_ver, patchelf, output_type)
97
97
  puts "-- Running finalize script"
98
98
 
99
- RubyBuilder.new(ruby_ver, src_dir).target_build
99
+ RubyBuilder.new(ruby_ver, src_dir).target_build(output_type)
100
100
  exe_suffix = ScenarioManagerBase.new.exe_suffix
101
101
  src_name = File.join(src_dir, "ruby#{exe_suffix}")
102
102
  patchelf(src_name, patchelf)
103
103
  package_name = "#{app_name}#{exe_suffix}"
104
104
  # strip_or_copy(os_type, src_name, package_name)
105
105
  Tebako::Stripper.strip_file(src_name, package_name)
106
- puts "Created tebako package at \"#{package_name}\""
106
+ puts "Created tebako #{output_type} at \"#{package_name}\""
107
107
  end
108
108
 
109
109
  # Init
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2023-2024 [Ribose Inc](https://www.ribose.com).
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
  #
@@ -61,7 +61,7 @@ module Tebako
61
61
  deploy
62
62
  FileUtils.rm_f(name)
63
63
  Tebako::Packager.mkdwarfs(@opts.deps_bin_dir, name, @opts.data_src_dir, codegen)
64
- puts "Created tebako package at \"#{name}\""
64
+ puts "Created tebako #{@opts.output_type_second} at \"#{name}\""
65
65
  end
66
66
 
67
67
  def deploy
@@ -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
  #
@@ -50,8 +50,8 @@ module Tebako
50
50
  end
51
51
 
52
52
  # Final build of tebako package
53
- def target_build
54
- puts " ... building tebako package"
53
+ def target_build(output_type)
54
+ puts " ... building tebako #{output_type}"
55
55
  Dir.chdir(@src_dir) do
56
56
  BuildHelpers.run_with_capture(["make", "ruby", "-j#{@ncores}"]) if @ruby_ver.ruby3x?
57
57
  BuildHelpers.run_with_capture(["make", "-j#{@ncores}"])
@@ -66,6 +66,14 @@ module Tebako
66
66
  @linux
67
67
  end
68
68
 
69
+ def linux_gnu?
70
+ @linux && !@musl
71
+ end
72
+
73
+ def linux_musl?
74
+ @linux && @musl
75
+ end
76
+
69
77
  def m_files
70
78
  # [TODO]
71
79
  # Ninja generates incorrect script for tebako press target -- gets lost in a chain custom targets
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.12.15"
29
+ VERSION = "0.12.16"
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.15
4
+ version: 0.12.16
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-02-24 00:00:00.000000000 Z
11
+ date: 2025-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler