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
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
require 'xezat/command/bump/compiler'
|
5
|
+
require 'xezat/command/bump/language'
|
6
|
+
require 'xezat/command/bump/tool'
|
7
|
+
|
8
|
+
module Xezat
|
9
|
+
module Command
|
10
|
+
class Bump
|
11
|
+
def get_development_packages(variables, packages)
|
12
|
+
LOG.debug('Collect development packages')
|
13
|
+
compilers = get_compilers(get_languages(variables[:S]), variables)
|
14
|
+
tools = get_tools(variables)
|
15
|
+
development_packages = (compilers + tools + [:cygport]).uniq.sort
|
16
|
+
development_packages.map! do |package|
|
17
|
+
packages[package] || ''
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
class IllegalStateError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
module Command
|
10
|
+
class Bump
|
11
|
+
def get_files(variables)
|
12
|
+
LOG.debug('Collect files')
|
13
|
+
pkg2files = {}
|
14
|
+
variables[:pkg_name].each do |pkg_name|
|
15
|
+
LOG.debug(" Collect #{pkg_name}")
|
16
|
+
lst_file = File.expand_path(File.join(variables[:T], ".#{pkg_name}.lst"))
|
17
|
+
raise IllegalStateError, "No such file: #{lst_file}" unless FileTest.readable?(lst_file)
|
18
|
+
|
19
|
+
lines = File.readlines(lst_file)
|
20
|
+
lines.delete_if do |path|
|
21
|
+
path.strip!
|
22
|
+
path[-1] == File::SEPARATOR # ignore directory
|
23
|
+
end
|
24
|
+
lines.map! do |path|
|
25
|
+
File::SEPARATOR + path
|
26
|
+
end
|
27
|
+
if variables[:PN] == pkg_name
|
28
|
+
readme = File::SEPARATOR + File.join('usr', 'share', 'doc', 'Cygwin', "#{pkg_name}.README")
|
29
|
+
lines << readme.strip unless lines.include?(readme)
|
30
|
+
end
|
31
|
+
pkg2files[pkg_name.intern] = lines.sort
|
32
|
+
end
|
33
|
+
pkg2files
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
require 'xezat/ext/linguist/file_blob'
|
5
|
+
|
6
|
+
module Xezat
|
7
|
+
module Command
|
8
|
+
class Bump
|
9
|
+
def get_languages(top_src_dir)
|
10
|
+
LOG.debug('Collect languages')
|
11
|
+
languages_file = File.expand_path(File.join(DATA_DIR, 'languages.json'))
|
12
|
+
languages_candidates = JSON.parse(File.read(languages_file))
|
13
|
+
languages = []
|
14
|
+
Find.find(top_src_dir) do |path|
|
15
|
+
next if FileTest.directory?(path)
|
16
|
+
|
17
|
+
name = languages_candidates[File.extname(path)]
|
18
|
+
if name.nil?
|
19
|
+
language = Xezat::Linguist::FileBlob.new(path).language
|
20
|
+
next if language.nil?
|
21
|
+
|
22
|
+
name = language.name
|
23
|
+
end
|
24
|
+
languages << name
|
25
|
+
end
|
26
|
+
languages.uniq
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
require 'xezat/command/bump/cygport_dep'
|
5
|
+
require 'xezat/variables'
|
6
|
+
|
7
|
+
module Xezat
|
8
|
+
module Command
|
9
|
+
class Bump
|
10
|
+
def get_runtime_packages(cygport)
|
11
|
+
LOG.debug('Collect runtime packages from cygport dep')
|
12
|
+
result = invoke_cygport_dep(cygport)
|
13
|
+
result.gsub(/^.*\*\*\*.*$/, '').split($INPUT_RECORD_SEPARATOR).map(&:lstrip)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
require 'xezat/cygclasses'
|
5
|
+
|
6
|
+
module Xezat
|
7
|
+
module Command
|
8
|
+
class Bump
|
9
|
+
def get_src_uri(vars, cygclasses = CygclassManager.new)
|
10
|
+
LOG.debug('Collect SRC_URI')
|
11
|
+
cygclasses.vcs.each do |vcs|
|
12
|
+
next unless vars.key?("_#{vcs}_CYGCLASS_".intern)
|
13
|
+
|
14
|
+
src_uri_key = "#{vcs.to_s.upcase}_URI".intern
|
15
|
+
return vars[src_uri_key].split if vars.key?(src_uri_key)
|
16
|
+
end
|
17
|
+
vars[:SRC_URI].split
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/xezat/command/debug.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
module Command
|
5
7
|
class Debug < Thor
|
6
|
-
|
7
8
|
desc 'linguist cygport', 'Show used programming languages'
|
8
9
|
|
9
10
|
def linguist(cygport)
|
@@ -17,7 +18,6 @@ module Xezat
|
|
17
18
|
require 'xezat/debugger/variable'
|
18
19
|
Debugger::Variable.new(cygport).debug
|
19
20
|
end
|
20
|
-
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/xezat/command/doctor.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'zlib'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -5,8 +7,7 @@ module Xezat
|
|
5
7
|
class Doctor
|
6
8
|
include Xezat
|
7
9
|
|
8
|
-
def initialize
|
9
|
-
end
|
10
|
+
def initialize; end
|
10
11
|
|
11
12
|
def execute
|
12
13
|
get_contents_uniqueness.each do |path, pkg|
|
@@ -22,6 +23,7 @@ module Xezat
|
|
22
23
|
gz.each_line do |line|
|
23
24
|
line.strip!
|
24
25
|
next if line.end_with?('/')
|
26
|
+
|
25
27
|
path = line.intern
|
26
28
|
content2pkg[path] = [] unless content2pkg.key?(path)
|
27
29
|
content2pkg[path] << pkg
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
module Command
|
5
7
|
class Generate < Thor
|
6
|
-
|
7
8
|
desc 'generate pkgconfig cygport', 'Generate *.pc'
|
8
9
|
option :overwrite, type: :boolean, aliases: '-o', desc: 'overwrite *.pc'
|
9
10
|
|
@@ -11,7 +12,6 @@ module Xezat
|
|
11
12
|
require 'xezat/generator/pkgconfig'
|
12
13
|
Generator::Pkgconfig.new(options, cygport).generate
|
13
14
|
end
|
14
|
-
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/xezat/command/init.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'facets/file/atomic_write'
|
2
4
|
require 'json'
|
3
5
|
require 'xezat/config'
|
4
6
|
require 'xezat/cygclasses'
|
5
7
|
|
6
8
|
module Xezat
|
7
|
-
|
8
9
|
class NoSuchRepositoryError < StandardError
|
9
10
|
end
|
10
11
|
|
@@ -29,7 +30,8 @@ module Xezat
|
|
29
30
|
def execute
|
30
31
|
cygclass_dir = config(@options[:config])['cygwin']['cygclassdir']
|
31
32
|
repository_variables = get_repository_variables(@options['repository'])
|
32
|
-
raise UnoverwritableCygportError, "#{cygport} already exists" if
|
33
|
+
raise UnoverwritableCygportError, "#{cygport} already exists" if FileTest.exist?(@cygport) && !@options['overwrite']
|
34
|
+
|
33
35
|
cygclasses = (@options['inherit'] || '').split(',')
|
34
36
|
template_variables = get_template_variables(repository_variables, CygclassManager.new(cygclass_dir), cygclasses)
|
35
37
|
File.atomic_write(@cygport) do |f|
|
@@ -40,12 +42,13 @@ module Xezat
|
|
40
42
|
def get_repository_variables(repository)
|
41
43
|
if repository
|
42
44
|
repository_file = File.expand_path(File.join(REPOSITORY_DIR, "#{repository}.json"))
|
43
|
-
raise NoSuchRepositoryError, "No such repository: #{template}" unless
|
45
|
+
raise NoSuchRepositoryError, "No such repository: #{template}" unless FileTest.exist?(repository_file) || FileTest.readable?(repository_file)
|
46
|
+
|
44
47
|
JSON.parse(File.read(repository_file), symbolize_names: true)
|
45
48
|
else
|
46
49
|
{
|
47
|
-
|
48
|
-
|
50
|
+
HOMEPAGE: '',
|
51
|
+
SRC_URI: ''
|
49
52
|
}
|
50
53
|
end
|
51
54
|
end
|
@@ -55,16 +58,17 @@ module Xezat
|
|
55
58
|
vcs_prefix = 'SRC'
|
56
59
|
cygclasses.each do |cygclass|
|
57
60
|
raise NoSuchCygclassError, "No such cygclass: #{cygclass}" unless cygclass_manager.include?(cygclass.intern)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
|
62
|
+
next unless cygclass_manager.vcs?(cygclass.intern)
|
63
|
+
raise CygclassConflictError, "#{cygclass} conflict with #{vcs_class}" if vcs_class
|
64
|
+
|
65
|
+
vcs_class = cygclass
|
62
66
|
end
|
63
67
|
vcs_prefix = vcs_class.to_s.upcase if vcs_class
|
64
68
|
vcs_uri = "#{vcs_prefix}_URI".intern
|
65
69
|
{
|
66
|
-
|
67
|
-
|
70
|
+
:HOMEPAGE => original_template_variables[:HOMEPAGE],
|
71
|
+
vcs_uri => original_template_variables[vcs_uri]
|
68
72
|
}
|
69
73
|
end
|
70
74
|
|
data/lib/xezat/command/port.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'xezat'
|
1
5
|
require 'xezat/config'
|
2
6
|
require 'xezat/variables'
|
3
7
|
|
4
8
|
module Xezat
|
5
|
-
|
6
9
|
class NoPortDirectoryError < StandardError
|
7
10
|
end
|
8
11
|
|
@@ -16,24 +19,30 @@ module Xezat
|
|
16
19
|
end
|
17
20
|
|
18
21
|
def execute
|
22
|
+
LOG.debug('Start porting')
|
19
23
|
vars = variables(@cygport)
|
20
24
|
d = File.expand_path(File.join(get_port_directory(@options), vars[:PN]))
|
25
|
+
cygport = File.expand_path(File.join(vars[:top], @cygport))
|
26
|
+
readme = File.expand_path(File.join(vars[:C], 'README'))
|
27
|
+
src_patch = File.expand_path(File.join(vars[:patchdir], "#{vars[:PF]}.src.patch"))
|
28
|
+
|
21
29
|
fuo = {
|
22
|
-
|
23
|
-
|
30
|
+
noop: @options[:noop],
|
31
|
+
verbose: @options[:noop] || @options[:verbose]
|
24
32
|
}
|
25
33
|
|
26
34
|
FileUtils.mkdir_p(d, fuo)
|
27
|
-
FileUtils.cp(
|
28
|
-
FileUtils.cp(
|
29
|
-
src_patch = File.expand_path(File.join(vars[:patchdir], "#{vars[:PF]}.src.patch"))
|
35
|
+
FileUtils.cp(cygport, d, fuo)
|
36
|
+
FileUtils.cp(readme, d, fuo)
|
30
37
|
FileUtils.cp(src_patch, d, fuo) unless FileTest.zero?(src_patch)
|
38
|
+
LOG.debug('End porting')
|
31
39
|
end
|
32
40
|
|
33
41
|
def get_port_directory(options)
|
34
|
-
conf = config(
|
42
|
+
conf = config(options[:config])
|
35
43
|
port_dir = conf['xezat']['portdir'] || options[:portdir]
|
36
44
|
raise NoPortDirectoryError if port_dir.nil?
|
45
|
+
|
37
46
|
port_dir
|
38
47
|
end
|
39
48
|
end
|
data/lib/xezat/config.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'inifile'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
def config(filepath = nil)
|
5
7
|
config = IniFile.new
|
6
8
|
config['cygwin'] = {
|
7
|
-
|
9
|
+
'cygclassdir' => '/usr/share/cygport/cygclass'
|
8
10
|
}
|
9
11
|
config['xezat'] = {
|
10
12
|
}
|
data/lib/xezat/cygchangelog.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'xezat/cygversion'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -6,29 +8,32 @@ module Xezat
|
|
6
8
|
|
7
9
|
class Cygchangelog
|
8
10
|
def initialize(str = '')
|
9
|
-
@changelogs =
|
11
|
+
@changelogs = nil
|
10
12
|
version = nil
|
11
13
|
str.each_line do |line|
|
12
14
|
line.rstrip!
|
13
|
-
if
|
15
|
+
if line == 'Port Notes:'
|
14
16
|
@changelogs = {}
|
17
|
+
next
|
18
|
+
end
|
19
|
+
next if @changelogs.nil?
|
20
|
+
|
21
|
+
match_version = /^----- version (.+) -----$/.match(line)
|
22
|
+
if match_version
|
23
|
+
version = match_version[1].intern
|
24
|
+
next
|
25
|
+
end
|
26
|
+
match_content = /^(.+)$/.match(line)
|
27
|
+
next unless match_content
|
28
|
+
raise ReadmeSyntaxError, 'Version missing' if version.nil?
|
29
|
+
|
30
|
+
if @changelogs.key?(version)
|
31
|
+
@changelogs[version] << $INPUT_RECORD_SEPARATOR << match_content[1]
|
15
32
|
else
|
16
|
-
|
17
|
-
if match_data = /^----- version (.+) -----$/.match(line)
|
18
|
-
version = match_data[1].intern
|
19
|
-
else
|
20
|
-
if match_data = /^(.+)$/.match(line)
|
21
|
-
raise ReadmeSyntaxError, 'Version missing' if version.nil?
|
22
|
-
if @changelogs.key?(version)
|
23
|
-
@changelogs[version] << $INPUT_RECORD_SEPARATOR << match_data[1]
|
24
|
-
else
|
25
|
-
@changelogs[version] = match_data[1]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
33
|
+
@changelogs[version] = match_content[1]
|
30
34
|
end
|
31
35
|
end
|
36
|
+
@changelogs ||= {}
|
32
37
|
end
|
33
38
|
|
34
39
|
def [](key)
|
@@ -44,9 +49,10 @@ module Xezat
|
|
44
49
|
end
|
45
50
|
|
46
51
|
def each
|
47
|
-
@changelogs.sort do |a, b|
|
52
|
+
logs = @changelogs.sort do |a, b|
|
48
53
|
-(Cygversion.new(a[0].to_s) <=> Cygversion.new(b[0].to_s))
|
49
|
-
end
|
54
|
+
end
|
55
|
+
logs.each do |k, v|
|
50
56
|
yield(k, v)
|
51
57
|
end
|
52
58
|
end
|
data/lib/xezat/cygclasses.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Xezat
|
2
4
|
class CygclassManager
|
3
5
|
def initialize(cygclass_dir = '/usr/share/cygport/cygclass')
|
4
6
|
raise ArgumentError, "#{cygclass_dir} not found" unless Dir.exist?(cygclass_dir)
|
7
|
+
|
5
8
|
@cygclasses = []
|
6
9
|
@vcs_cygclasses = []
|
7
10
|
Dir.glob(File.join(cygclass_dir, '*.cygclass')) do |filename|
|
8
11
|
cygclass = File.basename(filename, '.cygclass')
|
9
12
|
@cygclasses << cygclass.intern
|
10
13
|
File.foreach(filename) do |line|
|
11
|
-
@vcs_cygclasses << cygclass.intern if "readonly -f #{cygclass}_fetch"
|
14
|
+
@vcs_cygclasses << cygclass.intern if line.strip == "readonly -f #{cygclass}_fetch"
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
data/lib/xezat/cygversion.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -7,7 +9,7 @@ module Xezat
|
|
7
9
|
version = matched[1]
|
8
10
|
@release = matched[2]
|
9
11
|
splitted = version.split('+')
|
10
|
-
@version = splitted[0].
|
12
|
+
@version = splitted[0].tr('_', '.')
|
11
13
|
@revision = splitted.length >= 2 ? splitted[1].match(/(\d+)/)[0].to_i : Time.at(0).strftime('%Y%m%d').to_i
|
12
14
|
end
|
13
15
|
|
@@ -19,8 +21,8 @@ module Xezat
|
|
19
21
|
[@version, @revision, @release]
|
20
22
|
end
|
21
23
|
|
22
|
-
def <=>(
|
23
|
-
to_v <=>
|
24
|
+
def <=>(other)
|
25
|
+
to_v <=> other.to_v
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|