Class: Omnizip::Formats::Rpm::Entry
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rpm::Entry
- Includes:
- Constants
- Defined in:
- lib/omnizip/formats/rpm/entry.rb
Overview
RPM file entry
Represents a single file within an RPM package. File information is assembled from multiple header tags.
Constant Summary
Constants included from Constants
Constants::FILE_CONFIG, Constants::FILE_DOC, Constants::FILE_LICENSE, Constants::FILE_README, Constants::FLAG_EQUAL, Constants::FLAG_GREATER, Constants::FLAG_LESS, Constants::HEADER_HEADER_SIZE, Constants::HEADER_MAGIC, Constants::HEADER_SIGNED_TYPE, Constants::LEAD_MAGIC, Constants::LEAD_SIZE, Constants::PACKAGE_BINARY, Constants::PACKAGE_SOURCE, Constants::TAG_ENTRY_SIZE, Constants::TYPE_BINARY, Constants::TYPE_CHAR, Constants::TYPE_I18NSTRING, Constants::TYPE_INT16, Constants::TYPE_INT32, Constants::TYPE_INT64, Constants::TYPE_INT8, Constants::TYPE_NULL, Constants::TYPE_STRING, Constants::TYPE_STRING_ARRAY
Instance Attribute Summary collapse
-
#digest ⇒ String
File digest (MD5/SHA).
-
#flags ⇒ Integer
File flags.
-
#gid ⇒ Integer
Group ID.
-
#group ⇒ String
Group name.
-
#link_to ⇒ String
Symlink target (if symlink).
-
#mode ⇒ Integer
File mode.
-
#mtime ⇒ Time
Modification time.
-
#path ⇒ String
File path.
-
#size ⇒ Integer
File size.
-
#uid ⇒ Integer
User ID.
-
#user ⇒ String
User name.
Instance Method Summary collapse
-
#config? ⇒ Boolean
Check if file is a config file.
-
#directory? ⇒ Boolean
Check if entry is a directory.
-
#doc? ⇒ Boolean
Check if file is documentation.
-
#file? ⇒ Boolean
Check if entry is a regular file.
-
#permissions ⇒ String
Get permission string.
-
#symlink? ⇒ Boolean
Check if entry is a symbolic link.
Instance Attribute Details
#digest ⇒ String
Returns File digest (MD5/SHA).
32 33 34 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 32 def digest @digest end |
#flags ⇒ Integer
Returns File flags.
41 42 43 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 41 def flags @flags end |
#gid ⇒ Integer
Returns Group ID.
26 27 28 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 26 def gid @gid end |
#group ⇒ String
Returns Group name.
38 39 40 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 38 def group @group end |
#link_to ⇒ String
Returns Symlink target (if symlink).
44 45 46 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 44 def link_to @link_to end |
#mode ⇒ Integer
Returns File mode.
20 21 22 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 20 def mode @mode end |
#mtime ⇒ Time
Returns Modification time.
29 30 31 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 29 def mtime @mtime end |
#path ⇒ String
Returns File path.
14 15 16 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 14 def path @path end |
#size ⇒ Integer
Returns File size.
17 18 19 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 17 def size @size end |
#uid ⇒ Integer
Returns User ID.
23 24 25 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 23 def uid @uid end |
#user ⇒ String
Returns User name.
35 36 37 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 35 def user @user end |
Instance Method Details
#config? ⇒ Boolean
Check if file is a config file
70 71 72 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 70 def config? @flags.anybits?(FILE_CONFIG) end |
#directory? ⇒ Boolean
Check if entry is a directory
49 50 51 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 49 def directory? (@mode & 0o170_000) == 0o040_000 end |
#doc? ⇒ Boolean
Check if file is documentation
77 78 79 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 77 def doc? @flags.anybits?(FILE_DOC) end |
#file? ⇒ Boolean
Check if entry is a regular file
56 57 58 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 56 def file? (@mode & 0o170_000) == 0o100_000 end |
#permissions ⇒ String
Get permission string
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 84 def perms = (@mode & 0o777).to_s(8).rjust(3, "0") type_char = if directory? "d" elsif symlink? "l" else "-" end "#{type_char}#{perms}" end |
#symlink? ⇒ Boolean
Check if entry is a symbolic link
63 64 65 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 63 def symlink? (@mode & 0o170_000) == 0o120_000 end |