Class: Debian::Build::TarballSourceProvider::PackageRetriever

Inherits:
Object
  • Object
show all
Includes:
HelperMethods, FileUtils
Defined in:
lib/debian/build/source_providers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HelperMethods

#get, #sudo, #uncompress

Constructor Details

#initialize(url, package) ⇒ PackageRetriever

Returns a new instance of PackageRetriever.



25
26
27
# File 'lib/debian/build/source_providers.rb', line 25

def initialize(url, package)
  @url, @package = url, package
end

Instance Attribute Details

#packageObject (readonly)

Returns the value of attribute package.



23
24
25
# File 'lib/debian/build/source_providers.rb', line 23

def package
  @package
end

Instance Method Details

#orig_tarball_nameObject



51
52
53
# File 'lib/debian/build/source_providers.rb', line 51

def orig_tarball_name
  package.orig_source_tarball_name
end

#prepare_orig_tarballObject



35
36
37
38
39
40
41
# File 'lib/debian/build/source_providers.rb', line 35

def prepare_orig_tarball
  if tarball_name.match /bz2$/ 
    sh "bunzip2 -c #{tarball_name} | gzip -c > #{orig_tarball_name}" unless File.exists?(orig_tarball_name)
  else
    sh "ln -fs #{tarball_name} #{orig_tarball_name}"
  end
end

#retrieveObject



29
30
31
32
33
# File 'lib/debian/build/source_providers.rb', line 29

def retrieve
  get tarball_url
  uncompress tarball_name
  prepare_orig_tarball
end

#tarball_nameObject



47
48
49
# File 'lib/debian/build/source_providers.rb', line 47

def tarball_name
  File.basename URI.parse(tarball_url).path
end

#tarball_urlObject



43
44
45
# File 'lib/debian/build/source_providers.rb', line 43

def tarball_url
  @tarball_url ||= eval( '"' + @url + '"', package.get_binding)
end