Class: Debci::Data::Export
- Inherits:
-
Object
- Object
- Debci::Data::Export
- Defined in:
- lib/debci/data.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#tarball ⇒ Object
readonly
Returns the value of attribute tarball.
Instance Method Summary collapse
- #add(pkgname) ⇒ Object
-
#initialize(tarball) ⇒ Export
constructor
A new instance of Export.
- #save ⇒ Object
Constructor Details
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
18 19 20 |
# File 'lib/debci/data.rb', line 18 def entries @entries end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
18 19 20 |
# File 'lib/debci/data.rb', line 18 def root @root end |
#tarball ⇒ Object (readonly)
Returns the value of attribute tarball.
18 19 20 |
# File 'lib/debci/data.rb', line 18 def tarball @tarball end |
Instance Method Details
#add(pkgname) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/debci/data.rb', line 26 def add(pkgname) pkg = Debci::Package.find_by!(name: pkgname) # add data files suites = Debci.config.suite_list architectures = Debci.config.arch_list glob = "{packages,autopkgtest}/{#{suites.join(',')}}/{#{architectures.join(',')}}/#{pkg.prefix}/#{pkg.name}" Dir.chdir(root) do Dir[glob].each do |d| entries << d end end # add database data # FIXME make directory unique Dir.chdir(root) do FileUtils.mkdir_p('export') File.write("export/#{pkg.name}.json", Debci::Job.where(package: pkg).to_json) end entries << "export/#{pkg.name}.json" end |
#save ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/debci/data.rb', line 48 def save files_from = Tempfile.new files_from.puts(entries.sort) files_from.close target = File.(tarball) Dir.chdir(root) do system('tar', 'caf', target, "--files-from=#{files_from.path}") end end |