origen 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ctags +0 -0
- data/bin/origen +165 -1
- data/bin/rgen +2 -0
- data/config/application.rb +141 -0
- data/config/commands.rb +72 -0
- data/config/development.rb +7 -0
- data/config/environment.rb +0 -0
- data/config/rgen.policy +7 -0
- data/config/rubocop/easy.yml +620 -0
- data/config/rubocop/easy_disabled.yml +271 -0
- data/config/rubocop/easy_enabled.yml +731 -0
- data/config/rubocop/strict.yml +620 -0
- data/config/rubocop/strict_disabled.yml +247 -0
- data/config/rubocop/strict_enabled.yml +755 -0
- data/config/users.rb +20 -0
- data/config/version.rb +1 -1
- data/helpers/url.rb +68 -0
- data/lib/c99/doc_interface.rb +56 -0
- data/lib/c99/j750_interface.rb +85 -0
- data/lib/c99/nvm.rb +89 -0
- data/lib/c99/target/mock2.rb +1 -0
- data/lib/c99/target/subdir/mock3.rb +1 -0
- data/lib/option_parser/optparse.rb +12 -0
- data/lib/origen/acronyms.rb +60 -0
- data/lib/origen/application/command_dispatcher.rb +12 -0
- data/lib/origen/application/configuration.rb +206 -0
- data/lib/origen/application/configuration_manager.rb +78 -0
- data/lib/origen/application/deployer.rb +367 -0
- data/lib/origen/application/environment.rb +186 -0
- data/lib/origen/application/lsf.rb +145 -0
- data/lib/origen/application/lsf_manager.rb +657 -0
- data/lib/origen/application/plugins_manager.rb +280 -0
- data/lib/origen/application/release.rb +359 -0
- data/lib/origen/application/runner.rb +246 -0
- data/lib/origen/application/statistics.rb +191 -0
- data/lib/origen/application/target.rb +374 -0
- data/lib/origen/application/version_tracker.rb +59 -0
- data/lib/origen/application/workspace_manager.rb +151 -0
- data/lib/origen/application.rb +746 -0
- data/lib/origen/bugs/bug.rb +36 -0
- data/lib/origen/bugs.rb +45 -0
- data/lib/origen/callbacks.rb +35 -0
- data/lib/origen/chip_mode.rb +118 -0
- data/lib/origen/chip_package.rb +461 -0
- data/lib/origen/client.rb +87 -0
- data/lib/origen/code_generators/actions.rb +258 -0
- data/lib/origen/code_generators/base.rb +57 -0
- data/lib/origen/code_generators/bundler.rb +17 -0
- data/lib/origen/code_generators/gem_setup.rb +49 -0
- data/lib/origen/code_generators/rake.rb +13 -0
- data/lib/origen/code_generators/rspec.rb +12 -0
- data/lib/origen/code_generators/semver.rb +39 -0
- data/lib/origen/code_generators/timever.rb +37 -0
- data/lib/origen/code_generators.rb +111 -0
- data/lib/origen/commands/add.rb +12 -0
- data/lib/origen/commands/compile.rb +62 -0
- data/lib/origen/commands/ctags.rb +9 -0
- data/lib/origen/commands/dispatch.rb +22 -0
- data/lib/origen/commands/environment.rb +11 -0
- data/lib/origen/commands/fetch.rb +63 -0
- data/lib/origen/commands/generate.rb +130 -0
- data/lib/origen/commands/interactive.rb +73 -0
- data/lib/origen/commands/lint.rb +82 -0
- data/lib/origen/commands/lsf.rb +93 -0
- data/lib/origen/commands/merge.rb +55 -0
- data/lib/origen/commands/modifications.rb +12 -0
- data/lib/origen/commands/new.rb +113 -0
- data/lib/origen/commands/plugin.rb +105 -0
- data/lib/origen/commands/program.rb +70 -0
- data/lib/origen/commands/rc.rb +442 -0
- data/lib/origen/commands/save.rb +56 -0
- data/lib/origen/commands/target.rb +27 -0
- data/lib/origen/commands/time.rb +127 -0
- data/lib/origen/commands/version.rb +17 -0
- data/lib/origen/commands/web.rb +221 -0
- data/lib/origen/commands.rb +272 -0
- data/lib/origen/commands_global.rb +76 -0
- data/lib/origen/controller.rb +94 -0
- data/lib/origen/core_ext/array.rb +23 -0
- data/lib/origen/core_ext/bignum.rb +36 -0
- data/lib/origen/core_ext/enumerable.rb +76 -0
- data/lib/origen/core_ext/fixnum.rb +46 -0
- data/lib/origen/core_ext/hash.rb +52 -0
- data/lib/origen/core_ext/module.rb +14 -0
- data/lib/origen/core_ext/numeric.rb +126 -0
- data/lib/origen/core_ext/object.rb +13 -0
- data/lib/origen/core_ext/range.rb +7 -0
- data/lib/origen/core_ext/string.rb +124 -0
- data/lib/origen/core_ext.rb +10 -0
- data/lib/origen/database/key_value_store.rb +111 -0
- data/lib/origen/database/key_value_stores.rb +108 -0
- data/lib/origen/database.rb +6 -0
- data/lib/origen/encodings.rb +102 -0
- data/lib/origen/features/feature.rb +22 -0
- data/lib/origen/features.rb +104 -0
- data/lib/origen/file_handler.rb +429 -0
- data/lib/origen/generator/comparator.rb +56 -0
- data/lib/origen/generator/compiler.rb +277 -0
- data/lib/origen/generator/flow.rb +49 -0
- data/lib/origen/generator/job.rb +131 -0
- data/lib/origen/generator/pattern.rb +356 -0
- data/lib/origen/generator/pattern_finder.rb +155 -0
- data/lib/origen/generator/pattern_iterator.rb +55 -0
- data/lib/origen/generator/renderer.rb +113 -0
- data/lib/origen/generator/resources.rb +40 -0
- data/lib/origen/generator/stage.rb +89 -0
- data/lib/origen/generator.rb +85 -0
- data/lib/origen/global_methods.rb +205 -0
- data/lib/origen/import_manager.rb +596 -0
- data/lib/origen/location/base.rb +116 -0
- data/lib/origen/location/map.rb +83 -0
- data/lib/origen/location.rb +6 -0
- data/lib/origen/log.rb +217 -0
- data/lib/origen/logger_methods.rb +56 -0
- data/lib/origen/mode.rb +61 -0
- data/lib/origen/model.rb +267 -0
- data/lib/origen/model_initializer.rb +45 -0
- data/lib/origen/nvm/block_array.rb +72 -0
- data/lib/origen/nvm.rb +6 -0
- data/lib/origen/parameters/live.rb +22 -0
- data/lib/origen/parameters/missing.rb +28 -0
- data/lib/origen/parameters/set.rb +144 -0
- data/lib/origen/parameters.rb +107 -0
- data/lib/origen/pdm.rb +218 -0
- data/lib/origen/pins/function_proxy.rb +36 -0
- data/lib/origen/pins/ground_pin.rb +6 -0
- data/lib/origen/pins/pin.rb +860 -0
- data/lib/origen/pins/pin_bank.rb +349 -0
- data/lib/origen/pins/pin_clock.rb +124 -0
- data/lib/origen/pins/pin_collection.rb +492 -0
- data/lib/origen/pins/pin_common.rb +206 -0
- data/lib/origen/pins/port.rb +268 -0
- data/lib/origen/pins/power_pin.rb +30 -0
- data/lib/origen/pins.rb +696 -0
- data/lib/origen/registers/bit.rb +562 -0
- data/lib/origen/registers/bit_collection.rb +787 -0
- data/lib/origen/registers/container.rb +288 -0
- data/lib/origen/registers/domain.rb +16 -0
- data/lib/origen/registers/reg.rb +1406 -0
- data/lib/origen/registers/reg_collection.rb +24 -0
- data/lib/origen/registers.rb +652 -0
- data/lib/origen/regression_manager.rb +251 -0
- data/lib/origen/remote_manager.rb +340 -0
- data/lib/origen/revision_control/base.rb +257 -0
- data/lib/origen/revision_control/design_sync.rb +276 -0
- data/lib/origen/revision_control/git.rb +243 -0
- data/lib/origen/revision_control/subversion.rb +6 -0
- data/lib/origen/revision_control.rb +44 -0
- data/lib/origen/ruby_version_check.rb +131 -0
- data/lib/origen/site_config.rb +61 -0
- data/lib/origen/specs/checkers.rb +103 -0
- data/lib/origen/specs/creation_info.rb +17 -0
- data/lib/origen/specs/doc_resource.rb +91 -0
- data/lib/origen/specs/exhibit.rb +17 -0
- data/lib/origen/specs/mode_select.rb +16 -0
- data/lib/origen/specs/note.rb +17 -0
- data/lib/origen/specs/override.rb +21 -0
- data/lib/origen/specs/power_supply.rb +13 -0
- data/lib/origen/specs/spec.rb +226 -0
- data/lib/origen/specs/version_history.rb +14 -0
- data/lib/origen/specs.rb +552 -0
- data/lib/origen/sub_blocks.rb +298 -0
- data/lib/origen/tester/api.rb +277 -0
- data/lib/origen/tester/bdm/bdm.rb +25 -0
- data/lib/origen/tester/command_based_tester.rb +46 -0
- data/lib/origen/tester/doc/doc.rb +226 -0
- data/lib/origen/tester/doc/generator/flow.rb +71 -0
- data/lib/origen/tester/doc/generator/flow_line.rb +203 -0
- data/lib/origen/tester/doc/generator/test.rb +68 -0
- data/lib/origen/tester/doc/generator/test_group.rb +66 -0
- data/lib/origen/tester/doc/generator/tests.rb +47 -0
- data/lib/origen/tester/doc/generator.rb +126 -0
- data/lib/origen/tester/doc/model.rb +162 -0
- data/lib/origen/tester/generator/flow_control_api.rb +606 -0
- data/lib/origen/tester/generator/identity_map.rb +25 -0
- data/lib/origen/tester/generator/placeholder.rb +13 -0
- data/lib/origen/tester/generator/test_numberer.rb +25 -0
- data/lib/origen/tester/generator.rb +271 -0
- data/lib/origen/tester/interface.rb +154 -0
- data/lib/origen/tester/j750/files.rb +45 -0
- data/lib/origen/tester/j750/generator/flow.rb +123 -0
- data/lib/origen/tester/j750/generator/flow_line.rb +288 -0
- data/lib/origen/tester/j750/generator/patgroup.rb +111 -0
- data/lib/origen/tester/j750/generator/patgroups.rb +41 -0
- data/lib/origen/tester/j750/generator/patset.rb +111 -0
- data/lib/origen/tester/j750/generator/patsets.rb +41 -0
- data/lib/origen/tester/j750/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/j750/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/j750/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/j750/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/j750/generator/test_instance.rb +846 -0
- data/lib/origen/tester/j750/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/j750/generator/test_instances.rb +182 -0
- data/lib/origen/tester/j750/generator.rb +203 -0
- data/lib/origen/tester/j750/j750.rb +845 -0
- data/lib/origen/tester/j750/j750_hpt.rb +35 -0
- data/lib/origen/tester/j750/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/j750/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/j750/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/j750/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/j750/parser/descriptions.rb +340 -0
- data/lib/origen/tester/j750/parser/flow.rb +111 -0
- data/lib/origen/tester/j750/parser/flow_line.rb +207 -0
- data/lib/origen/tester/j750/parser/flows.rb +23 -0
- data/lib/origen/tester/j750/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/j750/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/j750/parser/test_instance.rb +322 -0
- data/lib/origen/tester/j750/parser/test_instances.rb +26 -0
- data/lib/origen/tester/j750/parser/timeset.rb +15 -0
- data/lib/origen/tester/j750/parser/timesets.rb +0 -0
- data/lib/origen/tester/j750/parser.rb +104 -0
- data/lib/origen/tester/jlink/jlink.rb +33 -0
- data/lib/origen/tester/parser/description_lookup.rb +64 -0
- data/lib/origen/tester/parser/searchable_array.rb +32 -0
- data/lib/origen/tester/parser/searchable_hash.rb +32 -0
- data/lib/origen/tester/parser.rb +24 -0
- data/lib/origen/tester/time.rb +338 -0
- data/lib/origen/tester/timing.rb +253 -0
- data/lib/origen/tester/ultraflex/files.rb +45 -0
- data/lib/origen/tester/ultraflex/generator/flow.rb +119 -0
- data/lib/origen/tester/ultraflex/generator/flow_line.rb +269 -0
- data/lib/origen/tester/ultraflex/generator/patgroup.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patgroups.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/patset.rb +111 -0
- data/lib/origen/tester/ultraflex/generator/patsets.rb +41 -0
- data/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb +9 -0
- data/lib/origen/tester/ultraflex/generator/templates/instances.txt.erb +16 -0
- data/lib/origen/tester/ultraflex/generator/templates/patgroups.txt.erb +8 -0
- data/lib/origen/tester/ultraflex/generator/templates/patsets.txt.erb +10 -0
- data/lib/origen/tester/ultraflex/generator/test_instance.rb +622 -0
- data/lib/origen/tester/ultraflex/generator/test_instance_group.rb +60 -0
- data/lib/origen/tester/ultraflex/generator/test_instances.rb +174 -0
- data/lib/origen/tester/ultraflex/generator.rb +200 -0
- data/lib/origen/tester/ultraflex/parser/ac_spec.rb +11 -0
- data/lib/origen/tester/ultraflex/parser/ac_specs.rb +0 -0
- data/lib/origen/tester/ultraflex/parser/dc_spec.rb +36 -0
- data/lib/origen/tester/ultraflex/parser/dc_specs.rb +50 -0
- data/lib/origen/tester/ultraflex/parser/descriptions.rb +342 -0
- data/lib/origen/tester/ultraflex/parser/flow.rb +111 -0
- data/lib/origen/tester/ultraflex/parser/flow_line.rb +207 -0
- data/lib/origen/tester/ultraflex/parser/flows.rb +23 -0
- data/lib/origen/tester/ultraflex/parser/pattern_set.rb +94 -0
- data/lib/origen/tester/ultraflex/parser/pattern_sets.rb +33 -0
- data/lib/origen/tester/ultraflex/parser/test_instance.rb +262 -0
- data/lib/origen/tester/ultraflex/parser/test_instances.rb +26 -0
- data/lib/origen/tester/ultraflex/parser/timeset.rb +15 -0
- data/lib/origen/tester/ultraflex/parser/timesets.rb +0 -0
- data/lib/origen/tester/ultraflex/parser.rb +104 -0
- data/lib/origen/tester/ultraflex/ultraflex.rb +759 -0
- data/lib/origen/tester/v93k/generator/flow.rb +63 -0
- data/lib/origen/tester/v93k/generator/flow_node/print.rb +10 -0
- data/lib/origen/tester/v93k/generator/flow_node.rb +17 -0
- data/lib/origen/tester/v93k/generator/pattern.rb +16 -0
- data/lib/origen/tester/v93k/generator/pattern_master.rb +54 -0
- data/lib/origen/tester/v93k/generator/templates/_test_method.txt.erb +6 -0
- data/lib/origen/tester/v93k/generator/templates/_test_suite.txt.erb +11 -0
- data/lib/origen/tester/v93k/generator/templates/template.flow.erb +121 -0
- data/lib/origen/tester/v93k/generator/templates/template.pmfl.erb +9 -0
- data/lib/origen/tester/v93k/generator/test_function.rb +103 -0
- data/lib/origen/tester/v93k/generator/test_functions.rb +79 -0
- data/lib/origen/tester/v93k/generator/test_method.rb +46 -0
- data/lib/origen/tester/v93k/generator/test_methods.rb +75 -0
- data/lib/origen/tester/v93k/generator/test_suite.rb +54 -0
- data/lib/origen/tester/v93k/generator/test_suites.rb +65 -0
- data/lib/origen/tester/v93k/generator.rb +80 -0
- data/lib/origen/tester/v93k/v93k.rb +420 -0
- data/lib/origen/tester/vector.rb +86 -0
- data/lib/origen/tester/vector_generator.rb +633 -0
- data/lib/origen/tester/vector_pipeline.rb +150 -0
- data/lib/origen/tester.rb +56 -0
- data/lib/origen/top_level.rb +134 -0
- data/lib/origen/users/ldap.rb +65 -0
- data/lib/origen/users/user.rb +149 -0
- data/lib/origen/users.rb +30 -0
- data/lib/origen/utility/block_args.rb +93 -0
- data/lib/origen/utility/csv_data.rb +110 -0
- data/lib/origen/utility/design_sync.rb +494 -0
- data/lib/origen/utility/diff.rb +158 -0
- data/lib/origen/utility/input_capture.rb +121 -0
- data/lib/origen/utility/mailer.rb +143 -0
- data/lib/origen/utility/s_record.rb +205 -0
- data/lib/origen/utility/time_and_date.rb +30 -0
- data/lib/origen/utility.rb +12 -0
- data/lib/origen/version_checker.rb +117 -0
- data/lib/origen/version_string.rb +356 -0
- data/lib/origen.rb +648 -0
- data/lib/tasks/gem.rake +27 -22
- data/origen_site_config.yml +36 -0
- data/source_setup +17 -0
- data/spec/format/rgen_formatter.rb +14 -0
- data/templates/api_doc/README.txt.erb +24 -0
- data/templates/code_generators/gemfile_app.rb +4 -0
- data/templates/code_generators/gemfile_plugin.rb +6 -0
- data/templates/code_generators/gemspec.rb +33 -0
- data/templates/code_generators/rakefile.rb +10 -0
- data/templates/code_generators/spec_helper.rb +49 -0
- data/templates/code_generators/version.rb +8 -0
- data/templates/code_generators/version_time.rb +3 -0
- data/templates/git/gitignore.erb +33 -0
- data/templates/j750/_vt_flow.txt.erb +8 -0
- data/templates/j750/_vt_instances.txt.erb +4 -0
- data/templates/j750/program_sheet.txt.erb +9 -0
- data/templates/nanoc/Rules +74 -0
- data/templates/nanoc/config.yaml +77 -0
- data/templates/nanoc/content/favicon.ico +0 -0
- data/templates/nanoc/layouts/bootstrap.html.erb +63 -0
- data/templates/nanoc/layouts/bootstrap3.html.erb +71 -0
- data/templates/nanoc/layouts/freescale.html.erb +79 -0
- data/templates/nanoc/lib/bootstrap_filter.rb +49 -0
- data/templates/nanoc/lib/codeblocks_filter.rb +41 -0
- data/templates/nanoc/lib/default.rb +2 -0
- data/templates/nanoc/lib/gzip_filter.rb +16 -0
- data/templates/nanoc/lib/haml_code_filter.rb +41 -0
- data/templates/nanoc/lib/helpers.rb +1 -0
- data/templates/nanoc/lib/search_filter.rb +62 -0
- data/templates/nanoc_dynamic/content/search.js.erb +92 -0
- data/templates/shared/web/_logo.html +10 -0
- data/templates/test/_inline_sub.txt.erb +2 -0
- data/templates/test/environment.txt.erb +1 -0
- data/templates/test/inline.txt.erb +11 -0
- data/templates/test/inspections.txt.erb +19 -0
- data/templates/test/set1/_sub1.txt.erb +12 -0
- data/templates/test/set1/_sub4.txt.erb +1 -0
- data/templates/test/set1/_sub5.txt.erb +1 -0
- data/templates/test/set1/main.txt.erb +53 -0
- data/templates/test/set1/sub_dir/_sub2.txt.erb +20 -0
- data/templates/test/set1/sub_dir/_sub3.txt.erb +12 -0
- data/templates/test/set1/sub_dir/main2.txt.erb +4 -0
- data/templates/test/set2/template_with_no_erb_1.txt +9 -0
- data/templates/test/set2/template_with_no_erb_2.txt +9 -0
- data/templates/test/set3/_layout.html.erb +4 -0
- data/templates/test/set3/content.html.erb +6 -0
- data/templates/time/filter.rb.erb +15 -0
- data/templates/time/rules.rb.erb +45 -0
- metadata +639 -5
@@ -0,0 +1,243 @@
|
|
1
|
+
module Origen
|
2
|
+
module RevisionControl
|
3
|
+
class Git < Base
|
4
|
+
def build
|
5
|
+
if Dir["#{local}/*"].empty?
|
6
|
+
FileUtils.rm_rf(local.to_s)
|
7
|
+
# Not using the regular 'git' method here since the local dir doesn't exist to CD into
|
8
|
+
system "git clone #{remote} #{local}"
|
9
|
+
else
|
10
|
+
fail "The requested workspace is not empty: #{local}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def checkout(path = nil, options = {})
|
15
|
+
paths, options = clean_path(path, options)
|
16
|
+
# Pulls latest metadata from server, does not change workspace
|
17
|
+
git 'fetch', options
|
18
|
+
|
19
|
+
version = options[:version] || current_branch
|
20
|
+
|
21
|
+
if version == 'HEAD'
|
22
|
+
puts "Sorry, but you are not currently on a branch and I don't know which branch you want to checkout"
|
23
|
+
puts 'Please supply a branch name as the version to checkout the latest version of it, e.g. origen rc co -v develop'
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:force]
|
28
|
+
git 'reset HEAD'
|
29
|
+
git "checkout #{version} #{paths.join(' ')}", options
|
30
|
+
else
|
31
|
+
if paths.size > 1 || paths.first != local.to_s
|
32
|
+
fail 'The Git driver does not support partial merge checkout, it has to be the whole workspace'
|
33
|
+
end
|
34
|
+
git 'reset HEAD'
|
35
|
+
res = git 'stash', options
|
36
|
+
stashed = !res.any? { |l| l =~ /^No local changes to save/ }
|
37
|
+
git "checkout #{version}", options
|
38
|
+
if stashed
|
39
|
+
result = git 'stash pop', { check_errors: false }.merge(options)
|
40
|
+
conflicts = []
|
41
|
+
result.each do |line|
|
42
|
+
if line =~ /CONFLICT.* (.*)$/
|
43
|
+
conflicts << Regexp.last_match(1)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
git 'reset HEAD'
|
47
|
+
unless conflicts.empty?
|
48
|
+
Origen.log.info ''
|
49
|
+
Origen.log.error 'Your local changes could not automatically merged into the following files, open them to fix the conflicts:'
|
50
|
+
conflicts.each do |conflict|
|
51
|
+
Origen.log.error " #{conflict}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
paths
|
57
|
+
end
|
58
|
+
|
59
|
+
def checkin(path = nil, options = {})
|
60
|
+
paths, options = clean_path(path, options)
|
61
|
+
# Can't check in unless we have the latest
|
62
|
+
if options[:force] && !options[:initial]
|
63
|
+
# Locally check in the given files
|
64
|
+
checkin(paths.join(' '), local: true, verbose: false, comment: options[:comment])
|
65
|
+
local_rev = current_commit
|
66
|
+
# Pull latest
|
67
|
+
checkout
|
68
|
+
# Restore the given files to our previous version
|
69
|
+
# Errors are ignored here since this can fail if the given file didn't exist until now,
|
70
|
+
# in that case we already implicitly have the previous version
|
71
|
+
git("checkout #{local_rev} -- #{paths.join(' ')}", check_errors: false)
|
72
|
+
# Then proceed with checking them in as latest
|
73
|
+
else
|
74
|
+
checkout unless options[:initial]
|
75
|
+
end
|
76
|
+
cmd = 'add'
|
77
|
+
cmd += ' -u' unless options[:unmanaged]
|
78
|
+
cmd += " #{paths.join(' ')}"
|
79
|
+
git cmd, options
|
80
|
+
if changes_pending_commit?
|
81
|
+
cmd = 'commit'
|
82
|
+
if options[:comment] && !options[:comment].strip.empty?
|
83
|
+
cmd += " -m \"#{options[:comment].strip}\""
|
84
|
+
else
|
85
|
+
cmd += " -m \"No comment!\""
|
86
|
+
end
|
87
|
+
if options[:author]
|
88
|
+
if options[:author].respond_to?(:name_and_email)
|
89
|
+
author = options[:author].name_and_email
|
90
|
+
else
|
91
|
+
author = "#{options[:author]} <>"
|
92
|
+
end
|
93
|
+
cmd += " --author=\"#{author}\""
|
94
|
+
end
|
95
|
+
if options[:time]
|
96
|
+
cmd += " --date=\"#{options[:time].strftime('%a %b %e %H:%M:%S %Y %z')}\""
|
97
|
+
end
|
98
|
+
git cmd, options
|
99
|
+
end
|
100
|
+
git "push origin #{current_branch}" unless options[:local]
|
101
|
+
paths
|
102
|
+
end
|
103
|
+
|
104
|
+
def changes(dir = nil, options = {})
|
105
|
+
paths, options = clean_path(dir, options)
|
106
|
+
options = {
|
107
|
+
verbose: false
|
108
|
+
}.merge(options)
|
109
|
+
# Pulls latest metadata from server, does not change workspace
|
110
|
+
git 'fetch', options
|
111
|
+
|
112
|
+
version = options[:version] || 'HEAD'
|
113
|
+
objects = {}
|
114
|
+
|
115
|
+
objects[:added] = git("diff --name-only --diff-filter=A #{version} #{paths.first}", options).map(&:strip)
|
116
|
+
objects[:removed] = git("diff --name-only --diff-filter=D #{version} #{paths.first}", options).map(&:strip)
|
117
|
+
objects[:changed] = git("diff --name-only --diff-filter=M #{version} #{paths.first}", options).map(&:strip)
|
118
|
+
|
119
|
+
objects[:present] = !objects[:added].empty? || !objects[:removed].empty? || !objects[:changed].empty?
|
120
|
+
# Return full paths
|
121
|
+
objects[:added].map! { |i| "#{paths.first}/" + i }
|
122
|
+
objects[:removed].map! { |i| "#{paths.first}/" + i }
|
123
|
+
objects[:changed].map! { |i| "#{paths.first}/" + i }
|
124
|
+
objects
|
125
|
+
end
|
126
|
+
|
127
|
+
def local_modifications(dir = nil, options = {})
|
128
|
+
paths, options = clean_path(dir, options)
|
129
|
+
options = {
|
130
|
+
verbose: false
|
131
|
+
}.merge(options)
|
132
|
+
|
133
|
+
cmd = 'diff --name-only'
|
134
|
+
dir = " #{paths.first}"
|
135
|
+
unstaged = git(cmd + dir, options).map(&:strip)
|
136
|
+
staged = git(cmd + ' --cached' + dir, options).map(&:strip)
|
137
|
+
unstaged + staged
|
138
|
+
end
|
139
|
+
|
140
|
+
def unmanaged(dir = nil, options = {})
|
141
|
+
paths, options = clean_path(dir, options)
|
142
|
+
options = {
|
143
|
+
verbose: false
|
144
|
+
}.merge(options)
|
145
|
+
cmd = "ls-files #{paths.first} --exclude-standard --others"
|
146
|
+
git(cmd, options).map(&:strip)
|
147
|
+
end
|
148
|
+
|
149
|
+
def diff_cmd(file, version)
|
150
|
+
"git difftool --tool tkdiff -y #{prefix_tag(version)} #{file}"
|
151
|
+
end
|
152
|
+
|
153
|
+
def tag(id, options = {})
|
154
|
+
id = VersionString.new(id)
|
155
|
+
id = id.prefixed if id.semantic?
|
156
|
+
if options[:comment]
|
157
|
+
git "tag -a #{id} -m \"#{options[:comment]}\""
|
158
|
+
else
|
159
|
+
git "tag #{id}"
|
160
|
+
end
|
161
|
+
git "push origin #{id}"
|
162
|
+
end
|
163
|
+
|
164
|
+
def root
|
165
|
+
Pathname.new(git('rev-parse --show-toplevel', verbose: false).first.strip)
|
166
|
+
end
|
167
|
+
|
168
|
+
def current_branch
|
169
|
+
git('rev-parse --abbrev-ref HEAD', verbose: false).first
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns true if the given tag already exists
|
173
|
+
def tag_exists?(tag)
|
174
|
+
git('fetch', verbose: false) unless @all_tags_fetched
|
175
|
+
@all_tags_fetched = true
|
176
|
+
git('tag', verbose: false).include?(tag.to_s)
|
177
|
+
end
|
178
|
+
|
179
|
+
private
|
180
|
+
|
181
|
+
def create_gitignore
|
182
|
+
c = Origen::Generator::Compiler.new
|
183
|
+
c.compile "#{Origen.top}/templates/git/gitignore.erb",
|
184
|
+
output_directory: local,
|
185
|
+
quiet: true,
|
186
|
+
check_for_changes: false
|
187
|
+
FileUtils.mv "#{local}/gitignore", "#{local}/.gitignore"
|
188
|
+
end
|
189
|
+
|
190
|
+
def changes_pending_commit?
|
191
|
+
!(git('status --verbose', verbose: false).last =~ /^(no changes|nothing to commit)/)
|
192
|
+
end
|
193
|
+
|
194
|
+
def current_commit
|
195
|
+
git('rev-parse HEAD', verbose: false).first
|
196
|
+
end
|
197
|
+
|
198
|
+
def initialize_local_dir
|
199
|
+
super
|
200
|
+
unless initialized?
|
201
|
+
Origen.log.debug "Initializing Git workspace at #{local}"
|
202
|
+
git 'init'
|
203
|
+
git "remote add origin #{remote}"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def initialized?
|
208
|
+
File.exist?("#{local}/.git")
|
209
|
+
end
|
210
|
+
|
211
|
+
# Execute a git operation, the resultant output is returned in an array
|
212
|
+
def git(command, options = {})
|
213
|
+
options = {
|
214
|
+
check_errors: true,
|
215
|
+
verbose: true
|
216
|
+
}.merge(options)
|
217
|
+
output = []
|
218
|
+
if options[:verbose]
|
219
|
+
Origen.log.info "git #{command}"
|
220
|
+
Origen.log.info ''
|
221
|
+
end
|
222
|
+
Dir.chdir local do
|
223
|
+
Open3.popen2e("git #{command}") do |_stdin, stdout_err, wait_thr|
|
224
|
+
while line = stdout_err.gets
|
225
|
+
Origen.log.info line.strip if options[:verbose]
|
226
|
+
unless line.strip.empty?
|
227
|
+
output << line.strip
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
exit_status = wait_thr.value
|
232
|
+
unless exit_status.success?
|
233
|
+
if options[:check_errors]
|
234
|
+
fail GitError, "This command failed: 'git #{command}'"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
output
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Origen
|
2
|
+
module RevisionControl
|
3
|
+
require 'origen/revision_control/base'
|
4
|
+
autoload :DesignSync, 'origen/revision_control/design_sync'
|
5
|
+
autoload :Git, 'origen/revision_control/git'
|
6
|
+
autoload :Subversion, 'origen/revision_control/subversion'
|
7
|
+
|
8
|
+
IGNORE_DIRS = %w(
|
9
|
+
.ws .lsf log output web coverage .ref .yardoc .collection .bin
|
10
|
+
.session .bundle .tpc pkg tmp lbin .git
|
11
|
+
)
|
12
|
+
|
13
|
+
IGNORE_FILES = %w(
|
14
|
+
target/.default release_note.txt *.swp *.swo *~ .bin
|
15
|
+
list/referenced.list tags .ref .pdm/pi_attributes.txt
|
16
|
+
environment/.default
|
17
|
+
)
|
18
|
+
|
19
|
+
# Creates a new revision controller object based on the supplied :local and :remote
|
20
|
+
# options.
|
21
|
+
#
|
22
|
+
# The revision control system will be worked out from the supplied remote value. This method
|
23
|
+
# should therefore be used whenever the remote is a variable that could refer to many different
|
24
|
+
# systems.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
#
|
28
|
+
# # I know that the remote refers to DesignSync
|
29
|
+
# rc = Origen::RevisionControl::DesignSync.new remote: "sync//....", local: "my/path"
|
30
|
+
#
|
31
|
+
# # The remote is a variable and I don't know the type
|
32
|
+
# rc = Origen::RevisionControl.new remote: rc_url, local: "my/path"
|
33
|
+
def self.new(options = {})
|
34
|
+
case
|
35
|
+
when options[:remote] =~ /^sync/
|
36
|
+
DesignSync.new(options)
|
37
|
+
when options[:remote] =~ /git/
|
38
|
+
Git.new(options)
|
39
|
+
else
|
40
|
+
fail "Could not work out the revision control system for: #{options[:remote]}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
def origen_top
|
4
|
+
# This is set in bin/origen
|
5
|
+
$origen_launch_root
|
6
|
+
end
|
7
|
+
|
8
|
+
def ruby_acceptable_to_run?
|
9
|
+
if RUBY_PLATFORM == 'i386-mingw32'
|
10
|
+
RUBY_VERSION >= '1.9.3'
|
11
|
+
else
|
12
|
+
ruby_latest?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def ruby_latest?
|
17
|
+
# For now assume windows is always a valid installation
|
18
|
+
if RUBY_PLATFORM == 'i386-mingw32'
|
19
|
+
true
|
20
|
+
else
|
21
|
+
RUBY_VERSION == '2.1.5' && RUBY_PATCHLEVEL && RUBY_PATCHLEVEL == 273
|
22
|
+
# RUBY_VERSION == '1.9.3' && RUBY_PATCHLEVEL && RUBY_PATCHLEVEL == 327
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def puts_latest_policy_files
|
27
|
+
puts <<-END
|
28
|
+
Please contact your system administrator to have the latest versions of the following packages
|
29
|
+
installed (when they are available you can import them by running the commands above):
|
30
|
+
|
31
|
+
END
|
32
|
+
File.readlines("#{origen_top}/config/origen.policy").each do |line|
|
33
|
+
if line !~ /^#/
|
34
|
+
puts " #{line}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
puts ''
|
38
|
+
end
|
39
|
+
|
40
|
+
def puts_require_latest_ruby
|
41
|
+
puts <<-END
|
42
|
+
It's possible that your Ruby version may be stale or out of date, please run the following commands:
|
43
|
+
|
44
|
+
cd #{origen_top}
|
45
|
+
source source_setup update
|
46
|
+
cd #{FileUtils.pwd}
|
47
|
+
|
48
|
+
If you see this message again after performing the above steps then it may be that your site
|
49
|
+
does not have the most recent version of the Ruby package installed.
|
50
|
+
Please contact your system administrator to have the latest version of this package
|
51
|
+
installed (when it is available you can re-run the commands above):
|
52
|
+
|
53
|
+
END
|
54
|
+
File.readlines("#{origen_top}/config/origen.policy").each do |line|
|
55
|
+
if line !~ /^#/ && line =~ /ruby/
|
56
|
+
puts " #{line}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
puts ''
|
60
|
+
end
|
61
|
+
|
62
|
+
def _running_from_tr?
|
63
|
+
if RUBY_PLATFORM != 'i386-mingw32'
|
64
|
+
!!(`echo $PATH` =~ /fs-origen-/)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
unless ruby_latest?
|
69
|
+
if ruby_acceptable_to_run?
|
70
|
+
puts <<-END
|
71
|
+
|
72
|
+
Origen has upgraded to a new toolset but you are currently running with the old tools.
|
73
|
+
|
74
|
+
Your site may already have access to the new tools and you can test this by running the
|
75
|
+
following commands which may be sufficient to remove this message:
|
76
|
+
|
77
|
+
cd #{origen_top}
|
78
|
+
source source_setup update
|
79
|
+
cd #{FileUtils.pwd}
|
80
|
+
|
81
|
+
If that doesn't work then the most likely problem is that your site does not have the required
|
82
|
+
packages installed and you should get some feedback to this effect when running source_setup.
|
83
|
+
|
84
|
+
END
|
85
|
+
puts_latest_policy_files
|
86
|
+
|
87
|
+
else
|
88
|
+
|
89
|
+
if _running_from_tr?
|
90
|
+
puts <<-END
|
91
|
+
I can see that you have added the Origen bin directory to your path, however the required Ruby
|
92
|
+
executable is being overridden by another version that has higher precedence in your path.
|
93
|
+
|
94
|
+
To fix this you should move the Origen bin directory higher up your path, e.g. add this at the very
|
95
|
+
end of your setup file to place it at the head of your path:
|
96
|
+
|
97
|
+
setenv PATH ./lbin:/run/pkg/fs-origen-/latest/bin:$PATH
|
98
|
+
|
99
|
+
For now you can resolve the problem in this shell by running:
|
100
|
+
|
101
|
+
source /run/pkg/fs-origen-/latest/origen_setup
|
102
|
+
|
103
|
+
END
|
104
|
+
exit 1
|
105
|
+
else
|
106
|
+
|
107
|
+
puts <<-END
|
108
|
+
|
109
|
+
Sorry but your Ruby installation is too old to guarantee that Origen will run properly.
|
110
|
+
|
111
|
+
It's possible that you haven't installed Origen correctly, please ensure that you have followed
|
112
|
+
the instructions here:
|
113
|
+
|
114
|
+
http://freeshare.freescale.net:2222/public/origen-cmty-svc/Lists/Posts/Post.aspx?ID=8
|
115
|
+
|
116
|
+
If that doesn't help then perhaps your local copy of the tool collection is stale and
|
117
|
+
running the following commands may help:
|
118
|
+
|
119
|
+
cd #{origen_top}
|
120
|
+
source source_setup update
|
121
|
+
cd #{FileUtils.pwd}
|
122
|
+
|
123
|
+
If that doesn't work then the most likely problem is that your site does not have the required
|
124
|
+
packages installed and you should get some feedback to this effect when running source_setup.
|
125
|
+
|
126
|
+
END
|
127
|
+
puts_latest_policy_files
|
128
|
+
exit 1
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Origen
|
2
|
+
class SiteConfig
|
3
|
+
require 'pathname'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
def method_missing(method, *args, &block)
|
7
|
+
method = method.to_s
|
8
|
+
if method =~ /(.*)!$/
|
9
|
+
method = Regexp.last_match(1)
|
10
|
+
must_be_present = true
|
11
|
+
end
|
12
|
+
env = "ORIGEN_#{method.upcase}"
|
13
|
+
if ENV.key?(env)
|
14
|
+
val = ENV[env]
|
15
|
+
else
|
16
|
+
config = configs.find { |c| c.key?(method) }
|
17
|
+
val = config ? config[method] : nil
|
18
|
+
end
|
19
|
+
if must_be_present && val.nil?
|
20
|
+
puts "No value assigned for site_config attribute '#{method}'"
|
21
|
+
puts
|
22
|
+
fail 'Missing site_config value!'
|
23
|
+
end
|
24
|
+
define_singleton_method(method) do
|
25
|
+
val
|
26
|
+
end
|
27
|
+
val
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def configs
|
33
|
+
@configs ||= begin
|
34
|
+
path = Pathname.pwd
|
35
|
+
configs = []
|
36
|
+
# Add any site_configs from where we are currently running from, i.e. the application
|
37
|
+
# directory area
|
38
|
+
until path.root?
|
39
|
+
file = File.join(path, 'origen_site_config.yml')
|
40
|
+
configs << YAML.load_file(file) if File.exist?(file)
|
41
|
+
path = path.parent
|
42
|
+
end
|
43
|
+
# Add and any site_configs from the directory hierarchy where Ruby is installed
|
44
|
+
path = Pathname.new($LOAD_PATH.last)
|
45
|
+
until path.root?
|
46
|
+
file = File.join(path, 'origen_site_config.yml')
|
47
|
+
configs << YAML.load_file(file) if File.exist?(file)
|
48
|
+
path = path.parent
|
49
|
+
end
|
50
|
+
# Add the one from the Origen core as the lowest priority, this one defines
|
51
|
+
# the default values
|
52
|
+
configs << YAML.load_file(File.expand_path('../../../origen_site_config.yml', __FILE__))
|
53
|
+
configs
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.site_config
|
59
|
+
@site_config ||= SiteConfig.new
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# rubocop:disable Style/RescueModifier:
|
2
|
+
def name_audit(name)
|
3
|
+
return name if name.nil?
|
4
|
+
return nil unless name.is_a?(Symbol) || name.is_a?(String)
|
5
|
+
if name == :inspect
|
6
|
+
Origen.log.debug ':inspect is a reserved spec name'
|
7
|
+
return nil
|
8
|
+
end
|
9
|
+
if name.match(/^\d/)
|
10
|
+
Origen.log.debug "Spec #{name} starts with a number"
|
11
|
+
return nil
|
12
|
+
end
|
13
|
+
if name.match(/\s+/)
|
14
|
+
Origen.log.debug "Spec #{name} contains white space, removing it"
|
15
|
+
name.delete!(/\s+/)
|
16
|
+
end
|
17
|
+
name.is_a?(String) ? name.downcase.to_sym : name
|
18
|
+
end
|
19
|
+
|
20
|
+
# Check that min, max are not mixed with typ. If a user wants
|
21
|
+
# a baseline value for a spec use target as it will not be
|
22
|
+
# checked against pass/fail
|
23
|
+
def limits_ok?
|
24
|
+
status = true
|
25
|
+
if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')
|
26
|
+
return status
|
27
|
+
end
|
28
|
+
if @min.exp.nil? ^ @max.exp.nil?
|
29
|
+
@limit_type = :single_sided
|
30
|
+
if @typ.exp
|
31
|
+
# status = false
|
32
|
+
Origen.log.debug "Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max"
|
33
|
+
end
|
34
|
+
elsif @min.exp && @max.exp
|
35
|
+
@limit_type = :double_sided
|
36
|
+
# Both min and max must be numerical to compare them
|
37
|
+
if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)
|
38
|
+
# Check that min and max make sense
|
39
|
+
if @max.value <= @min.value || @min.value >= @max.value
|
40
|
+
status = false
|
41
|
+
Origen.log.debug "Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed"
|
42
|
+
end
|
43
|
+
# Check that target is OK
|
44
|
+
unless @target.nil?
|
45
|
+
if @target.value <= @min.value || @target.value >= @max.value
|
46
|
+
status = false
|
47
|
+
Origen.log.debug "Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
status
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_mode
|
56
|
+
spec_mode = nil
|
57
|
+
if current_mode.nil?
|
58
|
+
if self == Origen.top_level
|
59
|
+
spec_mode = :global
|
60
|
+
else
|
61
|
+
spec_mode = :local
|
62
|
+
end
|
63
|
+
else
|
64
|
+
spec_mode = current_mode.name
|
65
|
+
end
|
66
|
+
spec_mode
|
67
|
+
end
|
68
|
+
|
69
|
+
def evaluate_limit(limit)
|
70
|
+
return limit if limit.is_a?(Numeric) || limit.is_a?(Symbol)
|
71
|
+
return nil if limit.nil?
|
72
|
+
limit.gsub!("\n", ' ')
|
73
|
+
limit.scrub!
|
74
|
+
result = false
|
75
|
+
if !!(limit.match(/^\d+\.\d+$/)) || !!(limit.match(/^-\d+\.\d+$/))
|
76
|
+
result = Float(limit).round(4) rescue false # Use the same four digits of accuracy as the Spec model
|
77
|
+
elsif !!(limit.match(/\d+\.\d+\s+\d+\.\d+/)) # workaround for multiple specs authoring bug
|
78
|
+
Origen.log.debug "Found two numbers without an operator in the limit string '#{limit}', choosing the first..."
|
79
|
+
first_number = limit.match(/(\d+\.\d+)\s+\d+\.\d+/).captures.first
|
80
|
+
result = Float(first_number).round(4) rescue false # Use the same four digits of accuracy as the Spec model
|
81
|
+
# elsif !!(limit.match(/^tbd$/i)) # unique case of TBD or To Be Determined, will convert to symbol
|
82
|
+
# limit = limit.downcase.to_sym
|
83
|
+
else
|
84
|
+
result = Integer(limit) rescue false
|
85
|
+
end
|
86
|
+
if result == false
|
87
|
+
# Attempt to eval the limit because users could write a limit like "3.3 + 50.mV"
|
88
|
+
# which would not work with the code above but should eval to a number 3.35
|
89
|
+
begin
|
90
|
+
result = eval(limit)
|
91
|
+
return result.round(4) if result.is_a? Numeric
|
92
|
+
rescue SyntaxError, NameError, TypeError
|
93
|
+
Origen.log.debug "Limit '#{limit}' had to be rescued, storing it as a #{limit.class}"
|
94
|
+
if limit.is_a? Symbol
|
95
|
+
return limit
|
96
|
+
else
|
97
|
+
return "#{limit}"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
else
|
101
|
+
return result
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Origen
|
2
|
+
module Specs
|
3
|
+
# This class is used to store spec note information used to document IP
|
4
|
+
class Creation_Info
|
5
|
+
attr_accessor :author, :date, :revision, :source, :tool, :tool_version
|
6
|
+
|
7
|
+
def initialize(author, date, src_info = {}, tool_info = {})
|
8
|
+
@author = author
|
9
|
+
@date = date
|
10
|
+
@revision = src_info[:revision]
|
11
|
+
@source = src_info[:source]
|
12
|
+
@tool = tool_info[:tool]
|
13
|
+
@tool_version = tool_info[:version]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|