public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ruby/facter/files/, dev-ruby/facter/
Date: Sun, 10 Sep 2023 04:42:36 +0000 (UTC)	[thread overview]
Message-ID: <1694320954.058c1ba90d789566374dca91b3d4c64218f156ee.robbat2@gentoo> (raw)

commit:     058c1ba90d789566374dca91b3d4c64218f156ee
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 10 04:35:04 2023 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 04:42:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=058c1ba9

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 <AT> gentoo.org>

 dev-ruby/facter/facter-4.4.3-r1.ebuild             | 55 ++++++++++++++++++++++
 .../files/facter-4.4.3-rspec-gentoo-tweak.patch    | 53 +++++++++++++++++++++
 2 files changed, 108 insertions(+)

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
+


             reply	other threads:[~2023-09-10  4:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10  4:42 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-10  2:45 [gentoo-commits] repo/gentoo:master commit in: dev-ruby/facter/files/, dev-ruby/facter/ Sam James
2020-02-18 16:40 Matthew Thode
2017-06-27 15:54 Matt Thode
2016-11-29  7:49 Robin H. Johnson
2016-05-01  1:36 Matt Thode

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1694320954.058c1ba90d789566374dca91b3d4c64218f156ee.robbat2@gentoo \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox