class RPM::File
Attributes
@return [String] Group that owns the file. Nil may be returned.
@return [String] Path to the destination if the file is a symbolic link @note
This path is sometimes relative. To convert an absolute path from relative path: File.expand_path (file.link_to, File.dirname (file.path))
@return [String] md5sum as string
@return [Number] Device type of the file
@return [Time] File
modification time.
@return [String] File
owner. Nil may be returned.
@return [String] file path
Public Class Methods
Source
# File lib/rpm/file.rb, line 120 def initialize(path, md5sum, link_to, size, mtime, owner, group, rdev, mode, attr, state) @path = path @md5sum = md5sum # If link_to is "" save it as nil @link_to = ((link_to && link_to.empty?) ? nil : link_to) @size = size @mtime = mtime @owner = owner @group = group @rdev = rdev @mode = mode @attr = attr @state = state end
Public Instance Methods
Source
# File lib/rpm/file.rb, line 36 def config? ! (@attr & RPM::C::FileAttrs[:config]).zero? end
@return [Boolean] True if the file is marked as a configuration file
Source
# File lib/rpm/file.rb, line 41 def doc? ! (@attr & RPM::C::FileAttrs[:doc]).zero? end
@return [Boolean] True if the file is marked as documentation
Source
# File lib/rpm/file.rb, line 47 def donotuse? msg = "RPMFILE_DONOTUSE was removed in recent versions of RPM." warn "#{Kernel.caller.first} #{msg}" raise NotImplementedError end
@return [Boolean] True if the file is marked as do not use @deprecated RPMFILE_DONOTUSE was removed in recent versions of RPM
.
Source
# File lib/rpm/file.rb, line 99 def exclude? msg = "RPMFILE_EXCLUDE was removed in recent versions of RPM." warn "#{Kernel.caller.first} #{msg}" raise NotImplementedError end
@raise NotImplementedError @deprecated RPMFILE_EXCLUDE was removed in recent versions of RPM
.
Source
# File lib/rpm/file.rb, line 83 def ghost? ! (@attr & RPM::C::FileAttrs[:ghost]).zero? end
@return [Boolean] True if the file is marked as ghost
This flag indicates the file should not be included in the package. It can be used to name the needed attributes for a file that the program, when installed,
will create.
For example, you may want to ensure that a program’s log file has certain attributes.
Source
# File lib/rpm/file.rb, line 57 def is_missingok? ! (@attr & RPM::C::FileAttrs[:missingok]).zero? end
@return [Boolean] True if the file is marked that can be missing on disk
This modifier is used for files or links that are created during the %post scripts but will need to be removed if the package is removed
Source
# File lib/rpm/file.rb, line 68 def is_noreplace? ! (@attr & RPM::C::FileAttrs[:noreplace]).zero? end
@return [Boolean] True if the file is marked as configuration not to be replaced
This flag is used to protect local modifications. If used, the file will not overwrite an existing file that has been modified. If the file has not been modified on disk, the rpm command will overwrite the file. But,
if the file has been modified on disk, the rpm command will copy the new file with an extra file-name extension of .rpmnew.
Source
# File lib/rpm/file.rb, line 73 def is_specfile? ! (@attr & RPM::C::FileAttrs[:specfile]).zero? end
@return [Boolean] True if the file is marked as a spec file
Source
# File lib/rpm/file.rb, line 88 def license? ! (@attr & RPM::C::FileAttrs[:license]).zero? end
@return [Boolean] True if the file is a license
Source
# File lib/rpm/file.rb, line 111 def notinstalled? ! (@attr & RPM::C::FileState[:notinstalled]).zero? end
@return [Boolean] True if the file is not installed
Source
# File lib/rpm/file.rb, line 93 def readme? ! (@attr & RPM::C::FileAttrs[:readme]).zero? end
@return [Boolean] True if the file is a README
Source
# File lib/rpm/file.rb, line 106 def replaced? ! (@attr & RPM::C::FileState[:replaced]).zero? end
@return [Boolean] True if the file is replaced during installation
Source
# File lib/rpm/file.rb, line 31 def symlink? ! @link_to.nil? end
@return [Boolean] True if the file is a symbolic link