Class: Omnizip::Formats::Rpm::Entry
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rpm::Entry
- 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.
- #entry_directory? ⇒ Boolean
- #entry_mtime ⇒ Object
- #entry_name ⇒ Object
- #entry_size ⇒ Object
-
#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).
38 39 40 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 38 def digest @digest end |
#flags ⇒ Integer
Returns File flags.
47 48 49 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 47 def flags @flags end |
#gid ⇒ Integer
Returns Group ID.
32 33 34 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 32 def gid @gid end |
#group ⇒ String
Returns Group name.
44 45 46 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 44 def group @group end |
#link_to ⇒ String
Returns Symlink target (if symlink).
50 51 52 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 50 def link_to @link_to end |
#mode ⇒ Integer
Returns File mode.
26 27 28 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 26 def mode @mode end |
#mtime ⇒ Time
Returns Modification time.
35 36 37 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 35 def mtime @mtime end |
#path ⇒ String
Returns File path.
20 21 22 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 20 def path @path end |
#size ⇒ Integer
Returns File size.
23 24 25 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 23 def size @size end |
#uid ⇒ Integer
Returns User ID.
29 30 31 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 29 def uid @uid end |
#user ⇒ String
Returns User name.
41 42 43 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 41 def user @user end |
Instance Method Details
#config? ⇒ Boolean
Check if file is a config file
76 77 78 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 76 def config? @flags.anybits?(FILE_CONFIG) end |
#directory? ⇒ Boolean
Check if entry is a directory
55 56 57 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 55 def directory? (@mode & 0o170_000) == 0o040_000 end |
#doc? ⇒ Boolean
Check if file is documentation
83 84 85 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 83 def doc? @flags.anybits?(FILE_DOC) end |
#entry_directory? ⇒ Boolean
15 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 15 def entry_directory? = mode && ::File.directory?(mode) |
#entry_mtime ⇒ Object
17 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 17 def entry_mtime = mtime |
#entry_name ⇒ Object
14 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 14 def entry_name = path |
#entry_size ⇒ Object
16 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 16 def entry_size = size |
#file? ⇒ Boolean
Check if entry is a regular file
62 63 64 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 62 def file? (@mode & 0o170_000) == 0o100_000 end |
#permissions ⇒ String
Get permission string
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 90 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
69 70 71 |
# File 'lib/omnizip/formats/rpm/entry.rb', line 69 def symlink? (@mode & 0o170_000) == 0o120_000 end |