unhook Puppet 5, hook up Puppet 7, move to Ruby 3.1,

Also switch to install gems instead of hand-rolled install
This commit is contained in:
sebastia 2023-01-20 20:58:32 +00:00
parent 5325b82985
commit 7c6cb3024e
8 changed files with 3134 additions and 1295 deletions

View File

@ -1,35 +1,25 @@
PORTROACH= limit:^6
VERSION= 6.28.0
REVISION= 1
REVISION= 2
RUN_DEPENDS+= databases/ruby-hiera3,${MODRUBY_FLAVOR} \
devel/ruby-gettext-setup,${MODRUBY_FLAVOR}>=0.28,<1 \
devel/ruby-locale,${MODRUBY_FLAVOR}>=2.1,<3 \
devel/ruby-rgen,${MODRUBY_FLAVOR} \
devel/ruby-concurrent-ruby,${MODRUBY_FLAVOR} \
devel/ruby-puppet-resource_api,${MODRUBY_FLAVOR} \
devel/ruby-semantic_puppet,${MODRUBY_FLAVOR} \
sysutils/facter
sysutils/ruby-facter,${MODRUBY_FLAVOR} \
www/ruby-httpclient,${MODRUBY_FLAVOR}
SUBST_VARS += MODPY_DEFAULT_VERSION_2 MODPY_DEFAULT_VERSION_3
pre-install:
pre-configure:
${SUBST_CMD} ${WRKDIST}/lib/puppet/provider/package/gem.rb \
${WRKDIST}/lib/puppet/provider/package/pip.rb \
${WRKDIST}/lib/puppet/provider/package/pip3.rb \
${WRKDIST}/lib/puppet/provider/package/gem.rb \
${WRKSRC}/lib/puppet/reference/configuration.rb \
${WRKSRC}/lib/puppet/util/run_mode.rb \
${WRKSRC}/lib/puppet/defaults.rb
do-install:
@cd ${WRKSRC} && ${FAKE_FLAGS} ${RUBY} install.rb \
--vardir=${LOCALSTATEDIR}/db/puppet/cache/ \
--rundir=${LOCALSTATEDIR}/run/puppetlabs/ \
--localedir=${TRUEPREFIX}/${MODRUBY_SITEDIR}/puppet/locales/
mv ${WRKINST}${SYSCONFDIR}/puppetlabs ${PREFIX}/${MODRUBY_RELEXAMPLEDIR}-puppet
${INSTALL_DATA} ${WRKSRC}/conf/*.conf \
${PREFIX}/${MODRUBY_RELEXAMPLEDIR}-puppet/puppet/
# Suppress a huge number of Ruby deprecation/obsolete warnings
sed -i -e "s/ruby${MODRUBY_BINREV}/ruby${MODRUBY_BINREV} -W0/" ${PREFIX}/bin/puppet
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (puppet-6.28.0.tar.gz) = yX/PrJcurhAUQbkN+29CqryuYRQ9tFZBIKl6wUisHjU=
SIZE (puppet-6.28.0.tar.gz) = 2909190
SHA256 (puppet-6.28.0.gem) = stieYieBdevYqwhVL4XmKuDDaNfFeY+JXSKX7s3so20=
SIZE (puppet-6.28.0.gem) = 2870272

View File

@ -0,0 +1,52 @@
Ruby 3 compat, taken from Puppet 7
Index: lib/puppet/util.rb
--- lib/puppet/util.rb.orig
+++ lib/puppet/util.rb
@@ -472,7 +472,7 @@ module Util
orig_verbose = $VERBOSE
$VERBOSE = nil unless Puppet::Util::Platform.jruby?
begin
- encoded += URI.escape(parts[:path]) unless parts[:path].nil?
+ encoded += rfc2396_escape(parts[:path]) unless parts[:path].nil?
ensure
$VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby?
end
@@ -494,12 +494,31 @@ module Util
end
module_function :uri_encode
- def uri_unescape(path)
- orig_verbose = $VERBOSE
- $VERBOSE = nil unless Puppet::Util::Platform.jruby?
- return URI.unescape(path)
- ensure
- $VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby?
+ # From https://github.com/ruby/ruby/blob/v2_7_3/lib/uri/rfc2396_parser.rb#L24-L46
+ ALPHA = "a-zA-Z".freeze
+ ALNUM = "#{ALPHA}\\d".freeze
+ UNRESERVED = "\\-_.!~*'()#{ALNUM}".freeze
+ RESERVED = ";/?:@&=+$,\\[\\]".freeze
+ UNSAFE = Regexp.new("[^#{UNRESERVED}#{RESERVED}]").freeze
+
+ HEX = "a-fA-F\\d".freeze
+ ESCAPED = Regexp.new("%[#{HEX}]{2}").freeze
+
+ def rfc2396_escape(str)
+ str.gsub(UNSAFE) do |match|
+ tmp = ''
+ match.each_byte do |uc|
+ tmp << sprintf('%%%02X', uc)
+ end
+ tmp
+ end.force_encoding(Encoding::US_ASCII)
+ end
+ module_function :rfc2396_escape
+
+ def uri_unescape(str)
+ enc = str.encoding
+ enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
+ str.gsub(ESCAPED) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end
module_function :uri_unescape

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
SUBDIR =
SUBDIR += 5
SUBDIR += 6
SUBDIR += 7
.include <bsd.port.subdir.mk>

View File

@ -2,10 +2,8 @@ PKG_ARCH ?= *
COMMENT ?= centralised configuration management for networks
DISTNAME ?= puppet-${VERSION}
HOMEPAGE ?= https://puppet.com/
MASTER_SITES ?= https://downloads.puppetlabs.com/puppet/
MAINTAINER ?= Sebastian Reitenbach <sebastia@openbsd.org>
NO_TEST ?= Yes
NO_BUILD ?= Yes
PKGDIR ?= ${.CURDIR}/../pkg
PLIST ?= ${.CURDIR}/pkg/PLIST
@ -25,8 +23,6 @@ SUBST_VARS += RUBY
# sysutils/mcollective
# sysutils/ruby-augeas
# sysutils/ruby-shadow
# Puppet 5:
# databases/ruby-hiera3
# Puppet 6:
# devel/ruby-concurrent-ruby
# devel/ruby-semantic_puppet
@ -35,7 +31,9 @@ MODULES += lang/ruby \
lang/python
MODPY_BUILDDEP = No
MODPY_RUNDEP = No
MODRUBY_REV = 2.7
MODRUBY_HANDLE_FLAVORS = No
GEM_FLAGS = --no-format-executable
CONFIGURE_STYLE = ruby gem
BUILD_DEPENDS +=${RUN_DEPENDS}
RUN_DEPENDS += archivers/gtar \
@ -45,10 +43,4 @@ RUN_DEPENDS += archivers/gtar \
# Apache2
PERMIT_PACKAGE= Yes
FAKE_FLAGS += HOME=${WKRDIR}/home
SUBST_VARS += MODRUBY_BINREV
post-install:
find ${PREFIX} -type f \( -name '*.beforesubst' -or -name '*.orig' \) -delete
gunzip ${PREFIX}/man/*/*.gz
SUBST_VARS += MODRUBY_BINREV MODPY_DEFAULT_VERSION_2 MODPY_DEFAULT_VERSION_3

View File

@ -4,7 +4,7 @@ daemon="${TRUEPREFIX}/bin/puppet agent"
. /etc/rc.d/rc.subr
pexp="${RUBY} -W0 ${daemon}${daemon_flags:+ ${daemon_flags}}"
pexp="${RUBY} ${daemon}${daemon_flags:+ ${daemon_flags}}"
rc_reload=NO
rc_cmd $1

View File

@ -1,10 +0,0 @@
#!/bin/ksh
daemon="${TRUEPREFIX}/bin/puppet master"
. /etc/rc.d/rc.subr
pexp="${RUBY} -W0 ${daemon}${daemon_flags:+ ${daemon_flags}}"
rc_reload=NO
rc_cmd $1