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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96eabb01327f6e3f5facc629140375ee06c16d160f77788cf3cee63df1fe0a55
4
- data.tar.gz: 3a30f619c73fb04003c7b6dd7d1a2d2a7f8f0fed2e503892c691280a02055af9
3
+ metadata.gz: 99b1ad9e8d9403c7f77e22b16497456324c340b08122b765033530f713e35c3c
4
+ data.tar.gz: 2d33590e395b9ca715e1c16d509d0a62a1ebeab2315b700ff4377a08803c89af
5
5
  SHA512:
6
- metadata.gz: ab7cd7746f19395bbc430cfb7b90bd3c6727d9a72069828c338f9abcb69c9776a52f8a6ceeb9244764ed55d9b1ad039739d32e3de27107a5edf7f01e22d10f34
7
- data.tar.gz: a9f620db6b823d54560b201fe6d706be0c6db502d1cae49100322926011702ad59e7fcdece25dcc2df8ac7cb49cfde67fd432a392b4416e492a0b4eadbeda47c
6
+ metadata.gz: '097ce6c8c16c17441f5a8748ba4ab33afecf6d22d4d54c7ce53475cd642407ae5013346ba482f7fa9375176ab6790febfe030e9f7959ba7b928b5d3762382237'
7
+ data.tar.gz: 2fb616d7d66fc2eb979c9911921faecf163f51dd3323ac127265bcaefd0e8a4e3aab9ef41cc9bdf8bd351d44d4ef2cc388c692d5dc9a2d1b811155f21e3f0889
@@ -727,6 +727,8 @@ module TSV
727
727
  Log.exception $!
728
728
  abort_stream(into, $!)
729
729
  raise $!
730
+ ensure
731
+ Log::ProgressBar.remove_bar(bar) if bar
730
732
  end
731
733
 
732
734
  into
@@ -2,6 +2,7 @@ require 'lockfile'
2
2
  require 'digest/md5'
3
3
  require 'cgi'
4
4
  require 'zlib'
5
+ require 'etc'
5
6
  require 'rubygems/package'
6
7
 
7
8
  require 'rbbt/util/tar'
@@ -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
- n
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
@@ -94,7 +94,8 @@ module Open
94
94
  end
95
95
 
96
96
  begin
97
- wget_options = options.merge( '-O' => '-')
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
@@ -25,5 +25,4 @@ file = STDIN if file == '-'
25
25
 
26
26
  tsv = TSV.open file, :merge => true, :type => :double
27
27
 
28
-
29
28
  puts tsv.to_unmerged_expanded_s
@@ -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.12
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-14 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake