Class: FPM::Fry::Source::Patched::Cache

Inherits:
Struct
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/fpm/fry/source/patched.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*_) ⇒ Cache

Returns a new instance of Cache.



15
16
17
18
19
# File 'lib/fpm/fry/source/patched.rb', line 15

def initialize(*_)
  @updated = false
  super
  @inner = package.inner.build_cache(tmpdir)
end

Instance Attribute Details

#innerObject (readonly)

Returns the value of attribute inner.



13
14
15
# File 'lib/fpm/fry/source/patched.rb', line 13

def inner
  @inner
end

#packageObject

Returns the value of attribute package

Returns:

  • (Object)

    the current value of package



7
8
9
# File 'lib/fpm/fry/source/patched.rb', line 7

def package
  @package
end

#tmpdirObject

Returns the value of attribute tmpdir

Returns:

  • (Object)

    the current value of tmpdir



7
8
9
# File 'lib/fpm/fry/source/patched.rb', line 7

def tmpdir
  @tmpdir
end

Instance Method Details

#cachekeyObject



88
89
90
91
92
93
94
95
96
# File 'lib/fpm/fry/source/patched.rb', line 88

def cachekey
  dig = Digest::SHA2.new
  dig << inner.cachekey << "\x00"
  package.patches.each do |patch|
    dig.file(patch[:file])
    dig << "\x00"
  end
  return dig.hexdigest
end

#tar_ioObject



83
84
85
86
# File 'lib/fpm/fry/source/patched.rb', line 83

def tar_io
  update!
  return Exec::popen('tar','-c','.',chdir: unpacked_tmpdir, logger: logger)
end

#unpacked_tmpdirObject



98
99
100
# File 'lib/fpm/fry/source/patched.rb', line 98

def unpacked_tmpdir
  File.join(tmpdir, cachekey)
end