xezat 0.4.0 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 971a71dc0eae6338466af60e22d6cce153514be903f36ce3b8466cbe8e197f8d
4
- data.tar.gz: 97ec5d3fd7386ae4022dc488e8fd1bb239629e91a54b606347fca99c3128378c
3
+ metadata.gz: eb4e15ff6a5eab549ec2a89d711b6d81ec7a4e05656ecf59524cc472746dfe6c
4
+ data.tar.gz: 3f2c68eee2a3699adb2c2796bac9a988708bd8395b3e83f4ecd449b09e768c1b
5
5
  SHA512:
6
- metadata.gz: a092f71a8b3f282c2d48dc736df3fc6081d8c1ec23bbb5de81f05db9a8e58e45eca00f193819e67d6680ff7c2ec8dcb0bd59c2fdafb16be47a2562669d6e5856
7
- data.tar.gz: 7dda61ff0a0a7234486f085705b8bd2f0f2e19af108c8eb8c1696f224a66a33534069ffd159d76047dd4e31dd13dee32095d5795bdc054e9af744b05a9e4bb85
6
+ metadata.gz: 1750d00392ebe3232b98098803aee8ea6d45f661de0c754e63b3ee4ee149fe9fd9e6309015c7645f2e4936a26c09110139a84da41f46d9416c25c8b5978c8497
7
+ data.tar.gz: 508ef5825975aa6bbaa48c58d9b7f957215f190c4747f73ccdec88f6d93d09bf0fca26c24049910d14cf505aae99e4f16472c5f313eb5f8b3b2d59dbf908184c
data/exe/xezat CHANGED
@@ -5,7 +5,6 @@ Encoding.default_external = 'UTF-8'
5
5
 
6
6
  self_file =
7
7
  if File.symlink?(__FILE__)
8
- require 'pathname'
9
8
  Pathname.new(__FILE__).realpath
10
9
  else
11
10
  __FILE__
@@ -15,7 +15,7 @@ module Xezat
15
15
  File.dirname(file)
16
16
  end.sort.uniq.join(':')
17
17
  Xezat.logger.debug(" Additional PATH = #{additional_path.gsub(Regexp.new(variables[:D]), '')}")
18
- command = ['bash', File.expand_path(File.join(DATA_DIR, 'cygport_dep.sh')), cygport]
18
+ command = ['bash', File.expand_path(File.join(DATA_DIR, 'cygport.sh')), cygport, 'dep']
19
19
  result, error, status = Open3.capture3({ 'PATH' => "#{additional_path}:#{ENV.fetch('PATH')}" }, command.join(' '))
20
20
  Xezat.logger.warn(" Stderr = #{error}") unless error.empty?
21
21
  raise CygportProcessError, error unless status.success?
@@ -26,11 +26,11 @@ module Xezat
26
26
 
27
27
  def resolve_pseudo(pkg, pkgs)
28
28
  case pkg
29
- when 'python3'
29
+ when /^python3\s*/
30
30
  pkgs[:python39]
31
- when 'perl5_036'
31
+ when /^perl5_0\d{2}$/
32
32
  pkgs[:perl_base]
33
- when 'ruby_32'
33
+ when /^ruby_\d{2}$/
34
34
  pkgs[:ruby]
35
35
  else
36
36
  pkg
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'xezat'
5
+ require 'xezat/config'
6
+ require 'xezat/variables'
7
+
8
+ module Xezat
9
+ class NoDistDirectoryError < StandardError
10
+ end
11
+
12
+ module Command
13
+ class Dist
14
+ include Xezat
15
+
16
+ def initialize(options, cygport)
17
+ @options = options
18
+ @cygport = cygport
19
+ end
20
+
21
+ def execute
22
+ Xezat.logger.debug('Start distributing')
23
+ vars = variables(@cygport)
24
+
25
+ noop = @options[:noop]
26
+ verbose = @options[:noop] || @options[:verbose]
27
+
28
+ arch = vars[:ARCH]
29
+ release_dir = File.expand_path(File.join(get_dist_directory(@options), arch, 'release'))
30
+ pkg_dir = File.expand_path(File.join(release_dir, vars[:PN]))
31
+ dist_dir = File.expand_path(File.join(vars[:distdir], vars[:PN]))
32
+
33
+ if Dir.exist?(pkg_dir)
34
+ Xezat.logger.warn(" Package directory already exists : #{pkg_dir} (skip)")
35
+ else
36
+ Xezat.logger.debug(" Copy package to release directory : #{pkg_dir}")
37
+ FileUtils.cp_r(dist_dir, release_dir, noop:, verbose:)
38
+ end
39
+
40
+ Xezat.logger.debug('End distributing')
41
+ end
42
+
43
+ def get_dist_directory(options)
44
+ conf = config(options[:config])
45
+ dist_dir = conf['xezat']['distdir'] || options[:distdir]
46
+ raise NoDistDirectoryError if dist_dir.nil?
47
+
48
+ Xezat.logger.debug(" Dist directory: #{dist_dir}")
49
+ dist_dir
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'open3'
5
+ require 'xezat'
6
+ require 'xezat/variables'
7
+
8
+ module Xezat
9
+ module Command
10
+ class Prep
11
+ include Xezat
12
+
13
+ def initialize(options, cygport)
14
+ @options = options
15
+ @cygport = cygport
16
+ end
17
+
18
+ def execute
19
+ Xezat.logger.debug('Start prep')
20
+ invoke_cygport_command('fetch')
21
+ invoke_cygport_command('prep')
22
+ copy_readme_if_exists
23
+ Xezat.logger.debug('End prep')
24
+ end
25
+
26
+ private
27
+
28
+ def invoke_cygport_command(command)
29
+ Xezat.logger.debug(" Execute cygport #{command}")
30
+ script = File.expand_path(File.join(DATA_DIR, 'cygport.sh'))
31
+ output = +''
32
+ Open3.popen2e("bash #{script} #{@cygport} #{command}") do |_stdin, stdout_err, wait_thr|
33
+ stdout_err.each_line do |line|
34
+ $stdout.print(line)
35
+ $stdout.flush
36
+ output << line
37
+ end
38
+ raise CygportProcessError, output unless wait_thr.value.success?
39
+ end
40
+ end
41
+
42
+ def copy_readme_if_exists
43
+ vars = variables(@cygport)
44
+ cygport_dir = File.dirname(File.expand_path(@cygport))
45
+ readme_source = File.expand_path('README', cygport_dir)
46
+ readme_dest = File.expand_path('README', vars[:C])
47
+
48
+ return unless File.exist?(readme_source)
49
+
50
+ Xezat.logger.debug(" Copy README from #{readme_source} to #{readme_dest}")
51
+ FileUtils.cp(readme_source, readme_dest)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'xezat'
4
+
5
+ module Xezat
6
+ module Command
7
+ class Validate
8
+ def validate_appstream_path(variables)
9
+ legacy_dir = File.join(variables[:D], '/usr/share/appdata')
10
+ Dir.glob('*', base: legacy_dir).each do |file|
11
+ Xezat.logger.error(" #{file} is in the legacy AppStream path /usr/share/appdata, move it to /usr/share/metainfo")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -30,10 +30,23 @@ module Xezat
30
30
  end
31
31
  end
32
32
 
33
+ EXECUTABLE_TIMEOUT = 5
34
+
33
35
  private
34
36
 
35
37
  def executable?(config)
36
- Open3.capture3(config.to_s)
38
+ Open3.popen3(config.to_s) do |stdin, stdout, stderr, wait_thr|
39
+ stdin.close
40
+ out_reader = Thread.new { stdout.read }
41
+ err_reader = Thread.new { stderr.read }
42
+ unless wait_thr.join(EXECUTABLE_TIMEOUT)
43
+ Process.kill(:KILL, wait_thr.pid)
44
+ wait_thr.join
45
+ raise "#{config} timed out after #{EXECUTABLE_TIMEOUT}s"
46
+ end
47
+ out_reader.join
48
+ err_reader.join
49
+ end
37
50
  rescue StandardError => e
38
51
  Xezat.logger.warn(" #{config} not executable: #{e}")
39
52
  raise e
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'net/http'
4
4
  require 'uri'
5
+ require 'xezat/command/validate/appstream'
5
6
  require 'xezat/command/validate/config'
6
7
  require 'xezat/command/validate/license'
7
8
  require 'xezat/command/validate/pkgconfig'
@@ -47,6 +48,9 @@ module Xezat
47
48
  Xezat.logger.debug(' Validate *-config')
48
49
  validate_config(vars, gcc_version)
49
50
 
51
+ Xezat.logger.debug(' Validate AppStream path')
52
+ validate_appstream_path(vars)
53
+
50
54
  Xezat.logger.debug('End validating')
51
55
  end
52
56
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xezat
4
+ module Detector
5
+ class GnomeCommon
6
+ def detect?(variables)
7
+ variables.key?(:_gnome2_CYGCLASS_)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -31,6 +31,10 @@ module Xezat
31
31
  Xezat.logger.debug(' Remove python27 because of detecting python3x')
32
32
  tools.delete(:python27)
33
33
  end
34
+ if tools.include?(:libtool) && tools.include?(:cmake)
35
+ Xezat.logger.debug(' Remove libtool because of detecting cmake')
36
+ tools.delete(:libtool)
37
+ end
34
38
  tools
35
39
  end
36
40
  end
data/lib/xezat/main.rb CHANGED
@@ -62,6 +62,15 @@ module Xezat
62
62
  Command::Port.new(options, cygport).execute
63
63
  end
64
64
 
65
+ desc 'dist cygport', 'Copy dist directory to release directory'
66
+ option :noop, type: :boolean, aliases: '-n', desc: 'dry run'
67
+ option :distdir, type: :string, aliases: '-d', desc: 'specify dist directory'
68
+
69
+ def dist(cygport)
70
+ require 'xezat/command/dist'
71
+ Command::Dist.new(options, cygport).execute
72
+ end
73
+
65
74
  desc 'validate cygport', 'Validate files'
66
75
  option :ignore, type: :boolean, aliases: '-i', desc: 'ignore error'
67
76
 
@@ -76,5 +85,12 @@ module Xezat
76
85
  require 'xezat/command/announce'
77
86
  Command::Announce.new(nil, cygport).execute
78
87
  end
88
+
89
+ desc 'prep cygport', 'Fetch and prepare sources'
90
+
91
+ def prep(cygport)
92
+ require 'xezat/command/prep'
93
+ Command::Prep.new(options, cygport).execute
94
+ end
79
95
  end
80
96
  end
data/lib/xezat/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xezat
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -4,14 +4,12 @@
4
4
  - archive
5
5
  - audio
6
6
  - base
7
- - benchmark
8
7
  - comm
9
8
  - database
10
9
  - debug
11
10
  - devel
12
11
  - doc
13
12
  - editors
14
- - emulators
15
13
  - games
16
14
  - gnome
17
15
  - graphics
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ export LANG=C
4
+
5
+ source ${CYGPORT:-/usr/bin/cygport} $*
data/xezat.gemspec CHANGED
@@ -40,12 +40,13 @@ Gem::Specification.new do |spec|
40
40
  spec.bindir = 'exe'
41
41
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
42
42
  spec.require_paths = ['lib']
43
- spec.required_ruby_version = '>= 3.2.2'
43
+ spec.required_ruby_version = '>= 4.0.5'
44
44
 
45
45
  spec.add_dependency 'bashvar', '>= 0.1.1'
46
46
  spec.add_dependency 'colorize', '>= 1.1.0'
47
47
  spec.add_dependency 'facets', '>= 3.1.0'
48
48
  spec.add_dependency 'github-linguist', '>= 9.1.0'
49
+ spec.add_dependency 'logger', '>= 1.6.0'
49
50
  spec.add_dependency 'pkg-config', '>= 1.6.1'
50
51
  spec.add_dependency 'spdx', '>= 4.1.5'
51
52
  spec.add_dependency 'thor', '>= 1.2.2'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xezat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Fujimura (fd0)
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: 9.1.0
68
+ - !ruby/object:Gem::Dependency
69
+ name: logger
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.6.0
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.6.0
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: pkg-config
70
84
  requirement: !ruby/object:Gem::Requirement
@@ -244,11 +258,14 @@ files:
244
258
  - lib/xezat/command/bump/src_uri.rb
245
259
  - lib/xezat/command/bump/tool.rb
246
260
  - lib/xezat/command/debug.rb
261
+ - lib/xezat/command/dist.rb
247
262
  - lib/xezat/command/doctor.rb
248
263
  - lib/xezat/command/generate.rb
249
264
  - lib/xezat/command/init.rb
250
265
  - lib/xezat/command/port.rb
266
+ - lib/xezat/command/prep.rb
251
267
  - lib/xezat/command/validate.rb
268
+ - lib/xezat/command/validate/appstream.rb
252
269
  - lib/xezat/command/validate/config.rb
253
270
  - lib/xezat/command/validate/license.rb
254
271
  - lib/xezat/command/validate/pkgconfig.rb
@@ -268,6 +285,7 @@ files:
268
285
  - lib/xezat/detector/font-util.rb
269
286
  - lib/xezat/detector/gengetopt.rb
270
287
  - lib/xezat/detector/gettext-devel.rb
288
+ - lib/xezat/detector/gnome-common.rb
271
289
  - lib/xezat/detector/gnulib.rb
272
290
  - lib/xezat/detector/gobject-introspection.rb
273
291
  - lib/xezat/detector/halibut.rb
@@ -300,7 +318,7 @@ files:
300
318
  - share/xezat/bashvar.sh
301
319
  - share/xezat/categories.yaml
302
320
  - share/xezat/compilers.yaml
303
- - share/xezat/cygport_dep.sh
321
+ - share/xezat/cygport.sh
304
322
  - share/xezat/languages.yaml
305
323
  - share/xezat/repository/bitbucket.yaml
306
324
  - share/xezat/repository/github.yaml
@@ -327,14 +345,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
345
  requirements:
328
346
  - - ">="
329
347
  - !ruby/object:Gem::Version
330
- version: 3.2.2
348
+ version: 4.0.5
331
349
  required_rubygems_version: !ruby/object:Gem::Requirement
332
350
  requirements:
333
351
  - - ">="
334
352
  - !ruby/object:Gem::Version
335
353
  version: '0'
336
354
  requirements: []
337
- rubygems_version: 3.6.9
355
+ rubygems_version: 4.0.10
338
356
  specification_version: 4
339
357
  summary: xezat helps you win at cygport.
340
358
  test_files: []
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
-
3
- export LANG=C
4
-
5
- source ${CYGPORT:-/usr/bin/cygport} $* dep