From 552f10e7b73967330995fa36cb69392778f40f15 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Tue, 19 Jan 2021 14:38:35 -0500 Subject: [PATCH 1/3] (PA-3526) Patch Ruby 2.7.2 to avoid realpath in require Tracked in https://tickets.puppetlabs.com/browse/PA-3526 --- configs/components/ruby-2.7.3.rb | 2 + configs/platforms/windows-2019-x64.rb | 54 +++++++++++++++++++ .../patches/ruby_27/ruby-faster-load_27.patch | 11 ++++ 3 files changed, 67 insertions(+) create mode 100644 configs/platforms/windows-2019-x64.rb create mode 100644 resources/patches/ruby_27/ruby-faster-load_27.patch diff --git a/configs/components/ruby-2.7.3.rb b/configs/components/ruby-2.7.3.rb index 96f109ee8..6401aa2f1 100644 --- a/configs/components/ruby-2.7.3.rb +++ b/configs/components/ruby-2.7.3.rb @@ -39,6 +39,8 @@ # Patch for https://bugs.ruby-lang.org/issues/14972 pkg.apply_patch "#{base}/net_http_eof_14972_r2.5.patch" + pkg.apply_patch "#{base}/ruby-faster-load_27.patch" + if platform.is_cross_compiled? pkg.apply_patch "#{base}/uri_generic_remove_safe_nav_operator_r2.5.patch" pkg.apply_patch "#{base}/lib_optparse_remove_safe_nav_operator.patch" diff --git a/configs/platforms/windows-2019-x64.rb b/configs/platforms/windows-2019-x64.rb new file mode 100644 index 000000000..847d7bbe9 --- /dev/null +++ b/configs/platforms/windows-2019-x64.rb @@ -0,0 +1,54 @@ +platform "windows-2019-x64" do |plat| + plat.vmpooler_template "win-2019-x86_64" + + plat.servicetype "windows" + visual_studio_version = '2017' + visual_studio_sdk_version = 'win8.1' + + # We need to ensure we install chocolatey prior to adding any nuget repos. Otherwise, everything will fall over + plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources/windows/chocolatey/install-chocolatey.ps1" + plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/api/nuget/nuget" + + # C:\tools is likely added by mingw, however because we also want to use that + # dir for vsdevcmd.bat we create it for safety + plat.provision_with "mkdir C:/tools" + # We don't want to install any packages from the chocolatey repo by accident + plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe upgrade -y chocolatey" + plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe sources remove -name chocolatey" + + packages = [ + "cmake", + "pl-gdbm-#{self._platform.architecture}", + "pl-iconv-#{self._platform.architecture}", + "pl-libffi-#{self._platform.architecture}", + "pl-pdcurses-#{self._platform.architecture}", + "pl-toolchain-#{self._platform.architecture}", + "pl-zlib-#{self._platform.architecture}", + "mingw-w64 -version 5.2.0 -debug", + "Wix310 -version 3.10.2 -debug -x86" + ] + + packages.each do |name| + plat.provision_with("C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress #{name}") + end + # We use cache-location in the following install because msvc has several long paths + # if we do not update the cache location choco will fail because paths get too long + plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe install msvc.#{visual_studio_version}-#{visual_studio_sdk_version}.sdk.en-us -y --cache-location=\"C:\\msvc\" --no-progress" + # The following creates a batch file that will execute the vsdevcmd batch file located within visual studio. + # We create the following batch file under C:\tools\vsdevcmd.bat so we can avoid using both the %ProgramFiles(x86)% + # evironment var, as well as any spaces in the path when executing things with cygwin. This makes command execution + # through cygwin much easier. + # + # Note that the unruly \'s in the following string escape the following sequence to literal chars: "\" and then \"" + plat.provision_with "touch C:/tools/vsdevcmd.bat && echo \"\\\"%ProgramFiles(x86)%\\Microsoft Visual Studio\\#{visual_studio_version}\\BuildTools\\Common7\\Tools\\vsdevcmd\\\"\" >> C:/tools/vsdevcmd.bat" + + plat.install_build_dependencies_with "C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress" + + plat.make "/usr/bin/make" + plat.patch "TMP=/var/tmp /usr/bin/patch.exe --binary" + + plat.platform_triple "x86_64-w64-mingw32" + + plat.package_type "archive" + plat.output_dir "windows" +end diff --git a/resources/patches/ruby_27/ruby-faster-load_27.patch b/resources/patches/ruby_27/ruby-faster-load_27.patch new file mode 100644 index 000000000..92e41c783 --- /dev/null +++ b/resources/patches/ruby_27/ruby-faster-load_27.patch @@ -0,0 +1,11 @@ +--- ruby-2.7.0/load.c.orig 2020-02-26 12:19:04.963826602 -0800 ++++ ruby-2.7.0/load.c 2020-02-26 12:28:55.865876051 -0800 +@@ -578,7 +578,7 @@ + rb_parser_set_context(parser, NULL, FALSE); + ast = (rb_ast_t *)rb_parser_load_file(parser, fname); + iseq = rb_iseq_new_top(&ast->body, rb_fstring_lit(""), +- fname, rb_realpath_internal(Qnil, fname, 1), NULL); ++ fname, fname, NULL); + rb_ast_dispose(ast); + } + rb_exec_event_hook_script_compiled(ec, iseq, Qnil); From 609a3541f828f6fcad1c075e1f5bcf415fcfdc75 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Thu, 11 Feb 2021 11:39:41 -0500 Subject: [PATCH 2/3] (maint) update vanagon --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0f398deee..7eac5a6be 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place) end gem 'artifactory' -gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || '~> 0.16') +gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || '~> 0.20.0') gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '~> 0.99.8') gem 'rake', '~> 12.0' From a2ccf6682d38a6fb46a259ac74780945f2ff3aca Mon Sep 17 00:00:00 2001 From: Lucy Wyman Date: Mon, 29 Mar 2021 15:21:48 -0700 Subject: [PATCH 3/3] Add new Windows 2019 platform to dtrace ignore arrays This updates the list of platforms that don't have dtrace to include the new Windows 2019 platform, so that puppet-runtime can be built for Windows 2019. --- configs/components/ruby-2.4.10.rb | 1 + configs/components/ruby-2.5.9.rb | 1 + configs/components/ruby-2.7.3.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/configs/components/ruby-2.4.10.rb b/configs/components/ruby-2.4.10.rb index a87c4a18d..0524099a7 100644 --- a/configs/components/ruby-2.4.10.rb +++ b/configs/components/ruby-2.4.10.rb @@ -115,6 +115,7 @@ 'ubuntu-16.04-ppc64el', 'windows-2012r2-x64', 'windows-2012r2-x86', + 'windows-2019-x64', 'windowsfips-2012r2-x64' ] diff --git a/configs/components/ruby-2.5.9.rb b/configs/components/ruby-2.5.9.rb index 7c79b7e02..20fee5eeb 100644 --- a/configs/components/ruby-2.5.9.rb +++ b/configs/components/ruby-2.5.9.rb @@ -118,6 +118,7 @@ 'ubuntu-16.04-ppc64el', 'windows-2012r2-x64', 'windows-2012r2-x86', + 'windows-2019-x64', 'windowsfips-2012r2-x64' ] diff --git a/configs/components/ruby-2.7.3.rb b/configs/components/ruby-2.7.3.rb index 6401aa2f1..8b1180ac0 100644 --- a/configs/components/ruby-2.7.3.rb +++ b/configs/components/ruby-2.7.3.rb @@ -114,6 +114,7 @@ 'ubuntu-16.04-ppc64el', 'windows-2012r2-x64', 'windows-2012r2-x86', + 'windows-2019-x64', 'windowsfips-2012r2-x64' ]