class RPM::Package

Overview

RPM Package Header data container

Defined in:

rpm/dependency.cr
rpm/package.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.create(name : String, version : Version) #

Creates a new package header with given name and version


[View source]
def self.open(filename) #

Open existing RPM Package file


[View source]
def self.open(filename, *, transaction : Transaction) #

Open existing RPM package file, using existing transaction


[View source]

Instance Method Detail

def [](tag) #

Get the value of given Tag directly.

Raises KeyError if given Tag is not found.


[View source]
def []?(tag) #

Get the value of given Tag directly.

If given Tag is not found, returns nil.


[View source]
def changelogs #

Get the list of Changelogs.


[View source]
def conflicts #

Get the list of "Conflict" dependencies.


[View source]
def file_paths : Array(String) #

Get the list of file paths.

Handy function for getting file paths. Since RPM stores basename and dirname separately, this method concatenate them to represents list of fullpaths.


[View source]
def files : Array(RPM::File) #

Get the list of files with extra metadata.


[View source]
def finalize #

Cleanup the handle to package header.

The package header does not seem to depend to the external resources (fd for the file or DB). So calling this method is not mandated.


[View source]
def get_tagdata(tag : Tag | TagValue, *, flags : HeaderGetFlags = HeaderGetFlags::MINMEM) #

Get TagData for given Tag.

Raises KeyError if the given tag is not found.


[View source]
def get_tagdata(tag : DbiTag, **opts) #

Get TagData for given Tag.

Raises TypeCastError if the given tag is not valid for Tag. Raises KeyError if the given tag is not found.


[View source]
def get_tagdata?(tag : Tag | TagValue, *, flags : HeaderGetFlags = HeaderGetFlags::MINMEM) #

Get TagData for given Tag

Returns nil if the given tag is not found.


[View source]
def get_tagdata?(tag : DbiTag, **opts) #

Get TagData for given Tag

Returns nil if the given tag is not found, or not valid tag.


[View source]
def instance #

Returns header instance

If this instance is from rpmdb, returns the rpmdb record number. Otherwise returns 0.


[View source]
def name #

Returns the name of package.

Shorthand for calling #[] with Tag::Name.


[View source]
def obsoletes #

Get the list of "Obsolete" dependencies.


[View source]
def provides #

Get the list of "Provide" dependencies.


[View source]
def requires #

Get the list of "Require" dependencies.


[View source]
def signature #

Returns the signature string

Returns the signature string with hexadecimal charactors. Returns the string (none) if not set.

If you want a binary data, you may use #with_tagdata(Tag::SigMD5) and TagData#bytes. But it just converts back to binary from this hexadecimal character representation.


[View source]
def sprintf(fmt) #

Format a string with package data

The format is same to the --queryformat argument in rpm -q: for example, %{name} will be replaced with the name of the package and %{version} will be replaced with the version of the package.


[View source]
def to_unsafe : RPM::LibRPM::Header #

Returns pointer to header to deal with librpm C API directly.


[View source]
def with_tagdata(*tags, **opts, &) #

Get TagData(s) for given Tag(s), yield them and then cleanup them.

Returns the result of given block.

Raises KeyError if one of tags is not found. In this case, the block will not be yielded.


[View source]
def with_tagdata?(*tags, **opts, &) #

Get TagData(s) for given Tag(s), yield them and then cleanup them.

Returns the result of given block.

If some of tags are not found, this method pass nil for them.


[View source]