patchelf 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd819b0568e9a9229a56b68b7b4c29c99dc11af026209fe9fede7e29826256fb
4
- data.tar.gz: dc3b19894d4f6059c11ab3c8acc5c21454653563ec6d3452f1b20cc3842f4a27
3
+ metadata.gz: 8560f68dba4f9e656585c38f31da63ae5f15320a03c1675adb13d27ffa2230b4
4
+ data.tar.gz: 2d19b129beb5df7bd713fc6f0f65bb942194bea201857bda499a18e4496c4fe2
5
5
  SHA512:
6
- metadata.gz: b02df17391121bfd37a15d9392aa21c3f062140ae7040199db8d5823a576a2a4a4b134e70bb891b97cd0c60dd90bbd39d263317ef302b81b863bf43c1481a99b
7
- data.tar.gz: 3da57ea6306e19d5f3582f73031e57f4ddd2c2b9361b0d04b22a0bc6322da32e6f8e3778833955da962017757ae414eb4257f371cf8459957e5d64b56fc8dfd8
6
+ metadata.gz: a2c443a08655333dc1b97ca62c1f6803bf6971565a9b40c80554aaf89a78b8e7548f0a854dd6703175e8be57154ca541ffe71f642a35ded2a734fbe1eae83b0e
7
+ data.tar.gz: 73707a964c3cc1a9d47efcb0baaa45d1fc8e42e2450acca899b5258ca2b9236229e9e560a5c9fa347bbd7c5a429644a66ceed5ac072cb7ac06db3b98088c1a8c
@@ -19,13 +19,21 @@ module PatchELF
19
19
  # @param [String] filename
20
20
  # Filename of input ELF.
21
21
  # @param [Boolean] logging
22
- # Whether to use a (stderr-initialized) logger for errors
23
- def initialize(filename, logging: true)
22
+ # *deprecated*: use +on_error+ instead
23
+ # @param [:log, :silent, :exception] on_error
24
+ # action when the desired segment/tag field isn't present
25
+ # :log = logs to stderr
26
+ # :exception = raise exception related to the error
27
+ # :silent = ignore the errors
28
+ def initialize(filename, on_error: :log, logging: true)
24
29
  @in_file = filename
25
30
  @elf = ELFTools::ELFFile.new(File.open(filename))
26
31
  @set = {}
27
32
  @rpath_sym = :runpath
28
- @logging = logging
33
+ @on_error = !logging ? :exception : on_error
34
+
35
+ on_error_syms = %i[exception log silent]
36
+ raise ArgumentError, "on_error must be one of #{on_error_syms}" unless on_error_syms.include?(@on_error)
29
37
  end
30
38
 
31
39
  # @return [String?]
@@ -179,9 +187,9 @@ module PatchELF
179
187
  private
180
188
 
181
189
  def log_or_raise(msg, exception = PatchELF::PatchError)
182
- raise exception, msg unless @logging
190
+ raise exception, msg if @on_error == :exception
183
191
 
184
- PatchELF::Logger.warn(msg)
192
+ PatchELF::Logger.warn(msg) if @on_error == :log
185
193
  end
186
194
 
187
195
  def interpreter_
@@ -2,5 +2,5 @@
2
2
 
3
3
  module PatchELF
4
4
  # Current gem version.
5
- VERSION = '1.1.1'.freeze
5
+ VERSION = '1.2.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patchelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elftools