aspera-cli 4.21.1 → 4.21.2

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -2
  3. data/CHANGELOG.md +22 -10
  4. data/CONTRIBUTING.md +68 -143
  5. data/README.md +175 -145
  6. data/bin/ascli +5 -14
  7. data/bin/asession +1 -3
  8. data/examples/get_proto_file.rb +4 -3
  9. data/examples/proxy.pac +20 -20
  10. data/lib/aspera/agent/base.rb +2 -0
  11. data/lib/aspera/agent/{alpha.rb → desktop.rb} +7 -7
  12. data/lib/aspera/agent/direct.rb +9 -1
  13. data/lib/aspera/agent/transferd.rb +24 -17
  14. data/lib/aspera/api/alee.rb +1 -1
  15. data/lib/aspera/api/cos_node.rb +1 -1
  16. data/lib/aspera/api/node.rb +4 -4
  17. data/lib/aspera/ascp/installation.rb +40 -58
  18. data/lib/aspera/cli/extended_value.rb +9 -3
  19. data/lib/aspera/cli/formatter.rb +8 -1
  20. data/lib/aspera/cli/info.rb +1 -0
  21. data/lib/aspera/cli/main.rb +2 -2
  22. data/lib/aspera/cli/manager.rb +3 -3
  23. data/lib/aspera/cli/plugins/aoc.rb +106 -55
  24. data/lib/aspera/cli/plugins/config.rb +10 -31
  25. data/lib/aspera/cli/plugins/faspex5.rb +8 -5
  26. data/lib/aspera/cli/plugins/node.rb +6 -3
  27. data/lib/aspera/cli/version.rb +1 -1
  28. data/lib/aspera/coverage.rb +5 -3
  29. data/lib/aspera/environment.rb +20 -11
  30. data/lib/aspera/faspex_postproc.rb +3 -5
  31. data/lib/aspera/hash_ext.rb +2 -12
  32. data/lib/aspera/oauth/base.rb +6 -1
  33. data/lib/aspera/preview/generator.rb +12 -9
  34. data/lib/aspera/preview/options.rb +2 -2
  35. data/lib/aspera/preview/terminal.rb +1 -1
  36. data/lib/aspera/preview/utils.rb +4 -4
  37. data/lib/aspera/products/connect.rb +34 -0
  38. data/lib/aspera/products/{alpha.rb → desktop.rb} +2 -2
  39. data/lib/aspera/products/transferd.rb +8 -1
  40. data/lib/aspera/rest.rb +4 -4
  41. data/lib/aspera/secret_hider.rb +7 -0
  42. data/lib/aspera/temp_file_manager.rb +5 -4
  43. data/lib/aspera/uri_reader.rb +18 -1
  44. data.tar.gz.sig +0 -0
  45. metadata +4 -174
  46. metadata.gz.sig +0 -0
  47. data/examples/build_exec +0 -74
  48. data/examples/build_exec_rubyc +0 -40
@@ -14,7 +14,7 @@ module Aspera
14
14
  # from bash manual: meta-character need to be escaped
15
15
  BASH_SPECIAL_CHARACTERS = "|&;()<> \t#\n"
16
16
  # external binaries used
17
- EXTERNAL_TOOLS = %i[ffmpeg ffprobe convert composite optipng unoconv].freeze
17
+ EXTERNAL_TOOLS = %i[ffmpeg ffprobe magick optipng unoconv].freeze
18
18
  TEMP_FORMAT = 'img%04d.jpg'
19
19
  private_constant :BASH_SPECIAL_CHARACTERS, :EXTERNAL_TOOLS, :TEMP_FORMAT
20
20
 
@@ -32,7 +32,7 @@ module Aspera
32
32
  tools_to_check.delete(:unoconv) if skip_types.include?(:office)
33
33
  # Check for binaries
34
34
  tools_to_check.each do |command_sym|
35
- external_command(command_sym, ['-h'])
35
+ external_command(command_sym, ['-h'], out: File::NULL)
36
36
  rescue Errno::ENOENT => e
37
37
  raise "missing #{command_sym} binary: #{e}"
38
38
  rescue
@@ -45,7 +45,7 @@ module Aspera
45
45
  # @return nil
46
46
  def external_command(command_sym, command_args)
47
47
  Aspera.assert_values(command_sym, EXTERNAL_TOOLS){'command'}
48
- Environment.secure_execute(exec: command_sym.to_s, args: command_args.map(&:to_s))
48
+ Environment.secure_execute(exec: command_sym.to_s, args: command_args.map(&:to_s), out: File::NULL, err: File::NULL)
49
49
  end
50
50
 
51
51
  def external_capture(command_sym, command_args)
@@ -97,7 +97,7 @@ module Aspera
97
97
  1.upto(count) do |i|
98
98
  percent = i * 100 / (count + 1)
99
99
  filename = get_tmp_num_filepath(temp_folder, index1 + i)
100
- external_command(:composite, ['-blend', percent, img2, img1, filename])
100
+ external_command(:magick, ['composite', '-blend', percent, img2, img1, filename])
101
101
  end
102
102
  end
103
103
 
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'aspera/environment'
4
+ require 'singleton'
4
5
 
5
6
  module Aspera
6
7
  module Products
7
8
  class Connect
9
+ include Singleton
8
10
  APP_NAME = 'IBM Aspera Connect'
11
+
9
12
  class << self
10
13
  # standard folder locations
11
14
  def locations
@@ -43,6 +46,37 @@ module Aspera
43
46
  end.map { |i| i.merge({ expected: APP_NAME }) }
44
47
  end
45
48
  end
49
+
50
+ def cdn_api
51
+ Rest.new(base_url: CDN_BASE_URL)
52
+ end
53
+
54
+ # retrieve structure from cloud (CDN) with all versions available
55
+ def versions
56
+ if @connect_versions.nil?
57
+ javascript = cdn_api.call(operation: 'GET', subpath: VERSION_INFO_FILE)
58
+ # get result on one line
59
+ connect_versions_javascript = javascript[:http].body.gsub(/\r?\n\s*/, '')
60
+ Log.log.debug{"javascript=[\n#{connect_versions_javascript}\n]"}
61
+ # get javascript object only
62
+ found = connect_versions_javascript.match(/^.*? = (.*);/)
63
+ raise Cli::Error, 'Problem when getting connect versions from internet' if found.nil?
64
+ all_data = JSON.parse(found[1])
65
+ @connect_versions = all_data['entries']
66
+ end
67
+ return @connect_versions
68
+ end
69
+
70
+ private
71
+
72
+ def initialize
73
+ @connect_versions = nil
74
+ end
75
+
76
+ VERSION_INFO_FILE = 'connectversions.js' # cspell: disable-line
77
+ CDN_BASE_URL = 'https://d3gcli72yxqn2z.cloudfront.net/connect'
78
+
79
+ private_constant :VERSION_INFO_FILE, :CDN_BASE_URL
46
80
  end
47
81
  end
48
82
  end
@@ -4,8 +4,8 @@ require 'aspera/environment'
4
4
 
5
5
  module Aspera
6
6
  module Products
7
- # Aspera Desktop Alpha Client
8
- class Alpha
7
+ # Client Aspera for Desktop
8
+ class Desktop
9
9
  APP_NAME = 'IBM Aspera for Desktop'
10
10
  APP_IDENTIFIER = 'com.ibm.software.aspera.desktop'
11
11
  class << self
@@ -4,6 +4,11 @@ module Aspera
4
4
  module Products
5
5
  class Transferd
6
6
  APP_NAME = 'IBM Aspera Transfer Daemon'
7
+ V1_DAEMON_NAME = 'asperatransferd'
8
+ # from 1.1.5
9
+ V2_DAEMON_NAME = 'transferd'
10
+ # folders to extract from SDK archive
11
+ RUNTIME_FOLDERS = %w[bin lib sbin aspera].freeze
7
12
  class << self
8
13
  # standard folder locations
9
14
  def locations
@@ -28,7 +33,9 @@ module Aspera
28
33
  end
29
34
 
30
35
  def transferd_path
31
- return File.join(sdk_directory, Environment.exe_file('asperatransferd')) # cspell:disable-line
36
+ v1_path = File.join(sdk_directory, Environment.exe_file(V1_DAEMON_NAME))
37
+ return v1_path if File.exist?(v1_path)
38
+ return File.join(sdk_directory, Environment.exe_file(V2_DAEMON_NAME))
32
39
  end
33
40
 
34
41
  # Well, the port number is only in log file
data/lib/aspera/rest.rb CHANGED
@@ -62,7 +62,7 @@ module Aspera
62
62
 
63
63
  class << self
64
64
  # @return [String] Basic auth token
65
- def basic_token(user, pass); return "Basic #{Base64.strict_encode64("#{user}:#{pass}")}"; end
65
+ def basic_authorization(user, pass); return "Basic #{Base64.strict_encode64("#{user}:#{pass}")}"; end
66
66
 
67
67
  # Build a parameter list prefixed with "[]"
68
68
  # @param values [Array] list of values
@@ -295,7 +295,7 @@ module Aspera
295
295
  Log.log.debug('using Basic auth')
296
296
  # done in build_req
297
297
  when :oauth2
298
- headers['Authorization'] = oauth.token unless headers.key?('Authorization')
298
+ headers['Authorization'] = oauth.authorization unless headers.key?('Authorization')
299
299
  when :url
300
300
  query ||= {}
301
301
  @auth_params[:url_query].each do |key, value|
@@ -409,12 +409,12 @@ module Aspera
409
409
  if @not_auth_codes.include?(result[:http].code.to_s) && @auth_params[:type].eql?(:oauth2)
410
410
  begin
411
411
  # try to use refresh token
412
- req['Authorization'] = oauth.token(refresh: true)
412
+ req['Authorization'] = oauth.authorization(refresh: true)
413
413
  rescue RestCallError => e_tok
414
414
  e = e_tok
415
415
  Log.log.error('refresh failed'.bg_red)
416
416
  # regenerate a brand new token
417
- req['Authorization'] = oauth.token(refresh: true)
417
+ req['Authorization'] = oauth.authorization(cache: false)
418
418
  end
419
419
  Log.log.debug{"using new token=#{headers['Authorization']}"}
420
420
  do_retry = true if (oauth_tries -= 1).positive?
@@ -38,6 +38,7 @@ module Aspera
38
38
  class << self
39
39
  attr_accessor :log_secrets
40
40
 
41
+ # @return new log formatter that hides secrets
41
42
  def log_formatter(original_formatter)
42
43
  original_formatter ||= Logger::Formatter.new
43
44
  # NOTE: that @log_secrets may be set AFTER this init is done, so it's done at runtime
@@ -51,6 +52,11 @@ module Aspera
51
52
  end
52
53
  end
53
54
 
55
+ def hide_secrets_in_string(value)
56
+ return value.gsub(REGEX_LOG_REPLACES.first){"#{Regexp.last_match(:begin)}#{HIDDEN_PASSWORD}#{Regexp.last_match(:end)}"}
57
+ end
58
+
59
+ # @return true if the key denotes a secret
54
60
  def secret?(keyword, value)
55
61
  keyword = keyword.to_s if keyword.is_a?(Symbol)
56
62
  # only Strings can be secrets, not booleans, or hash, arrays
@@ -62,6 +68,7 @@ module Aspera
62
68
  ALL_SECRETS.any?{|kw|keyword.include?(kw)}
63
69
  end
64
70
 
71
+ # Hides recursively secrets in Hash or Array of Hash
65
72
  def deep_remove_secret(obj)
66
73
  case obj
67
74
  when Array
@@ -35,22 +35,23 @@ module Aspera
35
35
 
36
36
  # ensure that provided folder exists, or create it, generate a unique filename
37
37
  # @return path to that unique file
38
- def new_file_path_in_folder(temp_folder, add_base = '')
38
+ def new_file_path_in_folder(temp_folder, prefix: nil, suffix: nil)
39
39
  FileUtils.mkdir_p(temp_folder)
40
- new_file = File.join(temp_folder, add_base + SecureRandom.uuid)
40
+ new_file = File.join(temp_folder, [prefix, SecureRandom.uuid, suffix].compact.join('-'))
41
41
  @created_files.push(new_file)
42
42
  new_file
43
43
  end
44
44
 
45
45
  # same as above but in global temp folder, with user's name
46
- def new_file_path_global(base_name)
46
+ def new_file_path_global(prefix=nil, suffix: nil)
47
47
  username =
48
48
  begin
49
49
  Etc.getlogin || Etc.getpwuid(Process.uid).name || 'unknown_user'
50
50
  rescue StandardError
51
51
  'unknown_user'
52
52
  end
53
- new_file_path_in_folder(Etc.systmpdir, base_name + '_' + username + '_')
53
+ prefix = [prefix, username].compact.join('-')
54
+ new_file_path_in_folder(Etc.systmpdir, prefix: prefix, suffix: suffix)
54
55
  end
55
56
 
56
57
  def cleanup_expired(temp_folder)
@@ -1,11 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'uri'
4
+ require 'aspera/assert'
4
5
  require 'aspera/rest'
6
+ require 'aspera/temp_file_manager'
5
7
 
6
8
  module Aspera
7
9
  # read some content from some URI, support file: , http: and https: schemes
8
10
  module UriReader
11
+ FILE_SCHEME_PREFIX = 'file:///'
12
+ private_constant :FILE_SCHEME_PREFIX
9
13
  class << self
10
14
  # read some content from some URI, support file: , http: and https: schemes
11
15
  def read(uri_to_read)
@@ -18,8 +22,21 @@ module Aspera
18
22
  raise 'URL shall have a path, check syntax' if local_file_path.nil?
19
23
  local_file_path = File.expand_path(local_file_path.gsub(%r{^/}, '')) if %r{^/(~|.|..)/}.match?(local_file_path)
20
24
  return File.read(local_file_path)
25
+ else Aspera.error_unexpected_value(uri.scheme) {"scheme for [#{uri_to_read}]"}
26
+ end
27
+ end
28
+
29
+ # @return path to file with content at URL
30
+ def read_as_file(url)
31
+ if url.start_with?('file:')
32
+ # require specific file scheme: the path part is "relative", or absolute if there are 4 slash
33
+ raise "use format: #{FILE_SCHEME_PREFIX}<path>" unless url.start_with?(FILE_SCHEME_PREFIX)
34
+ return File.expand_path(url[FILE_SCHEME_PREFIX.length..-1])
21
35
  else
22
- raise "unknown scheme: [#{uri.scheme}] for [#{uri_to_read}]"
36
+ # autodelete on exit
37
+ sdk_archive_path = TempFileManager.instance.new_file_path_global(suffix: File.basename(url))
38
+ Aspera::Rest.new(base_url: url, redirect_max: 3).call(operation: 'GET', save_to_file: sdk_archive_path)
39
+ return sdk_archive_path
23
40
  end
24
41
  end
25
42
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspera-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.1
4
+ version: 4.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Martin
@@ -37,7 +37,7 @@ cert_chain:
37
37
  eTf9kxhVM40wGQOECVNA8UsEEZHD48eF+csUYZtAJOF5oxTI8UyV9T/o6CgO0c9/
38
38
  Gzz+Qm5ULOUcPiJLjSpaiTrkiIVYiDGnqNSr6R1Hb1c=
39
39
  -----END CERTIFICATE-----
40
- date: 2025-03-14 00:00:00.000000000 Z
40
+ date: 2025-04-11 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: blankslate
@@ -123,20 +123,6 @@ dependencies:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '7.3'
126
- - !ruby/object:Gem::Dependency
127
- name: openssl
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: 3.3.0
133
- type: :runtime
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: 3.3.0
140
126
  - !ruby/object:Gem::Dependency
141
127
  name: rainbow
142
128
  requirement: !ruby/object:Gem::Requirement
@@ -249,160 +235,6 @@ dependencies:
249
235
  - - "~>"
250
236
  - !ruby/object:Gem::Version
251
237
  version: '1.0'
252
- - !ruby/object:Gem::Dependency
253
- name: grpc-tools
254
- requirement: !ruby/object:Gem::Requirement
255
- requirements:
256
- - - "~>"
257
- - !ruby/object:Gem::Version
258
- version: 1.67.0
259
- type: :development
260
- prerelease: false
261
- version_requirements: !ruby/object:Gem::Requirement
262
- requirements:
263
- - - "~>"
264
- - !ruby/object:Gem::Version
265
- version: 1.67.0
266
- - !ruby/object:Gem::Dependency
267
- name: rake
268
- requirement: !ruby/object:Gem::Requirement
269
- requirements:
270
- - - "~>"
271
- - !ruby/object:Gem::Version
272
- version: '13.0'
273
- type: :development
274
- prerelease: false
275
- version_requirements: !ruby/object:Gem::Requirement
276
- requirements:
277
- - - "~>"
278
- - !ruby/object:Gem::Version
279
- version: '13.0'
280
- - !ruby/object:Gem::Dependency
281
- name: reek
282
- requirement: !ruby/object:Gem::Requirement
283
- requirements:
284
- - - "~>"
285
- - !ruby/object:Gem::Version
286
- version: 6.1.0
287
- type: :development
288
- prerelease: false
289
- version_requirements: !ruby/object:Gem::Requirement
290
- requirements:
291
- - - "~>"
292
- - !ruby/object:Gem::Version
293
- version: 6.1.0
294
- - !ruby/object:Gem::Dependency
295
- name: rspec
296
- requirement: !ruby/object:Gem::Requirement
297
- requirements:
298
- - - "~>"
299
- - !ruby/object:Gem::Version
300
- version: '3.0'
301
- type: :development
302
- prerelease: false
303
- version_requirements: !ruby/object:Gem::Requirement
304
- requirements:
305
- - - "~>"
306
- - !ruby/object:Gem::Version
307
- version: '3.0'
308
- - !ruby/object:Gem::Dependency
309
- name: rubocop
310
- requirement: !ruby/object:Gem::Requirement
311
- requirements:
312
- - - "~>"
313
- - !ruby/object:Gem::Version
314
- version: '1.12'
315
- type: :development
316
- prerelease: false
317
- version_requirements: !ruby/object:Gem::Requirement
318
- requirements:
319
- - - "~>"
320
- - !ruby/object:Gem::Version
321
- version: '1.12'
322
- - !ruby/object:Gem::Dependency
323
- name: rubocop-ast
324
- requirement: !ruby/object:Gem::Requirement
325
- requirements:
326
- - - "~>"
327
- - !ruby/object:Gem::Version
328
- version: '1.4'
329
- type: :development
330
- prerelease: false
331
- version_requirements: !ruby/object:Gem::Requirement
332
- requirements:
333
- - - "~>"
334
- - !ruby/object:Gem::Version
335
- version: '1.4'
336
- - !ruby/object:Gem::Dependency
337
- name: rubocop-performance
338
- requirement: !ruby/object:Gem::Requirement
339
- requirements:
340
- - - "~>"
341
- - !ruby/object:Gem::Version
342
- version: '1.10'
343
- type: :development
344
- prerelease: false
345
- version_requirements: !ruby/object:Gem::Requirement
346
- requirements:
347
- - - "~>"
348
- - !ruby/object:Gem::Version
349
- version: '1.10'
350
- - !ruby/object:Gem::Dependency
351
- name: rubocop-shopify
352
- requirement: !ruby/object:Gem::Requirement
353
- requirements:
354
- - - "~>"
355
- - !ruby/object:Gem::Version
356
- version: '2.0'
357
- type: :development
358
- prerelease: false
359
- version_requirements: !ruby/object:Gem::Requirement
360
- requirements:
361
- - - "~>"
362
- - !ruby/object:Gem::Version
363
- version: '2.0'
364
- - !ruby/object:Gem::Dependency
365
- name: ruby-lsp
366
- requirement: !ruby/object:Gem::Requirement
367
- requirements:
368
- - - "~>"
369
- - !ruby/object:Gem::Version
370
- version: '0.23'
371
- type: :development
372
- prerelease: false
373
- version_requirements: !ruby/object:Gem::Requirement
374
- requirements:
375
- - - "~>"
376
- - !ruby/object:Gem::Version
377
- version: '0.23'
378
- - !ruby/object:Gem::Dependency
379
- name: simplecov
380
- requirement: !ruby/object:Gem::Requirement
381
- requirements:
382
- - - "~>"
383
- - !ruby/object:Gem::Version
384
- version: '0.22'
385
- type: :development
386
- prerelease: false
387
- version_requirements: !ruby/object:Gem::Requirement
388
- requirements:
389
- - - "~>"
390
- - !ruby/object:Gem::Version
391
- version: '0.22'
392
- - !ruby/object:Gem::Dependency
393
- name: solargraph
394
- requirement: !ruby/object:Gem::Requirement
395
- requirements:
396
- - - "~>"
397
- - !ruby/object:Gem::Version
398
- version: '0.48'
399
- type: :development
400
- prerelease: false
401
- version_requirements: !ruby/object:Gem::Requirement
402
- requirements:
403
- - - "~>"
404
- - !ruby/object:Gem::Version
405
- version: '0.48'
406
238
  description: Command line interface for IBM Aspera products
407
239
  email:
408
240
  - laurent.martin.aspera@fr.ibm.com
@@ -418,15 +250,13 @@ files:
418
250
  - README.md
419
251
  - bin/ascli
420
252
  - bin/asession
421
- - examples/build_exec
422
- - examples/build_exec_rubyc
423
253
  - examples/build_package.sh
424
254
  - examples/dascli
425
255
  - examples/get_proto_file.rb
426
256
  - examples/proxy.pac
427
- - lib/aspera/agent/alpha.rb
428
257
  - lib/aspera/agent/base.rb
429
258
  - lib/aspera/agent/connect.rb
259
+ - lib/aspera/agent/desktop.rb
430
260
  - lib/aspera/agent/direct.rb
431
261
  - lib/aspera/agent/httpgw.rb
432
262
  - lib/aspera/agent/node.rb
@@ -509,8 +339,8 @@ files:
509
339
  - lib/aspera/preview/terminal.rb
510
340
  - lib/aspera/preview/utils.rb
511
341
  - lib/aspera/preview/video_error.png
512
- - lib/aspera/products/alpha.rb
513
342
  - lib/aspera/products/connect.rb
343
+ - lib/aspera/products/desktop.rb
514
344
  - lib/aspera/products/other.rb
515
345
  - lib/aspera/products/transferd.rb
516
346
  - lib/aspera/proxy_auto_config.js
metadata.gz.sig CHANGED
Binary file
data/examples/build_exec DELETED
@@ -1,74 +0,0 @@
1
- #!/bin/bash
2
- # Glibc for various OS: https://gist.github.com/wagenet/35adca1a032cec2999d47b6c40aa45b1
3
- # https://distrowatch.com/table.php?distribution=redhat
4
- # RHEL 8 : glibc 2.28
5
- # RHEL 9 : glibc 2.34
6
- # https://distrowatch.com/table.php?distribution=ubuntu
7
- # Ubuntu 18.10 cosmic : glibc 2.28
8
- # Ubuntu 21.10 impish : gblic 2.34
9
- # https://www.ibm.com/docs/en/ahts/4.4.x?topic=release-notes
10
- # ascp 4.4.5 : gblic 2.28
11
- # dwarfs requires boost >= 1.65
12
- # boost requires cmake >= 3.30
13
- set -e
14
-
15
- if test $# -ne 5; then
16
- echo "Usage: $0 <CLI_EXECUTABLE> <CLI_PATH> <GEM_NAME> <GEM_VERSION> <DIR_TMP>" 1>&2
17
- exit 1
18
- fi
19
-
20
- CLI_EXECUTABLE=$1
21
- CLI_PATH=$(realpath $2)
22
- GEM_NAME=$3
23
- GEM_VERSION=$4
24
- DIR_TMP=$(realpath $5)
25
-
26
- echo "Building: $(basename $CLI_EXECUTABLE)"
27
-
28
- # tebako compilation
29
- tebako_env=$DIR_TMP/tebako-env
30
- # project files (gem)
31
- tebako_root=$DIR_TMP/tebako-root
32
- # only provide the name, not path
33
- tebako_entry=$(basename $CLI_PATH)
34
- tebako_output=$CLI_EXECUTABLE
35
-
36
- container_tag=alpine-3.17
37
- #container_tag=ubuntu-20.04
38
-
39
- gem install tebako
40
- mkdir -p $tebako_env $tebako_root
41
- (cd $tebako_root && gem fetch $GEM_NAME:$GEM_VERSION)
42
- case $(uname -s) in
43
- Darwin)
44
- brew update
45
- # install tools
46
- brew install bash binutils bison flex gnu-sed lz4 pkg-config xz
47
- # install libs
48
- brew install boost double-conversion fmt gdbm glog jemalloc libevent libffi libsodium libyaml ncurses openssl@3 zlib
49
- # make sure tools are reachable
50
- export PATH=/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:$PATH
51
- # remove binutils from path so that macos `ar` is used
52
- export PATH=$(echo $PATH|tr : \\n|grep -v /binutils/|tr \\n :)
53
- ;;
54
- Linux)
55
- tebako_root=/mnt/w
56
- tebako_prefix="podman run -it --rm -v $PWD:$tebako_root ghcr.io/tamatebako/tebako-${container_tag}:0.8.6"
57
- tebako_opts=--patchelf
58
- tebako_output=$tebako_root/$(basename $CLI_EXECUTABLE)
59
- ;;
60
- LinuxLocal)
61
- dnf module reset ruby
62
- dnf module install ruby:3.3
63
- dnf install -y cmake git bash sudo autoconf boost-devel flex bison make clang binutils-devel libevent-devel libacl-devel sed python3 pkgconfig curl lz4-devel openssl-devel zlib-devel xz zip unzip tar xz-devel elfutils-devel libffi-devel gdbm-devel ncurses-devel readline-devel ruby-devel gettext-devel brotli-devel clang libxslt-devel
64
- echo TODO
65
- exit 1
66
- dnf install
67
- ;;
68
- *)
69
- echo "This OS is not supported." >&2
70
- exit 1
71
- ;;
72
- esac
73
- set -x
74
- exec $tebako_prefix tebako press --root=$tebako_root --entry-point=$tebako_entry --output=$tebako_output --prefix=$tebako_env $tebako_opts
@@ -1,40 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- if test $# -ne 5; then
6
- echo "Usage: $0 <CLI_EXECUTABLE> <CLI_PATH> <GEM_NAME> <GEM_VERSION> <DIR_TMP>" 1>&2
7
- exit 1
8
- fi
9
-
10
- CLI_EXECUTABLE=$1
11
- CLI_PATH=$(realpath $2)
12
- GEM_NAME=$3
13
- GEM_VERSION=$4
14
- DIR_TMP=$(realpath $5)
15
-
16
- echo "Building: $(basename $CLI_EXECUTABLE)"
17
-
18
- # https://github.com/you54f/ruby-packer
19
- # https://github.com/you54f/ruby-packer/releases
20
- set -e
21
- FOLDER="$(dirname $0)/../tmp"
22
- RUBYC="$FOLDER/rubyc"
23
- if test ! -e "$RUBYC"; then
24
- mkdir -p "$FOLDER"
25
- case $(uname -sm|tr ' ' -) in
26
- Darwin-arm64)
27
- curl -L https://github.com/YOU54F/ruby-packer/releases/download/rel-20230812/rubyc-Darwin-arm64.tar.gz | tar -xz -C "$FOLDER"
28
- mv "$FOLDER/rubyc-Darwin-arm64" "$RUBYC"
29
- ;;
30
- Linux-x86_64)
31
- curl -L https://github.com/YOU54F/ruby-packer/releases/download/rel-20230812/rubyc-Linux-x86_64.tar.gz | tar -xz -C "$FOLDER"
32
- mv "$FOLDER/rubyc-Linux-x86_64" "$RUBYC"
33
- ;;
34
- *)
35
- echo "This architecture is not supported." >&2
36
- exit 1
37
- ;;
38
- esac
39
- fi
40
- exec "$RUBYC" -o "$CLI_EXECUTABLE" "$CLI_PATH"