Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9115033d04 | |||
| cabc5c19ce | |||
| 7dca7dad51 | |||
| 53bbad2eb1 | |||
| 80644b6813 | |||
| 4020627a15 | |||
| a265caa979 | |||
| 7ce45a207f | |||
| 6d9b130f9d | |||
| f2565cccc1 |
@@ -1,4 +1,11 @@
|
||||
## 2016-10-13 Release 0.1.1
|
||||
## 2016-10-13 Release 0.2.0
|
||||
|
||||
- Add `locale` fact
|
||||
- Remove obsolete `has_entropy` fact
|
||||
- Improve `entropy` package provider to set locale envvar directly
|
||||
and not shell out to a distributed script to set locale.
|
||||
|
||||
## 2016-10-13 Release 0.1.2
|
||||
|
||||
- Improved package regexes for valdiation and parsing
|
||||
(now following the Gentoo EAPI6 PMS document to ensure correctness)
|
||||
|
||||
13
README.md
13
README.md
@@ -243,6 +243,19 @@ For more info on package keywords, see https://wiki.gentoo.org/wiki/KEYWORDS
|
||||
* `entropy_splitdebug` Manages entropy package debug information
|
||||
* `entropy_splitdebug_mask` Manages entropy package debug information masks
|
||||
|
||||
### Facts
|
||||
|
||||
#### `locale`
|
||||
|
||||
Identifies the system-wide default locale, as set by `eselect`.
|
||||
|
||||
This is used internally by the entropy package provider to run `equo` commands
|
||||
using the correct locale.
|
||||
|
||||
#### `operatingsystem`
|
||||
|
||||
Overrides the detection of the operating system on Sabayon systems to `Sabayon`.
|
||||
|
||||
## Limitations
|
||||
|
||||
This module is actively used by the developer against current Sabayon versions.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
Facter.add(:has_entropy) do
|
||||
confine :kernel => :linux
|
||||
setcode do
|
||||
FileTest.exists?("/usr/bin/equo")
|
||||
end
|
||||
end
|
||||
|
||||
7
lib/facter/locale.rb
Normal file
7
lib/facter/locale.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
Facter.add(:locale) do
|
||||
confine :osfamily => :gentoo
|
||||
setcode do
|
||||
Facter::Core::Execution.exec('eselect --colour=no --brief locale show').strip
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'puppet/provider/package'
|
||||
require 'fileutils'
|
||||
|
||||
Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Package do
|
||||
Puppet::Type.type(:package).provide(:entropy, :parent => Puppet::Provider::Package) do
|
||||
desc "Provides packaging support for Sabayon's entropy system."
|
||||
|
||||
has_feature :versionable
|
||||
@@ -9,18 +9,27 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
has_feature :uninstallable
|
||||
has_feature :upgradeable
|
||||
|
||||
commands :equo => "#{File.dirname(__FILE__)}/entropy/equo_locale"
|
||||
has_command(:equo, "equo") do
|
||||
locale = Facter.value(:locale)
|
||||
environment({
|
||||
:LANG => locale,
|
||||
:LC_ALL => locale,
|
||||
:LANGUAHE => locale,
|
||||
})
|
||||
end
|
||||
|
||||
confine :has_entropy => true
|
||||
# Require the locale fact exist
|
||||
confine :false => Facter.value(:locale).nil?
|
||||
confine :osfamily => :Gentoo
|
||||
|
||||
defaultfor :has_entropy => :true, :osfamily => :Gentoo
|
||||
defaultfor :operatingsystem => :Sabayon
|
||||
|
||||
def self.instances
|
||||
result_format = /^(\S+)\/(\S+)-([\.\d]+(?:_?(?:a(?:lpha)?|b(?:eta)?|pre|rc|p)\d*)?(?:-r\d+)?)(?:#(\S+))?$/
|
||||
result_fields = [:category, :name, :ensure]
|
||||
|
||||
begin
|
||||
search_output = equo "query", "list", "installed", "--quiet", "--verbose"
|
||||
search_output = equo("query", "list", "installed", "--quiet", "--verbose").chomp
|
||||
|
||||
packages = []
|
||||
search_output.each_line do |search_result|
|
||||
@@ -32,6 +41,7 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
package[field] = value unless !value or value.empty?
|
||||
end
|
||||
package[:provider] = :entropy
|
||||
|
||||
packages << new(package)
|
||||
end
|
||||
end
|
||||
@@ -70,13 +80,12 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
end
|
||||
|
||||
def query
|
||||
result_format = /^(\S+)\/(\S+)-([\.\d]+(?:_(?:alpha|beta|pre|rc|p)\d+)?(?:-r\d+)?)(?:#(\S+))?$/
|
||||
result_format = /^(\S+)\/(\S+)-([\.\d]+(?:_(?:alpha|beta|pre|rc|p)\d+)?(?:-r\d+)?)(?::[^#]+)?(?:#(\S+))?$/
|
||||
result_fields = [:category, :name, :version_available]
|
||||
|
||||
begin
|
||||
# Look for an installed package from a known repository
|
||||
search_output = equo "match", "--quiet", "--verbose", package_name
|
||||
search_output.chomp
|
||||
search_output = equo("match", "--quiet", "--verbose", package_name).chomp
|
||||
|
||||
search_match = search_output.match(result_format)
|
||||
if search_match
|
||||
@@ -85,8 +94,9 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
package[field] = value unless !value or value.empty?
|
||||
end
|
||||
|
||||
installed_output = equo 'match', '--quiet', '--verbose', '--installed', package_name
|
||||
installed_output.chomp
|
||||
|
||||
begin
|
||||
installed_output = equo('match', '--quiet', '--verbose', '--installed', package_name).chomp
|
||||
installed_match = installed_output.match(result_format)
|
||||
|
||||
if installed_match
|
||||
@@ -95,14 +105,16 @@ Puppet::Type.type(:package).provide :entropy, :parent => Puppet::Provider::Packa
|
||||
else
|
||||
package[:ensure] = :absent
|
||||
end
|
||||
rescue Puppet::ExecutionFailure
|
||||
package[:ensure] = :absent
|
||||
end
|
||||
|
||||
return package
|
||||
|
||||
else
|
||||
# List all installed packages and try and find if it's installed from outside a repository
|
||||
# If so, assume the installed version is the latest available
|
||||
all_installed = equo "query", "list", "installed", "--quiet", "--verbose"
|
||||
all_installed.chomp
|
||||
all_installed = equo("query", "list", "installed", "--quiet", "--verbose").chomp
|
||||
|
||||
all_installed.split("\n").each do |installed_package|
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
/usr/bin/equo $@
|
||||
|
||||
exit 0
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "optiz0r-sabayon",
|
||||
"version": "0.1.2",
|
||||
"version": "0.2.0",
|
||||
"author": "Ben Roberts",
|
||||
"license": "MIT",
|
||||
"summary": "Extends Puppet with support for the Sabayon Linux distribution",
|
||||
|
||||
Reference in New Issue
Block a user