Add support and docs for entropy_splitdebug_mask
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Added support for `entropy_splitdebug`
|
- Added support for `entropy_splitdebug` and `entropy_splitdebug_mask`
|
||||||
|
|
||||||
## 2016-10-10 Release 0.0.2
|
## 2016-10-10 Release 0.0.2
|
||||||
|
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -183,6 +183,24 @@ entropy_splitdebug { 'kernel':
|
|||||||
The same caveats about managint the splitdebug file apply as with the
|
The same caveats about managint the splitdebug file apply as with the
|
||||||
`entropy_mask` type above.
|
`entropy_mask` type above.
|
||||||
|
|
||||||
|
### Enabling splitdebug masks for packages
|
||||||
|
|
||||||
|
This type inverts the `entropy_splitdebug` behaviour, and prevents splitdebug
|
||||||
|
from being installed for matching packages even when otherwise enabled by an
|
||||||
|
`entropy_splitdebug` entry. Masks take precedence, and anything matched by an
|
||||||
|
`entropy_splitdebug_mask` entry will never have debug information installed.
|
||||||
|
All the same parameters are supported as with `entropy_mask`.
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
entropy_splitdebug_mask { 'kernel-4.8':
|
||||||
|
package => 'sys-kernel/linux-sabayon',
|
||||||
|
slot => '4.8',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The same caveats about managint the splitdebug file apply as with the
|
||||||
|
`entropy_mask` type above.
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
### Classes
|
### Classes
|
||||||
@@ -195,6 +213,7 @@ The same caveats about managint the splitdebug file apply as with the
|
|||||||
* `entropy_mask`: Manages entropy package masks
|
* `entropy_mask`: Manages entropy package masks
|
||||||
* `entropy_unmask`: Manages entropy package unmasks
|
* `entropy_unmask`: Manages entropy package unmasks
|
||||||
* `entropy_splitdebug` Manages entropy package debug information
|
* `entropy_splitdebug` Manages entropy package debug information
|
||||||
|
* `entropy_splitdebug_mask` Manages entropy package debug information masks
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
|||||||
47
lib/puppet/provider/entropy_splitdebug_mask/parsed.rb
Normal file
47
lib/puppet/provider/entropy_splitdebug_mask/parsed.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
require 'puppet/provider/parsedfile'
|
||||||
|
file = "/etc/entropy/packages/package.splitdebug.mask"
|
||||||
|
|
||||||
|
Puppet::Type.type(:entropy_splitdebug).provide(:parsed,
|
||||||
|
:parent => Puppet::Provider::ParsedFile,
|
||||||
|
:default_target => file,
|
||||||
|
:filetype => :flat
|
||||||
|
) do
|
||||||
|
|
||||||
|
desc "File splitdebug mask provider for entropy packages"
|
||||||
|
|
||||||
|
defaultfor :operatingsystem => :sabayon
|
||||||
|
|
||||||
|
text_line :blank,
|
||||||
|
:match => /^\s*$/
|
||||||
|
|
||||||
|
text_line :comment,
|
||||||
|
:match => /^\s*#/
|
||||||
|
|
||||||
|
text_line :unmanaged,
|
||||||
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::(\w+))?(?:\[([^\]]*)\])?(?:#(\w+))?(?:::(\w+))?\s*$}
|
||||||
|
|
||||||
|
record_line :parsed,
|
||||||
|
:fields => %w{operator package version slot use tag repo name},
|
||||||
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::(\w+))?(?:\[([^\]]*)\])?(?:#(\w+))?(?:::(\w+))?\s+# Puppet Name: (.*)\s*$},
|
||||||
|
:block_eval => :instance do
|
||||||
|
|
||||||
|
def to_line(record)
|
||||||
|
line = ""
|
||||||
|
line += record[:operator] if record[:operator]
|
||||||
|
line += record[:package]
|
||||||
|
line += "-" + record[:version] if record[:version]
|
||||||
|
line += ":" + record[:slot] if record[:slot]
|
||||||
|
line += "[" + record[:use] + "]" if record[:use]
|
||||||
|
line += "#" + record[:tag] if record[:tag]
|
||||||
|
line += "::" + record[:repo] if record[:repo]
|
||||||
|
line += " # Puppet Name: " + record[:name]
|
||||||
|
|
||||||
|
line
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# vim: set ts=2 shiftwidth=2 expandtab :
|
||||||
|
|
||||||
64
lib/puppet/type/entropy_splitdebug_mask.rb
Normal file
64
lib/puppet/type/entropy_splitdebug_mask.rb
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
Puppet::Type.newtype(:entropy_splitdebug_mask) do
|
||||||
|
@desc = "Manages splitdebug masks for packages in Entropy"
|
||||||
|
|
||||||
|
ensurable
|
||||||
|
|
||||||
|
newparam(:name) do
|
||||||
|
desc "Unique name for this splitdebug mask specification"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:operator) do
|
||||||
|
desc "Operator that applies to the version. If not specified, defaults to '=' if a version is provided, not used if no version is provided"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:package) do
|
||||||
|
desc "Name of the package with splitdebug mask"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:version) do
|
||||||
|
desc "Version of the package"
|
||||||
|
|
||||||
|
validate do |value|
|
||||||
|
raise(ArgumentError, "") if value !~ /^(\d*(?:\.\d+[a-zA-Z]*)*)(?:_((?:alpha|beta|pre|rc)\d*))?(-r\d+)?$/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:slot) do
|
||||||
|
desc "Slot the package is in"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:use) do
|
||||||
|
desc "Useflags for the package"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:tag) do
|
||||||
|
desc "Tag for the package"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:repo) do
|
||||||
|
desc "Repo for the package"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:target) do
|
||||||
|
desc "Location of the package.splitdebug.mask file being managed"
|
||||||
|
|
||||||
|
defaultto {
|
||||||
|
if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
|
||||||
|
@resource.class.defaultprovider.default_target
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
validate do
|
||||||
|
raise(ArgumentError, "Version is required when an operator is specified") if self[:version].nil? && !self[:operator].nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
autobefore(:package) do
|
||||||
|
[self[:package]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 expandtab:
|
||||||
|
|
||||||
Reference in New Issue
Block a user