origen 0.60.7 → 0.60.8

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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/config/rubocop/easy.yml +4875 -308
  3. data/config/rubocop/strict.yml +4875 -308
  4. data/config/version.rb +1 -1
  5. data/lib/origen/application/configuration.rb +6 -3
  6. data/lib/origen/application/deployer.rb +4 -4
  7. data/lib/origen/application/environment.rb +4 -2
  8. data/lib/origen/application/lsf.rb +23 -4
  9. data/lib/origen/application/lsf_manager.rb +48 -52
  10. data/lib/origen/application/plugins.rb +7 -7
  11. data/lib/origen/application/release.rb +5 -3
  12. data/lib/origen/application/runner.rb +5 -6
  13. data/lib/origen/application/statistics.rb +1 -0
  14. data/lib/origen/application/target.rb +9 -6
  15. data/lib/origen/application/version_tracker.rb +4 -5
  16. data/lib/origen/application/workspace_manager.rb +5 -2
  17. data/lib/origen/application.rb +9 -9
  18. data/lib/origen/boot/api.rb +3 -0
  19. data/lib/origen/boot/app.rb +28 -30
  20. data/lib/origen/boot.rb +1 -0
  21. data/lib/origen/bugs.rb +2 -2
  22. data/lib/origen/chip_mode.rb +7 -4
  23. data/lib/origen/chip_package.rb +50 -53
  24. data/lib/origen/chips/chip.rb +8 -4
  25. data/lib/origen/chips.rb +16 -12
  26. data/lib/origen/client.rb +1 -0
  27. data/lib/origen/clocks/clock.rb +8 -7
  28. data/lib/origen/clocks/clocks_collection.rb +2 -1
  29. data/lib/origen/code_generators/actions.rb +1 -1
  30. data/lib/origen/code_generators/base.rb +1 -1
  31. data/lib/origen/code_generators.rb +3 -0
  32. data/lib/origen/commands/archive.rb +1 -1
  33. data/lib/origen/commands/compile.rb +2 -2
  34. data/lib/origen/commands/fetch.rb +1 -1
  35. data/lib/origen/commands/generate.rb +3 -3
  36. data/lib/origen/commands/interactive.rb +6 -7
  37. data/lib/origen/commands/lint.rb +1 -1
  38. data/lib/origen/commands/lsf.rb +2 -2
  39. data/lib/origen/commands/new.rb +1 -1
  40. data/lib/origen/commands/plugin.rb +2 -2
  41. data/lib/origen/commands/program.rb +3 -3
  42. data/lib/origen/commands/rc.rb +4 -4
  43. data/lib/origen/commands/save.rb +1 -1
  44. data/lib/origen/commands/time.rb +4 -6
  45. data/lib/origen/commands/web.rb +5 -2
  46. data/lib/origen/commands.rb +1 -1
  47. data/lib/origen/componentable.rb +1 -0
  48. data/lib/origen/controller.rb +11 -13
  49. data/lib/origen/core_ext/array.rb +2 -1
  50. data/lib/origen/core_ext/enumerable.rb +4 -2
  51. data/lib/origen/core_ext/hash.rb +5 -6
  52. data/lib/origen/core_ext/integer.rb +2 -4
  53. data/lib/origen/core_ext/object.rb +2 -2
  54. data/lib/origen/core_ext/option_parser/optparse.rb +1 -1
  55. data/lib/origen/core_ext/string.rb +8 -8
  56. data/lib/origen/database/key_value_store.rb +12 -14
  57. data/lib/origen/database/key_value_stores.rb +1 -0
  58. data/lib/origen/errata/hw_erratum.rb +1 -1
  59. data/lib/origen/errata.rb +7 -8
  60. data/lib/origen/features/feature.rb +1 -0
  61. data/lib/origen/features.rb +4 -6
  62. data/lib/origen/file_handler.rb +8 -7
  63. data/lib/origen/fuses/fuse_field.rb +2 -2
  64. data/lib/origen/generator/compiler.rb +2 -4
  65. data/lib/origen/generator/job.rb +3 -2
  66. data/lib/origen/generator/pattern.rb +3 -3
  67. data/lib/origen/generator/pattern_finder.rb +6 -5
  68. data/lib/origen/generator/pattern_sequence.rb +3 -0
  69. data/lib/origen/generator/renderer.rb +3 -4
  70. data/lib/origen/generator/resources.rb +1 -1
  71. data/lib/origen/generator/stage.rb +3 -0
  72. data/lib/origen/limits/limit.rb +14 -11
  73. data/lib/origen/limits/limit_set.rb +2 -1
  74. data/lib/origen/loader.rb +4 -2
  75. data/lib/origen/log.rb +3 -2
  76. data/lib/origen/memory.rb +1 -0
  77. data/lib/origen/model.rb +10 -4
  78. data/lib/origen/models.rb +2 -2
  79. data/lib/origen/netlist/list.rb +1 -0
  80. data/lib/origen/netlist.rb +5 -7
  81. data/lib/origen/org_file/interceptor.rb +1 -1
  82. data/lib/origen/org_file.rb +4 -1
  83. data/lib/origen/parameters/set.rb +1 -0
  84. data/lib/origen/parameters.rb +3 -1
  85. data/lib/origen/pins/pin.rb +18 -12
  86. data/lib/origen/pins/pin_bank.rb +3 -0
  87. data/lib/origen/pins/pin_clock.rb +3 -2
  88. data/lib/origen/pins/pin_collection.rb +3 -0
  89. data/lib/origen/pins/timing/wave.rb +5 -0
  90. data/lib/origen/pins.rb +7 -1
  91. data/lib/origen/ports.rb +1 -1
  92. data/lib/origen/power_domains/power_domain.rb +5 -2
  93. data/lib/origen/power_domains/power_domains_collection.rb +2 -1
  94. data/lib/origen/registers/bit.rb +21 -17
  95. data/lib/origen/registers/bit_collection.rb +15 -6
  96. data/lib/origen/registers/reg.rb +34 -28
  97. data/lib/origen/registers.rb +25 -24
  98. data/lib/origen/remote_manager.rb +3 -2
  99. data/lib/origen/revision_control/base.rb +1 -4
  100. data/lib/origen/revision_control/design_sync.rb +10 -10
  101. data/lib/origen/revision_control/git.rb +4 -2
  102. data/lib/origen/site_config/config.rb +3 -1
  103. data/lib/origen/site_config.rb +3 -0
  104. data/lib/origen/specs/checkers.rb +12 -8
  105. data/lib/origen/specs/doc_resource.rb +3 -4
  106. data/lib/origen/specs/spec.rb +5 -1
  107. data/lib/origen/specs/version_history.rb +1 -1
  108. data/lib/origen/specs.rb +52 -37
  109. data/lib/origen/sub_blocks.rb +20 -14
  110. data/lib/origen/top_level.rb +2 -1
  111. data/lib/origen/users/user.rb +4 -5
  112. data/lib/origen/utility/csv_data.rb +6 -4
  113. data/lib/origen/utility/diff.rb +9 -9
  114. data/lib/origen/utility/file_diff.rb +4 -0
  115. data/lib/origen/utility/input_capture.rb +6 -6
  116. data/lib/origen/utility/mailer.rb +8 -11
  117. data/lib/origen/utility/time_and_date.rb +1 -2
  118. data/lib/origen/utility.rb +2 -2
  119. data/lib/origen/value.rb +2 -1
  120. data/lib/origen/version_string.rb +33 -41
  121. data/lib/origen.rb +62 -64
  122. data/origen_app_generators/origen_app_generators.gemspec +1 -1
  123. metadata +9 -27
  124. data/config/rubocop/easy_disabled.yml +0 -275
  125. data/config/rubocop/easy_enabled.yml +0 -727
  126. data/config/rubocop/strict_disabled.yml +0 -251
  127. data/config/rubocop/strict_enabled.yml +0 -751
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 60
4
- BUGFIX = 7
4
+ BUGFIX = 8
5
5
  DEV = nil
6
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
7
7
  end
@@ -10,9 +10,9 @@ module Origen
10
10
  :history_file, :release_directory, :release_email_subject,
11
11
  :production_targets,
12
12
  :vault, :output_directory, :reference_directory,
13
- :semantically_version, :log_directory, :pattern_name_translator,
13
+ :semantically_version, :log_directory,
14
14
  :pattern_directory, :pattern_output_directory, :pattern_prefix, :pattern_postfix,
15
- :pattern_header, :default_lsf_action, :release_instructions, :proceed_with_pattern,
15
+ :pattern_header, :default_lsf_action, :release_instructions,
16
16
  :test_program_output_directory, :erb_trim_mode, :test_program_source_directory,
17
17
  :test_program_template_directory, :referenced_pattern_list, :program_prefix,
18
18
  :copy_command, :diff_command, :compile_only_dot_erb_files, :web_directory,
@@ -22,6 +22,8 @@ module Origen
22
22
  :user_aliases, :release_externally, :gem_name, :disqus_shortname,
23
23
  :default_plugin, :rc_tag_prepend_v
24
24
 
25
+ attr_writer :pattern_name_translator, :proceed_with_pattern
26
+
25
27
  # Mark any attributes that are likely to depend on properties of the target here,
26
28
  # this will raise an error if they are ever accessed before the target has been
27
29
  # instantiated (a concern for Origen core developers only).
@@ -54,7 +56,7 @@ module Origen
54
56
  ]
55
57
 
56
58
  ATTRS_THAT_ARE_SET_TO_A_BLOCK = [
57
- :current_plugin_pattern_header, :application_pattern_header, :shared_pattern_header, #:pattern_footer
59
+ :current_plugin_pattern_header, :application_pattern_header, :shared_pattern_header # :pattern_footer
58
60
  ]
59
61
 
60
62
  def log_deprecations
@@ -134,6 +136,7 @@ module Origen
134
136
  depend_on_target: true
135
137
  }.merge(options)
136
138
  attr_writer name
139
+
137
140
  define_method name do |override = true, &block|
138
141
  if block # _given?
139
142
  instance_variable_set("@#{name}".to_sym, block)
@@ -134,7 +134,7 @@ module Origen
134
134
  # Delete everything so that we don't preserve old files
135
135
  git_repo.delete_all(git_sub_dir)
136
136
  FileUtils.mkdir_p(dir) unless File.exist?(dir)
137
- `chmod a+w -R #{Origen.root}/web/output` # Ensure world writable, required?
137
+ `chmod a+w -R #{Origen.root}/web/output` # Ensure world writable, required?
138
138
  FileUtils.cp_r "#{Origen.root}/web/output/.", dir
139
139
  git_repo.checkin git_sub_dir, unmanaged: true, comment: @commit_message
140
140
  else
@@ -144,9 +144,9 @@ module Origen
144
144
  require_remote_directories
145
145
  end
146
146
  # Copy the new contents across
147
- `chmod g+w -R #{Origen.root}/web/output` # Ensure group writable
147
+ `chmod g+w -R #{Origen.root}/web/output` # Ensure group writable
148
148
  FileUtils.cp_r "#{Origen.root}/web/output/.", offline_remote_directory
149
- `chmod g+w -R #{offline_remote_directory}` # Double ensure group writable
149
+ `chmod g+w -R #{offline_remote_directory}` # Double ensure group writable
150
150
  # Make live
151
151
  create_symlink offline_remote_directory, latest_symlink
152
152
  index = "#{Origen.config.web_directory}/index.html"
@@ -162,7 +162,7 @@ module Origen
162
162
  remote_dir = deploy_to_git? ? "#{git_repo.local}/#{git_sub_dir}" : live_remote_directory
163
163
  if remote_dir
164
164
  file = Origen.file_handler.clean_path_to(file)
165
- sub_dir = Origen.file_handler.sub_dir_of(file, "#{Origen.root}/templates/web") .to_s
165
+ sub_dir = Origen.file_handler.sub_dir_of(file, "#{Origen.root}/templates/web").to_s
166
166
  page = file.basename.to_s.sub(/\..*/, '')
167
167
  # Special case for the main index page
168
168
  if page == 'index' && sub_dir == '.'
@@ -14,7 +14,7 @@ module Origen
14
14
  # An instance of this class is automatically
15
15
  # instantiated and available globally as Origen.environment.
16
16
  class Environment
17
- DIR = "#{Origen.root}/environment" # :nodoc:
17
+ DIR = "#{Origen.root}/environment" # :nodoc:
18
18
  SAVE_FILE = "#{DIR}/.default" # :nodoc:
19
19
  DEFAULT_FILE = "#{DIR}/default.rb" # :nodoc:
20
20
 
@@ -89,7 +89,7 @@ module Origen
89
89
 
90
90
  # Prints out the current environment details to the command line
91
91
  def describe
92
- f = self.file!
92
+ f = file!
93
93
  puts "Current environment: #{f.basename}"
94
94
  puts '*' * 70
95
95
  File.open(f).each do |line|
@@ -133,6 +133,7 @@ module Origen
133
133
  # otherwise returns nil
134
134
  def default_file
135
135
  return @default_file if @default_file
136
+
136
137
  if File.exist?(SAVE_FILE)
137
138
  File.open(SAVE_FILE) do |f|
138
139
  @default_file = Marshal.load(f)
@@ -146,6 +147,7 @@ module Origen
146
147
  # Returns the environment file (a Pathname object) if it has been defined, otherwise nil
147
148
  def file # :nodoc:
148
149
  return @file if @file
150
+
149
151
  if default_file && File.exist?(default_file)
150
152
  @file = default_file
151
153
  end
@@ -34,6 +34,14 @@ module Origen
34
34
  # - wam WAM cron processing
35
35
  # - grid Low-priority batch jobs (random sim, regressions, etc). Access to all spare CPU cycles.
36
36
  attr_accessor :cores
37
+ # default 400. Set number of max jobs (- 100) to be able to run by this user before lsf submission pauses.
38
+ # eg if max jobs you want ran is 500, set to 400, which will block until local submissions
39
+ # is less than 400 at which point it can batch submit up to 100 more jobs
40
+ attr_accessor :max_jobs
41
+ # default false. used when calculating remote job count for comparison with the max jobs parameter
42
+ # If set to true, then only jobs of the specified queue will be counted, effectively making
43
+ # the max_jobs value a max_jobs per queue
44
+ attr_accessor :queue_count_only
37
45
 
38
46
  def initialize
39
47
  @group = Origen.site_config.lsf_group
@@ -42,6 +50,8 @@ module Origen
42
50
  @queue = Origen.site_config.lsf_queue
43
51
  @debug = Origen.site_config.lsf_debug
44
52
  @cores = Origen.site_config.lsf_cores
53
+ @max_jobs = Origen.site_config.lsf_max_jobs || 400
54
+ @queue_count_only = Origen.site_config.lsf_queue_count_only || false
45
55
  end
46
56
  end
47
57
 
@@ -80,7 +90,7 @@ module Origen
80
90
  def submit(command, options = {})
81
91
  options = {
82
92
  dependents: [],
83
- rerunnable: true, # Will rerun automatically if the execution host fails
93
+ rerunnable: true # Will rerun automatically if the execution host fails
84
94
  }.merge(options)
85
95
  limit_job_submissions do
86
96
  group = options[:group] || config.group
@@ -103,7 +113,7 @@ module Origen
103
113
  cmd = "bsub -oo /dev/null #{dependents} #{rerunnable} #{group} #{project} #{resource} #{queue} #{cores} '#{command}'"
104
114
  if config.debug
105
115
  puts cmd
106
- '496212' # Return a dummy ID to keep the caller happy
116
+ '496212' # Return a dummy ID to keep the caller happy
107
117
  else
108
118
  output = `#{cmd}`
109
119
  Origen.log.info output.strip
@@ -140,7 +150,16 @@ module Origen
140
150
  i = 0
141
151
  `bjobs 2>&1`.split("\n").each do |line|
142
152
  if line =~ /^(\d+).*(RUN|PEND)/
143
- i += 1
153
+ if @queue_count_only && @queue
154
+ # only count jobs for current queue, helpful for when
155
+ # you have a service account user that runs lsf for a
156
+ # lot of jobs in addition to origen jobs
157
+ if line =~ /#{@queue}/
158
+ i += 1
159
+ end
160
+ else
161
+ i += 1
162
+ end
144
163
  end
145
164
  end
146
165
  i
@@ -152,7 +171,7 @@ module Origen
152
171
  def limit_job_submissions
153
172
  @local_job_count ||= 0
154
173
  if @local_job_count == 100
155
- while remote_jobs_count > 400
174
+ while remote_jobs_count > @max_jobs
156
175
  puts 'Waiting for submitted jobs count to fall below limit...'
157
176
  sleep 5
158
177
  end
@@ -209,7 +209,7 @@ module Origen
209
209
  if options[:type] == :all
210
210
  File.delete(remote_jobs_file) if File.exist?(remote_jobs_file)
211
211
  @remote_jobs = {}
212
- return
212
+ nil
213
213
  else
214
214
  send("#{options[:type]}_jobs").each do |job|
215
215
  remote_jobs.delete(job[:id])
@@ -278,54 +278,53 @@ module Origen
278
278
  # New files: 0
279
279
  # Changed files: 0
280
280
  # FAILED files: 1
281
- begin
282
- line.gsub!(/\e\[\d+m/, '') # Remove any coloring
283
- if line =~ /Total patterns:\s+(\d+)/
284
- @completed_patterns = Regexp.last_match[1].to_i
285
- elsif line =~ /Total vectors:\s+(\d+)/
286
- @total_vectors = Regexp.last_match[1].to_i
287
- elsif line =~ /Total duration:\s+(\d+\.\d+)/
288
- @total_duration = Regexp.last_match[1].to_f
289
- elsif line =~ /Total files:\s+(\d+)/
290
- @completed_files = Regexp.last_match[1].to_i
291
- elsif line =~ /Changed patterns:\s+(\d+)/
292
- @changed_patterns = Regexp.last_match[1].to_i
293
- elsif line =~ /Changed files:\s+(\d+)/
294
- @changed_files = Regexp.last_match[1].to_i
295
- elsif line =~ /New patterns:\s+(\d+)/
296
- @new_patterns = Regexp.last_match[1].to_i
297
- elsif line =~ /New files:\s+(\d+)/
298
- @new_files = Regexp.last_match[1].to_i
299
- elsif line =~ /FAILED patterns:\s+(\d+)/
300
- @failed_patterns = Regexp.last_match[1].to_i
301
- elsif line =~ /FAILED files:\s+(\d+)/
302
- @failed_files = Regexp.last_match[1].to_i
303
- elsif line =~ /ERROR!/
304
- stats.errors += 1
305
- Origen.log.send :relog, line, options
281
+
282
+ line.gsub!(/\e\[\d+m/, '') # Remove any coloring
283
+ if line =~ /Total patterns:\s+(\d+)/
284
+ @completed_patterns = Regexp.last_match[1].to_i
285
+ elsif line =~ /Total vectors:\s+(\d+)/
286
+ @total_vectors = Regexp.last_match[1].to_i
287
+ elsif line =~ /Total duration:\s+(\d+\.\d+)/
288
+ @total_duration = Regexp.last_match[1].to_f
289
+ elsif line =~ /Total files:\s+(\d+)/
290
+ @completed_files = Regexp.last_match[1].to_i
291
+ elsif line =~ /Changed patterns:\s+(\d+)/
292
+ @changed_patterns = Regexp.last_match[1].to_i
293
+ elsif line =~ /Changed files:\s+(\d+)/
294
+ @changed_files = Regexp.last_match[1].to_i
295
+ elsif line =~ /New patterns:\s+(\d+)/
296
+ @new_patterns = Regexp.last_match[1].to_i
297
+ elsif line =~ /New files:\s+(\d+)/
298
+ @new_files = Regexp.last_match[1].to_i
299
+ elsif line =~ /FAILED patterns:\s+(\d+)/
300
+ @failed_patterns = Regexp.last_match[1].to_i
301
+ elsif line =~ /FAILED files:\s+(\d+)/
302
+ @failed_files = Regexp.last_match[1].to_i
303
+ elsif line =~ /ERROR!/
304
+ stats.errors += 1
305
+ Origen.log.send :relog, line, options
306
+ else
307
+ # Compress multiple blank lines
308
+ if line =~ /^\s*$/ || line =~ /.*\|\|\s*$/
309
+ unless last_line_blank
310
+ Origen.log.send(log_method, nil)
311
+ last_line_blank = true
312
+ end
306
313
  else
307
- # Compress multiple blank lines
308
- if line =~ /^\s*$/ || line =~ /.*\|\|\s*$/
309
- unless last_line_blank
310
- Origen.log.send(log_method, nil)
311
- last_line_blank = true
312
- end
313
- else
314
- # Screen std origen output
315
- unless line =~ / origen save/ ||
316
- line =~ /Insecure world writable dir/ ||
317
- line =~ /To save all of/
318
- line.strip!
319
- Origen.log.send :relog, line, options
320
- last_line_blank = false
321
- end
314
+ # Screen std origen output
315
+ unless line =~ / origen save/ ||
316
+ line =~ /Insecure world writable dir/ ||
317
+ line =~ /To save all of/
318
+ line.strip!
319
+ Origen.log.send :relog, line, options
320
+ last_line_blank = false
322
321
  end
323
322
  end
324
- rescue
325
- # Sometimes illegal UTF-8 characters can get into crash dumps, if this
326
- # happens just print the line out rather than die
327
- Origen.log.error line
328
323
  end
324
+ rescue
325
+ # Sometimes illegal UTF-8 characters can get into crash dumps, if this
326
+ # happens just print the line out rather than die
327
+ Origen.log.error line
329
328
  end
330
329
  end
331
330
  stats.completed_patterns += @completed_patterns
@@ -628,11 +627,9 @@ module Origen
628
627
  def restore_remote_jobs
629
628
  if File.exist?(remote_jobs_file)
630
629
  File.open(remote_jobs_file) do |f|
631
- begin
632
- Marshal.load(f)
633
- rescue
634
- nil
635
- end
630
+ Marshal.load(f)
631
+ rescue
632
+ nil
636
633
  end
637
634
  end
638
635
  end
@@ -655,8 +652,7 @@ module Origen
655
652
  poll_duration_in_seconds: 1,
656
653
  # Don't wait long by the time this runs the LSF
657
654
  # should have guaranteed the job has run
658
- timeout_in_seconds: 120
659
- )
655
+ timeout_in_seconds: 120)
660
656
  unless options[:dependents].all? { |id| job_passed?(id) }
661
657
  File.open(log_file(options[:id]), 'w') do |f|
662
658
  f.puts "*** ERROR! *** #{options[:cmd].join(' ')} ***"
@@ -38,13 +38,13 @@ module Origen
38
38
  def current
39
39
  return nil if @temporary == :none
40
40
  return nil if @disabled
41
- name = @temporary || @current ||= begin
42
- if Origen.app.session.origen_core[:default_plugin]
43
- Origen.app.session.origen_core[:default_plugin]
44
- elsif Origen.app.config.default_plugin && !Origen.app.session.origen_core[:default_plugin_cleared_by_user]
45
- Origen.app.config.default_plugin
46
- end
47
- end
41
+
42
+ name = @temporary || @current ||= if Origen.app.session.origen_core[:default_plugin]
43
+ Origen.app.session.origen_core[:default_plugin]
44
+ elsif Origen.app.config.default_plugin && !Origen.app.session.origen_core[:default_plugin_cleared_by_user]
45
+ Origen.app.config.default_plugin
46
+ end
47
+
48
48
  find { |p| p.name.to_sym == name } if name
49
49
  end
50
50
 
@@ -32,6 +32,7 @@ module Origen
32
32
  if authorized?
33
33
  Origen.app.plugins.validate_production_status(true)
34
34
  fail 'No revision control configured for this application, cannot release a new version' if Origen.app.rc.nil?
35
+
35
36
  unless Origen.app.rc.local_modifications.empty?
36
37
  puts <<-EOT
37
38
  Your workspace has local modifications that are preventing the requested action
@@ -50,15 +51,16 @@ Your workspace has local modifications that are preventing the requested action
50
51
  Origen.app.listeners_for(:validate_release).each(&:validate_release)
51
52
  lint_test
52
53
  get_latest_version_files
53
- base_version = Origen.app.version(refresh: true) # Read in the latest version
54
+ base_version = Origen.app.version(refresh: true) # Read in the latest version
54
55
  get_release_note unless note
55
- new_version = get_or_confirm_version(type) # Don't mask this like the above!
56
+ new_version = get_or_confirm_version(type) # Don't mask this like the above!
56
57
  write_version(new_version)
57
58
  # Refresh the version in the current thread
58
59
  Origen.app.version(refresh: true)
59
60
  if Origen.app.version != new_version
60
61
  fail "Sorry something has gone wrong trying to update the version counter to #{new_version}!"
61
62
  end
63
+
62
64
  Origen.app.version_tracker.add_version(Origen.app.version) if Origen.app.version.production?
63
65
  write_history
64
66
  Origen.app.listeners_for(:before_release_tag).each do |listener|
@@ -103,7 +105,7 @@ Your workspace has local modifications that are preventing the requested action
103
105
  end
104
106
 
105
107
  def release_gem
106
- if File.exist?(File.join Origen.root, "#{Origen.app.gem_name}.gemspec")
108
+ if File.exist?(File.join(Origen.root, "#{Origen.app.gem_name}.gemspec"))
107
109
  Origen.app.listeners_for(:before_release_gem).each(&:before_release_gem)
108
110
  unless system 'rake gem:release'
109
111
  puts '***************************************'.red
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  module Origen
3
3
  class Application
4
- autoload :Statistics, 'origen/application/statistics'
4
+ autoload :Statistics, 'origen/application/statistics'
5
5
 
6
6
  # The Runner is responsible for co-ordinating all compile and generate
7
7
  # requests from the command line
@@ -140,15 +140,13 @@ module Origen
140
140
  # Only record user invocations at this time, also bypass windows since it seems
141
141
  # that threads can't be trusted not to block
142
142
  unless Origen.running_remotely? # || Origen.running_on_windows?
143
- # rubocop:disable Style/RescueModifier
144
143
  record_invocation = Thread.new do
145
144
  Origen.client.record_invocation(options[:action]) if options[:action]
146
- rescue
145
+ rescue
147
146
  # Dont allow server being down to flood the screen with the stacktrace
148
147
  end
149
- # rubocop:enable Style/RescueModifier
150
148
  end
151
- rescue
149
+ rescue
152
150
  # Don't allow this to kill an origen command
153
151
  end
154
152
  end
@@ -164,7 +162,7 @@ module Origen
164
162
  record_invocation.value
165
163
  end
166
164
  end
167
- rescue
165
+ rescue
168
166
  # Don't allow this to kill an origen command
169
167
  end
170
168
  end
@@ -174,6 +172,7 @@ module Origen
174
172
  # things like :compile => true, the extract_action method handles the old code
175
173
  def extract_action(options)
176
174
  return options[:action] if options[:action]
175
+
177
176
  if options[:compile]
178
177
  :compile
179
178
  elsif options[:program]
@@ -10,6 +10,7 @@ module Origen
10
10
 
11
11
  class Pattern
12
12
  attr_accessor :vectors, :cycles, :duration
13
+
13
14
  def initialize
14
15
  @vectors = 0
15
16
  @cycles = 0
@@ -12,7 +12,7 @@ module Origen
12
12
  # An instance of this class is automatically instantiated and available globally
13
13
  # as Origen.app.target
14
14
  class Target
15
- DIR = "#{Origen.root}/target" # :nodoc:
15
+ DIR = "#{Origen.root}/target" # :nodoc:
16
16
  SAVE_FILE = "#{DIR}/.default" # :nodoc:
17
17
  DEFAULT_FILE = "#{DIR}/default.rb" # :nodoc:
18
18
 
@@ -34,7 +34,7 @@ module Origen
34
34
  def loop(options = {})
35
35
  options = {
36
36
  set_target: true,
37
- force_debug: false, # Set true to force debug mode for all targets
37
+ force_debug: false # Set true to force debug mode for all targets
38
38
  }.merge(options)
39
39
  targets = [options.delete(:target), options.delete(:targets)].flatten.compact.uniq
40
40
  targets = [file!.basename.to_s] if targets.empty?
@@ -57,7 +57,7 @@ module Origen
57
57
  # end
58
58
  def each_production(options = {})
59
59
  options = {
60
- force_debug: false, # Set true to force debug mode for all targets
60
+ force_debug: false # Set true to force debug mode for all targets
61
61
  }.merge(options)
62
62
  prod_targets.each do |moo, targets|
63
63
  [targets].flatten.each do |target|
@@ -79,7 +79,7 @@ module Origen
79
79
  # end
80
80
  def each_unique_production(options = {})
81
81
  options = {
82
- force_debug: false, # Set true to force debug mode for all targets
82
+ force_debug: false # Set true to force debug mode for all targets
83
83
  }.merge(options)
84
84
  targets = {}
85
85
  prod_targets.each do |moo, moos_targets|
@@ -118,7 +118,7 @@ module Origen
118
118
  # defined there.
119
119
  def load!(options = {})
120
120
  options = {
121
- force_debug: false, # Set true to force debug mode for all targets
121
+ force_debug: false # Set true to force debug mode for all targets
122
122
  }.merge(options)
123
123
  Origen.app.load_target!(options)
124
124
  end
@@ -235,7 +235,7 @@ module Origen
235
235
 
236
236
  # Prints out the current target details to the command line
237
237
  def describe
238
- f = self.file!
238
+ f = file!
239
239
  puts "Current target: #{f.basename}"
240
240
  puts '*' * 70
241
241
  File.open(f).each do |line|
@@ -279,6 +279,7 @@ module Origen
279
279
  # otherwise returns nil
280
280
  def default_file
281
281
  return @default_file if @default_file
282
+
282
283
  if File.exist?(SAVE_FILE)
283
284
  File.open(SAVE_FILE) do |f|
284
285
  @default_file = Marshal.load(f)
@@ -292,6 +293,7 @@ module Origen
292
293
  # Returns the target file (a Pathname object) if it has been defined, otherwise nil
293
294
  def file # :nodoc:
294
295
  return @file if @file
296
+
295
297
  if default_file && File.exist?(default_file)
296
298
  @file = default_file
297
299
  end
@@ -374,6 +376,7 @@ module Origen
374
376
  def prod_targets # :nodoc:
375
377
  return {} unless Origen.config.production_targets
376
378
  return @prod_targets if @prod_targets
379
+
377
380
  @prod_targets = {}
378
381
  Origen.config.production_targets.each do |key, value|
379
382
  @prod_targets[key.upcase] = value
@@ -21,13 +21,12 @@ module Origen
21
21
  # Returns the persisted storage container (a Hash)
22
22
  def storage
23
23
  return @storage if @storage
24
+
24
25
  if File.exist?(STORAGE_FILE)
25
26
  File.open(STORAGE_FILE) do |f|
26
- begin
27
- @storage = Marshal.load(f)
28
- rescue
29
- @storage = {}
30
- end
27
+ @storage = Marshal.load(f)
28
+ rescue
29
+ @storage = {}
31
30
  end
32
31
  else
33
32
  @storage = {}
@@ -50,6 +50,7 @@ module Origen
50
50
  # all imported application workspaces
51
51
  def imports_directory
52
52
  return @imports_directory if @imports_directory
53
+
53
54
  old = "#{container_directory}/#{revision_control_root.basename}_imports_DO_NOT_HAND_MODIFY"
54
55
  @imports_directory = "#{container_directory}/.#{revision_control_root.basename}_imports_DO_NOT_HAND_MODIFY"
55
56
  FileUtils.rm_rf(old) if File.exist?(old)
@@ -60,6 +61,7 @@ module Origen
60
61
  # all remotes workspaces
61
62
  def remotes_directory
62
63
  return @remotes_directory if @remotes_directory
64
+
63
65
  old = "#{container_directory}/#{revision_control_root.basename}_remotes_DO_NOT_HAND_MODIFY"
64
66
  @remotes_directory = "#{container_directory}/.#{revision_control_root.basename}_remotes_DO_NOT_HAND_MODIFY"
65
67
  FileUtils.rm_rf(old) if File.exist?(old)
@@ -86,7 +88,7 @@ module Origen
86
88
  remote_ref = "#{origen_root(workspace)}/.ref"
87
89
  unless File.exist?(remote_ref)
88
90
  FileUtils.mkdir_p(remote_ref)
89
- `touch #{remote_ref}/dont_delete` # Make sure the pop does not blow this away
91
+ `touch #{remote_ref}/dont_delete` # Make sure the pop does not blow this away
90
92
  end
91
93
  if Origen.running_on_windows?
92
94
  system("call mklink /h #{reference_dir} #{remote_ref}")
@@ -113,6 +115,7 @@ module Origen
113
115
  if File.exist?(path.to_s) && !options[:allow_rebuild]
114
116
  fail "Sorry but #{path} already exists!"
115
117
  end
118
+
116
119
  FileUtils.rm_rf(path.to_s) if File.exist?(path.to_s)
117
120
  rc = RevisionControl.new options.merge(remote: options[:rc_url], local: path.to_s)
118
121
  rc.build
@@ -121,7 +124,7 @@ module Origen
121
124
  # Switches the given workspace path to the given version tag
122
125
  def switch_version(workspace, tag, options = {})
123
126
  options = {
124
- origen_root_only: false, # When true pop the Origen.root dir only instead
127
+ origen_root_only: false # When true pop the Origen.root dir only instead
125
128
  # of the whole application workspace - these may or may
126
129
  # not be the same thing depending on the application.
127
130
  }.merge(options)
@@ -23,8 +23,8 @@ module Origen
23
23
  require 'origen/users'
24
24
  include Origen::Users
25
25
 
26
- attr_accessor :name
27
- attr_accessor :namespace
26
+ attr_writer :name # attr_accessor leads to a duplicate method
27
+ attr_writer :namespace # attr_accessor leads to a duplicate method
28
28
 
29
29
  class << self
30
30
  def inherited(base)
@@ -84,6 +84,7 @@ module Origen
84
84
  @apps_by_namespace ||= {}
85
85
  @apps_by_namespace[namespace] ||= begin
86
86
  return Origen.app if Origen.app.namespace == namespace
87
+
87
88
  Origen.app.plugins.each do |plugin|
88
89
  return plugin if plugin.namespace == namespace
89
90
  end
@@ -105,7 +106,7 @@ module Origen
105
106
  include Rake::DSL
106
107
 
107
108
  def load_tasks
108
- $VERBOSE = nil # Don't care about world writable dir warnings and the like
109
+ $VERBOSE = nil # Don't care about world writable dir warnings and the like
109
110
  require 'colored'
110
111
 
111
112
  # Load all Origen tasks first
@@ -463,12 +464,14 @@ END
463
464
  if max && listeners.size > max
464
465
  fail "You can only define a #{callback} callback #{max > 1 ? (max.to_s + 'times') : 'once'}, however you have declared it #{listeners.size} times for instances of: #{listeners.map(&:class)}"
465
466
  end
467
+
466
468
  listeners
467
469
  end
468
470
 
469
471
  def version(options = {})
470
472
  @version = nil if options[:refresh]
471
473
  return @version if @version
474
+
472
475
  if Origen.running_globally?
473
476
  @version = Origen.version
474
477
  else
@@ -567,6 +570,7 @@ END
567
570
  if capture && line =~ /^#+ by (.*) on (.*(AM|PM))/
568
571
  user = Origen.fsl.find_by_name(Regexp.last_match(1))
569
572
  return user if user
573
+
570
574
  return Regexp.last_match(1)
571
575
  end
572
576
  else
@@ -871,7 +875,7 @@ END
871
875
  # declares here, the objects registered with origen should be refreshed accordingly
872
876
  clear_dynamic_resources
873
877
  load_event(:transient) do
874
- Origen.mode = Origen.app.session.origen_core[:mode] || :production # Important since a production target may rely on the default
878
+ Origen.mode = Origen.app.session.origen_core[:mode] || :production # Important since a production target may rely on the default
875
879
  begin
876
880
  $_target_options = @target_load_options
877
881
  Origen.target.set_signature(@target_load_options)
@@ -1028,14 +1032,10 @@ END
1028
1032
  # When debug is enabled, exception_class will be raised, defaulting to <code>RuntimeError</code>.
1029
1033
  def fail!(message: nil, exception_class: RuntimeError, exit_status: 1)
1030
1034
  if Origen.debug?
1031
- # rubocop:disable Style/RedundantSelf
1032
1035
  self.fail(message: message, exception_class: exception_class)
1033
- # rubocop:enable Style/RedundantSelf
1034
1036
  else
1035
1037
  begin
1036
- # rubocop:disable Style/RedundantSelf
1037
1038
  self.fail(message: message, exception_class: exception_class)
1038
- # rubocop:enable Style/RedundantSelf
1039
1039
  rescue exception_class => e
1040
1040
  Origen.log.error(e.message)
1041
1041
  exit exit_status
@@ -1051,7 +1051,7 @@ END
1051
1051
  # require "my_backend" # in lib/my_backend
1052
1052
  # config.i18n.backend = MyBackend
1053
1053
  # end
1054
- def add_lib_to_load_path! #:nodoc:
1054
+ def add_lib_to_load_path! # :nodoc:
1055
1055
  [root.join('lib'), root.join('vendor', 'lib'), root.join('app', 'lib')].each do |path|
1056
1056
  $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)
1057
1057
  end
@@ -8,6 +8,9 @@ module Origen
8
8
 
9
9
  # Platform independent means of retrieving the hostname
10
10
  def self.hostname
11
+ # gethostbyname is deprecated in favor of Addrinfo#getaddrinfo
12
+ # rubocop:disable Lint/DeprecatedClassMethods
11
13
  Socket.gethostbyname(Socket.gethostname).first.downcase
14
+ # rubocop:enable Lint/DeprecatedClassMethods
12
15
  end
13
16
  end