rbbt-util 5.27.12 → 5.27.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/parallel/traverse.rb +2 -0
- data/lib/rbbt/util/misc.rb +1 -0
- data/lib/rbbt/util/misc/development.rb +12 -2
- data/lib/rbbt/util/misc/inspect.rb +1 -1
- data/lib/rbbt/util/open.rb +6 -1
- data/share/rbbt_commands/tsv/uncollapse +0 -1
- data/test/rbbt/util/test_misc.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99b1ad9e8d9403c7f77e22b16497456324c340b08122b765033530f713e35c3c
|
4
|
+
data.tar.gz: 2d33590e395b9ca715e1c16d509d0a62a1ebeab2315b700ff4377a08803c89af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '097ce6c8c16c17441f5a8748ba4ab33afecf6d22d4d54c7ce53475cd642407ae5013346ba482f7fa9375176ab6790febfe030e9f7959ba7b928b5d3762382237'
|
7
|
+
data.tar.gz: 2fb616d7d66fc2eb979c9911921faecf163f51dd3323ac127265bcaefd0e8a4e3aab9ef41cc9bdf8bd351d44d4ef2cc388c692d5dc9a2d1b811155f21e3f0889
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -295,13 +295,18 @@ def self.add_libdir(dir=nil)
|
|
295
295
|
def self.bootstrap(elems, num = nil, options = {}, &block)
|
296
296
|
IndiferentHash.setup options
|
297
297
|
|
298
|
-
num = Rbbt::Config.get :cpus, :default_bootstrap_cpus, :bootstrap_cpus if num == :current || num == nil
|
298
|
+
num = Rbbt::Config.get :cpus, :default_bootstrap_cpus, :bootstrap_cpus if num == :current || num == nil if defined?(Rbbt::Config)
|
299
299
|
num = :current if num.nil?
|
300
300
|
cpus = case num
|
301
301
|
when :current
|
302
302
|
n = Etc.nprocessors
|
303
303
|
n = elems.length / 2 if n > elems.length/2
|
304
|
-
|
304
|
+
|
305
|
+
if $BOOTSTRAPPED_CURRENT && $BOOTSTRAPPED_CURRENT + n > Etc.nprocessors
|
306
|
+
1
|
307
|
+
else
|
308
|
+
n
|
309
|
+
end
|
305
310
|
when String
|
306
311
|
num.to_i
|
307
312
|
when Integer
|
@@ -320,7 +325,12 @@ def self.add_libdir(dir=nil)
|
|
320
325
|
respawn = options[:respawn] and options[:cpus] and options[:cpus].to_i > 1
|
321
326
|
|
322
327
|
index = (0..elems.length-1).to_a.collect{|v| v.to_s }
|
328
|
+
|
323
329
|
TSV.traverse index, options do |pos|
|
330
|
+
if num == :current
|
331
|
+
$BOOTSTRAPPED_CURRENT ||= n
|
332
|
+
$BOOTSTRAPPED_CURRENT += 0
|
333
|
+
end
|
324
334
|
elem = elems[pos.to_i]
|
325
335
|
elems.annotate elem if elems.respond_to? :annotate
|
326
336
|
res = begin
|
@@ -401,7 +401,7 @@ module Misc
|
|
401
401
|
|
402
402
|
def self.scan_version_text(text, cmd = nil)
|
403
403
|
cmd = "NOCMDGIVE" if cmd.nil? || cmd.empty?
|
404
|
-
m = text.match(/(?:version.*?|#{cmd}.*?|v)((?:\d+\.)*\d+(?:-[a-z_]+)?)/i)
|
404
|
+
m = text.match(/(?:version.*?|#{cmd}.*?|#{cmd.split(/[-_.]/).first}.*?|v)((?:\d+\.)*\d+(?:-[a-z_]+)?)/i)
|
405
405
|
return nil if m.nil?
|
406
406
|
m[1]
|
407
407
|
end
|
data/lib/rbbt/util/open.rb
CHANGED
@@ -94,7 +94,8 @@ module Open
|
|
94
94
|
end
|
95
95
|
|
96
96
|
begin
|
97
|
-
wget_options = options.
|
97
|
+
wget_options = options.dup
|
98
|
+
wget_options = wget_options.merge( '-O' => '-') unless options.include?('--output-document')
|
98
99
|
wget_options[:pipe] = pipe unless pipe.nil?
|
99
100
|
wget_options[:stderr] = stderr unless stderr.nil?
|
100
101
|
|
@@ -824,4 +825,8 @@ module Open
|
|
824
825
|
def self.broken_link?(path)
|
825
826
|
File.symlink?(path) && ! File.exists?(File.readlink(path))
|
826
827
|
end
|
828
|
+
|
829
|
+
def self.download(url, path)
|
830
|
+
Open.wget(url, "--output-document" => path)
|
831
|
+
end
|
827
832
|
end
|
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -690,5 +690,30 @@ Written by Mike Haertel and others, see |
|
690
690
|
EOF
|
691
691
|
assert_equal "3.1", Misc.scan_version_text(txt, "grep")
|
692
692
|
end
|
693
|
+
|
694
|
+
def test_bootstrap_current_only_once
|
695
|
+
|
696
|
+
|
697
|
+
max = Etc.nprocessors * 10
|
698
|
+
TmpFile.with_file do |f|
|
699
|
+
RbbtSemaphore.with_semaphore(1) do |sem|
|
700
|
+
Misc.bootstrap (1..max).to_a do
|
701
|
+
Open.open(f, :mode => 'a') do |sin|
|
702
|
+
sin.puts Process.pid.to_s
|
703
|
+
end
|
704
|
+
Misc.bootstrap (1..10).to_a do
|
705
|
+
RbbtSemaphore.synchronize(sem) do
|
706
|
+
Open.open(f, :mode => 'a') do |sin|
|
707
|
+
sin.puts [Process.ppid.to_s, Process.pid.to_s] * ":"
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
713
|
+
assert_equal max * 10 + max, Open.read(f).split("\n").length
|
714
|
+
assert_equal Etc.nprocessors * 2, Open.read(f).split("\n").uniq.length
|
715
|
+
end
|
716
|
+
|
717
|
+
end
|
693
718
|
end
|
694
719
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.27.
|
4
|
+
version: 5.27.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|