SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,25 @@
PORTROACH= limit:^7
VERSION= 7.25.0
RUN_DEPENDS+= converters/ruby-multi_json,${MODRUBY_FLAVOR}>=1.10,<2 \
databases/ruby-hiera3,${MODRUBY_FLAVOR}>=3.2.1,<4 \
devel/ruby-concurrent-ruby,${MODRUBY_FLAVOR}>=1,<1.2.0 \
devel/ruby-deep_merge,${MODRUBY_FLAVOR}>=1,<2 \
devel/ruby-fast_gettext,${MODRUBY_FLAVOR}>=1.1,<3 \
devel/ruby-locale,${MODRUBY_FLAVOR}>=2.1,<3 \
devel/ruby-puppet-resource_api,${MODRUBY_FLAVOR}>=1.5,<2 \
devel/ruby-scanf,${MODRUBY_FLAVOR}>=1,<2 \
devel/ruby-semantic_puppet,${MODRUBY_FLAVOR}>=1,<2 \
net/ruby-msgpack,${MODRUBY_FLAVOR} \
sysutils/ruby-facter,${MODRUBY_FLAVOR}>=2.0.1,<5
pre-configure:
${SUBST_CMD} ${WRKSRC}/lib/puppet/provider/package/gem.rb \
${WRKSRC}/lib/puppet/provider/package/pip.rb \
${WRKSRC}/lib/puppet/provider/package/pip3.rb \
${WRKSRC}/lib/puppet/reference/configuration.rb \
${WRKSRC}/lib/puppet/util/run_mode.rb \
${WRKSRC}/lib/puppet/defaults.rb
.include <bsd.port.mk>

View file

@ -0,0 +1,2 @@
SHA256 (puppet-7.25.0.gem) = VQ8Pg1W5kXNrgRlWOHezkrWPryMITPjLaasPMQrVxgU=
SIZE (puppet-7.25.0.gem) = 2783744

View file

@ -0,0 +1,52 @@
Index: install.rb
--- install.rb.orig
+++ install.rb
@@ -171,10 +171,10 @@ def prepare_installation
opts.on('--codedir[=OPTIONAL]', 'Installation directory for code files', 'Default /etc/puppetlabs/code') do |codedir|
InstallOptions.codedir = codedir
end
- opts.on('--vardir[=OPTIONAL]', 'Installation directory for var files', 'Default /opt/puppetlabs/puppet/cache') do |vardir|
+ opts.on('--vardir[=OPTIONAL]', 'Installation directory for var files', 'Default /var/puppetlabs/puppet/cache') do |vardir|
InstallOptions.vardir = vardir
end
- opts.on('--publicdir[=OPTIONAL]', 'Installation directory for public files such as the `last_run_summary.yaml` report', 'Default /opt/puppetlabs/puppet/public') do |publicdir|
+ opts.on('--publicdir[=OPTIONAL]', 'Installation directory for public files such as the `last_run_summary.yaml` report', 'Default /var/puppetlabs/puppet/public') do |publicdir|
InstallOptions.publicdir = publicdir
end
opts.on('--rundir[=OPTIONAL]', 'Installation directory for state files', 'Default /var/run/puppetlabs') do |rundir|
@@ -186,7 +186,7 @@ def prepare_installation
opts.on('--bindir[=OPTIONAL]', 'Installation directory for binaries', 'overrides RbConfig::CONFIG["bindir"]') do |bindir|
InstallOptions.bindir = bindir
end
- opts.on('--localedir[=OPTIONAL]', 'Installation directory for locale information', 'Default /opt/puppetlabs/puppet/share/locale') do |localedir|
+ opts.on('--localedir[=OPTIONAL]', 'Installation directory for locale information', 'Default /var/puppetlabs/puppet/share/locale') do |localedir|
InstallOptions.localedir = localedir
end
opts.on('--ruby[=OPTIONAL]', 'Ruby interpreter to use with installation', 'overrides ruby used to call install.rb') do |ruby|
@@ -262,7 +262,7 @@ def prepare_installation
elsif $operatingsystem == "windows"
vardir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "cache")
else
- vardir = "/opt/puppetlabs/puppet/cache"
+ vardir = "/var/puppetlabs/puppet/cache"
end
if not InstallOptions.publicdir.nil?
@@ -270,7 +270,7 @@ def prepare_installation
elsif $operatingsystem == "windows"
publicdir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "public")
else
- publicdir = "/opt/puppetlabs/puppet/public"
+ publicdir = "/var/puppetlabs/puppet/public"
end
if not InstallOptions.rundir.nil?
@@ -301,7 +301,7 @@ def prepare_installation
if $operatingsystem == "windows"
localedir = File.join(ENV['PROGRAMFILES'], "Puppet Labs", "Puppet", "puppet", "share", "locale")
else
- localedir = "/opt/puppetlabs/puppet/share/locale"
+ localedir = "/var/puppetlabs/puppet/share/locale"
end
end

View file

@ -0,0 +1,40 @@
Update the user and group to _puppet
Fix module search path to /var/puppetlabs
Index: lib/puppet/defaults.rb
--- lib/puppet/defaults.rb.orig
+++ lib/puppet/defaults.rb
@@ -57,7 +57,7 @@ module Puppet
end
path.join(File::PATH_SEPARATOR)
else
- '$codedir/modules:/opt/puppetlabs/puppet/modules'
+ '$codedir/modules:/var/puppetlabs/puppet/modules'
end
end
@@ -70,7 +70,7 @@ module Puppet
nil
end
else
- '/opt/puppetlabs/puppet/vendor_modules'
+ '/var/puppetlabs/puppet/vendor_modules'
end
end
@@ -1312,13 +1312,13 @@ EOT
settings.define_settings(:server,
:user => {
- :default => "puppet",
+ :default => "_puppet",
:desc => "The user Puppet Server will run as. Used to ensure
the agent side processes (agent, apply, etc) create files and
directories readable by Puppet Server when necessary.",
},
:group => {
- :default => "puppet",
+ :default => "_puppet",
:desc => "The group Puppet Server will run as. Used to ensure
the agent side processes (agent, apply, etc) create files and
directories readable by Puppet Server when necessary.",

View file

@ -0,0 +1,14 @@
Tell Puppet where to find locales
Index: lib/puppet/gettext/config.rb
--- lib/puppet/gettext/config.rb.orig
+++ lib/puppet/gettext/config.rb
@@ -2,7 +2,7 @@ require_relative '../../puppet/util/platform'
require_relative '../../puppet/file_system'
module Puppet::GettextConfig
- LOCAL_PATH = File.absolute_path('../../../locales', File.dirname(__FILE__))
+ LOCAL_PATH = File.absolute_path('../../puppet/locales', File.dirname(__FILE__))
POSIX_PATH = File.absolute_path('../../../../../share/locale', File.dirname(__FILE__))
WINDOWS_PATH = File.absolute_path('../../../../../../puppet/share/locale', File.dirname(__FILE__))

View file

@ -0,0 +1,14 @@
Use the locally installed gem command with explicit ruby version.
Index: lib/puppet/provider/package/gem.rb
--- lib/puppet/provider/package/gem.rb.orig
+++ lib/puppet/provider/package/gem.rb
@@ -46,7 +46,7 @@ Puppet::Type.type(:package).provide :gem, :parent => P
# Define the default provider package command as optional when the provider is targetable.
# Doing do defers the evaluation of provider suitability until all commands are evaluated.
- has_command(:gemcmd, 'gem') do
+ has_command(:gemcmd, 'gem${MODRUBY_BINREV}') do
is_optional
end

View file

@ -0,0 +1,258 @@
- Handle errors from pkg_add
- Handle uninstall_options being 'nil' by default
- If no flavor speficied, force the empty flavor with '--'
but skipping the % un-ambiguity pkg names
- Bail out on shortform PKG_PATH (i.e. 'ftp.openbsd.org')
- pkg.conf is gone
- properly handle packages with multiple versions and flavors,
i.e. postfix-XXX-flavor
Index: lib/puppet/provider/package/openbsd.rb
--- lib/puppet/provider/package/openbsd.rb.orig
+++ lib/puppet/provider/package/openbsd.rb
@@ -22,6 +22,8 @@ Puppet::Type.type(:package).provide :openbsd, :parent
has_feature :upgradeable
has_feature :supports_flavors
+ mk_resource_methods
+
def self.instances
packages = []
@@ -44,12 +46,6 @@ Puppet::Type.type(:package).provide :openbsd, :parent
packages << new(hash)
hash = {}
- else
- unless line =~ /Updating the pkgdb/
- # Print a warning on lines we can't match, but move
- # on, since it should be non-fatal
- warning(_("Failed to match line %{line}") % { line: line })
- end
end
}
end
@@ -65,26 +61,18 @@ Puppet::Type.type(:package).provide :openbsd, :parent
end
def latest
- parse_pkgconf
- if @resource[:source][-1,1] == ::File::SEPARATOR
- e_vars = { 'PKG_PATH' => @resource[:source] }
- else
- e_vars = {}
- end
-
if @resource[:flavor]
query = "#{@resource[:name]}--#{@resource[:flavor]}"
else
- query = @resource[:name]
+ query = @resource[:name] + "--"
end
- output = Puppet::Util.withenv(e_vars) {pkginfo "-Q", query}
- version = properties[:ensure]
+ output = Puppet::Util.withenv({}) {pkginfo "-Q", query}
if output.nil? or output.size == 0 or output =~ /Error from /
debug "Failed to query for #{resource[:name]}"
- return version
+ return properties[:ensure]
else
# Remove all fuzzy matches first.
output = output.split.select {|p| p =~ /^#{resource[:name]}-(\d[^-]*)[-]?(\w*)/ }.join
@@ -93,21 +81,22 @@ Puppet::Type.type(:package).provide :openbsd, :parent
if output =~ /^#{resource[:name]}-(\d[^-]*)[-]?(\w*) \(installed\)$/
debug "Package is already the latest available"
- return version
+ return properties[:ensure]
else
match = /^(.*)-(\d[^-]*)[-]?(\w*)$/.match(output)
debug "Latest available for #{resource[:name]}: #{match[2]}"
- if version.to_sym == :absent || version.to_sym == :purged
+ if properties[:ensure].to_sym == :absent
return match[2]
end
- vcmp = version.split('.').map{|s|s.to_i} <=> match[2].split('.').map{|s|s.to_i}
+ vcmp = properties[:ensure].split('.').map{|s|s.to_i} <=> match[2].split('.').map{|s|s.to_i}
if vcmp > 0
+ debug "ensure: #{properties[:ensure]}"
# The locally installed package may actually be newer than what a mirror
# has. Log it at debug, but ignore it otherwise.
- debug "Package #{resource[:name]} #{version} newer then available #{match[2]}"
- return version
+ debug "Package #{resource[:name]} #{properties[:ensure]} newer then available #{match[2]}"
+ return properties[:ensure]
else
return match[2]
end
@@ -118,57 +107,25 @@ Puppet::Type.type(:package).provide :openbsd, :parent
self.install(true)
end
- def parse_pkgconf
- unless @resource[:source]
- if Puppet::FileSystem.exist?("/etc/pkg.conf")
- File.open("/etc/pkg.conf", "rb").readlines.each do |line|
- matchdata = line.match(/^installpath\s*=\s*(.+)\s*$/i)
- if matchdata
- @resource[:source] = matchdata[1]
- else
- matchdata = line.match(/^installpath\s*\+=\s*(.+)\s*$/i)
- if matchdata
- if @resource[:source].nil?
- @resource[:source] = matchdata[1]
- else
- @resource[:source] += ":" + matchdata[1]
- end
- end
- end
- end
-
- unless @resource[:source]
- raise Puppet::Error,
- _("No valid installpath found in /etc/pkg.conf and no source was set")
- end
- else
- raise Puppet::Error,
- _("You must specify a package source or configure an installpath in /etc/pkg.conf")
- end
- end
- end
-
def install(latest = false)
cmd = []
- parse_pkgconf
-
- if @resource[:source][-1,1] == ::File::SEPARATOR
- e_vars = { 'PKG_PATH' => @resource[:source] }
- full_name = get_full_name(latest)
- else
- e_vars = {}
- full_name = @resource[:source]
- end
-
+ cmd << '-r'
cmd << install_options
- cmd << full_name
+ cmd << get_full_name(latest)
if latest
- cmd.unshift('-rz')
+ cmd.unshift('-z')
end
- Puppet::Util.withenv(e_vars) { pkgadd cmd.flatten.compact }
+ # pkg_add(1) doesn't set the return value upon failure so we have to peek
+ # at it's output to see if something went wrong.
+ output = Puppet::Util.withenv({}) { pkgadd cmd.flatten.compact }
+ require 'pp'
+ pp output
+ if output =~ /Can't find /
+ self.fail "pkg_add returned: #{output.chomp}"
+ end
end
def get_full_name(latest = false)
@@ -177,11 +134,20 @@ Puppet::Type.type(:package).provide :openbsd, :parent
# installing with 'latest', we do need to handle the flavors. This is
# done so we can feed pkg_add(8) the full package name to install to
# prevent ambiguity.
- if latest && resource[:flavor]
- "#{resource[:name]}--#{resource[:flavor]}"
- elsif latest
- # Don't depend on get_version for updates.
- @resource[:name]
+ if resource[:flavor]
+ # If :ensure contains a version, use that instead of looking it up.
+ # This allows for installing packages with the same stem, but multiple
+ # version such as postfix-VERSION-flavor.
+ if @resource[:ensure].to_s =~ /(\d[^-]*)$/
+ use_version = @resource[:ensure]
+ else
+ use_version = ''
+ end
+ "#{resource[:name]}-#{use_version}-#{resource[:flavor]}"
+ elsif resource[:name].to_s.match(/[a-z0-9]%[0-9a-z]/i)
+ "#{resource[:name]}"
+ elsif not latest
+ "#{resource[:name]}--"
else
# If :ensure contains a version, use that instead of looking it up.
# This allows for installing packages with the same stem, but multiple
@@ -192,32 +158,42 @@ Puppet::Type.type(:package).provide :openbsd, :parent
use_version = get_version
end
- [ @resource[:name], use_version, @resource[:flavor]].join('-').gsub(/-+$/, '')
+ if resource[:flavor]
+ [ @resource[:name], use_version, @resource[:flavor]].join('-').gsub(/-+$/, '')
+ else
+ [ @resource[:name], use_version ]
+ end
end
end
def get_version
- execpipe([command(:pkginfo), "-I", @resource[:name]]) do |process|
- # our regex for matching pkg_info output
- regex = /^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/
- master_version = 0
- version = -1
+ pkg_search_name = @resource[:name]
+ unless pkg_search_name.match(/[a-z0-9]%[0-9a-z]/i) and not @resource[:flavor]
+ # we are only called when no flavor is specified
+ # so append '--' to the :name to avoid patch versions on flavors
+ pkg_search_name << "--"
+ end
+ # our regex for matching pkg_info output
+ regex = /^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/
+ master_version = 0
+ version = -1
- process.each_line do |line|
- match = regex.match(line.split[0])
- if match
- # now we return the first version, unless ensure is latest
- version = match.captures[1]
- return version unless @resource[:ensure] == "latest"
-
- master_version = version unless master_version > version
- end
+ # pkg_info -I might return multiple lines, i.e. flavors
+ matching_pkgs = pkginfo("-I", "pkg_search_name")
+ matching_pkgs.each_line do |line|
+ if match = regex.match(line.split[0])
+ # now we return the first version, unless ensure is latest
+ version = match.captures[1]
+ return version unless @resource[:ensure] == "latest"
+ master_version = version unless master_version > version
end
- return master_version unless master_version == 0
- return '' if version == -1
- raise Puppet::Error, _("%{version} is not available for this package") % { version: version }
end
+
+ return master_version unless master_version == 0
+ return '' if version == -1
+ raise Puppet::Error, _("%{version} is not available for this package") % { version: version }
+
rescue Puppet::ExecutionFailure
return nil
end
@@ -236,7 +212,7 @@ Puppet::Type.type(:package).provide :openbsd, :parent
end
def uninstall_options
- join_options(resource[:uninstall_options])
+ [join_options(resource[:uninstall_options])]
end
def uninstall

View file

@ -0,0 +1,15 @@
Allow the pip package provider to work for the default
python3 version
Index: lib/puppet/provider/package/pip3.rb
--- lib/puppet/provider/package/pip3.rb.orig
+++ lib/puppet/provider/package/pip3.rb
@@ -12,6 +12,6 @@ Puppet::Type.type(:package).provide :pip3,
has_feature :installable, :uninstallable, :upgradeable, :versionable, :install_options, :targetable
def self.cmd
- ["pip3"]
+ ["pip${MODPY_DEFAULT_VERSION_3}"]
end
end

View file

@ -0,0 +1,16 @@
Allow the pip package provider to work for the default
python2 version
Index: lib/puppet/provider/package/pip.rb
--- lib/puppet/provider/package/pip.rb.orig
+++ lib/puppet/provider/package/pip.rb
@@ -38,7 +38,7 @@ Puppet::Type.type(:package).provide :pip, :parent => :
if Puppet::Util::Platform.windows?
["pip.exe"]
else
- ["pip", "pip-python", "pip2", "pip-2"]
+ ["pip-python", "pip2", "pip-2", "pip${MODPY_DEFAULT_VERSION_2}"]
end
end

View file

@ -0,0 +1,23 @@
Update the default directory locations
Index: lib/puppet/reference/configuration.rb
--- lib/puppet/reference/configuration.rb.orig
+++ lib/puppet/reference/configuration.rb
@@ -23,13 +23,13 @@ config = Puppet::Util::Reference.newreference(:configu
# Now print the data about the item.
val = object.default
if name.to_s == 'vardir'
- val = 'Unix/Linux: /opt/puppetlabs/puppet/cache -- Windows: C:\ProgramData\PuppetLabs\puppet\cache -- Non-root user: ~/.puppetlabs/opt/puppet/cache'
+ val = 'Unix/Linux: /var/puppetlabs/puppet/cache -- Windows: C:\ProgramData\PuppetLabs\puppet\cache -- Non-root user: ~/.puppetlabs/opt/puppet/cache'
elsif name.to_s == 'publicdir'
- val = 'Unix/Linux: /opt/puppetlabs/puppet/public -- Windows: C:\ProgramData\PuppetLabs\puppet\public -- Non-root user: ~/.puppetlabs/opt/puppet/public'
+ val = 'Unix/Linux: /var/puppetlabs/puppet/public -- Windows: C:\ProgramData\PuppetLabs\puppet\public -- Non-root user: ~/.puppetlabs/opt/puppet/public'
elsif name.to_s == 'confdir'
- val = 'Unix/Linux: /etc/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\etc -- Non-root user: ~/.puppetlabs/etc/puppet'
+ val = 'Unix/Linux: ${SYSCONFDIR}/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\etc -- Non-root user: ~/.puppetlabs/etc/puppet'
elsif name.to_s == 'codedir'
- val = 'Unix/Linux: /etc/puppetlabs/code -- Windows: C:\ProgramData\PuppetLabs\code -- Non-root user: ~/.puppetlabs/etc/code'
+ val = 'Unix/Linux: ${SYSCONFDIR}/puppetlabs/code -- Windows: C:\ProgramData\PuppetLabs\code -- Non-root user: ~/.puppetlabs/etc/code'
elsif name.to_s == 'rundir'
val = 'Unix/Linux: /var/run/puppetlabs -- Windows: C:\ProgramData\PuppetLabs\puppet\var\run -- Non-root user: ~/.puppetlabs/var/run'
elsif name.to_s == 'logdir'

View file

@ -0,0 +1,30 @@
Update the default directory locations
Index: lib/puppet/util/run_mode.rb
--- lib/puppet/util/run_mode.rb.orig
+++ lib/puppet/util/run_mode.rb
@@ -63,19 +63,19 @@ module Puppet
class UnixRunMode < RunMode
def conf_dir
- which_dir("/etc/puppetlabs/puppet", "~/.puppetlabs/etc/puppet")
+ which_dir("${SYSCONFDIR}/puppetlabs/puppet", "~/.puppetlabs/etc/puppet")
end
def code_dir
- which_dir("/etc/puppetlabs/code", "~/.puppetlabs/etc/code")
+ which_dir("${SYSCONFDIR}/puppetlabs/code", "~/.puppetlabs/etc/code")
end
def var_dir
- which_dir("/opt/puppetlabs/puppet/cache", "~/.puppetlabs/opt/puppet/cache")
+ which_dir("/var/puppetlabs/puppet/cache", "~/.puppetlabs/opt/puppet/cache")
end
def public_dir
- which_dir("/opt/puppetlabs/puppet/public", "~/.puppetlabs/opt/puppet/public")
+ which_dir("/var/puppetlabs/puppet/public", "~/.puppetlabs/opt/puppet/public")
end
def run_dir

View file

@ -0,0 +1,11 @@
Starting with Puppet 6, some common functionality has been moved from
puppet into modules managed by puppetlabs.
This includes providers for
- cron
- host
- mount
- scheduled_task
- sshkeys
These can be installed from the Puppet Forge, see puppet-module(8).

File diff suppressed because it is too large Load diff