Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ruby/concurrent-ruby/files/, dev-ruby/concurrent-ruby/
Date: Mon, 04 Jul 2016 18:44:35
Message-Id: 1467657860.c6726d0acaddd1fb67d9fbc547a36548ef43ed2e.graaff@gentoo
1 commit: c6726d0acaddd1fb67d9fbc547a36548ef43ed2e
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 4 18:41:45 2016 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 4 18:44:20 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6726d0a
7
8 dev-ruby/concurrent-ruby: add patch for alpha, bug 587986
9
10 Add a patch for alpha to determine processor_count.
11
12 Package-Manager: portage-2.2.28
13
14 .../concurrent-ruby-1.0.2-r1.ebuild | 38 ++++++++++++++++
15 .../files/concurrent-ruby-1.0.2-alpha.patch | 50 ++++++++++++++++++++++
16 2 files changed, 88 insertions(+)
17
18 diff --git a/dev-ruby/concurrent-ruby/concurrent-ruby-1.0.2-r1.ebuild b/dev-ruby/concurrent-ruby/concurrent-ruby-1.0.2-r1.ebuild
19 new file mode 100644
20 index 0000000..2be2bca
21 --- /dev/null
22 +++ b/dev-ruby/concurrent-ruby/concurrent-ruby-1.0.2-r1.ebuild
23 @@ -0,0 +1,38 @@
24 +# Copyright 1999-2016 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +# $Id$
27 +
28 +EAPI=5
29 +USE_RUBY="ruby20 ruby21 ruby22 ruby23"
30 +
31 +RUBY_FAKEGEM_RECIPE_TEST="rspec3"
32 +
33 +RUBY_FAKEGEM_RECIPE_DOC=""
34 +
35 +RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec"
36 +
37 +inherit ruby-fakegem
38 +
39 +DESCRIPTION="Modern concurrency tools including agents, futures, promises, thread pools, more"
40 +HOMEPAGE="https://github.com/ruby-concurrency/concurrent-ruby"
41 +SRC_URI="https://github.com/ruby-concurrency/concurrent-ruby/archive/v${PV}.tar.gz -> ${P}.tar.gz"
42 +
43 +LICENSE="MIT"
44 +SLOT="1"
45 +KEYWORDS="~amd64 ~arm ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
46 +IUSE=""
47 +
48 +RUBY_PATCHES=( ${P}-alpha.patch )
49 +
50 +all_ruby_prepare() {
51 + # Remove edge files as defined in support/file_map.rb
52 + rm -rf {lib,spec}/concurrent/{actor,channel,edge}* \
53 + lib/concurrent/{concurrent-edge,lazy_register.rb} \
54 + spec/concurrent/lazy_register_spec.rb || die
55 + sed -i -e '/concurrent-edge/ s:^:#:' spec/spec_helper.rb || die
56 +
57 + # Remove specs for the ext gem
58 + rm -rf spec/concurrent/atomic || die
59 +
60 + sed -i -e '/file_map/d' -e '/s.files/d' ${RUBY_FAKEGEM_GEMSPEC} || die
61 +}
62
63 diff --git a/dev-ruby/concurrent-ruby/files/concurrent-ruby-1.0.2-alpha.patch b/dev-ruby/concurrent-ruby/files/concurrent-ruby-1.0.2-alpha.patch
64 new file mode 100644
65 index 0000000..a1a97ec
66 --- /dev/null
67 +++ b/dev-ruby/concurrent-ruby/files/concurrent-ruby-1.0.2-alpha.patch
68 @@ -0,0 +1,50 @@
69 +commit af059a7ac7815d1edac67b21e5c1bd6b805d4493
70 +Author: Hans de Graaff <hans@××××××××.org>
71 +Date: Mon Jul 4 20:09:25 2016 +0200
72 +
73 + Support Alpha architecture for processor_count
74 +
75 + Alpha machines with Linux do have /proc/cpuinfo but its format is
76 + different from normal Linux machines, and most specifically the
77 + processor entry is missing. Moreover, Alpha machines can be configured
78 + to compartimentalize their CPUs into different machines leading to
79 + further confusion when reading /proc/cpuinfo.
80 +
81 + Using /usr/bin/nproc seems to be the most reliable method of determining
82 + the number of processors on Alpha. Since reading /proc/cpuinfo is not
83 + reliable this patch places the nproc method before trying /proc/cpuinfo.
84 +
85 + For futher reference see our downstream bug report at
86 + https://bugs.gentoo.org/show_bug.cgi?id=587986
87 +
88 +diff --git a/CHANGELOG.md b/CHANGELOG.md
89 +index e84c683..18dd8cc 100644
90 +--- a/CHANGELOG.md
91 ++++ b/CHANGELOG.md
92 +@@ -1,3 +1,5 @@
93 ++* Support Alpha with `Concurrent::processor_count`
94 ++
95 + ## Current Release v1.0.2 (2 May 2016)
96 +
97 + * Fix bug with `Concurrent::Map` MRI backend `#inspect` method
98 +diff --git a/lib/concurrent/utility/processor_counter.rb b/lib/concurrent/utility/processor_counter.rb
99 +index d18b0bb..e82c0a6 100644
100 +--- a/lib/concurrent/utility/processor_counter.rb
101 ++++ b/lib/concurrent/utility/processor_counter.rb
102 +@@ -28,6 +28,7 @@ module Concurrent
103 + # processor", which taked into account hyperthreading.
104 + #
105 + # * AIX: /usr/sbin/pmcycles (AIX 5+), /usr/sbin/lsdev
106 ++ # * Alpha: /usr/bin/nproc (/proc/cpuinfo exists but cannot be used)
107 + # * BSD: /sbin/sysctl
108 + # * Cygwin: /proc/cpuinfo
109 + # * Darwin: /usr/bin/hwprefs, /usr/sbin/sysctl
110 +@@ -84,6 +85,8 @@ module Concurrent
111 + result = WIN32OLE.connect("winmgmts://").ExecQuery(
112 + "select NumberOfLogicalProcessors from Win32_Processor")
113 + result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
114 ++ elsif File.executable?("/usr/bin/nproc")
115 ++ IO.popen("/usr/bin/nproc --all").read.to_i
116 + elsif File.readable?("/proc/cpuinfo")
117 + IO.read("/proc/cpuinfo").scan(/^processor/).size
118 + elsif File.executable?("/usr/bin/hwprefs")