Class: RPM::File
- Inherits:
-
Object
- Object
- RPM::File
- Defined in:
- lib/rpm/file.rb
Instance Attribute Summary collapse
-
#attr ⇒ Object
Returns the value of attribute attr.
-
#group ⇒ String
Group that owns the file.
-
#link_to ⇒ String
Path to the destination if the file is a symbolic link.
-
#md5sum ⇒ String
Md5sum as string.
-
#mode ⇒ Number
Device type of the file.
-
#mtime ⇒ Time
File modification time.
-
#owner ⇒ String
File owner.
-
#path ⇒ String
File path.
-
#rdev ⇒ Object
Returns the value of attribute rdev.
-
#size ⇒ Number
File size.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#config? ⇒ Boolean
True if the file is marked as a configuration file.
-
#doc? ⇒ Boolean
True if the file is marked as documentation.
-
#donotuse? ⇒ Boolean
deprecated
Deprecated.
RPMFILE_DONOTUSE was removed in recent versions of RPM.
-
#exclude? ⇒ Boolean
deprecated
Deprecated.
RPMFILE_EXCLUDE was removed in recent versions of RPM.
-
#ghost? ⇒ Boolean
This flag indicates the file should not be included in the package.
-
#initialize(path, md5sum, link_to, size, mtime, owner, group, rdev, mode, attr, state) ⇒ File
constructor
A new instance of File.
-
#is_missingok? ⇒ Boolean
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.
-
#is_noreplace? ⇒ Boolean
This flag is used to protect local modifications.
-
#is_specfile? ⇒ Boolean
True if the file is marked as a spec file.
-
#license? ⇒ Boolean
True if the file is a license.
-
#netshared? ⇒ Boolean
True if the file is shared over the network.
-
#notinstalled? ⇒ Boolean
True if the file is not installed.
-
#readme? ⇒ Boolean
True if the file is a README.
-
#replaced? ⇒ Boolean
True if the file is replaced during installation.
-
#symlink? ⇒ Boolean
True if the file is a symbolic link.
Constructor Details
#initialize(path, md5sum, link_to, size, mtime, owner, group, rdev, mode, attr, state) ⇒ File
Returns a new instance of File.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# 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 |
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
26 27 28 |
# File 'lib/rpm/file.rb', line 26 def attr @attr end |
#group ⇒ String
Returns Group that owns the file. Nil may be returned.
22 23 24 |
# File 'lib/rpm/file.rb', line 22 def group @group end |
#link_to ⇒ String
This path is sometimes relative. To convert an absolute path from relative path: File.expand_path (file.link_to, File.dirname (file.path))
Returns Path to the destination if the file is a symbolic link.
14 15 16 |
# File 'lib/rpm/file.rb', line 14 def link_to @link_to end |
#md5sum ⇒ String
Returns md5sum as string.
9 10 11 |
# File 'lib/rpm/file.rb', line 9 def md5sum @md5sum end |
#mode ⇒ Number
Returns Device type of the file.
24 25 26 |
# File 'lib/rpm/file.rb', line 24 def mode @mode end |
#mtime ⇒ Time
Returns File modification time.
18 19 20 |
# File 'lib/rpm/file.rb', line 18 def mtime @mtime end |
#owner ⇒ String
Returns File owner. Nil may be returned.
20 21 22 |
# File 'lib/rpm/file.rb', line 20 def owner @owner end |
#path ⇒ String
Returns file path.
7 8 9 |
# File 'lib/rpm/file.rb', line 7 def path @path end |
#rdev ⇒ Object
Returns the value of attribute rdev.
28 29 30 |
# File 'lib/rpm/file.rb', line 28 def rdev @rdev end |
#size ⇒ Number
Returns File size.
16 17 18 |
# File 'lib/rpm/file.rb', line 16 def size @size end |
#state ⇒ Object
Returns the value of attribute state.
27 28 29 |
# File 'lib/rpm/file.rb', line 27 def state @state end |
Instance Method Details
#config? ⇒ Boolean
Returns True if the file is marked as a configuration file.
36 37 38 |
# File 'lib/rpm/file.rb', line 36 def config? ! (@attr & RPM::C::FileAttrs[:config]).zero? end |
#doc? ⇒ Boolean
Returns True if the file is marked as documentation.
41 42 43 |
# File 'lib/rpm/file.rb', line 41 def doc? ! (@attr & RPM::C::FileAttrs[:doc]).zero? end |
#donotuse? ⇒ Boolean
RPMFILE_DONOTUSE was removed in recent versions of RPM.
Returns True if the file is marked as do not use.
47 48 49 50 51 |
# 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? ⇒ Boolean
RPMFILE_EXCLUDE was removed in recent versions of RPM.
99 100 101 102 103 |
# 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? ⇒ Boolean
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.
83 84 85 |
# File 'lib/rpm/file.rb', line 83 def ghost? ! (@attr & RPM::C::FileAttrs[:ghost]).zero? end |
#is_missingok? ⇒ Boolean
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
57 58 59 |
# File 'lib/rpm/file.rb', line 57 def is_missingok? ! (@attr & RPM::C::FileAttrs[:missingok]).zero? end |
#is_noreplace? ⇒ Boolean
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.
68 69 70 |
# File 'lib/rpm/file.rb', line 68 def is_noreplace? ! (@attr & RPM::C::FileAttrs[:noreplace]).zero? end |
#is_specfile? ⇒ Boolean
Returns True if the file is marked as a spec file.
73 74 75 |
# File 'lib/rpm/file.rb', line 73 def is_specfile? ! (@attr & RPM::C::FileAttrs[:specfile]).zero? end |
#license? ⇒ Boolean
Returns True if the file is a license.
88 89 90 |
# File 'lib/rpm/file.rb', line 88 def license? ! (@attr & RPM::C::FileAttrs[:license]).zero? end |
#netshared? ⇒ Boolean
Returns True if the file is shared over the network.
116 117 118 |
# File 'lib/rpm/file.rb', line 116 def netshared? ! (@attr & RPM::C::FileState[:netshared]).zero? end |
#notinstalled? ⇒ Boolean
Returns True if the file is not installed.
111 112 113 |
# File 'lib/rpm/file.rb', line 111 def notinstalled? ! (@attr & RPM::C::FileState[:notinstalled]).zero? end |
#readme? ⇒ Boolean
Returns True if the file is a README.
93 94 95 |
# File 'lib/rpm/file.rb', line 93 def readme? ! (@attr & RPM::C::FileAttrs[:readme]).zero? end |
#replaced? ⇒ Boolean
Returns True if the file is replaced during installation.
106 107 108 |
# File 'lib/rpm/file.rb', line 106 def replaced? ! (@attr & RPM::C::FileState[:replaced]).zero? end |
#symlink? ⇒ Boolean
Returns True if the file is a symbolic link.
31 32 33 |
# File 'lib/rpm/file.rb', line 31 def symlink? ! @link_to.nil? end |