Class: Pkgman::Builds::Source
- Inherits:
-
Object
- Object
- Pkgman::Builds::Source
- Defined in:
- lib/pkgman/builds/source.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
Instance Method Summary collapse
-
#initialize(build, target) ⇒ Source
constructor
A new instance of Source.
- #path ⇒ Object
- #start ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(build, target) ⇒ Source
Returns a new instance of Source.
7 8 9 10 |
# File 'lib/pkgman/builds/source.rb', line 7 def initialize(build, target) @build = build @target = target end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build.
5 6 7 |
# File 'lib/pkgman/builds/source.rb', line 5 def build @build end |
Instance Method Details
#path ⇒ Object
39 40 41 |
# File 'lib/pkgman/builds/source.rb', line 39 def path '/tmp/compiled' end |
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pkgman/builds/source.rb', line 12 def start @target.execute("curl -o source.tar.gz #{build['source']}", '/tmp/src') @target.execute('tar -xf source.tar.gz', '/tmp/src') unless build['source-directory'] uri = URI(build['source']) build['source-directory'] = File.basename(uri.path, ".*") if build['source-directory'].end_with?('.tar') build['source-directory'] = File.basename(build['source-directory'], ".tar") end end build['configure'] ||= [] unless build['configure'].find { |it| it.start_with?('--prefix=') } build['configure'] << '--prefix=/usr' end dir = "/tmp/src/#{build['source-directory']}" @target.execute("./configure #{build['configure'].join(' ')}", dir) @target.execute('make install DESTDIR=/tmp/compiled', dir) end |
#type ⇒ Object
35 36 37 |
# File 'lib/pkgman/builds/source.rb', line 35 def type 'dir' end |