stepmod-utils 0.3.12 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -20
- data/.github/workflows/release.yml +6 -28
- data/README.adoc +6 -46
- data/exe/stepmod-extract-terms +39 -6
- data/lib/stepmod/utils/cleaner.rb +3 -1
- data/lib/stepmod/utils/concept.rb +1 -1
- data/lib/stepmod/utils/converters/ext_description.rb +1 -1
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +2 -2
- data/lib/stepmod/utils/converters/strong.rb +2 -1
- data/lib/stepmod/utils/converters/term.rb +10 -10
- data/lib/stepmod/utils/converters/uof.rb +1 -1
- data/lib/stepmod/utils/stepmod_definition_converter.rb +2 -1
- data/lib/stepmod/utils/term.rb +38 -0
- data/lib/stepmod/utils/terms_extractor.rb +15 -41
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +7 -7
- data/migrating_from_cvs.adoc +0 -190
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e40fc2ba271e4bd8e0859cb307831ead927b7bc12154b5845f528694ad18c8f8
|
4
|
+
data.tar.gz: e1b6f691a70d1e6531a7f841b5a998d49d6c376a84a9da340246b2920bd8459d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e62c15d95982deb33e03af65b9720cdb34746adfa36bf5945a2823fb0be9800beff3e8cf4b3e4acd34ebf940bacb0ff2b4a83b31af27e8d01cba2599fcc537
|
7
|
+
data.tar.gz: c9efdfa5eed962291c9454227e8d2c7c22b4ba665c88745d059f77cdfb5ae2bdb414d32d7c1ee957aec10db634c1f0fbc388851360ae4edb9bf9d721f740dca3
|
data/.github/workflows/rake.yml
CHANGED
@@ -10,23 +10,6 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
rake:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
strategy:
|
17
|
-
fail-fast: false
|
18
|
-
matrix:
|
19
|
-
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
|
-
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
-
experimental: [ false ]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
with:
|
25
|
-
submodules: true
|
26
|
-
|
27
|
-
- uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{ matrix.ruby }}
|
30
|
-
bundler-cache: true
|
31
|
-
|
32
|
-
- run: bundle exec rake
|
13
|
+
uses: metanorma/metanorma-build-scripts/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -15,32 +15,10 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
release:
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
uses: metanorma/metanorma-build-scripts/.github/workflows/rubygems-release.yml@main
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
event_name: ${{ github.event_name }}
|
22
|
+
secrets:
|
23
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
21
24
|
|
22
|
-
- uses: ruby/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: '2.6'
|
25
|
-
bundler-cache: true
|
26
|
-
|
27
|
-
- run: gem install gem-release
|
28
|
-
|
29
|
-
- run: |
|
30
|
-
git config user.name github-actions
|
31
|
-
git config user.email github-actions@github.com
|
32
|
-
|
33
|
-
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip'
|
34
|
-
run: gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
35
|
-
|
36
|
-
- name: publish to rubygems.org
|
37
|
-
env:
|
38
|
-
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
39
|
-
run: |
|
40
|
-
gem install gem-release
|
41
|
-
envsubst << 'EOF' > ~/.gem/credentials
|
42
|
-
---
|
43
|
-
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
44
|
-
EOF
|
45
|
-
chmod 0600 ~/.gem/credentials
|
46
|
-
gem release
|
data/README.adoc
CHANGED
@@ -10,12 +10,8 @@ image:https://img.shields.io/github/commits-since/metanorma/stepmod-utils/latest
|
|
10
10
|
|
11
11
|
== Purpose
|
12
12
|
|
13
|
-
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod
|
14
|
-
|
15
|
-
|
16
|
-
== CVS to Git migration procedures
|
17
|
-
|
18
|
-
include::migrating_from_cvs.adoc[]
|
13
|
+
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod
|
14
|
+
repository.
|
19
15
|
|
20
16
|
|
21
17
|
== Installation
|
@@ -31,11 +27,8 @@ Or include it in your gemspec.
|
|
31
27
|
|
32
28
|
[source,sh]
|
33
29
|
----
|
34
|
-
# Extracts from
|
35
|
-
$ stepmod-extract-terms
|
36
|
-
|
37
|
-
# Extracts from specified stepmod/ or stepmod/data/ directory
|
38
|
-
$ stepmod-extract-terms {stepmod-data-directory}
|
30
|
+
# Extracts from specified stepmod/data/ directory
|
31
|
+
$ stepmod-extract-terms -p {stepmod-data-directory} -i {path-to-repository_index.xml}
|
39
32
|
----
|
40
33
|
|
41
34
|
Then these files will be created:
|
@@ -118,48 +111,15 @@ expg_image:contract_schemaexpg1.xml[]
|
|
118
111
|
expg_image:contract_schemaexpg2.xml[]
|
119
112
|
----
|
120
113
|
|
114
|
+
== Git repository
|
121
115
|
|
122
|
-
|
123
|
-
|
124
|
-
If the STEPmod repository is a CVS repository, it will display the
|
125
|
-
working and repository revisions as comments.
|
126
|
-
|
127
|
-
WARNING: CVS revision detection can be *slow*! Be patient.
|
128
|
-
|
129
|
-
Sample output:
|
130
|
-
|
131
|
-
[source,sh]
|
132
|
-
----
|
133
|
-
[stepmod-utils] INFO: STEPmod directory set to ../x/stepmod/.
|
134
|
-
[stepmod-utils] INFO: STEPmod directory is a CVS repository and will detect revisions.
|
135
|
-
[stepmod-utils] INFO: [CVS] Detecting file revisions can be slow, please be patient!
|
136
|
-
[stepmod-utils] INFO: Detecting paths...
|
137
|
-
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
138
|
-
[stepmod-utils] INFO: Detecting CVS revision...
|
139
|
-
[stepmod-utils] INFO: CVS working rev (1.148), repo rev (1.148)
|
140
|
-
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
141
|
-
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
142
|
-
[stepmod-utils] INFO: Detecting CVS revision...
|
143
|
-
[stepmod-utils] INFO: CVS working rev (1.31), repo rev (1.31)
|
144
|
-
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
145
|
-
...
|
146
|
-
stepmod/data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
147
|
-
[stepmod-utils] INFO: written to: 031-generated-terms.adoc
|
148
|
-
[stepmod-utils] INFO: written to: 991-generated-bibliography.adoc
|
149
|
-
----
|
150
|
-
|
151
|
-
|
152
|
-
== Non-CVS repository
|
153
|
-
|
154
|
-
If the STEPmod repository is not a CVS repository, or if the `cvs` executable
|
155
|
-
cannot be found, term extract will still work.
|
116
|
+
If the STEPmod repository is a Git repository, term extract will work.
|
156
117
|
|
157
118
|
Sample output:
|
158
119
|
|
159
120
|
[source,sh]
|
160
121
|
----
|
161
122
|
[stepmod-utils] INFO: STEPmod directory set to ../iso-10303-stepmod.
|
162
|
-
[stepmod-utils] INFO: STEPmod directory is not a CVS repository, skipping revision detection.
|
163
123
|
[stepmod-utils] INFO: Detecting paths...
|
164
124
|
[stepmod-utils] INFO: Processing XML file data/application_protocols/boundary_representation_for_iso_14306_open_jt/application_protocol.xml
|
165
125
|
[stepmod-utils] INFO: skipped ISO/CD 10303-243 as it is not IS, DIS or TS
|
data/exe/stepmod-extract-terms
CHANGED
@@ -20,15 +20,52 @@ end
|
|
20
20
|
|
21
21
|
require "bundler/setup"
|
22
22
|
require "stepmod/utils/terms_extractor"
|
23
|
+
require 'optparse'
|
23
24
|
|
24
|
-
|
25
|
+
def log(message)
|
26
|
+
puts "[stepmod-utils] #{message}"
|
27
|
+
end
|
28
|
+
|
29
|
+
options = {}
|
30
|
+
OptionParser.new do |opts|
|
31
|
+
opts.banner = "Usage: #{$0} [options]"
|
32
|
+
|
33
|
+
opts.on("-p", "--path STEPMOD_DATA_PATH", String, "Path to STEPmod data directory") do |path|
|
34
|
+
options[:stepmod_dir] = path
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on("-i", "--index INDEX_PATH", String, "Path to repository_index.xml") do |path|
|
38
|
+
unless path.nil?
|
39
|
+
options[:index_path] = Pathname.new(path).to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
44
|
+
puts opts
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
end.parse!
|
48
|
+
|
49
|
+
stepmod_dir = options[:stepmod_dir]
|
50
|
+
if stepmod_dir.nil?
|
51
|
+
raise StandardError.new("STEPmod data path not set, set with the `-p` option.")
|
52
|
+
else
|
53
|
+
log "STEPmod data path: `#{stepmod_dir}`"
|
54
|
+
end
|
55
|
+
|
56
|
+
index_path = options[:index_path] || File.join(stepmod_dir, "repository_index.xml")
|
57
|
+
unless File.exists?(index_path)
|
58
|
+
raise StandardError.new("Index file not present at #{index_path}, set with the `-i` option.")
|
59
|
+
else
|
60
|
+
log "Repository index path: `#{index_path}`"
|
61
|
+
end
|
25
62
|
|
26
63
|
general_concepts,
|
27
64
|
resource_concepts,
|
28
65
|
parsed_bibliography,
|
29
66
|
part_concepts,
|
30
67
|
part_resources,
|
31
|
-
part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir)
|
68
|
+
part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir, index_path)
|
32
69
|
|
33
70
|
def part_to_title(bibdata)
|
34
71
|
case bibdata.part.to_i
|
@@ -69,10 +106,6 @@ def replace_images(content)
|
|
69
106
|
content
|
70
107
|
end
|
71
108
|
|
72
|
-
def log(message)
|
73
|
-
puts "[stepmod-utils] #{message}"
|
74
|
-
end
|
75
|
-
|
76
109
|
part_concepts.each do |(bibdata, current_part_concepts)|
|
77
110
|
current_part_concepts = current_part_concepts.to_a.map do |n|
|
78
111
|
n.localizations["en"]
|
@@ -3,7 +3,7 @@ module Stepmod
|
|
3
3
|
module Converters
|
4
4
|
class ExtDescription < ReverseAdoc::Converters::Base
|
5
5
|
def convert(node, state = {})
|
6
|
-
state = state.merge(schema_name: node["linkend"])
|
6
|
+
state = state.merge(schema_name: node["linkend"], non_flanking_whitesapce: true)
|
7
7
|
child_text = treat_children(node, state).strip
|
8
8
|
|
9
9
|
<<~TEMPLATE
|
@@ -8,12 +8,13 @@ module Stepmod
|
|
8
8
|
|
9
9
|
def convert(node, state = {})
|
10
10
|
content = treat_children(node, state.merge(already_strong: true))
|
11
|
+
strong_tag = state[:non_flanking_whitesapce] ? '**' : '*'
|
11
12
|
if content.strip.empty? || state[:already_strong]
|
12
13
|
content
|
13
14
|
else
|
14
15
|
handle_express_escape_seq(
|
15
16
|
node,
|
16
|
-
"#{content[/^\s*/]}
|
17
|
+
"#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}"
|
17
18
|
)
|
18
19
|
end
|
19
20
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "stepmod/utils/converters/synonym"
|
4
|
+
require "stepmod/utils/term"
|
5
|
+
require "glossarist"
|
4
6
|
|
5
7
|
module Stepmod
|
6
8
|
module Utils
|
@@ -22,22 +24,20 @@ module Stepmod
|
|
22
24
|
unless first_child &&
|
23
25
|
node.text.split(";").length == 2 &&
|
24
26
|
defined?(Stepmod::Utils::Converters::Synonym)
|
25
|
-
|
27
|
+
|
28
|
+
return Stepmod::Utils::Term.from_h(
|
29
|
+
"definition" => treat_children(node, state).strip,
|
30
|
+
).to_mn_adoc
|
26
31
|
end
|
27
32
|
|
28
33
|
term_def, alt = node.text.split(";")
|
29
34
|
alt_xml = Nokogiri::XML::Text.new(alt, Nokogiri::XML::Document.new)
|
30
35
|
converted_alt = Stepmod::Utils::Converters::Synonym.new.convert(alt_xml)
|
31
|
-
"=== #{treat_acronym(term_def)}\n\n#{converted_alt}"
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def treat_acronym(term_def)
|
37
|
-
return term_def.strip if term_def !~ /.+\(.+?\)$/
|
38
36
|
|
39
|
-
|
40
|
-
|
37
|
+
Stepmod::Utils::Term.from_h(
|
38
|
+
"definition" => term_def,
|
39
|
+
"synonyms" => [converted_alt],
|
40
|
+
).to_mn_adoc
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -17,6 +17,7 @@ require "stepmod/utils/converters/term"
|
|
17
17
|
require "stepmod/utils/converters/synonym"
|
18
18
|
require "stepmod/utils/converters/uof"
|
19
19
|
require "stepmod/utils/converters/figure"
|
20
|
+
require "stepmod/utils/cleaner"
|
20
21
|
|
21
22
|
require "reverse_adoc/converters/a"
|
22
23
|
require "reverse_adoc/converters/blockquote"
|
@@ -56,7 +57,7 @@ module Stepmod
|
|
56
57
|
options)
|
57
58
|
return "" unless result
|
58
59
|
|
59
|
-
|
60
|
+
Stepmod::Utils::Cleaner.new.tidy(result.dup)
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "glossarist"
|
2
|
+
|
3
|
+
module Stepmod
|
4
|
+
module Utils
|
5
|
+
class Term < Glossarist::LocalizedConcept
|
6
|
+
# Term acronym
|
7
|
+
attr_accessor :acronym
|
8
|
+
|
9
|
+
def to_mn_adoc
|
10
|
+
mn_adoc = ["=== #{definition}"]
|
11
|
+
mn_adoc << "\nalt:[#{acronym}]" if acronym
|
12
|
+
mn_adoc << "\n\n#{designations.join(", ")}" if designations&.any?
|
13
|
+
|
14
|
+
mn_adoc.join
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def from_h(hash)
|
19
|
+
_, definition, acronym = treat_acronym(hash["definition"])
|
20
|
+
|
21
|
+
hash["definition"] = definition
|
22
|
+
hash["acronym"] = acronym.gsub(/\(|\)/, "") if acronym
|
23
|
+
hash["designations"] = hash["synonyms"]
|
24
|
+
|
25
|
+
super(hash.reject { |k, _| k == "synonyms" })
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def treat_acronym(term_def)
|
31
|
+
return [nil, term_def.strip, nil] unless term_def.match?(/.+\(.+?\)$/)
|
32
|
+
|
33
|
+
term_def.match(/(.+?)(\(.+\))$/).to_a
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -15,24 +15,25 @@ module Stepmod
|
|
15
15
|
|
16
16
|
attr_reader :stepmod_path,
|
17
17
|
:stepmod_dir,
|
18
|
+
:index_path,
|
18
19
|
:general_concepts,
|
19
20
|
:resource_concepts,
|
20
21
|
:parsed_bibliography,
|
21
22
|
:encountered_terms,
|
22
|
-
:cvs_mode,
|
23
23
|
:part_concepts,
|
24
24
|
:part_resources,
|
25
25
|
:part_modules,
|
26
26
|
:stdout
|
27
27
|
|
28
|
-
def self.call(stepmod_dir, stdout = $stdout)
|
29
|
-
new(stepmod_dir, stdout).call
|
28
|
+
def self.call(stepmod_dir, index_path, stdout = $stdout)
|
29
|
+
new(stepmod_dir, index_path, stdout).call
|
30
30
|
end
|
31
31
|
|
32
|
-
def initialize(stepmod_dir, stdout)
|
32
|
+
def initialize(stepmod_dir, index_path, stdout)
|
33
33
|
@stdout = stdout
|
34
34
|
@stepmod_dir = stepmod_dir
|
35
35
|
@stepmod_path = Pathname.new(stepmod_dir).realpath
|
36
|
+
@index_path = Pathname.new(index_path).to_s
|
36
37
|
@general_concepts = Glossarist::Collection.new
|
37
38
|
@resource_concepts = Glossarist::Collection.new
|
38
39
|
@parsed_bibliography = []
|
@@ -58,28 +59,10 @@ module Stepmod
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def call
|
61
|
-
# If we are using the stepmod CVS repository, provide the revision number per file
|
62
|
-
@cvs_mode = if Dir.exists?(stepmod_path.join("CVS"))
|
63
|
-
require "ptools"
|
64
|
-
# ptools provides File.which
|
65
|
-
File.which("cvs")
|
66
|
-
end
|
67
|
-
|
68
62
|
log "INFO: STEPmod directory set to #{stepmod_dir}."
|
69
|
-
|
70
|
-
if cvs_mode
|
71
|
-
log "INFO: STEPmod directory is a \
|
72
|
-
CVS repository and will detect revisions."
|
73
|
-
log "INFO: [CVS] Detecting file revisions can be slow, \
|
74
|
-
please be patient!"
|
75
|
-
else
|
76
|
-
log "INFO: STEPmod directory is not a CVS repository, \
|
77
|
-
skipping revision detection."
|
78
|
-
end
|
79
|
-
|
80
63
|
log "INFO: Detecting paths..."
|
81
64
|
|
82
|
-
repo_index = Nokogiri::XML(File.read(
|
65
|
+
repo_index = Nokogiri::XML(File.read(@index_path)).root
|
83
66
|
|
84
67
|
files = []
|
85
68
|
|
@@ -159,24 +142,15 @@ module Stepmod
|
|
159
142
|
next
|
160
143
|
end
|
161
144
|
|
162
|
-
revision_string = "
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
working_rev = status.split(/\n/).grep(/Working revision:/)
|
172
|
-
.first.match(/revision:\s+(.+)$/)[1]
|
173
|
-
repo_rev = status.split(/\n/).grep(/Repository revision:/)
|
174
|
-
.first.match(/revision:\t(.+)\t/)[1]
|
175
|
-
log "INFO: CVS working rev (#{working_rev}), \
|
176
|
-
repo rev (#{repo_rev})"
|
177
|
-
revision_string = "\n// CVS working rev: (#{working_rev}), repo rev (#{repo_rev})\n" +
|
178
|
-
"// CVS: revision #{working_rev == repo_rev ? 'up to date' : 'differs'}"
|
179
|
-
end
|
145
|
+
revision_string = ""
|
146
|
+
|
147
|
+
# Run `cvs status` to find out version
|
148
|
+
log "INFO: Detecting Git SHA..."
|
149
|
+
Dir.chdir(stepmod_path) do
|
150
|
+
git_sha = `git rev-parse HEAD`
|
151
|
+
|
152
|
+
unless git_sha.empty?
|
153
|
+
revision_string = "\n// Git: SHA #{git_sha}"
|
180
154
|
end
|
181
155
|
end
|
182
156
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -213,16 +213,16 @@ files:
|
|
213
213
|
- lib/stepmod/utils/smrl_resource_converter.rb
|
214
214
|
- lib/stepmod/utils/stepmod_definition_converter.rb
|
215
215
|
- lib/stepmod/utils/stepmod_file_annotator.rb
|
216
|
+
- lib/stepmod/utils/term.rb
|
216
217
|
- lib/stepmod/utils/terms_extractor.rb
|
217
218
|
- lib/stepmod/utils/version.rb
|
218
|
-
- migrating_from_cvs.adoc
|
219
219
|
- resource_example.xml
|
220
220
|
- stepmod-utils.gemspec
|
221
221
|
homepage: https://github.com/metanorma/stepmod-utils
|
222
222
|
licenses:
|
223
223
|
- BSD-2-Clause
|
224
224
|
metadata: {}
|
225
|
-
post_install_message:
|
225
|
+
post_install_message:
|
226
226
|
rdoc_options: []
|
227
227
|
require_paths:
|
228
228
|
- lib
|
@@ -237,8 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
|
-
rubygems_version: 3.
|
241
|
-
signing_key:
|
240
|
+
rubygems_version: 3.0.3.1
|
241
|
+
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: Stepmod-utils is a toolkit that works on STEPmod data.
|
244
244
|
test_files: []
|
data/migrating_from_cvs.adoc
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
= STEPmod CVS to Git import
|
2
|
-
|
3
|
-
== Purpose
|
4
|
-
|
5
|
-
The `cvs/` submodule is a CSV import of STEPmod files from the CVS server hosted at Boost Conseil.
|
6
|
-
|
7
|
-
The goal is to import the CSV-managed files in a way useable via Git, with full history information.
|
8
|
-
|
9
|
-
This guide is used as reference for the usage of `cvs-fast-import`:
|
10
|
-
https://oitofelix.github.io/article-savannah-cvs-to-git-migration/
|
11
|
-
|
12
|
-
|
13
|
-
== Strategy to import
|
14
|
-
|
15
|
-
Cloning a remote CVS repository while importing is super slow,
|
16
|
-
especially for a large repository like STEPmod.
|
17
|
-
|
18
|
-
We have tested and settled on these steps:
|
19
|
-
|
20
|
-
. Maintain a local `rsync` copy of the CVS repository.
|
21
|
-
. Resolve all names from the CVS repository (CVS only stores UNIX usernames, in Git are names and emails) using `cvs-fast-import`.
|
22
|
-
. Run `cvs-fast-import` to import the CVS repository into the `iso-10303-stepmod-cvs` Git repo.
|
23
|
-
|
24
|
-
|
25
|
-
== Creating the `rsync` clone of the CVS repository
|
26
|
-
|
27
|
-
[source,sh]
|
28
|
-
----
|
29
|
-
rsync -avrPz -e ssh ronald@cvs.boost-lab.net:/stepmod/ stepmod-rsync/
|
30
|
-
----
|
31
|
-
|
32
|
-
|
33
|
-
== Install cvs-fast-export
|
34
|
-
|
35
|
-
`cvs-fast-export` only works on Linux.
|
36
|
-
Run it on Ubuntu with the `rsync`'ed CVS directory.
|
37
|
-
|
38
|
-
Install:
|
39
|
-
[source,sh]
|
40
|
-
----
|
41
|
-
$ apt-get -y install cvs-fast-export
|
42
|
-
----
|
43
|
-
|
44
|
-
== Getting all users for email mapping
|
45
|
-
|
46
|
-
Find all authors in the CVS repository using `cvs-fast-export -a`.
|
47
|
-
It is much faster than using the equivalent CVS command to list all authors.
|
48
|
-
|
49
|
-
[source,sh]
|
50
|
-
----
|
51
|
-
$ find stepmod-rsync -type f | cvs-fast-export -a
|
52
|
-
----
|
53
|
-
|
54
|
-
|
55
|
-
== Create fast-import file for Git
|
56
|
-
|
57
|
-
After all authors are mapped, run `cvs-fast-export` to create
|
58
|
-
the import file.
|
59
|
-
|
60
|
-
[source,sh]
|
61
|
-
----
|
62
|
-
$ find stepmod-rsync -type f | cvs-fast-export -A author-map.txt > fast-import-file
|
63
|
-
----
|
64
|
-
|
65
|
-
== Perform the Git fast-import
|
66
|
-
|
67
|
-
Once the fast-import file is created, we can perform the Git import.
|
68
|
-
|
69
|
-
[source,sh]
|
70
|
-
----
|
71
|
-
$ cd iso-10303-stepmod-cvs
|
72
|
-
$ git fast-import < ../fast-import-file
|
73
|
-
----
|
74
|
-
|
75
|
-
|
76
|
-
== Upload the new Git repo
|
77
|
-
|
78
|
-
[source,sh]
|
79
|
-
----
|
80
|
-
git push --all && git push --tags
|
81
|
-
----
|
82
|
-
|
83
|
-
|
84
|
-
== DEPRECATED steps using `git cvsimport` (do not use, it won't work)
|
85
|
-
|
86
|
-
=== General
|
87
|
-
|
88
|
-
https://stackoverflow.com/questions/11362676/how-to-import-and-keep-updated-a-cvs-repository-in-git[This StackOverflow post]
|
89
|
-
describes steps for using `git cvsimport`.
|
90
|
-
|
91
|
-
Originally the `git cvsimport` tool was chosen since it is part of
|
92
|
-
`git`. However, it utilizes a deprecated/unmaintained tool called
|
93
|
-
`cvsps`. The latest `cvsps` is version 3, but only version 2 is
|
94
|
-
compatible with `git cvsimport`.
|
95
|
-
|
96
|
-
In addition, the `cvsps` tool is maintained by the maintainer
|
97
|
-
of `cvs-fast-import`, and is no longer updated.
|
98
|
-
Eventually `cvs-fast-import` is used instead.
|
99
|
-
|
100
|
-
WARNING: This command completely fails
|
101
|
-
on this repository because it is too large and complex.
|
102
|
-
|
103
|
-
|
104
|
-
=== Setup
|
105
|
-
|
106
|
-
On macOS, run the following commands to setup for running the import. The `git` executable must be installed.
|
107
|
-
|
108
|
-
Install `cvsps` version 2.
|
109
|
-
|
110
|
-
NOTE: The steps from the StackOverflow of installing `cvsps` no longer work.
|
111
|
-
|
112
|
-
[source,sh]
|
113
|
-
----
|
114
|
-
$ brew tap Frizlab/Perso
|
115
|
-
# ==> Tapping frizlab/perso
|
116
|
-
# Cloning into '/usr/local/Homebrew/Library/Taps/frizlab/homebrew-perso'...
|
117
|
-
# remote: Enumerating objects: 123, done.
|
118
|
-
# remote: Total 123 (delta 0), reused 0 (delta 0), pack-reused 123
|
119
|
-
# Receiving objects: 100% (123/123), 19.08 KiB | 91.00 KiB/s, done.
|
120
|
-
# Resolving deltas: 100% (43/43), done.
|
121
|
-
# Tapped 1 cask and 10 formulae (38 files, 60.5KB).
|
122
|
-
|
123
|
-
$ brew install cvsps@2
|
124
|
-
# ==> Installing cvsps@2 from frizlab/perso
|
125
|
-
# Warning: A newer Command Line Tools release is available.
|
126
|
-
# Update them from Software Update in System Preferences or
|
127
|
-
# https://developer.apple.com/download/more/.
|
128
|
-
# ==> Downloading https://deb.debian.org/debian/pool/main/c/cvsps/cvsps_2.1.orig.tar.gz
|
129
|
-
######################################################################## 100.0%
|
130
|
-
# ==> make all
|
131
|
-
# ==> make install prefix=/usr/local/Cellar/cvsps@2/2.1
|
132
|
-
# 🍺 /usr/local/Cellar/cvsps@2/2.1: 7 files, 124.6KB, built in 6 seconds
|
133
|
-
----
|
134
|
-
|
135
|
-
Verify it is installed:
|
136
|
-
[source,sh]
|
137
|
-
----
|
138
|
-
$ cvsps -v
|
139
|
-
# Can't open CVS/Root
|
140
|
-
# cannot determine CVSROOT
|
141
|
-
----
|
142
|
-
|
143
|
-
////
|
144
|
-
== Checkout the CVS repository
|
145
|
-
|
146
|
-
First set the `CVSROOT` and `CVS_RSH` variables.
|
147
|
-
|
148
|
-
[source,sh]
|
149
|
-
----
|
150
|
-
export CVSROOT=:ext:ronald@cvs.boost-lab.net:/stepmod
|
151
|
-
export CVS_RSH=ssh
|
152
|
-
cvs checkout stepmod
|
153
|
-
# => stepmod/ is created in $PWD
|
154
|
-
----
|
155
|
-
////
|
156
|
-
|
157
|
-
|
158
|
-
=== Run the import
|
159
|
-
|
160
|
-
Run the import from CVS to Git.
|
161
|
-
|
162
|
-
Go to the directory that will carry the target Git repository.
|
163
|
-
|
164
|
-
Run `git cvsimport`.
|
165
|
-
|
166
|
-
[source,sh]
|
167
|
-
----
|
168
|
-
# Importing from remote
|
169
|
-
$ export CVSROOT=:ext:ronald@cvs.boost-lab.net:/stepmod
|
170
|
-
$ export CVS_RSH=ssh
|
171
|
-
$ git cvsimport -C iso-10303-stepmod-cvs -r cvs -k -v -d $CVSROOT stepmod
|
172
|
-
|
173
|
-
# Importing from local rsync'ed copy
|
174
|
-
$ export CVSROOT=$(pwd)/stepmod-rsync
|
175
|
-
$ git cvsimport -C iso-10303-stepmod-cvs -r cvs -k -v -d $CVSROOT stepmod
|
176
|
-
----
|
177
|
-
|
178
|
-
WARNING: TLDR. Technically this should work, but I ran into a `cvsps cannot allocate memory` error with 64GB of RAM, and not even completing the clone after 24 hours. So I gave up and switched to local. And local still takes a long time with tons of error messages. `cvs-fast-import` only takes 5-10 minutes to import.
|
179
|
-
|
180
|
-
|
181
|
-
=== Updating the CVS import
|
182
|
-
|
183
|
-
Run `git cvsimport` to synchronize the Git repo using updated data from CVS.
|
184
|
-
|
185
|
-
[source,sh]
|
186
|
-
----
|
187
|
-
$ git cvsimport
|
188
|
-
----
|
189
|
-
|
190
|
-
|