xezat 0.2.2 → 0.3.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +45 -0
  3. data/.gitignore +2 -3
  4. data/.rubocop.yml +5 -2
  5. data/.ruby-version +1 -1
  6. data/README.md +1 -1
  7. data/lib/xezat/command/bump/compiler.rb +5 -5
  8. data/lib/xezat/command/bump/cygport_dep.rb +2 -2
  9. data/lib/xezat/command/bump/development_package.rb +29 -4
  10. data/lib/xezat/command/bump/language.rb +8 -4
  11. data/lib/xezat/command/bump/runtime_package.rb +2 -1
  12. data/lib/xezat/command/bump.rb +6 -7
  13. data/lib/xezat/command/generate.rb +2 -1
  14. data/lib/xezat/command/init.rb +2 -2
  15. data/lib/xezat/command/port.rb +7 -9
  16. data/lib/xezat/command/validate/config.rb +40 -0
  17. data/lib/xezat/command/validate/license.rb +30 -0
  18. data/lib/xezat/command/validate/pkgconfig.rb +37 -0
  19. data/lib/xezat/command/validate.rb +20 -25
  20. data/lib/xezat/config.rb +1 -2
  21. data/lib/xezat/cygchangelog.rb +2 -2
  22. data/lib/xezat/cygversion.rb +2 -0
  23. data/lib/xezat/debugger/linguist.rb +0 -1
  24. data/lib/xezat/debugger/variable.rb +0 -1
  25. data/lib/xezat/detector/autoconf.rb +18 -0
  26. data/lib/xezat/detector/automake.rb +18 -0
  27. data/lib/xezat/detector/cmake.rb +1 -4
  28. data/lib/xezat/detector/{python38-docutils.rb → python39-docutils.rb} +1 -1
  29. data/lib/xezat/detectors.rb +1 -1
  30. data/lib/xezat/generator/pkgconfig.rb +32 -10
  31. data/lib/xezat/variables.rb +19 -4
  32. data/lib/xezat/version.rb +1 -1
  33. data/share/xezat/compilers.yaml +44 -0
  34. data/share/xezat/languages.yaml +11 -0
  35. data/share/xezat/repository/bitbucket.yaml +4 -0
  36. data/share/xezat/repository/github.yaml +4 -0
  37. data/share/xezat/repository/gnu.yaml +3 -0
  38. data/share/xezat/repository/savannah.yaml +3 -0
  39. data/share/xezat/repository/sourceforge.yaml +5 -0
  40. data/share/xezat/template/cmake.erb +6 -8
  41. data/share/xezat/template/cygport.erb +4 -0
  42. data/share/xezat/{show_cygport_variable.sh → var2yaml.sh} +3 -2
  43. data/xezat.gemspec +11 -11
  44. metadata +54 -51
  45. data/.circleci/config.yml +0 -110
  46. data/share/xezat/compilers.json +0 -67
  47. data/share/xezat/languages.json +0 -12
  48. data/share/xezat/repository/bitbucket.json +0 -5
  49. data/share/xezat/repository/github.json +0 -5
  50. data/share/xezat/repository/gnu.json +0 -4
  51. data/share/xezat/repository/savannah.json +0 -4
  52. data/share/xezat/repository/sourceforge.json +0 -6
  53. /data/share/xezat/{invoke_cygport_dep.sh → cygport_dep.sh} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6183648a65f69a1fc1c1a85779066ba529614681aeb56fa78979ba9d9536c625
4
- data.tar.gz: 20589012624b3e1690014d2b03ad2dda3fe01c464f5c3fb03223572a856a8dc4
3
+ metadata.gz: 44f20fb8c8d53290ca2aa712f0305df3a64fa92b5fd495e74d9c251cea4bd38c
4
+ data.tar.gz: 43aa81a90789ba5ab3d9c64b7b8aa4b93bf04d96cde0c51ceba7a35238623771
5
5
  SHA512:
6
- metadata.gz: e94a00970240eb104ba88a2126a4fbd04d97820977a383a0498e584b3373b69e8dd98260c30cb59853e36f792949c5fa527a910345b19582ea1332541f2b2a48
7
- data.tar.gz: b01a34f4cc54b8967e765045048d8759612de6653602c0833ff6b252b8302563ea286fcfde36eefb4d1ab58f623a3c32f299aedb5b741aef681363840f719e63
6
+ metadata.gz: fde0d1e68848308d416fe1e06749bfcaec89a558a40454fc8924a0038103ddbbc07db8900894d48b825a21633e112c83ce72899e40133b8766f082749a3a2f12
7
+ data.tar.gz: 0cbca3957598e70390bdb6c87bddfe94585d5d1afe85b97057158b23dae17a2ab1555c7b63410595417cf996382124e42907dd42f1aa1e43831710f26295184d
@@ -0,0 +1,45 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ with:
22
+ submodules: true
23
+ - name: Install native libraries
24
+ run: sudo apt-get install cmake libicu-dev
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: '3.2.2' # Not needed with a .ruby-version file
29
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
+ - name: Run rubocop
31
+ run: bundle exec rubocop --format simple
32
+ - name: Run fasterer
33
+ run: bundle exec fasterer
34
+ - name: Run tests
35
+ run: bundle exec rspec
36
+ - name: Formatting coverage results
37
+ uses: 5monkeys/cobertura-action@master
38
+ with:
39
+ path: tmp/coverage/coverage.xml
40
+ minimum_coverage: 75
41
+ show_branch: true
42
+ show_missing: true
43
+ show_class_names: true
44
+ link_missing_lines: true
45
+ report_name: code coverage results
data/.gitignore CHANGED
@@ -1,12 +1,11 @@
1
1
  /.bundle/
2
- /.yardoc
3
2
  /Gemfile.lock
4
- /_yardoc/
5
3
  /coverage/
6
4
  /doc/
7
5
  /pkg/
8
6
  /spec/reports/
9
7
  /tmp/
8
+ /vendor/
10
9
 
11
10
  # rspec failure tracking
12
- .rspec_status
11
+ # .rspec_status
data/.rubocop.yml CHANGED
@@ -3,16 +3,19 @@ require: rubocop-performance
3
3
  AllCops:
4
4
  NewCops: enable
5
5
  SuggestExtensions: false
6
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 3.2
7
7
  Exclude:
8
8
  - 'spec/cygport/**/*'
9
9
  - 'vendor/**/*'
10
10
 
11
+ Gemspec/DevelopmentDependencies:
12
+ EnforcedStyle: gemspec
13
+
11
14
  Layout/LineLength:
12
15
  Max: 160
13
16
 
14
17
  Metrics/AbcSize:
15
- Max: 40
18
+ Max: 45
16
19
  Metrics/BlockLength:
17
20
  Exclude:
18
21
  - '*.gemspec'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.4
1
+ 3.2.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Xezat
2
2
 
3
- [![CircleCI](https://circleci.com/gh/fd00/xezat/tree/master.svg?style=svg)](https://circleci.com/gh/fd00/xezat/tree/master)
3
+ [![Actions](https://github.com/fd00/xezat/actions/workflows/ruby.yml/badge.svg)](https://github.com/fd00/xezat/)
4
4
 
5
5
  xezat helps you win at cygport.
6
6
 
@@ -7,17 +7,17 @@ module Xezat
7
7
  class Bump
8
8
  def get_compilers(languages, _variables)
9
9
  Xezat.logger.debug(' Collect compilers')
10
- compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
11
- compiler_candidates = JSON.parse(File.read(compiler_file))
10
+ compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.yaml'))
11
+ compiler_candidates = YAML.safe_load(File.open(compiler_file), symbolize_names: true, permitted_classes: [Symbol])
12
12
  compilers = []
13
13
  languages.uniq.each do |language|
14
14
  next unless compiler_candidates.key?(language)
15
15
 
16
16
  compiler_candidate = compiler_candidates[language]
17
- compilers << compiler_candidate['package'].intern
18
- next unless compiler_candidate.key?('dependencies')
17
+ compilers << compiler_candidate[:package].intern
18
+ next unless compiler_candidate.key?(:dependencies)
19
19
 
20
- compiler_candidate['dependencies'].each do |dependency|
20
+ compiler_candidate[:dependencies].each do |dependency|
21
21
  compilers << dependency.intern
22
22
  end
23
23
  end
@@ -14,8 +14,8 @@ module Xezat
14
14
  additional_path = candidate_files.map do |file|
15
15
  File.dirname(file)
16
16
  end.sort.uniq.join(':')
17
- command = ['bash', File.expand_path(File.join(DATA_DIR, 'invoke_cygport_dep.sh')), cygport]
18
- result, error, status = Open3.capture3({ 'PATH' => "#{ENV['PATH']}:#{additional_path}" }, command.join(' '))
17
+ command = ['bash', File.expand_path(File.join(DATA_DIR, 'cygport_dep.sh')), cygport]
18
+ result, error, status = Open3.capture3({ 'PATH' => "#{ENV.fetch('PATH')}:#{additional_path}" }, command.join(' '))
19
19
  raise CygportProcessError, error unless status.success?
20
20
 
21
21
  result
@@ -8,17 +8,42 @@ require 'xezat/command/bump/tool'
8
8
  module Xezat
9
9
  module Command
10
10
  class Bump
11
- def get_development_packages(variables, packages)
11
+ def get_development_packages(variables, packages, runtimes, pkg2files)
12
12
  Xezat.logger.debug(' Collect development packages')
13
13
  compilers = get_compilers(get_languages(variables[:S]), variables)
14
14
  tools = get_tools(variables)
15
15
  build_requires = variables[:BUILD_REQUIRES].nil? ? [] : variables[:BUILD_REQUIRES].split.map(&:to_sym)
16
- development_packages = (compilers + tools + build_requires + [:cygport]).uniq.sort
17
- development_packages.delete(:'libssl-devel') if development_packages.include?(:'libssl1.0-devel')
16
+ development_packages = (compilers + tools + build_requires + [:cygport]).uniq
17
+
18
+ resolve_development_package(development_packages)
19
+
20
+ # Check gcc-gfortran
21
+ if runtimes.grep(/^libgfortran/).empty?
22
+ delete_fortran = true
23
+ pkg2files.each_value do |files|
24
+ delete_fortran = false unless files.grep(/\.mod$/).empty?
25
+ end
26
+ development_packages.delete(:'gcc-fortran') if delete_fortran
27
+ end
28
+
29
+ development_packages.sort!
30
+
18
31
  development_packages.map! do |package|
19
- packages[package] || ''
32
+ pkg = packages[package]
33
+ raise "Package #{package} is not installed in your system" if pkg.nil?
34
+
35
+ pkg
20
36
  end
21
37
  end
38
+
39
+ def resolve_development_package(development_packages)
40
+ # Check libssl duplication
41
+ development_packages.delete(:'libssl-devel') if development_packages.include?(:'libssl1.0-devel')
42
+
43
+ # Check lua duplication
44
+ development_packages.delete(:lua) if development_packages.include?(:'lua5.1-devel')
45
+ development_packages.delete(:lua) if development_packages.include?(:'luajit-devel')
46
+ end
22
47
  end
23
48
  end
24
49
  end
@@ -8,20 +8,24 @@ module Xezat
8
8
  class Bump
9
9
  def get_languages(top_src_dir)
10
10
  Xezat.logger.debug(' Collect languages')
11
- languages_file = File.expand_path(File.join(DATA_DIR, 'languages.json'))
12
- languages_candidates = JSON.parse(File.read(languages_file))
11
+ languages_file = File.expand_path(File.join(DATA_DIR, 'languages.yaml'))
12
+ languages_candidates = YAML.safe_load(File.open(languages_file), symbolize_names: true, permitted_classes: [Symbol])
13
13
  languages = []
14
14
  Find.find(top_src_dir) do |path|
15
15
  next if FileTest.directory?(path)
16
16
 
17
- name = languages_candidates[File.extname(path)]
17
+ extname = File.extname(path)
18
+ next if extname == '.inc' # ambiguous
19
+
20
+ name = languages_candidates[extname.to_sym]
18
21
  if name.nil?
22
+
19
23
  language = Xezat::Linguist::FileBlob.new(path).language
20
24
  next if language.nil?
21
25
 
22
26
  name = language.name
23
27
  end
24
- languages << name
28
+ languages << name.to_sym
25
29
  end
26
30
  languages.uniq
27
31
  end
@@ -13,10 +13,11 @@ module Xezat
13
13
  runtime_packages = result.gsub(/^.*\*\*\*.*$/, '').split($INPUT_RECORD_SEPARATOR).map(&:lstrip)
14
14
  build_requires = variables[:BUILD_REQUIRES].nil? ? [] : variables[:BUILD_REQUIRES].split.map(&:to_sym)
15
15
  runtime_packages.delete(pkgs[:'libssl-devel']) if build_requires.include?(:'libssl1.0-devel')
16
+ runtime_packages.map! { |pkg| pkg == 'python3' ? pkgs[:python39] : pkg }
16
17
  variables[:REQUIRES]&.split&.each do |req|
17
18
  runtime_packages << pkgs[req.to_sym]
18
19
  end
19
- runtime_packages.sort
20
+ runtime_packages.sort.uniq
20
21
  end
21
22
  end
22
23
  end
@@ -30,13 +30,12 @@ module Xezat
30
30
  vars = variables(@cygport)
31
31
  readme_file = File.expand_path(File.join(vars[:C], 'README'))
32
32
 
33
- info = {
34
- src_uri: get_src_uri(vars),
35
- runtimes: get_runtime_packages(vars, pkgs, @cygport),
36
- developments: get_development_packages(vars, pkgs),
37
- files: get_files(vars),
38
- changelog: get_changelog(vars, @options, readme_file)
39
- }
33
+ info = {}
34
+ info[:src_uri] = get_src_uri(vars)
35
+ info[:runtimes] = get_runtime_packages(vars, pkgs, @cygport)
36
+ info[:files] = get_files(vars)
37
+ info[:developments] = get_development_packages(vars, pkgs, info[:runtimes], info[:files])
38
+ info[:changelog] = get_changelog(vars, @options, readme_file)
40
39
 
41
40
  Xezat.logger.debug(' Write ChangeLog atomically')
42
41
  File.atomic_write(readme_file) do |f|
@@ -5,8 +5,9 @@ require 'thor'
5
5
  module Xezat
6
6
  module Command
7
7
  class Generate < Thor
8
- desc 'generate pkgconfig cygport', 'Generate *.pc'
8
+ desc 'pkgconfig cygport', 'Generate *.pc'
9
9
  option :overwrite, type: :boolean, aliases: '-o', desc: 'overwrite *.pc'
10
+ option :srcdir, type: :string, aliases: '-s', desc: 'relative path to Makefile.am / CMakeLists.txt'
10
11
 
11
12
  def pkgconfig(cygport)
12
13
  require 'xezat/generator/pkgconfig'
@@ -41,10 +41,10 @@ module Xezat
41
41
 
42
42
  def get_repository_variables(repository)
43
43
  if repository
44
- repository_file = File.expand_path(File.join(REPOSITORY_DIR, "#{repository}.json"))
44
+ repository_file = File.expand_path(File.join(REPOSITORY_DIR, "#{repository}.yaml"))
45
45
  raise NoSuchRepositoryError, "No such repository: #{template}" unless FileTest.exist?(repository_file) || FileTest.readable?(repository_file)
46
46
 
47
- JSON.parse(File.read(repository_file), symbolize_names: true)
47
+ YAML.safe_load(File.open(repository_file), symbolize_names: true, permitted_classes: [Symbol])
48
48
  else
49
49
  {
50
50
  HOMEPAGE: '',
@@ -26,15 +26,13 @@ module Xezat
26
26
  readme = File.expand_path(File.join(vars[:C], 'README'))
27
27
  src_patch = File.expand_path(File.join(vars[:patchdir], "#{vars[:PF]}.src.patch"))
28
28
 
29
- fuo = {
30
- noop: @options[:noop],
31
- verbose: @options[:noop] || @options[:verbose]
32
- }
33
-
34
- FileUtils.mkdir_p(d, fuo)
35
- FileUtils.cp(cygport, d, fuo)
36
- FileUtils.cp(readme, d, fuo)
37
- FileUtils.cp(src_patch, d, fuo) unless FileTest.zero?(src_patch)
29
+ noop = @options[:noop]
30
+ verbose = @options[:noop] || @options[:verbose]
31
+
32
+ FileUtils.mkdir_p(d, noop:, verbose:)
33
+ FileUtils.cp(cygport, d, noop:, verbose:)
34
+ FileUtils.cp(readme, d, noop:, verbose:)
35
+ FileUtils.cp(src_patch, d, noop:, verbose:) unless FileTest.empty?(src_patch)
38
36
  Xezat.logger.debug('End porting')
39
37
  end
40
38
 
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pkg-config'
4
+ require 'xezat'
5
+
6
+ module Xezat
7
+ module Command
8
+ class Validate
9
+ def validate_config(variables, gcc_version)
10
+ configs = Dir.glob(File.join(variables[:D], '/usr/bin/*-config'))
11
+ configs.each do |config|
12
+ basename = File.basename(config)
13
+ Xezat.logger.debug(" #{basename} found")
14
+
15
+ result, _, status = Open3.capture3("#{config} --cflags")
16
+ if status.success?
17
+ Xezat.logger.debug(" cflags = #{result.strip}")
18
+ else
19
+ Xezat.logger.warn(' cflags not supported')
20
+ end
21
+
22
+ result, _, status = Open3.capture3("#{config} --cxxflags")
23
+ if status.success?
24
+ Xezat.logger.debug(" cxxflags = #{result.strip}")
25
+ else
26
+ Xezat.logger.warn(' cxxflags not supported')
27
+ end
28
+
29
+ result, _, status = Open3.capture3("#{config} --libs")
30
+ if status.success?
31
+ Xezat.logger.debug(" libs = #{result.strip}")
32
+ validate_libs(variables, result.strip, gcc_version)
33
+ else
34
+ Xezat.logger.warn(' libs not supported')
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spdx'
4
+ require 'xezat'
5
+
6
+ module Xezat
7
+ module Command
8
+ class Validate
9
+ def validate_license(vars)
10
+ license = vars[:LICENSE]
11
+ if license.nil? || license.empty?
12
+ Xezat.logger.warn(' LICENSE is not defined')
13
+ elsif Spdx.valid?(license)
14
+ Xezat.logger.debug(" LICENSE = #{license}")
15
+ else
16
+ Xezat.logger.error(" LICENSE = #{license} (invalid)")
17
+ end
18
+
19
+ license_uri = vars[:LICENSE_URI]
20
+ if license_uri.nil? || license_uri.empty?
21
+ Xezat.logger.warn(' LICENSE_URI is not defined')
22
+ elsif File.exist?(File.join(vars[:S], license_uri))
23
+ Xezat.logger.debug(" LICENSE_URI = #{license_uri}")
24
+ else
25
+ Xezat.logger.error(" LICENSE_URI = #{license_uri} (not found)")
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pkg-config'
4
+ require 'xezat'
5
+
6
+ module Xezat
7
+ module Command
8
+ class Validate
9
+ def validate_pkgconfig(variables, gcc_version)
10
+ pkgconfig_path = File.join(variables[:D], 'usr', 'lib', 'pkgconfig')
11
+ PKGConfig.add_path(pkgconfig_path)
12
+ Dir.glob('*.pc', 0, base: pkgconfig_path).each do |pc|
13
+ Xezat.logger.debug(" #{pc} found")
14
+ basename = File.basename(pc, '.pc')
15
+
16
+ modversion = PKGConfig.modversion(basename)
17
+ Xezat.logger.debug(" modversion = #{modversion}")
18
+ pv = variables[:PV][0].gsub(/\+.+$/, '')
19
+ Xezat.logger.error(" modversion differs from $PN = #{pv}") unless modversion == pv
20
+
21
+ prefix = PKGConfig.variable(basename, 'prefix')
22
+ if prefix.nil? || prefix.empty? || prefix.eql?('/usr')
23
+ Xezat.logger.debug(" prefix = #{prefix}")
24
+ else
25
+ Xezat.logger.warn(" prefix = #{prefix} (not standard)")
26
+ end
27
+
28
+ Xezat.logger.debug(" cflags = #{PKGConfig.cflags(basename)}")
29
+
30
+ libs = PKGConfig.libs(basename)
31
+ Xezat.logger.debug(" libs = #{libs}")
32
+ validate_libs(variables, libs, gcc_version)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'net/http'
4
- require 'pkg-config'
5
4
  require 'uri'
5
+ require 'xezat/command/validate/config'
6
+ require 'xezat/command/validate/license'
7
+ require 'xezat/command/validate/pkgconfig'
8
+ require 'xezat/cygversion'
6
9
  require 'xezat/packages'
7
10
  require 'xezat/variables'
8
11
 
@@ -21,6 +24,8 @@ module Xezat
21
24
  vars = variables(@cygport)
22
25
  pkgs = packages
23
26
 
27
+ gcc_version = Cygversion.new(pkgs[:'gcc-core'].gsub(/^gcc-core-/, '')).version.split('.')[0]
28
+
24
29
  Xezat.logger.debug(' Validate .cygport')
25
30
  validate_cygport(@cygport)
26
31
 
@@ -30,11 +35,17 @@ module Xezat
30
35
  Xezat.logger.debug(' Validate homepage')
31
36
  validate_homepage(vars[:HOMEPAGE])
32
37
 
38
+ Xezat.logger.debug(' Validate licenses')
39
+ validate_license(vars)
40
+
33
41
  Xezat.logger.debug(' Validate BUILD_REQUIRES')
34
42
  validate_build_requires(vars[:BUILD_REQUIRES], pkgs)
35
43
 
36
44
  Xezat.logger.debug(' Validate *.pc')
37
- validate_pkgconfig(vars)
45
+ validate_pkgconfig(vars, gcc_version)
46
+
47
+ Xezat.logger.debug(' Validate *-config')
48
+ validate_config(vars, gcc_version)
38
49
 
39
50
  Xezat.logger.debug('End validating')
40
51
  end
@@ -47,21 +58,22 @@ module Xezat
47
58
 
48
59
  def validate_category(category)
49
60
  categories_file = File.expand_path(File.join(DATA_DIR, 'categories.yaml'))
50
- Xezat.logger.error(" Category is invalid : #{category}") unless YAML.safe_load(File.open(categories_file), [Symbol]).include?(category.downcase)
61
+ Xezat.logger.error(" Category is invalid : #{category}") unless
62
+ YAML.safe_load(File.open(categories_file), symbolize_names: true, permitted_classes: [Symbol]).include?(category.downcase)
51
63
  end
52
64
 
53
65
  def validate_homepage(homepage)
54
66
  response = Net::HTTP.get_response(URI.parse(homepage))
55
67
  code = response.code
56
68
  if code == '200'
57
- Xezat.logger.debug(" code = #{response.code}")
69
+ Xezat.logger.debug(" code = #{code}")
58
70
  else
59
- Xezat.logger.error(" code = #{response.code}")
71
+ Xezat.logger.error(" code = #{code}")
60
72
  end
61
73
  rescue OpenSSL::SSL::SSLError => e
62
74
  raise e unless @options[:ignore]
63
75
 
64
- Xezat.logger.error(' Ignore SSLError')
76
+ Xezat.logger.warn(' Ignore SSLError')
65
77
  end
66
78
 
67
79
  def validate_build_requires(build_requires, pkgs)
@@ -77,25 +89,8 @@ module Xezat
77
89
  end
78
90
  end
79
91
 
80
- def validate_pkgconfig(variables)
81
- pkgconfig_path = File.join(variables[:D], 'usr', 'lib', 'pkgconfig')
82
- PKGConfig.add_path(pkgconfig_path)
83
- Dir.glob('*.pc', 0, base: pkgconfig_path).each do |pc|
84
- basename = File.basename(pc, '.pc')
85
- Xezat.logger.debug(" #{basename}.pc found")
86
- modversion = PKGConfig.modversion(basename)
87
- Xezat.logger.debug(" modversion = #{modversion}")
88
- pv = variables[:PV][0].gsub(/\+.+$/, '')
89
- Xezat.logger.error(" modversion differs from $PN = #{pv}") unless modversion == pv
90
- Xezat.logger.debug(" cflags = #{PKGConfig.cflags(basename)}")
91
- libs = PKGConfig.libs(basename)
92
- Xezat.logger.debug(" libs = #{libs}")
93
- validate_libs(variables, libs)
94
- end
95
- end
96
-
97
- def validate_libs(variables, libs)
98
- lib_dirs = [File.join(variables[:D], '/usr/lib'), '/usr/lib', '/usr/lib/w32api', '/usr/lib/gcc/x86_64-pc-cygwin/11']
92
+ def validate_libs(variables, libs, gcc_version)
93
+ lib_dirs = [File.join(variables[:D], '/usr/lib'), '/usr/lib', '/usr/lib/w32api', "/usr/lib/gcc/x86_64-pc-cygwin/#{gcc_version}"]
99
94
  libs.split do |option|
100
95
  if option.start_with?('-l')
101
96
  lib_name = option[2, 255] # Assume file length limit
data/lib/xezat/config.rb CHANGED
@@ -8,8 +8,7 @@ module Xezat
8
8
  config['cygwin'] = {
9
9
  'cygclassdir' => '/usr/share/cygport/cygclass'
10
10
  }
11
- config['xezat'] = {
12
- }
11
+ config['xezat'] = {}
13
12
  config.merge!(YAML.load_file(filepath)) if filepath
14
13
  config
15
14
  end
@@ -49,11 +49,11 @@ module Xezat
49
49
  @changelogs.key?(key)
50
50
  end
51
51
 
52
- def each(&block)
52
+ def each(&)
53
53
  logs = @changelogs.sort do |a, b|
54
54
  -(Cygversion.new(a[0].to_s) <=> Cygversion.new(b[0].to_s))
55
55
  end
56
- logs.each(&block)
56
+ logs.each(&)
57
57
  end
58
58
 
59
59
  def length
@@ -4,6 +4,8 @@ require 'rubygems'
4
4
 
5
5
  module Xezat
6
6
  class Cygversion
7
+ attr_reader :version
8
+
7
9
  def initialize(str)
8
10
  matched = str.match(/(.+)-(.+)/)
9
11
  version = matched[1]
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'find'
4
- require 'pp'
5
4
  require 'xezat/ext/linguist/file_blob'
6
5
  require 'xezat/variables'
7
6
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pp'
4
3
  require 'xezat/variables'
5
4
 
6
5
  module Xezat
@@ -6,6 +6,24 @@ module Xezat
6
6
  module Detector
7
7
  class Autoconf
8
8
  def detect(variables)
9
+ return false unless variables.keys.index do |key|
10
+ %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
+ end.nil?
12
+
13
+ cygautoreconf = false
14
+ File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
15
+ if line.index('cygautoreconf')
16
+ cygautoreconf = true
17
+ return true
18
+ end
19
+ end
20
+
21
+ unless cygautoreconf
22
+ File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
23
+ return false if line.index('src_compile')
24
+ end
25
+ end
26
+
9
27
  Find.find(variables[:S]) do |file|
10
28
  return true if file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
29
  end
@@ -6,6 +6,24 @@ module Xezat
6
6
  module Detector
7
7
  class Automake
8
8
  def detect(variables)
9
+ return false unless variables.keys.index do |key|
10
+ %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
+ end.nil?
12
+
13
+ cygautoreconf = false
14
+ File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
15
+ if line.index('cygautoreconf')
16
+ cygautoreconf = true
17
+ return true
18
+ end
19
+ end
20
+
21
+ unless cygautoreconf
22
+ File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
23
+ return false if line.index('src_compile')
24
+ end
25
+ end
26
+
9
27
  Find.find(variables[:S]) do |file|
10
28
  return true if file.end_with?('.am')
11
29
  end
@@ -6,10 +6,7 @@ module Xezat
6
6
  module Detector
7
7
  class Cmake
8
8
  def detect(variables)
9
- Find.find(variables[:S]) do |file|
10
- return true if file.end_with?("#{File::SEPARATOR}CMakeLists.txt")
11
- end
12
- false
9
+ variables.key?(:_cmake_CYGCLASS_)
13
10
  end
14
11
  end
15
12
  end
@@ -4,7 +4,7 @@ require 'find'
4
4
 
5
5
  module Xezat
6
6
  module Detector
7
- class Python38Docutils
7
+ class Python39Docutils
8
8
  def detect(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
@@ -8,7 +8,7 @@ module Xezat
8
8
  def initialize(detector_dir = File.expand_path(File.join(File.dirname(__FILE__), 'detector')))
9
9
  Xezat.logger.debug(' Load detectors')
10
10
  @detectors = {}
11
- Dir.glob(File.join(detector_dir, '*.rb')).sort.each do |rb|
11
+ Dir.glob(File.join(detector_dir, '*.rb')).each do |rb|
12
12
  require rb
13
13
  @detectors[File.basename(rb, '.rb').intern] = Object.const_get("Xezat::Detector::#{File.basename(rb, '.rb').camelize}").new
14
14
  end