xezat 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +75 -0
- data/.fasterer.yml +6 -0
- data/.rubocop.yml +33 -0
- data/Gemfile +4 -2
- data/README.md +2 -0
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/exe/xezat +1 -0
- data/lib/xezat.rb +8 -0
- data/lib/xezat/command/bump.rb +16 -127
- data/lib/xezat/command/bump/changelog.rb +29 -0
- data/lib/xezat/command/bump/compiler.rb +28 -0
- data/lib/xezat/command/bump/cygport_dep.rb +18 -0
- data/lib/xezat/command/bump/development_package.rb +22 -0
- data/lib/xezat/command/bump/file.rb +37 -0
- data/lib/xezat/command/bump/language.rb +30 -0
- data/lib/xezat/command/bump/runtime_package.rb +17 -0
- data/lib/xezat/command/bump/src_uri.rb +21 -0
- data/lib/xezat/command/bump/tool.rb +13 -0
- data/lib/xezat/command/debug.rb +2 -2
- data/lib/xezat/command/doctor.rb +4 -2
- data/lib/xezat/command/generate.rb +2 -2
- data/lib/xezat/command/init.rb +15 -11
- data/lib/xezat/command/port.rb +16 -7
- data/lib/xezat/config.rb +3 -1
- data/lib/xezat/cygchangelog.rb +24 -18
- data/lib/xezat/cygclasses.rb +4 -1
- data/lib/xezat/cygversion.rb +5 -3
- data/lib/xezat/debugger/linguist.rb +4 -0
- data/lib/xezat/debugger/variable.rb +2 -0
- data/lib/xezat/detector/autoconf.rb +2 -0
- data/lib/xezat/detector/automake.rb +2 -0
- data/lib/xezat/detector/boost.m4.rb +3 -0
- data/lib/xezat/detector/cmake.rb +2 -0
- data/lib/xezat/detector/gengetopt.rb +2 -0
- data/lib/xezat/detector/gnulib.rb +2 -0
- data/lib/xezat/detector/gobject-introspection.rb +2 -0
- data/lib/xezat/detector/halibut.rb +2 -0
- data/lib/xezat/detector/libQt5Core-devel.rb +2 -0
- data/lib/xezat/detector/libtool.rb +9 -0
- data/lib/xezat/detector/make.rb +3 -2
- data/lib/xezat/detector/meson.rb +2 -0
- data/lib/xezat/detector/ninja.rb +4 -0
- data/lib/xezat/detector/python27.rb +24 -0
- data/lib/xezat/detector/{python-docutils.rb → python3-docutils.rb} +5 -2
- data/lib/xezat/detector/python36.rb +24 -0
- data/lib/xezat/detector/roundup.rb +2 -0
- data/lib/xezat/detector/waf.rb +9 -1
- data/lib/xezat/detectors.rb +12 -1
- data/lib/xezat/ext/linguist/file_blob.rb +3 -1
- data/lib/xezat/generator/pkgconfig.rb +23 -20
- data/lib/xezat/main.rb +4 -3
- data/lib/xezat/packages.rb +7 -0
- data/lib/xezat/variables.rb +23 -4
- data/lib/xezat/version.rb +3 -1
- data/share/xezat/compilers.json +0 -3
- data/xezat.gemspec +13 -9
- metadata +70 -15
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c0af671c67dab5b04826969bc2ec3d76d2bebad555c9b56cdc2afaf9bafc8600
|
4
|
+
data.tar.gz: cd5799a4eaeb7f9bcdc7ae0ca59271b7d40241d07bb0f37d90a5554b0889e98f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c51af33761f4ff6e3edc6edb02e1352a864bd4a7dae447c98bf3328fd0d05b7c54684d3ec73394cf9d0ce81a0a21bb680ba9a89b42e14270d8f91da0c379c28
|
7
|
+
data.tar.gz: abdc28922f8369cef8a4aaabac83124f5208643ded6ad7af2c4517ef49cc4be05c8962849a33a5970de498a404dc8d417941fb28c32139947445fd146757859d
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby
|
11
|
+
|
12
|
+
working_directory: ~/repo
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
- run:
|
18
|
+
name: Init & update submodule
|
19
|
+
command: |
|
20
|
+
git submodule init
|
21
|
+
git submodule update
|
22
|
+
git submodule foreach git pull origin master
|
23
|
+
|
24
|
+
# Download and cache dependencies
|
25
|
+
- restore_cache:
|
26
|
+
keys:
|
27
|
+
- v1-dependencies-{{ .Branch }}
|
28
|
+
# fallback to using the latest cache if no exact match is found
|
29
|
+
#- v1-dependencies-
|
30
|
+
|
31
|
+
- run:
|
32
|
+
name: Show ruby version
|
33
|
+
command: |
|
34
|
+
ruby -v
|
35
|
+
|
36
|
+
- run:
|
37
|
+
name: Install native libraries
|
38
|
+
command: |
|
39
|
+
sudo apt-get install cmake libicu-dev
|
40
|
+
|
41
|
+
- run:
|
42
|
+
name: Install dependencies
|
43
|
+
command: |
|
44
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
45
|
+
|
46
|
+
- save_cache:
|
47
|
+
paths:
|
48
|
+
- ./vendor/bundle
|
49
|
+
key: v1-dependencies-{{ .Branch }}
|
50
|
+
|
51
|
+
# Rubocop
|
52
|
+
- run:
|
53
|
+
name: Rubocop
|
54
|
+
command: |
|
55
|
+
bundle exec rubocop -D -c .rubocop.yml --format simple
|
56
|
+
|
57
|
+
# Fasterer
|
58
|
+
- run:
|
59
|
+
name: Fasterer
|
60
|
+
command: |
|
61
|
+
bundle exec fasterer
|
62
|
+
|
63
|
+
# Run tests
|
64
|
+
- run:
|
65
|
+
name: Run tests
|
66
|
+
command: |
|
67
|
+
mkdir /tmp/test-results
|
68
|
+
bundle exec rspec --no-color \
|
69
|
+
--format progress \
|
70
|
+
--format RspecJunitFormatter \
|
71
|
+
--out /tmp/test-results/rspec.xml
|
72
|
+
|
73
|
+
# Collect reports
|
74
|
+
- store_test_results:
|
75
|
+
path: /tmp/test-results
|
data/.fasterer.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
Exclude:
|
6
|
+
- 'spec/cygport/**/*'
|
7
|
+
- 'vendor/**/*'
|
8
|
+
|
9
|
+
Layout/IndentHeredoc:
|
10
|
+
EnforcedStyle: active_support
|
11
|
+
|
12
|
+
Metrics/AbcSize:
|
13
|
+
Max: 40
|
14
|
+
Metrics/BlockLength:
|
15
|
+
Exclude:
|
16
|
+
- '*.gemspec'
|
17
|
+
- 'spec/**/*'
|
18
|
+
Metrics/CyclomaticComplexity:
|
19
|
+
Max: 10
|
20
|
+
Metrics/LineLength:
|
21
|
+
Max: 160
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Max: 35
|
24
|
+
Metrics/ParameterLists:
|
25
|
+
Max: 8
|
26
|
+
Metrics/PerceivedComplexity:
|
27
|
+
Max: 12
|
28
|
+
|
29
|
+
Naming/FileName:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/Documentation:
|
33
|
+
Enabled: false
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in xezat.gemspec
|
6
8
|
gemspec
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'xezat'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "xezat"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/exe/xezat
CHANGED
data/lib/xezat.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -8,4 +10,10 @@ module Xezat
|
|
8
10
|
INI_FILE = File.expand_path(File.join(Dir.home, '.xezat'))
|
9
11
|
|
10
12
|
LOG = Logger.new(STDOUT)
|
13
|
+
LOG.formatter = proc { |_severity, datetime, _progname, message|
|
14
|
+
"#{datetime}: #{message}\n"
|
15
|
+
}
|
16
|
+
|
17
|
+
class CygportProcessError < StandardError
|
18
|
+
end
|
11
19
|
end
|
data/lib/xezat/command/bump.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'facets/file/atomic_write'
|
2
4
|
require 'find'
|
3
5
|
require 'json'
|
4
6
|
require 'xezat'
|
7
|
+
require 'xezat/command/bump/changelog'
|
8
|
+
require 'xezat/command/bump/development_package'
|
9
|
+
require 'xezat/command/bump/file'
|
10
|
+
require 'xezat/command/bump/runtime_package'
|
11
|
+
require 'xezat/command/bump/src_uri'
|
5
12
|
require 'xezat/cygchangelog'
|
6
13
|
require 'xezat/cygclasses'
|
7
|
-
require 'xezat/detectors'
|
8
|
-
require 'xezat/ext/linguist/file_blob'
|
9
14
|
require 'xezat/packages'
|
10
15
|
require 'xezat/variables'
|
11
16
|
|
12
17
|
module Xezat
|
13
|
-
|
14
|
-
class FilePermissionError < StandardError
|
15
|
-
end
|
16
|
-
|
17
|
-
class IllegalStateError < StandardError
|
18
|
-
end
|
19
|
-
|
20
18
|
module Command
|
21
19
|
class Bump
|
22
20
|
include Xezat
|
@@ -27,134 +25,25 @@ module Xezat
|
|
27
25
|
end
|
28
26
|
|
29
27
|
def execute
|
30
|
-
|
28
|
+
LOG.debug('Start bumping')
|
29
|
+
pkgs = packages
|
31
30
|
vars = variables(@cygport)
|
32
31
|
readme_file = File.expand_path(File.join(vars[:C], 'README'))
|
33
32
|
|
34
33
|
info = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
src_uri: get_src_uri(vars),
|
35
|
+
runtimes: get_runtime_packages(@cygport),
|
36
|
+
developments: get_development_packages(vars, pkgs),
|
37
|
+
files: get_files(vars),
|
38
|
+
changelog: get_changelog(vars, @options, readme_file)
|
40
39
|
}
|
41
40
|
|
41
|
+
LOG.debug('Write ChangeLog atomically')
|
42
42
|
File.atomic_write(readme_file) do |f|
|
43
43
|
f.write(get_embedded_contents(vars, info))
|
44
44
|
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def get_src_uri(vars, cygclasses = CygclassManager.new)
|
49
|
-
cygclasses.vcs.each do |vcs|
|
50
|
-
next unless vars.key?("_#{vcs}_CYGCLASS_".intern)
|
51
|
-
src_uri_key = "#{vcs.to_s.upcase}_URI".intern
|
52
|
-
return vars[src_uri_key].split if vars.key?(src_uri_key)
|
53
|
-
end
|
54
|
-
vars[:SRC_URI].split
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def get_runtime_packages(cygport)
|
59
|
-
command = ['bash', File.expand_path(File.join(DATA_DIR, 'invoke_cygport_dep.sh')), cygport]
|
60
|
-
result, error, status = Open3.capture3(command.join(' '))
|
61
|
-
raise CygportProcessError, error unless status.success?
|
62
|
-
result.gsub!(/^.*\*\*\*.*$/, '')
|
63
|
-
result.split($INPUT_RECORD_SEPARATOR).map!(&:lstrip)
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def get_development_packages(variables, packages)
|
68
|
-
compilers = get_compilers(get_languages(variables[:S]), variables)
|
69
|
-
tools = get_tools(variables)
|
70
|
-
development_packages = (compilers + tools + [:cygport]).uniq.sort
|
71
|
-
development_packages.map! do |package|
|
72
|
-
packages[package] || ''
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def get_compilers(languages, variables)
|
77
|
-
compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
|
78
|
-
compiler_candidates = JSON.parse(File.read(compiler_file))
|
79
|
-
compilers = []
|
80
|
-
languages.uniq.each do |language|
|
81
|
-
next unless compiler_candidates.key?(language)
|
82
|
-
compiler_candidate = compiler_candidates[language]
|
83
|
-
if compiler_candidate['package'] == 'python'
|
84
|
-
pkg_names = variables[:PKG_NAMES] || variables[:PN]
|
85
|
-
if pkg_names.include?('python3-')
|
86
|
-
compilers << :'python3'
|
87
|
-
elsif pkg_names.include?('pypi-')
|
88
|
-
compilers << :'pypi'
|
89
|
-
else
|
90
|
-
compilers << compiler_candidate['package'].intern
|
91
|
-
end
|
92
|
-
else
|
93
|
-
compilers << compiler_candidate['package'].intern
|
94
|
-
end
|
95
|
-
next unless compiler_candidate.key?('dependencies')
|
96
|
-
compiler_candidate['dependencies'].each do |dependency|
|
97
|
-
compilers << dependency.intern
|
98
|
-
end
|
99
|
-
end
|
100
|
-
compilers.uniq
|
101
|
-
end
|
102
45
|
|
103
|
-
|
104
|
-
languages_file = File.expand_path(File.join(DATA_DIR, 'languages.json'))
|
105
|
-
languages_candidates = JSON.parse(File.read(languages_file))
|
106
|
-
languages = []
|
107
|
-
Find.find(top_src_dir) do |path|
|
108
|
-
next if FileTest.directory?(path)
|
109
|
-
name = languages_candidates[File.extname(path)]
|
110
|
-
if name.nil?
|
111
|
-
language = Xezat::Linguist::FileBlob.new(path).language
|
112
|
-
next if language.nil?
|
113
|
-
name = language.name
|
114
|
-
end
|
115
|
-
languages << name
|
116
|
-
end
|
117
|
-
languages
|
118
|
-
end
|
119
|
-
|
120
|
-
def get_tools(variables)
|
121
|
-
DetectorManager.new().detect(variables)
|
122
|
-
end
|
123
|
-
|
124
|
-
def get_files(variables)
|
125
|
-
pkg2files = {}
|
126
|
-
variables[:pkg_name].each do |pkg_name|
|
127
|
-
lst_file = File.expand_path(File.join(variables[:T], ".#{pkg_name}.lst"))
|
128
|
-
raise IllegalStateError, "No such file: #{lst_file}" unless FileTest.readable?(lst_file)
|
129
|
-
lines = File.readlines(lst_file)
|
130
|
-
lines.delete_if do |path|
|
131
|
-
path.strip!
|
132
|
-
path[-1] == File::SEPARATOR # ignore directory
|
133
|
-
end.map! do |path|
|
134
|
-
File::SEPARATOR + path
|
135
|
-
end
|
136
|
-
if variables[:PN] == pkg_name
|
137
|
-
readme = File::SEPARATOR + File.join('usr', 'share', 'doc', 'Cygwin', "#{pkg_name}.README")
|
138
|
-
lines << readme.strip unless lines.include?(readme)
|
139
|
-
end
|
140
|
-
pkg2files[pkg_name.intern] = lines.sort
|
141
|
-
end
|
142
|
-
pkg2files
|
143
|
-
end
|
144
|
-
|
145
|
-
def get_changelog(variables, options, readme_file)
|
146
|
-
current_version = variables[:PVR].intern
|
147
|
-
if FileTest.exist?(readme_file)
|
148
|
-
raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest.readable?(readme_file)
|
149
|
-
raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest.writable?(readme_file)
|
150
|
-
changelog = Cygchangelog.new(File.read(readme_file))
|
151
|
-
message = options['message'] || 'Version bump.'
|
152
|
-
changelog[current_version] = message unless changelog.key?(current_version)
|
153
|
-
else
|
154
|
-
changelog = Cygchangelog.new
|
155
|
-
changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
|
156
|
-
end
|
157
|
-
changelog
|
46
|
+
LOG.debug('End bumping')
|
158
47
|
end
|
159
48
|
|
160
49
|
def get_embedded_contents(variables, info)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
class FilePermissionError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
module Command
|
10
|
+
class Bump
|
11
|
+
def get_changelog(variables, options, readme_file)
|
12
|
+
LOG.debug('Append latest log to changelog')
|
13
|
+
current_version = variables[:PVR].intern
|
14
|
+
if FileTest.exist?(readme_file)
|
15
|
+
raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest.readable?(readme_file)
|
16
|
+
raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest.writable?(readme_file)
|
17
|
+
|
18
|
+
changelog = Cygchangelog.new(File.read(readme_file))
|
19
|
+
message = options['message'] || 'Version bump.'
|
20
|
+
changelog[current_version] = message unless changelog.key?(current_version)
|
21
|
+
else
|
22
|
+
changelog = Cygchangelog.new
|
23
|
+
changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
|
24
|
+
end
|
25
|
+
changelog
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
module Command
|
7
|
+
class Bump
|
8
|
+
def get_compilers(languages, _variables)
|
9
|
+
LOG.debug('Collect compilers')
|
10
|
+
compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
|
11
|
+
compiler_candidates = JSON.parse(File.read(compiler_file))
|
12
|
+
compilers = []
|
13
|
+
languages.uniq.each do |language|
|
14
|
+
next unless compiler_candidates.key?(language)
|
15
|
+
|
16
|
+
compiler_candidate = compiler_candidates[language]
|
17
|
+
compilers << compiler_candidate['package'].intern
|
18
|
+
next unless compiler_candidate.key?('dependencies')
|
19
|
+
|
20
|
+
compiler_candidate['dependencies'].each do |dependency|
|
21
|
+
compilers << dependency.intern
|
22
|
+
end
|
23
|
+
end
|
24
|
+
compilers.uniq
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
require 'xezat'
|
5
|
+
|
6
|
+
module Xezat
|
7
|
+
module Command
|
8
|
+
class Bump
|
9
|
+
def invoke_cygport_dep(cygport)
|
10
|
+
command = ['bash', File.expand_path(File.join(DATA_DIR, 'invoke_cygport_dep.sh')), cygport]
|
11
|
+
result, error, status = Open3.capture3(command.join(' '))
|
12
|
+
raise CygportProcessError, error unless status.success?
|
13
|
+
|
14
|
+
result
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|