Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c94c710db | |||
| 6e5f65befc | |||
| 5a658c5d7e | |||
| 1072760d2b | |||
| c2ee8a6ca5 | |||
|
|
0f8bfcdc01 | ||
| 614e836827 | |||
| deda75dc92 | |||
| 8ca58a6323 | |||
| 9928a31e06 | |||
| 57c7b3fbce |
@@ -1,3 +1,10 @@
|
|||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- Added support for additional types:
|
||||||
|
- `entropy_splitdebug`
|
||||||
|
- `entropy_splitdebug_mask`
|
||||||
|
- `entropy_keywords`
|
||||||
|
|
||||||
## 2016-10-10 Release 0.0.2
|
## 2016-10-10 Release 0.0.2
|
||||||
|
|
||||||
- First forge release
|
- First forge release
|
||||||
|
|||||||
119
README.md
119
README.md
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This module extends puppet with support for the Sabayon Linux disttribution.
|
This module extends puppet with support for the Sabayon Linux distribution.
|
||||||
|
|
||||||
It adds support for:
|
It adds support for:
|
||||||
* The Entropy package manager
|
* The Entropy package manager
|
||||||
@@ -25,13 +25,13 @@ It adds support for:
|
|||||||
|
|
||||||
### What the sabayon module affects
|
### What the sabayon module affects
|
||||||
|
|
||||||
* `operatingsystem` fact
|
* `operatingsystem` fact:
|
||||||
This module overrides the operatingsystem fact to `Sabayon` on Sabayon
|
This module overrides the operatingsystem fact to `Sabayon` on Sabayon
|
||||||
systems.
|
systems.
|
||||||
* `Service` provider
|
* `Service` provider:
|
||||||
This module overrides the default provider for `service` resources to
|
This module overrides the default provider for `service` resources to
|
||||||
force use of `systemd`
|
force use of `systemd`
|
||||||
* `Package` provider
|
* `Package` provider:
|
||||||
This module overrides the default provider for `package` resources to
|
This module overrides the default provider for `package` resources to
|
||||||
force use of `entropy`
|
force use of `entropy`
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ setup, as long as the required packages are already installed. To let this
|
|||||||
module take care of installing the required packages, simply include the
|
module take care of installing the required packages, simply include the
|
||||||
`sabayon` class.
|
`sabayon` class.
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
class { 'sabayon': }
|
class { 'sabayon': }
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ so no special configuration is required.
|
|||||||
|
|
||||||
The provider supports package names in both the fully-qualified format, e.g.
|
The provider supports package names in both the fully-qualified format, e.g.
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
package { 'net-misc/openssh':
|
package { 'net-misc/openssh':
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ package { 'net-misc/openssh':
|
|||||||
|
|
||||||
Or the more verbose format:
|
Or the more verbose format:
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
package { 'ssh-server':
|
package { 'ssh-server':
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
category => 'net-misc',
|
category => 'net-misc',
|
||||||
@@ -78,7 +78,7 @@ not install 'mysql' since there's no way to disambiguate between
|
|||||||
|
|
||||||
### Managing enman repositories
|
### Managing enman repositories
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
enman_repo { 'community':
|
enman_repo { 'community':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
}
|
}
|
||||||
@@ -90,16 +90,18 @@ Entropy is very flexible in how to specify which packages can be masked,
|
|||||||
and supports some or all of the following in the atom specification.
|
and supports some or all of the following in the atom specification.
|
||||||
|
|
||||||
All of these parameters are optional, but at least one must be specified
|
All of these parameters are optional, but at least one must be specified
|
||||||
* `package` (either fully qualified or unqualified package name)
|
|
||||||
* `operator` (`<`, `<=`, `=`, `>=`, `>`. applied to version)
|
* `package` (either fully qualified or unqualified package name)
|
||||||
* `version`
|
* `operator` (`<`, `<=`, `=`, `>=`, `>`. applied to version)
|
||||||
* `slot`
|
* `version`
|
||||||
* `use`
|
* `slot`
|
||||||
* `tag`
|
* `use`
|
||||||
* `repo`
|
* `tag`
|
||||||
|
* `repo`
|
||||||
|
|
||||||
The `entropy_mask` type also takes the following optional parameters:
|
The `entropy_mask` type also takes the following optional parameters:
|
||||||
* `target` (The path to the mask file, defaults to
|
|
||||||
|
* `target` (The path to the mask file, defaults to
|
||||||
`/etc/entropy/packages/package.mask`)
|
`/etc/entropy/packages/package.mask`)
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
@@ -107,7 +109,7 @@ The `entropy_mask` type also takes the following optional parameters:
|
|||||||
To mask all packages within the `community` repository by default
|
To mask all packages within the `community` repository by default
|
||||||
and later unmask specific packages, you could use something like:
|
and later unmask specific packages, you could use something like:
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
entropy_mask { 'mask-community-by-default':
|
entropy_mask { 'mask-community-by-default':
|
||||||
repo => 'community',
|
repo => 'community',
|
||||||
}
|
}
|
||||||
@@ -115,9 +117,9 @@ entropy_mask { 'mask-community-by-default':
|
|||||||
|
|
||||||
Alternatively, you could mask newer versions of a package
|
Alternatively, you could mask newer versions of a package
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
entropy_mask { 'mask-postgresql-9.5+':
|
entropy_mask { 'mask-postgresql-9.5+':
|
||||||
package => 'app-shells/bash',
|
package => 'app-shells/bash',
|
||||||
operator => '>=',
|
operator => '>=',
|
||||||
version => '9.5',
|
version => '9.5',
|
||||||
}
|
}
|
||||||
@@ -127,7 +129,7 @@ Or mask a package with an undesirable set of use flags, e.g.
|
|||||||
to ensure any installed version of openssh supports ldap, mask
|
to ensure any installed version of openssh supports ldap, mask
|
||||||
all versions of openssh which don't include ldap support with:
|
all versions of openssh which don't include ldap support with:
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
entropy_mask { 'openssh-without-ldap-support':
|
entropy_mask { 'openssh-without-ldap-support':
|
||||||
package => 'net-misc/openssh',
|
package => 'net-misc/openssh',
|
||||||
use => '-ldap',
|
use => '-ldap',
|
||||||
@@ -153,7 +155,7 @@ in the example above you have masked everything in the `community` repository
|
|||||||
you could enable installing a particular package from that repository again
|
you could enable installing a particular package from that repository again
|
||||||
using:
|
using:
|
||||||
|
|
||||||
```
|
```puppet
|
||||||
entropy_unmask { 'sublime':
|
entropy_unmask { 'sublime':
|
||||||
package => 'app-editors/sublime-text',
|
package => 'app-editors/sublime-text',
|
||||||
}
|
}
|
||||||
@@ -162,17 +164,84 @@ entropy_unmask { 'sublime':
|
|||||||
The same caveats about managing the unmask file apply as with `entropy_mask`
|
The same caveats about managing the unmask file apply as with `entropy_mask`
|
||||||
above.
|
above.
|
||||||
|
|
||||||
|
### Enabling splitdebug for packages
|
||||||
|
|
||||||
|
Entropy splits debug information for packages into separate objects which are
|
||||||
|
installed at the same time as the package only if splitdebug is enabled
|
||||||
|
globally, or for specific packages listed in the `package.splitdebug` file.
|
||||||
|
|
||||||
|
This type behaves similarly to masks/unmasks and manages entries in the
|
||||||
|
splitdebug file to define packages for which debug information should be
|
||||||
|
installed. All the same parameters are supported as with `entropy_mask`.
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
entropy_splitdebug { 'kernel':
|
||||||
|
package => 'sys-kernel/linux-sabayon',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The same caveats about managint the splitdebug file apply as with the
|
||||||
|
`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.
|
||||||
|
|
||||||
|
### Managing package keywords
|
||||||
|
|
||||||
|
The `entropy_keywords` type allows managing entries in the `package.keywords`
|
||||||
|
file, which can set missing keywords on packages. A typical example is when
|
||||||
|
installing a `9999` version package straight from source control which hasn't
|
||||||
|
been marked as supported on any platform.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
* `keyword`: The package keyword to apply. Defaults to the OS architecutre,
|
||||||
|
e.g. `amd64` if not specified, but other typical values might be `~amd64`,
|
||||||
|
`-*` or `**`.
|
||||||
|
* `package`: Name of the package, maybe qualified or unqualified.
|
||||||
|
* `operator`: (`<`, `<=`, `=`, `>=`, `>`, applied to version)
|
||||||
|
* `version`: Restrict the keyword to a specifc version or range of versions
|
||||||
|
* `repo`: Restrict the keyword to packages from a specific repo
|
||||||
|
|
||||||
|
At least one of `package` or `repo` must be specified.
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
entropy_keywords { 'sublime-live':
|
||||||
|
package => 'app-text/sublime-text',
|
||||||
|
version => '9999',
|
||||||
|
keyword => '**',
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more info on package keywords, see https://wiki.gentoo.org/wiki/KEYWORDS
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
### Classes
|
### Classes
|
||||||
|
|
||||||
* `::sabayon` class to install required packages to support included types
|
* `::sabayon` class to install required packages to support included types
|
||||||
|
|
||||||
### Types
|
### Types
|
||||||
|
|
||||||
* `enman_repo` Manages SCR repositories using enman
|
* `enman_repo`: Manages SCR repositories using enman
|
||||||
* `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_mask` Manages entropy package debug information masks
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
|
|||||||
44
lib/puppet/provider/entropy_keywords/parsed.rb
Normal file
44
lib/puppet/provider/entropy_keywords/parsed.rb
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
require 'puppet/provider/parsedfile'
|
||||||
|
file = "/etc/entropy/packages/package.keywords"
|
||||||
|
|
||||||
|
Puppet::Type.type(:entropy_keywords).provide(:parsed,
|
||||||
|
:parent => Puppet::Provider::ParsedFile,
|
||||||
|
:default_target => file,
|
||||||
|
:filetype => :flat
|
||||||
|
) do
|
||||||
|
|
||||||
|
desc "Override keywords for entropy packages"
|
||||||
|
|
||||||
|
defaultfor :operatingsystem => :sabayon
|
||||||
|
|
||||||
|
text_line :blank,
|
||||||
|
:match => /^\s*$/
|
||||||
|
|
||||||
|
text_line :comment,
|
||||||
|
:match => /^\s*#/
|
||||||
|
|
||||||
|
text_line :unmanaged,
|
||||||
|
:match => %r{^(\S+)\s+([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?:\s+repo=([a-zA-Z0-9\._-]+))?\s*$}
|
||||||
|
|
||||||
|
record_line :parsed,
|
||||||
|
:fields => %w{keyword operator package version repo name},
|
||||||
|
:match => %r{^(\S+)\s+([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?:\s+repo=([a-zA-Z0-9\._-]+))?\s+## Puppet Name: (.*)\s*$},
|
||||||
|
:block_eval => :instance do
|
||||||
|
|
||||||
|
def to_line(record)
|
||||||
|
line = record[:keyword] + " "
|
||||||
|
line += record[:operator] if record[:operator]
|
||||||
|
line += record[:package] if record[:package]
|
||||||
|
line += "-" + record[:version] if record[:version]
|
||||||
|
line += " repo=" + record[:repo] if record[:repo]
|
||||||
|
line += " ## Puppet Name: " + record[:name]
|
||||||
|
|
||||||
|
line
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# vim: set ts=2 shiftwidth=2 expandtab :
|
||||||
|
|
||||||
@@ -18,11 +18,11 @@ Puppet::Type.type(:entropy_mask).provide(:parsed,
|
|||||||
:match => /^\s*#/
|
:match => /^\s*#/
|
||||||
|
|
||||||
text_line :unmanaged,
|
text_line :unmanaged,
|
||||||
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::(\w+))?(?:\[([^\]]*)\])?(?:#(\w+))?(?:::(\w+))?\s*$}
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9\._-]+))?\s*$}
|
||||||
|
|
||||||
record_line :parsed,
|
record_line :parsed,
|
||||||
:fields => %w{operator package version slot use tag repo name},
|
: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*$},
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9\._-]+))?\s+#+ Puppet Name: (.*)\s*$},
|
||||||
:block_eval => :instance do
|
:block_eval => :instance do
|
||||||
|
|
||||||
def to_line(record)
|
def to_line(record)
|
||||||
@@ -34,7 +34,7 @@ Puppet::Type.type(:entropy_mask).provide(:parsed,
|
|||||||
line += "[" + record[:use] + "]" if record[:use]
|
line += "[" + record[:use] + "]" if record[:use]
|
||||||
line += "#" + record[:tag] if record[:tag]
|
line += "#" + record[:tag] if record[:tag]
|
||||||
line += "::" + record[:repo] if record[:repo]
|
line += "::" + record[:repo] if record[:repo]
|
||||||
line += " # Puppet Name: " + record[:name]
|
line += " ## Puppet Name: " + record[:name]
|
||||||
|
|
||||||
line
|
line
|
||||||
end
|
end
|
||||||
|
|||||||
47
lib/puppet/provider/entropy_splitdebug/parsed.rb
Normal file
47
lib/puppet/provider/entropy_splitdebug/parsed.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
require 'puppet/provider/parsedfile'
|
||||||
|
file = "/etc/entropy/packages/package.splitdebug"
|
||||||
|
|
||||||
|
Puppet::Type.type(:entropy_splitdebug).provide(:parsed,
|
||||||
|
:parent => Puppet::Provider::ParsedFile,
|
||||||
|
:default_target => file,
|
||||||
|
:filetype => :flat
|
||||||
|
) do
|
||||||
|
|
||||||
|
desc "File splitdebug 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+)?))?(?::([a-zA-Z0-9\._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9\._-]+))?(?:::([a-zA-Z0-9\._-]+))?\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+)?))?(?::([a-zA-Z0-9\._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9\._-]+))?(?:::([a-zA-Z0-9\._-]+))?\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 :
|
||||||
|
|
||||||
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+)?))?(?::([a-zA-Z0-9\._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9._-]+))?\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+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9._-]+))?\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 :
|
||||||
|
|
||||||
@@ -18,11 +18,11 @@ Puppet::Type.type(:entropy_unmask).provide(:parsed,
|
|||||||
:match => /^\s*#/
|
:match => /^\s*#/
|
||||||
|
|
||||||
text_line :unmanaged,
|
text_line :unmanaged,
|
||||||
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::(\w+))?(?:\[([^\]]*)\])?(?:#(\w+))?(?:::(\w+))?\s*$}
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9._-]+))?\s*$}
|
||||||
|
|
||||||
record_line :parsed,
|
record_line :parsed,
|
||||||
:fields => %w{operator package version slot use tag repo name},
|
: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*$},
|
:match => %r{^([<>]?=)?([a-zA-Z+\/-]*)(?:-(\d+(?:\.\d+)*[a-z]*(?:_(?:alpha|beta|pre|p|rc)\d*)?(?:-r\d+)?))?(?::([a-zA-Z0-9._-]+))?(?:\[([^\]]*)\])?(?:#([a-zA-Z0-9._-]+))?(?:::([a-zA-Z0-9._-]+))?\s+#+ Puppet Name: (.*)\s*$},
|
||||||
:block_eval => :instance do
|
:block_eval => :instance do
|
||||||
|
|
||||||
def to_line(record)
|
def to_line(record)
|
||||||
@@ -34,7 +34,7 @@ Puppet::Type.type(:entropy_unmask).provide(:parsed,
|
|||||||
line += "[" + record[:use] + "]" if record[:use]
|
line += "[" + record[:use] + "]" if record[:use]
|
||||||
line += "#" + record[:tag] if record[:tag]
|
line += "#" + record[:tag] if record[:tag]
|
||||||
line += "::" + record[:repo] if record[:repo]
|
line += "::" + record[:repo] if record[:repo]
|
||||||
line += " # Puppet Name: " + record[:name]
|
line += " ## Puppet Name: " + record[:name]
|
||||||
|
|
||||||
line
|
line
|
||||||
end
|
end
|
||||||
|
|||||||
69
lib/puppet/type/entropy_keywords.rb
Normal file
69
lib/puppet/type/entropy_keywords.rb
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
Puppet::Type.newtype(:entropy_keywords) do
|
||||||
|
@desc = "Override keywords for Entropy packages"
|
||||||
|
|
||||||
|
ensurable
|
||||||
|
|
||||||
|
newparam(:name) do
|
||||||
|
desc "Unique name for this keyword entry"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:keyword) do
|
||||||
|
desc "Keyword to be applied to matching packages"
|
||||||
|
|
||||||
|
defaultto {
|
||||||
|
os = Facter.value(:os)
|
||||||
|
if os.key?('architecture')
|
||||||
|
os['architecture']
|
||||||
|
else
|
||||||
|
'**'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
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 being keyworded"
|
||||||
|
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(:repo) do
|
||||||
|
desc "Repo for the package"
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:target) do
|
||||||
|
desc "Location of the package.keywords 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, "At least one of package or repo is required") if self[:package].nil? && self[:repo].nil?
|
||||||
|
|
||||||
|
raise(ArgumentError, "Package is required when a version is specified") if self[:package].nil? && !self[:version].nil?
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
@@ -52,6 +52,10 @@ Puppet::Type.newtype(:entropy_mask) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
validate do
|
validate do
|
||||||
|
raise(ArgumentError, "At least one of package, tag or repo is required") if self[:package].nil? && self[:tag].nil? && self[:repo].nil?
|
||||||
|
|
||||||
|
raise(ArgumentError, "Package is required when a version is specified") if self[:package].nil? && !self[:version].nil?
|
||||||
|
|
||||||
raise(ArgumentError, "Version is required when an operator is specified") if self[:version].nil? && !self[:operator].nil?
|
raise(ArgumentError, "Version is required when an operator is specified") if self[:version].nil? && !self[:operator].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
64
lib/puppet/type/entropy_splitdebug.rb
Normal file
64
lib/puppet/type/entropy_splitdebug.rb
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
Puppet::Type.newtype(:entropy_splitdebug) do
|
||||||
|
@desc = "Manages splitdebug for packages in Entropy"
|
||||||
|
|
||||||
|
ensurable
|
||||||
|
|
||||||
|
newparam(:name) do
|
||||||
|
desc "Unique name for this splitdebug 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"
|
||||||
|
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 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:
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
81
spec/types/entropy_mask_spec.rb
Normal file
81
spec/types/entropy_mask_spec.rb
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Puppet::Type.type(:entropy_mask) do
|
||||||
|
before do
|
||||||
|
@provider = stub 'provider'
|
||||||
|
@provider.stubs(:name).returns(:parsed)
|
||||||
|
@provider.stubs(:ancestors).returns([Puppet::Provider::ParsedFile])
|
||||||
|
@provider.stubs(:default_target).returns("defaulttarget")
|
||||||
|
described_class.stubs(:defaultprovider).returns(@provider)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be an instance of Puppet::Type::Entropy_mask" do
|
||||||
|
expect(described_class.new(:name => "test", :package => "app-admin/dummy")).to be_an_instance_of Puppet::Type::Entropy_mask
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when validating attributes" do
|
||||||
|
params = [:name]
|
||||||
|
properties = [:package, :operator, :version, :slot, :use, :tag, :repo, :target]
|
||||||
|
|
||||||
|
params.each do |param|
|
||||||
|
it "should have the #{param} param" do
|
||||||
|
expect(described_class.attrtype(param)).to eq :param
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
properties.each do |property|
|
||||||
|
it "should have the #{property} property" do
|
||||||
|
expect(described_class.attrtype(property)).to eq :property
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should have name as the namevar" do
|
||||||
|
expect(described_class.key_attributes).to eq [:name]
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when validating the target property" do
|
||||||
|
it "should default to the provider's default target" do
|
||||||
|
expect(described_class.new(:name => "test", :package => "app-admin/dummy").should(:target)).to eq "defaulttarget"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when validating required properties" do
|
||||||
|
it "should raise an error when no required attributes are passed" do
|
||||||
|
expect {
|
||||||
|
described_class.new(:name => "test")
|
||||||
|
}.to raise_error(Puppet::Error, /At least one of (.*) is required/)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should raise an error when a version is passed with no package" do
|
||||||
|
expect {
|
||||||
|
described_class.new(:name => "test", :repo => "test", :version => "1.2.3")
|
||||||
|
}.to raise_error(Puppet::Error, /Package is required/)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should raise an error when an operator is passed with no version" do
|
||||||
|
expect {
|
||||||
|
described_class.new(:name => "test", :package => "app-admin/dummy", :operator => "<=")
|
||||||
|
}.to raise_error(Puppet::Error, /Version is required/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when the catalog includes a matching package" do
|
||||||
|
it "should have an autobefore relationship" do
|
||||||
|
mask = described_class.new(:name => "test", :package => "app-admin/dummy")
|
||||||
|
package = Puppet::Type.type(:package).new(:title => 'app-admin/dummy')
|
||||||
|
|
||||||
|
catalog = Puppet::Resource::Catalog.new
|
||||||
|
catalog.add_resource package
|
||||||
|
catalog.add_resource mask
|
||||||
|
|
||||||
|
befores = mask.autobefore
|
||||||
|
expect(befores.size).to eq 1
|
||||||
|
expect(befores[0].source).to eq mask
|
||||||
|
expect(befores[0].target).to eq package
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# vim: set ts=2 sw=2 expandtab:
|
||||||
Reference in New Issue
Block a user