class RPM::File

Attributes

attr[RW]
group[RW]

@return [String] Group that owns the file. Nil may be returned.

md5sum[RW]

@return [String] md5sum as string

mode[RW]

@return [Number] Device type of the file

mtime[RW]

@return [Time] File modification time.

owner[RW]

@return [String] File owner. Nil may be returned.

path[RW]

@return [String] file path

rdev[RW]
size[RW]

@return [Number] File size

state[RW]

Public Class Methods

new(path, md5sum, link_to, size, mtime, owner, group, rdev, mode, attr, state) click to toggle 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

config?() click to toggle source

@return [Boolean] True if the file is marked as a configuration file

# File lib/rpm/file.rb, line 36
def config?
  ! (@attr & RPM::C::FileAttrs[:config]).zero?
end
doc?() click to toggle source

@return [Boolean] True if the file is marked as documentation

# File lib/rpm/file.rb, line 41
def doc?
  ! (@attr & RPM::C::FileAttrs[:doc]).zero?
end
donotuse?() click to toggle source

@return [Boolean] True if the file is marked as do not use @deprecated RPMFILE_DONOTUSE was removed in recent versions of RPM.

# 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
exclude?() click to toggle source

@raise NotImplementedError @deprecated RPMFILE_EXCLUDE was removed in recent versions of RPM.

# 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
ghost?() click to toggle source

@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.

# File lib/rpm/file.rb, line 83
def ghost?
  ! (@attr & RPM::C::FileAttrs[:ghost]).zero?
end
is_missingok?() click to toggle source

@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

# File lib/rpm/file.rb, line 57
def is_missingok?
  ! (@attr & RPM::C::FileAttrs[:missingok]).zero?
end
is_noreplace?() click to toggle source

@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.
# File lib/rpm/file.rb, line 68
def is_noreplace?
  ! (@attr & RPM::C::FileAttrs[:noreplace]).zero?
end
is_specfile?() click to toggle source

@return [Boolean] True if the file is marked as a spec file

# File lib/rpm/file.rb, line 73
def is_specfile?
  ! (@attr & RPM::C::FileAttrs[:specfile]).zero?
end
license?() click to toggle source

@return [Boolean] True if the file is a license

# File lib/rpm/file.rb, line 88
def license?
  ! (@attr & RPM::C::FileAttrs[:license]).zero?
end
netshared?() click to toggle source

@return [Boolean] True if the file is shared over the network

# File lib/rpm/file.rb, line 116
def netshared?
  ! (@attr & RPM::C::FileState[:netshared]).zero?
end
notinstalled?() click to toggle source

@return [Boolean] True if the file is not installed

# File lib/rpm/file.rb, line 111
def notinstalled?
  ! (@attr & RPM::C::FileState[:notinstalled]).zero?
end
readme?() click to toggle source

@return [Boolean] True if the file is a README

# File lib/rpm/file.rb, line 93
def readme?
  ! (@attr & RPM::C::FileAttrs[:readme]).zero?
end
replaced?() click to toggle source

@return [Boolean] True if the file is replaced during installation

# File lib/rpm/file.rb, line 106
def replaced?
  ! (@attr & RPM::C::FileState[:replaced]).zero?
end