Class: Machinery::RpmDatabase

Inherits:
ManagedFilesDatabase show all
Defined in:
lib/rpm_database.rb

Overview

Copyright © 2013-2016 SUSE LLC

This program is free software; you can redistribute it and/or modify it under the terms of version 3 of the GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, contact SUSE LLC.

To contact SUSE about this file by physical or electronic mail, you may find current contact information at www.suse.com

Instance Method Summary collapse

Methods inherited from ManagedFilesDatabase

#changed_files, #expected_tag?, #get_file_properties, #get_link_target, #get_path_data, #handle_verify_fail, #initialize, #parse_changes_line, #parse_stat_line

Constructor Details

This class inherits a constructor from Machinery::ManagedFilesDatabase

Instance Method Details

#check_requirementsObject



29
30
31
32
33
# File 'lib/rpm_database.rb', line 29

def check_requirements
  @system.check_requirement("rpm", "--version")
  @system.check_requirement("stat", "--version")
  @system.check_requirement("find", "--version")
end

#managed_files_list(&block) ⇒ Object



19
20
21
# File 'lib/rpm_database.rb', line 19

def managed_files_list(&block)
  @system.run_script_with_progress("changed_files.sh", &block)
end

#package_for_file_path(file) ⇒ Object



23
24
25
26
27
# File 'lib/rpm_database.rb', line 23

def package_for_file_path(file)
  package = @system.run_command("rpm", "-qf", file, stdout: :capture).split.first
  package_name, package_version = package.scan(/(.*)-([^-]*)-[^-]/).first
  [package_name, package_version]
end