diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2023-09-09 21:35:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2023-09-09 21:42:34 -0700 |
commit | 058c1ba90d789566374dca91b3d4c64218f156ee (patch) | |
tree | cfb2e13b82a9273ab16c5a4bcda09d18265011a0 /dev-ruby | |
parent | dev-ruby/simplecov: test passes on x86 (diff) | |
download | gentoo-058c1ba90d789566374dca91b3d4c64218f156ee.tar.gz gentoo-058c1ba90d789566374dca91b3d4c64218f156ee.tar.bz2 gentoo-058c1ba90d789566374dca91b3d4c64218f156ee.zip |
dev-ruby/facter: bring testsuite back
Get testsuite working again, to catch bugs like the missing
sys-filesystem dependency added by upstream.
Temporarily drop keywords back to ~amd64 ~x86 until deps can be
keyworded.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'dev-ruby')
-rw-r--r-- | dev-ruby/facter/facter-4.4.3-r1.ebuild | 55 | ||||
-rw-r--r-- | dev-ruby/facter/files/facter-4.4.3-rspec-gentoo-tweak.patch | 53 |
2 files changed, 108 insertions, 0 deletions
diff --git a/dev-ruby/facter/facter-4.4.3-r1.ebuild b/dev-ruby/facter/facter-4.4.3-r1.ebuild new file mode 100644 index 000000000000..1020d9528957 --- /dev/null +++ b/dev-ruby/facter/facter-4.4.3-r1.ebuild @@ -0,0 +1,55 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30 ruby31" +RUBY_FAKEGEM_GEMSPEC="facter.gemspec" +RUBY_FAKEGEM_RECIPE_TEST="rspec3" +RUBY_FAKEGEM_RECIPE_DOC="yard" + +inherit ruby-ng ruby-fakegem + +DESCRIPTION="A cross-platform ruby library for retrieving facts from operating systems" +HOMEPAGE="http://www.puppetlabs.com/puppet/related-projects/facter/" + +LICENSE="Apache-2.0" +SLOT="0" +#IUSE="test" +if [[ ${PV} == 9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/puppetlabs/facter.git" + EGIT_BRANCH="master" +else + [[ "${PV}" = *_rc* ]] || \ + KEYWORDS="~amd64 ~x86" + #KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86" + SRC_URI="https://github.com/puppetlabs/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" +fi + +#RESTRICT="!test? ( test )" + +ruby_add_rdepend "dev-ruby/hocon <dev-ruby/thor-2.0 dev-ruby/ffi dev-ruby/sys-filesystem" +ruby_add_bdepend "test? ( dev-ruby/simplecov dev-ruby/timecop dev-ruby/webmock )" + +PATCHES=( + "${FILESDIR}"/facter-4.4.3-rspec-gentoo-tweak.patch +) + +src_unpack() { + if [[ ${PV} == 9999 ]] ; then + git-r3_src_unpack + fi + ruby-ng_src_unpack +} + +all_ruby_prepare() { + sed -e 's/__dir__/"."/' \ + -e 's/__FILE__/"'${RUBY_FAKEGEM_GEMSPEC}'"/' \ + -i ${RUBY_FAKEGEM_GEMSPEC} || die + # Breaks tests; handle deps ourselves + sed -e "/require 'bundler/d" -i spec/spec_helper.rb || die + # dev tasks not needed, but block tests + for f in tasks/rubocop.rake tasks/check.rake ; do + test -e ${f} && mv -f ${f}{,.DISABLE} + done +} diff --git a/dev-ruby/facter/files/facter-4.4.3-rspec-gentoo-tweak.patch b/dev-ruby/facter/files/facter-4.4.3-rspec-gentoo-tweak.patch new file mode 100644 index 000000000000..ce97bbbccee9 --- /dev/null +++ b/dev-ruby/facter/files/facter-4.4.3-rspec-gentoo-tweak.patch @@ -0,0 +1,53 @@ +These two tests fail on a Gentoo system. Mark as pending so we have coverage of the other tests. + +``` + 1) Facter::Core::Execution::Base#execute with expand on posix does not expant builtin command + # False positive on Gentoo due to environment, returns GEM_SKIP instead of PATH + Failure/Error: old_require(path) unless LIBS_TO_SKIP.include?(path) + + {"SHELL"=>"/bin/bash", ..., "_"=>"/usr/bin/rspec", "RACK_ENV"=>"test", + "resolution_test_foo"=>"foo"} received :[] with unexpected arguments + expected: ("PATH") + got: ("GEM_SKIP") + Please stub a default value first if message might be received with other args as well. + # ./spec/mocks/kernel.rb:7:in `require' + # ./lib/facter/custom_facts/core/execution/base.rb:74:in `execute_command' + # ./lib/facter/custom_facts/core/execution/base.rb:63:in `execute' + # ./spec/custom_facts/core/execution/fact_manager_spec.rb:106:in `block (4 levels) in <top (required)>' + + + 2) Facter::Core::Execution::Posix when calling execute_command executes a command + # False positive on Gentoo due to environment, returns "" instead of ["", ""] + Failure/Error: expect(posix_executor.execute_command('/usr/bin/true', nil, logger)).to eq(['', '']) + + expected: ["", ""] + got: "" + + (compared using ==) + # ./spec/custom_facts/core/execution/posix_spec.rb:112:in `block (3 levels) in <top (required)>' +``` + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -NuarwbB --exclude '*swp' facter-4.4.3.orig/spec/custom_facts/core/execution/fact_manager_spec.rb facter-4.4.3/spec/custom_facts/core/execution/fact_manager_spec.rb +--- facter-4.4.3.orig/spec/custom_facts/core/execution/fact_manager_spec.rb 2023-08-24 10:49:03.000000000 -0700 ++++ facter-4.4.3/spec/custom_facts/core/execution/fact_manager_spec.rb 2023-09-09 21:25:03.428326009 -0700 +@@ -99,6 +99,7 @@ + end + + it 'does not expant builtin command' do ++ pending('False positive on Gentoo due to environment, returns GEM_SKIP instead of PATH') + allow(Facter::Core::Execution::Popen3).to receive(:popen3e).with({ 'LC_ALL' => 'C', 'LANG' => 'C' }, '/bin/foo') + .and_return('') + allow(Open3).to receive(:capture2).with('type /bin/foo').and_return('builtin') +diff -NuarwbB --exclude '*swp' facter-4.4.3.orig/spec/custom_facts/core/execution/posix_spec.rb facter-4.4.3/spec/custom_facts/core/execution/posix_spec.rb +--- facter-4.4.3.orig/spec/custom_facts/core/execution/posix_spec.rb 2023-08-24 10:49:03.000000000 -0700 ++++ facter-4.4.3/spec/custom_facts/core/execution/posix_spec.rb 2023-09-09 21:24:39.484374593 -0700 +@@ -108,6 +108,7 @@ + let(:logger) { instance_spy(Logger) } + + it 'executes a command' do ++ pending('False positive on Gentoo due to environment, returns "" instead of ["", ""]') + expect(posix_executor.execute_command('/usr/bin/true', nil, logger)).to eq(['', '']) + end + |