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
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
require 'pp'
|
3
5
|
require 'xezat/ext/linguist/file_blob'
|
@@ -18,8 +20,10 @@ module Xezat
|
|
18
20
|
top_src_dir = vars[:S]
|
19
21
|
Find.find(top_src_dir) do |path|
|
20
22
|
next if FileTest.directory?(path)
|
23
|
+
|
21
24
|
language = Xezat::Linguist::FileBlob.new(path).language
|
22
25
|
next if language.nil?
|
26
|
+
|
23
27
|
name = language.name
|
24
28
|
lang2files[name] = [] unless lang2files.key?(name)
|
25
29
|
lang2files[name] << path.gsub("#{top_src_dir}/", '')
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -6,6 +8,7 @@ module Xezat
|
|
6
8
|
def detect(variables)
|
7
9
|
Find.find(variables[:S]) do |file|
|
8
10
|
next unless file.end_with?(File::SEPARATOR + 'configure.ac') || file.end_with?(File::SEPARATOR + 'configure.in')
|
11
|
+
|
9
12
|
File.foreach(file) do |line|
|
10
13
|
return true if line.lstrip.start_with?('BOOST_REQUIRE')
|
11
14
|
end
|
data/lib/xezat/detector/cmake.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
|
3
5
|
module Xezat
|
@@ -7,6 +9,13 @@ module Xezat
|
|
7
9
|
Find.find(variables[:S]) do |file|
|
8
10
|
return true if file.end_with?(File::SEPARATOR + 'ltmain.sh')
|
9
11
|
end
|
12
|
+
Find.find(variables[:S]) do |file|
|
13
|
+
next unless file.end_with?(File::SEPARATOR + 'Makefile') || file.end_with?(File::SEPARATOR + 'makefile')
|
14
|
+
|
15
|
+
File.foreach(file) do |line|
|
16
|
+
return true if line.lstrip.include?('libtool')
|
17
|
+
end
|
18
|
+
end
|
10
19
|
false
|
11
20
|
end
|
12
21
|
end
|
data/lib/xezat/detector/make.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
module Detector
|
5
7
|
class Make
|
6
8
|
def detect(variables)
|
7
|
-
return true if variables.key?(:_cmake_CYGCLASS_)
|
8
9
|
Find.find(variables[:B]) do |file|
|
9
|
-
return true if
|
10
|
+
return true if file.end_with?(File::SEPARATOR + 'Makefile') || file.end_with?(File::SEPARATOR + 'makefile')
|
10
11
|
end
|
11
12
|
File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
|
12
13
|
return true if line.index('cygmake')
|
data/lib/xezat/detector/meson.rb
CHANGED
data/lib/xezat/detector/ninja.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
module Detector
|
5
7
|
class Ninja
|
6
8
|
def detect(variables)
|
9
|
+
return true if variables.key?(:_meson_CYGCLASS_)
|
10
|
+
|
7
11
|
Find.find(variables[:B]) do |file|
|
8
12
|
return true if file.end_with?(File::SEPARATOR + 'build.ninja')
|
9
13
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
module Detector
|
7
|
+
class Python27
|
8
|
+
def detect(variables)
|
9
|
+
return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python2.7'))
|
10
|
+
|
11
|
+
Find.find(variables[:D]) do |file|
|
12
|
+
next unless file.end_with?('.py')
|
13
|
+
|
14
|
+
File.foreach(file) do |line|
|
15
|
+
return true if line.strip == '#!/usr/bin/env python' || line.strip.start_with?('#!/usr/bin/env python2')
|
16
|
+
|
17
|
+
break
|
18
|
+
end
|
19
|
+
end
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'find'
|
2
4
|
|
3
5
|
module Xezat
|
4
6
|
module Detector
|
5
|
-
class
|
7
|
+
class Python3Docutils
|
6
8
|
def detect(variables)
|
7
9
|
Find.find(variables[:S]) do |file|
|
8
10
|
next unless file.end_with?(File::SEPARATOR + 'configure.ac') || file.end_with?(File::SEPARATOR + 'configure.in')
|
11
|
+
|
9
12
|
File.foreach(file) do |line|
|
10
|
-
return true if
|
13
|
+
return true if line.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
|
11
14
|
end
|
12
15
|
end
|
13
16
|
false
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
module Detector
|
7
|
+
class Python36
|
8
|
+
def detect(variables)
|
9
|
+
return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.6'))
|
10
|
+
|
11
|
+
Find.find(variables[:D]) do |file|
|
12
|
+
next unless file.end_with?('.py')
|
13
|
+
|
14
|
+
File.foreach(file) do |line|
|
15
|
+
return true if line.strip.start_with?('#!/usr/bin/env python3')
|
16
|
+
|
17
|
+
break
|
18
|
+
end
|
19
|
+
end
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/xezat/detector/waf.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Xezat
|
2
4
|
module Detector
|
3
5
|
class Waf
|
4
6
|
def detect(variables)
|
5
|
-
variables.key?(:_waf_CYGCLASS_)
|
7
|
+
if variables.key?(:_waf_CYGCLASS_)
|
8
|
+
Find.find(variables[:S]) do |file|
|
9
|
+
return false if file.end_with?(File::SEPARATOR + 'waf')
|
10
|
+
end
|
11
|
+
return true
|
12
|
+
end
|
13
|
+
false
|
6
14
|
end
|
7
15
|
end
|
8
16
|
end
|
data/lib/xezat/detectors.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
|
1
5
|
module Xezat
|
2
6
|
class DetectorManager
|
3
7
|
def initialize(detector_dir = File.expand_path(File.join(File.dirname(__FILE__), 'detector')))
|
8
|
+
LOG.debug('Load detectors')
|
4
9
|
@detectors = {}
|
5
10
|
Dir.glob(File.join(detector_dir, '*.rb')) do |rb|
|
6
11
|
require rb
|
@@ -9,9 +14,15 @@ module Xezat
|
|
9
14
|
end
|
10
15
|
|
11
16
|
def detect(variables)
|
17
|
+
LOG.debug('Detect tools')
|
12
18
|
tools = []
|
13
19
|
@detectors.each do |name, detector|
|
14
|
-
|
20
|
+
if detector.detect(variables)
|
21
|
+
tools << name
|
22
|
+
LOG.debug(" #{name} ... yes")
|
23
|
+
else
|
24
|
+
LOG.debug(" #{name} ... no")
|
25
|
+
end
|
15
26
|
end
|
16
27
|
tools
|
17
28
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'facets/file/atomic_open'
|
2
4
|
require 'facets/file/atomic_write'
|
3
5
|
require 'xezat/variables'
|
4
6
|
|
5
7
|
module Xezat
|
6
|
-
|
7
8
|
class UnregeneratableConfigurationError < StandardError
|
8
9
|
end
|
9
10
|
|
@@ -31,10 +32,11 @@ module Xezat
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def generate_pkg_config(variables, options)
|
34
|
-
srcdir = variables[:CYGCMAKE_SOURCE] || variables[:S]
|
35
|
+
srcdir = variables[:CYGCONF_SOURCE] || variables[:CYGCMAKE_SOURCE] || variables[:S]
|
35
36
|
pn = variables[:PN]
|
36
37
|
pc = File.expand_path(File.join(srcdir, "#{pn}.pc.in"))
|
37
|
-
raise UnregeneratableConfigurationError, "#{pn}.pc.in already exists" if
|
38
|
+
raise UnregeneratableConfigurationError, "#{pn}.pc.in already exists" if File.exist?(pc) && !options['overwrite']
|
39
|
+
|
38
40
|
File.atomic_write(pc) do |f|
|
39
41
|
f.write(get_pkg_config(variables))
|
40
42
|
end
|
@@ -48,10 +50,10 @@ module Xezat
|
|
48
50
|
def append_commands_to_cmakelists(variables)
|
49
51
|
srcdir = variables[:CYGCMAKE_SOURCE] || variables[:S]
|
50
52
|
cmakelists = File.expand_path(File.join(srcdir, 'CMakeLists.txt'))
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
return if File.read(cmakelists) =~ %r!DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig!
|
54
|
+
|
55
|
+
File.atomic_open(cmakelists, 'a') do |f|
|
56
|
+
f.write(get_cmakelists(variables))
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
@@ -66,25 +68,26 @@ module Xezat
|
|
66
68
|
configure_ac = File.expand_path(File.join(srcdir, 'configure.ac'))
|
67
69
|
configure_ac = File.expand_path(File.join(srcdir, 'configure.in')) unless File.exist?(configure_ac)
|
68
70
|
raise AutotoolsFileNotFoundError unless File.exist?(configure_ac)
|
71
|
+
|
69
72
|
original_ac = File.read(configure_ac)
|
70
73
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
return if original_ac =~ /#{pn}.pc/
|
75
|
+
|
76
|
+
original_ac.gsub!(/(AC_CONFIG_FILES\(\[)/, '\1' + "#{pn}.pc ")
|
77
|
+
File.atomic_write(configure_ac) do |fa|
|
78
|
+
fa.write(original_ac)
|
79
|
+
|
80
|
+
makefile_am = File.expand_path(File.join(srcdir, 'Makefile.am'))
|
81
|
+
raise AutotoolsFileNotFoundError unless File.exist?(makefile_am)
|
75
82
|
|
76
|
-
|
77
|
-
raise AutotoolsFileNotFoundError unless File.exist?(makefile_am)
|
83
|
+
break if File.read(makefile_am) =~ /pkgconfig_DATA/
|
78
84
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
fm.write(commands_am)
|
83
|
-
end
|
84
|
-
end
|
85
|
+
commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'Makefile.am')))
|
86
|
+
File.atomic_open(makefile_am, 'a') do |fm|
|
87
|
+
fm.write(commands_am)
|
85
88
|
end
|
86
89
|
end
|
87
90
|
end
|
88
91
|
end
|
89
92
|
end
|
90
|
-
end
|
93
|
+
end
|
data/lib/xezat/main.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
require 'thor/zsh_completion'
|
3
5
|
require 'xezat'
|
@@ -11,7 +13,7 @@ module Xezat
|
|
11
13
|
|
12
14
|
desc 'version', 'Print version'
|
13
15
|
|
14
|
-
def version
|
16
|
+
def version
|
15
17
|
puts "Xezat #{Xezat::VERSION}"
|
16
18
|
end
|
17
19
|
|
@@ -37,7 +39,7 @@ module Xezat
|
|
37
39
|
|
38
40
|
desc 'debug subcommand', 'Debug cygport'
|
39
41
|
require 'xezat/command/debug'
|
40
|
-
subcommand 'debug',Command::Debug
|
42
|
+
subcommand 'debug', Command::Debug
|
41
43
|
|
42
44
|
desc 'doctor', 'Check your system for potential problems'
|
43
45
|
|
@@ -58,6 +60,5 @@ module Xezat
|
|
58
60
|
require 'xezat/command/port'
|
59
61
|
Command::Port.new(options, cygport).execute
|
60
62
|
end
|
61
|
-
|
62
63
|
end
|
63
64
|
end
|
data/lib/xezat/packages.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat'
|
4
|
+
|
1
5
|
module Xezat
|
2
6
|
def packages(db_path = '/etc/setup/installed.db')
|
7
|
+
LOG.debug("Collect installed packages from #{db_path}")
|
3
8
|
raise ArgumentError, "#{db_path} not found" unless File.exist?(db_path)
|
9
|
+
|
4
10
|
packages = {}
|
5
11
|
File.read(db_path).lines do |line|
|
6
12
|
record = line.split(/\s+/)
|
7
13
|
next unless record.size == 3 # /^hoge hoge-ver-rel.tar.bz2 0$/
|
14
|
+
|
8
15
|
packages[record[0].intern] = record[1].gsub(/\.tar\.bz2$/, '')
|
9
16
|
end
|
10
17
|
packages
|
data/lib/xezat/variables.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'facets/file/atomic_write'
|
1
4
|
require 'facets/string/word_wrap'
|
2
5
|
require 'open3'
|
3
6
|
require 'uri'
|
@@ -5,19 +8,35 @@ require 'yaml'
|
|
5
8
|
require 'xezat'
|
6
9
|
|
7
10
|
module Xezat
|
8
|
-
class CygportProcessError < StandardError
|
9
|
-
end
|
10
|
-
|
11
11
|
def variables(cygport)
|
12
|
+
cygport_dir = File.dirname(File.absolute_path(cygport))
|
13
|
+
cache_file = File.expand_path(File.join(cygport_dir, File.basename(cygport, '.cygport') + '.cache.yml'))
|
14
|
+
|
15
|
+
LOG.debug('Extract variables')
|
16
|
+
|
17
|
+
if File.exist?(cache_file) && File.ctime(cache_file) > File.ctime(cygport)
|
18
|
+
LOG.debug(' Read cache for variables')
|
19
|
+
return YAML.safe_load(File.open(cache_file), [Symbol]).each_value do |v|
|
20
|
+
v.strip! if v.respond_to?(:strip)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
12
24
|
command = ['bash', File.expand_path(File.join(DATA_DIR, 'show_cygport_variable.sh')), cygport]
|
13
25
|
result, error, status = Open3.capture3(command.join(' '))
|
14
26
|
raise CygportProcessError, error unless status.success?
|
27
|
+
|
15
28
|
result.gsub!(/^.*\*\*\*.*$/, '')
|
16
29
|
|
17
|
-
variables = YAML.
|
30
|
+
variables = YAML.safe_load(result, [Symbol]).each_value do |v|
|
18
31
|
v.strip! if v.respond_to?(:strip)
|
19
32
|
end
|
20
33
|
variables[:DESCRIPTION].word_wrap!(79)
|
34
|
+
|
35
|
+
File.atomic_write(cache_file) do |f|
|
36
|
+
LOG.debug(' Write cache for variables')
|
37
|
+
f.write(YAML.dump(variables))
|
38
|
+
end
|
39
|
+
|
21
40
|
variables
|
22
41
|
end
|
23
42
|
end
|