Class: Puppet::Util::PTomulik::Package::Ports::PkgRecord
- Inherits:
-
Record
- Object
- Record
- Puppet::Util::PTomulik::Package::Ports::PkgRecord
- Defined in:
- lib/puppet/util/ptomulik/package/ports/pkg_record.rb
Overview
Represents single data record returned by Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages.
This is a kind of hash to hold results obtained from ‘portversion` command.
Class Method Summary collapse
-
.default_fields ⇒ Object
Default set of fields requested from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages.
-
.deps_for_amend ⇒ Object
If we want #amend! to add extra fields to PkgRecord we must first ensure that we request certain fields from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages.
-
.std_fields ⇒ Object
These fields may be obtained directly from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages without doing #amend!.
Instance Method Summary collapse
-
#amend!(fields) ⇒ Object
Add extra fields to an already existing PkgRecord.
Class Method Details
.default_fields ⇒ Object
Default set of fields requested from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages. See also Record.default_fields.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/puppet/util/ptomulik/package/ports/pkg_record.rb', line 24 def self.default_fields [ :pkgname, :portname, :portorigin, :pkgversion, :portstatus, :portinfo, :options, :options_file, :options_files ] end |
.deps_for_amend ⇒ Object
If we want #amend! to add extra fields to PkgRecord we must first ensure that we request certain fields from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages. For example, to determine ‘:pkgversion` field, one needs to have the `:pkgname` field in the `portversion`s search result.
The following hash describes these dependencies. See also Record.deps_for_amend.
See [portversion(1)](www.freebsd.org/cgi/man.cgi?query=portversion&manpath=ports&sektion=1) for more information about ‘portversion`.
48 49 50 51 52 53 54 55 |
# File 'lib/puppet/util/ptomulik/package/ports/pkg_record.rb', line 48 def self.deps_for_amend { :options => [:portname, :portorigin], :options_file => [:portname, :portorigin], :options_files => [:portname, :portorigin], :pkgversion => [:pkgname], } end |
.std_fields ⇒ Object
These fields may be obtained directly from Puppet::Util::PTomulik::Package::Ports::PkgSearch#search_packages without doing #amend!. See also Record.std_fields.
13 14 15 16 17 18 19 20 |
# File 'lib/puppet/util/ptomulik/package/ports/pkg_record.rb', line 13 def self.std_fields [ :pkgname, :portorigin, :portstatus, :portinfo ] end |
Instance Method Details
#amend!(fields) ⇒ Object
Add extra fields to an already existing PkgRecord.
Most of the extra fields that can be added do not introduce any new information in fact - they’re just computed from already existing fields. The exception is the ‘:options` field. Options are loaded from existing port options files (`/var/db/ports/*/optionsPuppet::Util::PTomulik::Package::Ports::PkgRecord.,,.local).
67 68 69 70 71 72 |
# File 'lib/puppet/util/ptomulik/package/ports/pkg_record.rb', line 67 def amend!(fields) if self[:pkgname] self[:portname], self[:pkgversion] = self.class.split_pkgname(self[:pkgname]) end super end |