diff --git a/fix-puppetlab-paths.patch b/fix-puppetlab-paths.patch index 7e22d09..cd1bdd6 100644 --- a/fix-puppetlab-paths.patch +++ b/fix-puppetlab-paths.patch @@ -1,7 +1,7 @@ -diff -uNr hiera-3.3.1.ORIG/lib/hiera/util.rb hiera-3.3.1/lib/hiera/util.rb ---- hiera-3.3.1.ORIG/lib/hiera/util.rb 2017-06-01 15:41:12.908907573 +0200 -+++ hiera-3.3.1/lib/hiera/util.rb 2017-06-01 15:41:45.015503104 +0200 -@@ -28,7 +28,7 @@ +diff -uNr hiera-3.6.0.ORIG/lib/hiera/util.rb hiera-3.6.0/lib/hiera/util.rb +--- hiera-3.6.0.ORIG/lib/hiera/util.rb 2019-11-13 09:43:32.600045630 +0100 ++++ hiera-3.6.0/lib/hiera/util.rb 2019-11-13 09:43:46.007065887 +0100 +@@ -20,7 +20,7 @@ if microsoft_windows? File.join(common_appdata, 'PuppetLabs', 'puppet', 'etc') else @@ -10,12 +10,111 @@ diff -uNr hiera-3.3.1.ORIG/lib/hiera/util.rb hiera-3.3.1/lib/hiera/util.rb end end -@@ -36,7 +36,7 @@ +@@ -28,7 +28,7 @@ if microsoft_windows? File.join(common_appdata, 'PuppetLabs', 'code') else - '/etc/puppetlabs/code' -+ '/etc/puppet' ++ '/etc/puppet/code' end end +diff -uNr hiera-3.6.0.ORIG/lib/hiera/util.rb.orig hiera-3.6.0/lib/hiera/util.rb.orig +--- hiera-3.6.0.ORIG/lib/hiera/util.rb.orig 1970-01-01 01:00:00.000000000 +0100 ++++ hiera-3.6.0/lib/hiera/util.rb.orig 2019-10-14 09:59:36.000000000 +0200 +@@ -0,0 +1,65 @@ ++class Hiera ++ ++ # Matches a key that is quoted using a matching pair of either single or double quotes. ++ QUOTED_KEY = /^(?:"([^"]+)"|'([^']+)')$/ ++ QUOTES = /[",]/ ++ ++ module Util ++ module_function ++ ++ def posix? ++ require 'etc' ++ Etc.getpwuid(0) != nil ++ end ++ ++ def microsoft_windows? ++ !!file_alt_separator ++ end ++ ++ def config_dir ++ if microsoft_windows? ++ File.join(common_appdata, 'PuppetLabs', 'puppet', 'etc') ++ else ++ '/etc/puppetlabs/puppet' ++ end ++ end ++ ++ def code_dir ++ if microsoft_windows? ++ File.join(common_appdata, 'PuppetLabs', 'code') ++ else ++ '/etc/puppetlabs/code' ++ end ++ end ++ ++ def var_dir ++ File.join(code_dir, 'environments' , '%{environment}' , 'hieradata') ++ end ++ ++ def file_alt_separator ++ File::ALT_SEPARATOR ++ end ++ ++ def common_appdata ++ @common_appdata ||= Hiera::Util::Win32.get_common_appdata() ++ end ++ ++ def split_key(key) ++ segments = key.split(/(?:"([^"]+)"|'([^']+)'|([^'".]+))/) ++ if segments.empty? ++ # Only happens if the original key was an empty string ++ '' ++ elsif segments.shift == '' ++ count = segments.size ++ raise yield('Syntax error') unless count > 0 ++ ++ segments.keep_if { |seg| seg != '.' } ++ raise yield('Syntax error') unless segments.size * 2 == count + 1 ++ segments ++ else ++ raise yield('Syntax error') ++ end ++ end ++ end ++end ++ +diff -uNr hiera-3.6.0.ORIG/spec/unit/util_spec.rb hiera-3.6.0/spec/unit/util_spec.rb +--- hiera-3.6.0.ORIG/spec/unit/util_spec.rb 2019-11-13 09:43:32.601045631 +0100 ++++ hiera-3.6.0/spec/unit/util_spec.rb 2019-11-13 09:44:42.269091590 +0100 +@@ -23,7 +23,7 @@ + describe 'Hiera::Util.config_dir' do + it 'should return the correct path for posix systems' do + Hiera::Util.expects(:file_alt_separator).returns(nil) +- expect(Hiera::Util.config_dir).to eq('/etc/puppetlabs/puppet') ++ expect(Hiera::Util.config_dir).to eq('/etc/puppet') + end + + it 'should return the correct path for microsoft windows systems' do +@@ -36,7 +36,7 @@ + describe 'Hiera::Util.code_dir' do + it 'should return the correct path for posix systems' do + Hiera::Util.expects(:file_alt_separator).returns(nil) +- expect(Hiera::Util.code_dir).to eq('/etc/puppetlabs/code') ++ expect(Hiera::Util.code_dir).to eq('/etc/puppet/code') + end + + it 'should return the correct path for microsoft windows systems' do +@@ -49,7 +49,7 @@ + describe 'Hiera::Util.var_dir' do + it 'should return the correct path for posix systems' do + Hiera::Util.expects(:file_alt_separator).returns(nil) +- expect(Hiera::Util.var_dir).to eq('/etc/puppetlabs/code/environments/%{environment}/hieradata') ++ expect(Hiera::Util.var_dir).to eq('/etc/puppet/code/environments/%{environment}/hieradata') + end + + it 'should return the correct path for microsoft windows systems' do diff --git a/hiera.spec b/hiera.spec index fd254b1..1415719 100644 --- a/hiera.spec +++ b/hiera.spec @@ -1,7 +1,7 @@ Name: hiera -Version: 3.3.1 -Release: 6%{?dist} +Version: 3.6.0 +Release: 1%{?dist} Summary: A simple hierarchical database supporting plugin data sources License: ASL 2.0 @@ -12,6 +12,7 @@ Patch0: fix-puppetlab-paths.patch BuildArch: noarch BuildRequires: rubygem(rspec) BuildRequires: rubygem(mocha) +BuildRequires: rubygem(json) BuildRequires: ruby-devel %description @@ -36,7 +37,7 @@ install -p -m0644 ext/hiera.yaml %{buildroot}%{_sysconfdir}/puppet mkdir -p %{buildroot}%{_var}/lib/hiera %check -ruby spec/spec_helper.rb +rspec -Ilib spec %files %{_bindir}/hiera @@ -49,6 +50,10 @@ ruby spec/spec_helper.rb %changelog +* Wed Nov 13 2019 Steve Traylen - 3.6.0-1 +- Update to 3.6.0. +- Call rspec tests correctly - actually run them. + * Thu Jul 25 2019 Fedora Release Engineering - 3.3.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sources b/sources index 9950278..1e5af7e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (hiera-3.3.1.tar.gz) = 723722dfbc074494534396b5facffb5e61c0b7ecdbd6df0cd88c1fd01fc8235e5e5b21a5df9155e0adc8cafdb0334ba7c85bf0445d2d497b099e0839046fd0ed +SHA512 (hiera-3.6.0.tar.gz) = e9819d0b166acca73321b6b6c23c404f2b03203d6fa934859918d47ec4ca6d234acff0c9f02012f756f239a719c00be4b48afb5b34b88069be2e67055a8f48e3