origen 0.36.1 → 0.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/version.rb +2 -2
- data/lib/origen.rb +0 -6
- data/lib/origen/boot_api.rb +13 -0
- data/lib/origen/site_config.rb +18 -15
- data/lib/origen/site_config/config.rb +37 -25
- data/vendor/lib/models/origen/export1.rb +1 -1
- data/vendor/lib/models/origen/export1/block1.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5dc0a0e894edf7f948dabf34643520bc2bf29862a484016888130663f55290
|
4
|
+
data.tar.gz: ccfe5cb101ac8cfb894e3f29a8edd4c81fb2d4f67765481af09bb8ffb22e09a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c8537554c0aa1045d3a390b84a364caf87ed28c1f6c3c500a158cee29866d51f1247c197693171ed14343c4031b07f9de5c8b6426c09848ec0698db1ad4e55
|
7
|
+
data.tar.gz: ccc58c03e5fad80a93afbb8ff507252cb7202e0f7f1aadcc45adcedeeaff613259d4ecbe3f82249c8c7d25932377f417ea807ed2e442df1afe142fe98dc7e80a
|
data/config/version.rb
CHANGED
data/lib/origen.rb
CHANGED
@@ -28,7 +28,6 @@ unless defined? RGen::ORIGENTRANSITION
|
|
28
28
|
require 'bundler'
|
29
29
|
require 'origen/undefined'
|
30
30
|
require 'origen/componentable'
|
31
|
-
require 'socket'
|
32
31
|
|
33
32
|
module Origen
|
34
33
|
autoload :Features, 'origen/features'
|
@@ -671,11 +670,6 @@ unless defined? RGen::ORIGENTRANSITION
|
|
671
670
|
end
|
672
671
|
alias_method :interactive?, :running_interactively?
|
673
672
|
|
674
|
-
# Platform independent way of retrieving the hostname
|
675
|
-
def hostname
|
676
|
-
Socket.gethostbyname(Socket.gethostname).first.downcase
|
677
|
-
end
|
678
|
-
|
679
673
|
# Returns true if Origen is running with the -d or --debug switches enabled
|
680
674
|
def debug?
|
681
675
|
@debug || false
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Helper methods here and in the required files can be used by Origen during the bootup process.
|
2
|
+
# (e.g., in site config ERB files)
|
3
|
+
# This can be expanded as needed to provide more helpers.
|
4
|
+
|
5
|
+
module Origen
|
6
|
+
require 'socket'
|
7
|
+
require_relative './operating_systems'
|
8
|
+
|
9
|
+
# Platform independent means of retrieving the hostname
|
10
|
+
def self.hostname
|
11
|
+
Socket.gethostbyname(Socket.gethostname).first.downcase
|
12
|
+
end
|
13
|
+
end
|
data/lib/origen/site_config.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module Origen
|
2
2
|
class SiteConfig
|
3
|
+
# NOTE: Gems are not allowed to be required here, only Ruby stlibs
|
3
4
|
require 'pathname'
|
4
5
|
require 'yaml'
|
5
6
|
require 'etc'
|
6
7
|
require 'erb'
|
7
|
-
require 'colored'
|
8
|
-
require 'httparty'
|
9
8
|
require_relative 'site_config/config'
|
10
9
|
|
11
|
-
#
|
12
|
-
require_relative '
|
10
|
+
# Require some useful methods from Origen without requiring the entire module
|
11
|
+
require_relative './boot_api'
|
13
12
|
|
14
13
|
TRUE_VALUES = ['true', 'TRUE', '1', 1]
|
15
14
|
FALSE_VALUES = ['false', 'FALSE', '0', 0]
|
@@ -87,7 +86,7 @@ module Origen
|
|
87
86
|
|
88
87
|
# Dynamically remove the highest instance of :var
|
89
88
|
def remove_highest(var)
|
90
|
-
|
89
|
+
configs.each do |c|
|
91
90
|
if c.has_var?(var)
|
92
91
|
return c.remove_var(var)
|
93
92
|
end
|
@@ -104,7 +103,7 @@ module Origen
|
|
104
103
|
# from lowest priority to highest.
|
105
104
|
# If [] is returned, it implies that there was no instancs of :var to be removed.
|
106
105
|
ret = []
|
107
|
-
|
106
|
+
configs.each do |c|
|
108
107
|
if c.has_var?(var)
|
109
108
|
ret << c.remove_var(var)
|
110
109
|
end
|
@@ -162,7 +161,7 @@ module Origen
|
|
162
161
|
|
163
162
|
def get_all(val)
|
164
163
|
ret = []
|
165
|
-
|
164
|
+
configs.each do |c|
|
166
165
|
if c.has_var?(val)
|
167
166
|
ret << c[val]
|
168
167
|
end
|
@@ -171,7 +170,7 @@ module Origen
|
|
171
170
|
end
|
172
171
|
|
173
172
|
def clear
|
174
|
-
|
173
|
+
configs.clear
|
175
174
|
end
|
176
175
|
|
177
176
|
def rebuild!
|
@@ -179,7 +178,7 @@ module Origen
|
|
179
178
|
end
|
180
179
|
|
181
180
|
def refresh
|
182
|
-
|
181
|
+
configs.each(&:refresh)
|
183
182
|
end
|
184
183
|
|
185
184
|
def pretty_print_configs
|
@@ -258,7 +257,7 @@ module Origen
|
|
258
257
|
else
|
259
258
|
puts "(No enviornment variable #{to_env(var)} defined)"
|
260
259
|
end
|
261
|
-
|
260
|
+
configs.each do |c|
|
262
261
|
if c.has_var?(var)
|
263
262
|
puts "#{c.path} (#{c.type}): #{c[var]}"
|
264
263
|
end
|
@@ -273,12 +272,12 @@ module Origen
|
|
273
272
|
# Inspects the config(s) at the incex given.
|
274
273
|
def inspect_configs(*config_indexes)
|
275
274
|
config_indexes.each do |i|
|
276
|
-
if i.to_i >
|
277
|
-
puts "Origen::SiteConfig: index #{i} is out of range of the available configs! Total configs: #{
|
275
|
+
if i.to_i > configs.size
|
276
|
+
puts red("Origen::SiteConfig: index #{i} is out of range of the available configs! Total configs: #{configs.size}.")
|
278
277
|
elsif i.to_i < 0
|
279
|
-
puts "Origen::SiteConfig: index #{i} is less than 0. This index is ignored."
|
278
|
+
puts red("Origen::SiteConfig: index #{i} is less than 0. This index is ignored.")
|
280
279
|
else
|
281
|
-
c =
|
280
|
+
c = configs[i.to_i]
|
282
281
|
puts "Inspecting config \##{i}"
|
283
282
|
puts "Type: #{c.type}"
|
284
283
|
puts "Path: #{c.path}"
|
@@ -350,6 +349,10 @@ module Origen
|
|
350
349
|
|
351
350
|
private
|
352
351
|
|
352
|
+
def red(message)
|
353
|
+
"\e[0;31;49m#{message}\e[0m"
|
354
|
+
end
|
355
|
+
|
353
356
|
def configs
|
354
357
|
@configs ||= configs!
|
355
358
|
end
|
@@ -375,7 +378,7 @@ module Origen
|
|
375
378
|
end
|
376
379
|
|
377
380
|
# Forces a reparse of the site configs.
|
378
|
-
# This will set the
|
381
|
+
# This will set the configs along the current path first,
|
379
382
|
# then, using those values, will add a site config at the home directory.
|
380
383
|
def configs!
|
381
384
|
# This global is set when Origen is first required, it generally means that what is considered
|
@@ -64,9 +64,9 @@ module Origen
|
|
64
64
|
def fetch
|
65
65
|
def inform_user_of_cached_file
|
66
66
|
if cached?
|
67
|
-
puts 'Origen: Site Config: Found previously cached site config. Using the older site config.'
|
67
|
+
puts yellow('Origen: Site Config: Found previously cached site config. Using the older site config.')
|
68
68
|
else
|
69
|
-
puts 'Origen: Site Config: No cached file found. An empty site config will be used in its place.'
|
69
|
+
puts yellow('Origen: Site Config: No cached file found. An empty site config will be used in its place.')
|
70
70
|
end
|
71
71
|
puts
|
72
72
|
end
|
@@ -75,36 +75,40 @@ module Origen
|
|
75
75
|
puts "Pulling centralized site config from: #{path}"
|
76
76
|
|
77
77
|
begin
|
78
|
+
# TODO: needs to be replaced with a net/http equivalent, can't use gems here. The reference
|
79
|
+
# to HTTParty will raise an error until that is done, but it will be handled gracefully below.
|
78
80
|
text = HTTParty.get(path, verify: parent.find_val('centralized_site_config_verify_ssl'))
|
79
81
|
puts "Caching centralized site config to: #{cached_file}"
|
80
82
|
|
81
83
|
unless Dir.exist?(cached_file.dirname)
|
82
84
|
FileUtils.mkdir_p(cached_file.dirname)
|
83
85
|
end
|
84
|
-
File.open(cached_file, 'w')
|
86
|
+
File.open(cached_file, 'w+') do |f|
|
87
|
+
f.write(text)
|
88
|
+
end
|
85
89
|
|
86
90
|
rescue SocketError => e
|
87
|
-
puts "Origen: Site Config: Unable to connect to #{path}"
|
88
|
-
puts 'Origen: Site Config: Failed to retrieve centralized site config!'
|
89
|
-
puts "Error from exception: #{e.message}"
|
91
|
+
puts red("Origen: Site Config: Unable to connect to #{path}")
|
92
|
+
puts red('Origen: Site Config: Failed to retrieve centralized site config!')
|
93
|
+
puts red("Error from exception: #{e.message}")
|
90
94
|
|
91
95
|
inform_user_of_cached_file
|
92
96
|
rescue OpenSSL::SSL::SSLError => e
|
93
|
-
puts "Origen: Site Config: Unable to connect to #{path}"
|
94
|
-
puts 'Origen: Site Config: Failed to retrieve centralized site config!'
|
95
|
-
puts "Error from exception: #{e.message}"
|
96
|
-
puts 'It looks like the error is related to SSL certification. If this is a trusted server, you can use
|
97
|
-
|
97
|
+
puts red("Origen: Site Config: Unable to connect to #{path}")
|
98
|
+
puts red('Origen: Site Config: Failed to retrieve centralized site config!')
|
99
|
+
puts red("Error from exception: #{e.message}")
|
100
|
+
puts red('It looks like the error is related to SSL certification. If this is a trusted server, you can use')
|
101
|
+
puts red("the site config setting 'centralized_site_config_verify_ssl' to disable verifying the SSL certificate.")
|
98
102
|
|
99
103
|
inform_user_of_cached_file
|
100
104
|
rescue Exception => e
|
101
105
|
# Rescue anything else to avoid any un-caught exceptions causing Origen not to boot.
|
102
106
|
# Print lots of red so that the users are aware that there's a problem, but don't ultimately want this
|
103
107
|
# to render Origen un-bootable
|
104
|
-
puts "Origen: Site Config: Unexpected exception ocurred trying to either retrieve or cache the site config at #{path}"
|
105
|
-
puts 'Origen: Site Config: Failed to retrieve centralized site config!'
|
106
|
-
puts "Class of exception: #{e.class}"
|
107
|
-
puts "Error from exception: #{e.message}"
|
108
|
+
puts red("Origen: Site Config: Unexpected exception ocurred trying to either retrieve or cache the site config at #{path}")
|
109
|
+
puts red('Origen: Site Config: Failed to retrieve centralized site config!')
|
110
|
+
puts red("Class of exception: #{e.class}")
|
111
|
+
puts red("Error from exception: #{e.message}")
|
108
112
|
|
109
113
|
inform_user_of_cached_file
|
110
114
|
end
|
@@ -124,22 +128,19 @@ module Origen
|
|
124
128
|
if centralized?
|
125
129
|
if !cached?
|
126
130
|
if fetch
|
127
|
-
# erb = ERB.new(File.read(cached_file), 0, '%<>')
|
128
131
|
erb = read_erb(cached_file)
|
129
132
|
else
|
130
|
-
# There was a problem fetching the
|
133
|
+
# There was a problem fetching the config. Just use an empty string.
|
131
134
|
# Warning message will come from #fetch
|
132
135
|
erb = ERB.new('')
|
133
136
|
end
|
134
137
|
else
|
135
|
-
# erb = ERB.new(File.read(cached_file), 0, '%<>')
|
136
138
|
erb = read_erb(cached_file)
|
137
139
|
end
|
138
140
|
|
139
141
|
@values = (YAML.load(erb.result) || {})
|
140
142
|
else
|
141
143
|
if File.extname(path) == '.erb'
|
142
|
-
# erb = ERB.new(File.read(path), 0, '%<>')
|
143
144
|
erb = read_erb(path)
|
144
145
|
@values = (YAML.load(erb.result) || {})
|
145
146
|
else
|
@@ -148,9 +149,11 @@ module Origen
|
|
148
149
|
end
|
149
150
|
|
150
151
|
unless @values.is_a?(Hash)
|
151
|
-
puts "Origen: Site Config: The config at #{path} was not parsed as a Hash, but as a #{@values.class}"
|
152
|
-
puts ' Please review the format of the this file.'
|
153
|
-
puts '
|
152
|
+
puts red("Origen: Site Config: The config at #{path} was not parsed as a Hash, but as a #{@values.class}")
|
153
|
+
puts red(' Please review the format of the this file.')
|
154
|
+
puts red(' Alternatively, an error condition may have been received from the server.')
|
155
|
+
puts red(" This site config is available at: #{cached_file}")
|
156
|
+
puts red(' This config will not be loaded and will be replaced with an empty config.')
|
154
157
|
puts
|
155
158
|
@values = {}
|
156
159
|
end
|
@@ -160,9 +163,8 @@ module Origen
|
|
160
163
|
RESTRICTED_FROM_CENTRALIZED_VARIABLES.each do |var|
|
161
164
|
if @values.key?(var)
|
162
165
|
val = @values.delete(var)
|
163
|
-
puts
|
164
|
-
|
165
|
-
"Value #{val} will not be applied!".red
|
166
|
+
puts red("Origen: Site Config: config variable #{var} is not allowed in the centralized site config and will be removed.")
|
167
|
+
puts red(" Value #{val} will not be applied!")
|
166
168
|
end
|
167
169
|
end
|
168
170
|
end
|
@@ -200,6 +202,16 @@ module Origen
|
|
200
202
|
def runtime?
|
201
203
|
type == :runtime
|
202
204
|
end
|
205
|
+
|
206
|
+
private
|
207
|
+
|
208
|
+
def red(message)
|
209
|
+
"\e[0;31;49m#{message}\e[0m"
|
210
|
+
end
|
211
|
+
|
212
|
+
def yellow(message)
|
213
|
+
"\e[0;33;49m#{message}\e[0m"
|
214
|
+
end
|
203
215
|
end
|
204
216
|
end
|
205
217
|
end
|
@@ -69,7 +69,7 @@ module Origen
|
|
69
69
|
model.add_virtual_pin :relay1
|
70
70
|
model.add_virtual_pin :relay2, packages: { bga: {} }
|
71
71
|
|
72
|
-
model.sub_block :block1, file: 'origen/export1/block1.rb', dir: '/
|
72
|
+
model.sub_block :block1, file: 'origen/export1/block1.rb', dir: '/home/stephen/Code/github/origen/vendor/lib/models', lazy: true
|
73
73
|
|
74
74
|
end
|
75
75
|
end
|
@@ -4,7 +4,7 @@ module Origen
|
|
4
4
|
module Export1
|
5
5
|
module Block1
|
6
6
|
def self.extended(model)
|
7
|
-
model.sub_block :x, file: 'origen/export1/block1/x.rb', dir: '/
|
7
|
+
model.sub_block :x, file: 'origen/export1/block1/x.rb', dir: '/home/stephen/Code/github/origen/vendor/lib/models', lazy: true, base_address: 0x40000000
|
8
8
|
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -418,6 +418,7 @@ files:
|
|
418
418
|
- lib/origen/application/target.rb
|
419
419
|
- lib/origen/application/version_tracker.rb
|
420
420
|
- lib/origen/application/workspace_manager.rb
|
421
|
+
- lib/origen/boot_api.rb
|
421
422
|
- lib/origen/bugs.rb
|
422
423
|
- lib/origen/bugs/bug.rb
|
423
424
|
- lib/origen/callbacks.rb
|
@@ -654,7 +655,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
654
655
|
version: 1.8.11
|
655
656
|
requirements: []
|
656
657
|
rubyforge_project:
|
657
|
-
rubygems_version: 2.7.
|
658
|
+
rubygems_version: 2.7.6
|
658
659
|
signing_key:
|
659
660
|
specification_version: 4
|
660
661
|
summary: The Semiconductor Developer's Kit
|