xezat 0.3.1 → 0.4.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 +4 -4
- data/README.md +36 -16
- data/lib/xezat/bashvar.rb +15 -0
- data/lib/xezat/command/generate.rb +9 -0
- data/lib/xezat/command/validate.rb +4 -2
- data/lib/xezat/detector/asciidoc.rb +1 -1
- data/lib/xezat/detector/autoconf-archive.rb +27 -0
- data/lib/xezat/detector/autoconf.rb +1 -1
- data/lib/xezat/detector/automake.rb +1 -1
- data/lib/xezat/detector/boost.m4.rb +1 -1
- data/lib/xezat/detector/cmake.rb +1 -1
- data/lib/xezat/detector/docbook2X.rb +1 -1
- data/lib/xezat/detector/font-util.rb +20 -0
- data/lib/xezat/detector/gengetopt.rb +1 -1
- data/lib/xezat/detector/gettext-devel.rb +2 -2
- data/lib/xezat/detector/gnulib.rb +1 -1
- data/lib/xezat/detector/gobject-introspection.rb +1 -1
- data/lib/xezat/detector/halibut.rb +1 -1
- data/lib/xezat/detector/libQt5Core-devel.rb +1 -1
- data/lib/xezat/detector/libtool.rb +1 -1
- data/lib/xezat/detector/make.rb +1 -1
- data/lib/xezat/detector/meson.rb +1 -1
- data/lib/xezat/detector/nasm.rb +1 -1
- data/lib/xezat/detector/ninja.rb +1 -1
- data/lib/xezat/detector/python27.rb +1 -1
- data/lib/xezat/detector/python36.rb +1 -1
- data/lib/xezat/detector/python37.rb +1 -1
- data/lib/xezat/detector/python38.rb +1 -1
- data/lib/xezat/detector/python39-docutils.rb +2 -2
- data/lib/xezat/detector/python39.rb +1 -1
- data/lib/xezat/detector/roundup.rb +1 -1
- data/lib/xezat/detector/waf.rb +1 -1
- data/lib/xezat/detector/xorg-util-macros.rb +20 -0
- data/lib/xezat/detectors.rb +1 -1
- data/lib/xezat/generator/cmake.rb +44 -0
- data/lib/xezat/generator/pkgconfig.rb +5 -7
- data/lib/xezat/generator.rb +6 -0
- data/lib/xezat/main.rb +1 -0
- data/lib/xezat/variables.rb +4 -29
- data/lib/xezat/version.rb +1 -1
- data/lib/xezat.rb +10 -1
- data/share/xezat/autoconf-archive.yml +583 -0
- data/share/xezat/bashvar.sh +8 -0
- data/share/xezat/template/README.erb +1 -0
- data/share/xezat/template/cmake/cmake.erb +22 -0
- data/xezat.gemspec +32 -11
- metadata +57 -35
- data/.fasterer.yml +0 -6
- data/.github/workflows/ruby.yml +0 -45
- data/.gitignore +0 -11
- data/.gitmodules +0 -3
- data/.rspec +0 -2
- data/.rubocop.yml +0 -36
- data/.ruby-version +0 -1
- data/Gemfile +0 -8
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/share/xezat/var2yaml.sh +0 -32
- /data/share/xezat/template/{Makefile.am → pkgconfig/Makefile.am} +0 -0
- /data/share/xezat/template/{cmake.erb → pkgconfig/cmake.erb} +0 -0
- /data/share/xezat/template/{pkgconfig.erb → pkgconfig/pkgconfig.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 971a71dc0eae6338466af60e22d6cce153514be903f36ce3b8466cbe8e197f8d
|
4
|
+
data.tar.gz: 97ec5d3fd7386ae4022dc488e8fd1bb239629e91a54b606347fca99c3128378c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a092f71a8b3f282c2d48dc736df3fc6081d8c1ec23bbb5de81f05db9a8e58e45eca00f193819e67d6680ff7c2ec8dcb0bd59c2fdafb16be47a2562669d6e5856
|
7
|
+
data.tar.gz: 7dda61ff0a0a7234486f085705b8bd2f0f2e19af108c8eb8c1696f224a66a33534069ffd159d76047dd4e31dd13dee32095d5795bdc054e9af744b05a9e4bb85
|
data/README.md
CHANGED
@@ -1,39 +1,59 @@
|
|
1
1
|
# Xezat
|
2
2
|
|
3
3
|
[](https://github.com/fd00/xezat/)
|
4
|
+
[](https://badge.fury.io/rb/xezat)
|
4
5
|
|
5
|
-
|
6
|
+
Xezat is a helper tool for your daily packaging tasks with [Cygport](httpss://cygwin.com/cygport/).
|
6
7
|
|
7
|
-
##
|
8
|
+
## Features
|
8
9
|
|
9
|
-
|
10
|
+
Xezat provides the following subcommands through the `xezat` command:
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
* `init`: Interactively generates a new `cygport` file.
|
13
|
+
* `bump`: Bumps the package version and updates the `README` file.
|
14
|
+
* `validate`: Validates that the `cygport` file and related files adhere to conventions.
|
15
|
+
* `port`: Copies the `cygport` to a Git repository.
|
16
|
+
* `announce`: Generates a template for ITP (Intent to Package) or `cygport` update announcements.
|
17
|
+
* `doctor`: Checks your system for potential problems.
|
18
|
+
* `generate`: Generates development files used by `cygport`.
|
19
|
+
* `debug`: Assists in debugging `cygport` files.
|
14
20
|
|
15
|
-
|
21
|
+
You can check the details of each command with `xezat <command> --help`.
|
16
22
|
|
17
|
-
|
23
|
+
## Installation
|
18
24
|
|
19
|
-
|
25
|
+
Install the gem:
|
20
26
|
|
21
|
-
|
27
|
+
```bash
|
28
|
+
gem install xezat
|
29
|
+
```
|
22
30
|
|
23
31
|
## Usage
|
24
32
|
|
25
|
-
|
33
|
+
### 1. Creating a new package
|
34
|
+
|
35
|
+
```bash
|
36
|
+
xezat init foo.cygport
|
37
|
+
```
|
26
38
|
|
27
|
-
|
39
|
+
### 2. Bumping the version
|
28
40
|
|
29
|
-
|
41
|
+
```bash
|
42
|
+
xezat bump foo.cygport
|
43
|
+
```
|
30
44
|
|
31
|
-
|
45
|
+
### 3. Validating the package
|
46
|
+
|
47
|
+
```bash
|
48
|
+
xezat validate foo.cygport
|
49
|
+
```
|
32
50
|
|
33
51
|
## Contributing
|
34
52
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/fd00/xezat.
|
53
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/fd00/xezat](https://github.com/fd00/xezat).
|
54
|
+
|
55
|
+
This project utilizes Google Gemini for development assistance.
|
36
56
|
|
37
57
|
## License
|
38
58
|
|
39
|
-
The gem is available as open source under the terms of the [MIT License](
|
59
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bashvar'
|
4
|
+
require 'open3'
|
5
|
+
require 'xezat'
|
6
|
+
|
7
|
+
module Xezat
|
8
|
+
def bashvar(cygport)
|
9
|
+
command = ['bash', File.expand_path(File.join(DATA_DIR, 'bashvar.sh')), cygport]
|
10
|
+
result, error, status = Open3.capture3(command.join(' '))
|
11
|
+
raise CygportProcessError, error unless status.success?
|
12
|
+
|
13
|
+
BashVar.parse(result, symbolize_names: true)
|
14
|
+
end
|
15
|
+
end
|
@@ -13,6 +13,15 @@ module Xezat
|
|
13
13
|
require 'xezat/generator/pkgconfig'
|
14
14
|
Generator::Pkgconfig.new(options, cygport).generate
|
15
15
|
end
|
16
|
+
|
17
|
+
desc 'cmake cygport', 'Generate CMakeLists.txt'
|
18
|
+
option :overwrite, type: :boolean, aliases: '-o', desc: 'overwrite CMakeLists.txt'
|
19
|
+
option :srcdir, type: :string, aliases: '-s', desc: 'relative path to CMakeLists.txt'
|
20
|
+
|
21
|
+
def cmake(cygport)
|
22
|
+
require 'xezat/generator/cmake'
|
23
|
+
Generator::CMake.new(options, cygport).generate
|
24
|
+
end
|
16
25
|
end
|
17
26
|
end
|
18
27
|
end
|
@@ -58,8 +58,10 @@ module Xezat
|
|
58
58
|
|
59
59
|
def validate_category(category)
|
60
60
|
categories_file = File.expand_path(File.join(DATA_DIR, 'categories.yaml'))
|
61
|
-
|
62
|
-
|
61
|
+
valid_categories = YAML.safe_load(File.open(categories_file), symbolize_names: true, permitted_classes: [Symbol])
|
62
|
+
category.split.each do |cat|
|
63
|
+
Xezat.logger.error(" Category is invalid : #{cat}") unless valid_categories.include?(cat.downcase)
|
64
|
+
end
|
63
65
|
end
|
64
66
|
|
65
67
|
def validate_homepage(homepage)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Xezat
|
4
|
+
module Detector
|
5
|
+
class AutoconfArchive
|
6
|
+
def detect?(variables)
|
7
|
+
return false unless variables.keys.index do |key|
|
8
|
+
%i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
|
9
|
+
end.nil?
|
10
|
+
|
11
|
+
autoconf_archive_file = File.expand_path(File.join(DATA_DIR, 'autoconf-archive.yml'))
|
12
|
+
autoconf_archive_macros = YAML.safe_load(File.open(autoconf_archive_file), symbolize_names: true, permitted_classes: [Symbol])
|
13
|
+
|
14
|
+
Find.find(variables[:S]) do |file|
|
15
|
+
next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
|
16
|
+
|
17
|
+
autoconf_archive_macros.each do |macro|
|
18
|
+
File.foreach(file) do |line|
|
19
|
+
return true if line.scrub.strip.start_with?(macro)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/xezat/detector/cmake.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
module Detector
|
7
|
+
class FontUtil
|
8
|
+
def detect?(variables)
|
9
|
+
Find.find(variables[:S]) do |file|
|
10
|
+
next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
|
11
|
+
|
12
|
+
File.foreach(file) do |line|
|
13
|
+
return true if line.start_with?('XORG_FONT_MACROS_VERSION')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module Xezat
|
4
4
|
module Detector
|
5
5
|
class GettextDevel
|
6
|
-
def detect(variables)
|
6
|
+
def detect?(variables)
|
7
7
|
Find.find(variables[:S]) do |file|
|
8
8
|
next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
|
9
9
|
|
10
10
|
File.foreach(file) do |line|
|
11
|
-
return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.lstrip)
|
11
|
+
return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.scrub.lstrip)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
false
|
data/lib/xezat/detector/make.rb
CHANGED
data/lib/xezat/detector/meson.rb
CHANGED
data/lib/xezat/detector/nasm.rb
CHANGED
data/lib/xezat/detector/ninja.rb
CHANGED
@@ -5,12 +5,12 @@ require 'find'
|
|
5
5
|
module Xezat
|
6
6
|
module Detector
|
7
7
|
class Python39Docutils
|
8
|
-
def detect(variables)
|
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")
|
11
11
|
|
12
12
|
File.foreach(file) do |line|
|
13
|
-
return true if line.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
|
13
|
+
return true if line.scrub.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
if variables.key?(:_meson_CYGCLASS_)
|
data/lib/xezat/detector/waf.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
module Xezat
|
6
|
+
module Detector
|
7
|
+
class XorgUtilMacros
|
8
|
+
def detect?(variables)
|
9
|
+
Find.find(variables[:S]) do |file|
|
10
|
+
next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
|
11
|
+
|
12
|
+
File.foreach(file) do |line|
|
13
|
+
return true if line.start_with?('XORG_MACROS_VERSION')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/xezat/detectors.rb
CHANGED
@@ -20,7 +20,7 @@ module Xezat
|
|
20
20
|
@detectors.each do |name, detector|
|
21
21
|
if variables[:PN].intern == name
|
22
22
|
Xezat.logger.debug(" #{name} ... no (self)")
|
23
|
-
elsif detector.detect(variables)
|
23
|
+
elsif detector.detect?(variables)
|
24
24
|
tools << name
|
25
25
|
Xezat.logger.debug(" #{name} ... yes")
|
26
26
|
else
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xezat/generator'
|
4
|
+
require 'xezat/variables'
|
5
|
+
|
6
|
+
module Xezat
|
7
|
+
module Generator
|
8
|
+
class CMake
|
9
|
+
include Xezat
|
10
|
+
|
11
|
+
def initialize(options, cygport)
|
12
|
+
@options = options
|
13
|
+
@cygport = cygport
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate
|
17
|
+
Xezat.logger.debug('Start CMakeLists.txt generation')
|
18
|
+
vars = variables(@cygport)
|
19
|
+
generate_cmakelists(vars, @options)
|
20
|
+
Xezat.logger.debug('End CMakeLists.txt generation')
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_cmakelists(variables, options)
|
24
|
+
srcdir = variables[:CYGCONF_SOURCE] || variables[:CYGCMAKE_SOURCE] || variables[:S]
|
25
|
+
srcdir = File.expand_path(File.join(variables[:S], options['srcdir'])) if options['srcdir']
|
26
|
+
Xezat.logger.debug(" srcdir = #{srcdir}")
|
27
|
+
|
28
|
+
cmakelists = File.expand_path(File.join(srcdir, 'CMakeLists.txt'))
|
29
|
+
raise UnregeneratableConfigurationError, 'CMakeLists.txt already exists' if File.exist?(cmakelists) && !options['overwrite']
|
30
|
+
|
31
|
+
Xezat.logger.debug(' Generate CMakeLists.txt')
|
32
|
+
|
33
|
+
File.atomic_write(cmakelists) do |f|
|
34
|
+
f.write(get_cmakelists(variables))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_cmakelists(variables)
|
39
|
+
erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake', 'cmake.erb'))
|
40
|
+
ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -3,12 +3,10 @@
|
|
3
3
|
require 'English'
|
4
4
|
require 'facets/file/atomic_open'
|
5
5
|
require 'facets/file/atomic_write'
|
6
|
+
require 'xezat/generator'
|
6
7
|
require 'xezat/variables'
|
7
8
|
|
8
9
|
module Xezat
|
9
|
-
class UnregeneratableConfigurationError < StandardError
|
10
|
-
end
|
11
|
-
|
12
10
|
class AutotoolsFileNotFoundError < StandardError
|
13
11
|
end
|
14
12
|
|
@@ -51,7 +49,7 @@ module Xezat
|
|
51
49
|
end
|
52
50
|
|
53
51
|
def get_pkg_config(variables)
|
54
|
-
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig.erb'))
|
52
|
+
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'pkgconfig.erb'))
|
55
53
|
ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
|
56
54
|
end
|
57
55
|
|
@@ -72,7 +70,7 @@ module Xezat
|
|
72
70
|
end
|
73
71
|
|
74
72
|
def get_cmakelists(variables)
|
75
|
-
erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake.erb'))
|
73
|
+
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'cmake.erb'))
|
76
74
|
ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
|
77
75
|
end
|
78
76
|
|
@@ -84,7 +82,7 @@ module Xezat
|
|
84
82
|
configure_ac = File.expand_path(File.join(srcdir, 'configure.in')) unless File.exist?(configure_ac)
|
85
83
|
raise AutotoolsFileNotFoundError unless File.exist?(configure_ac)
|
86
84
|
|
87
|
-
original_ac = File.read(configure_ac)
|
85
|
+
original_ac = File.read(configure_ac).scrub
|
88
86
|
|
89
87
|
if /#{pn}.pc/.match?(original_ac)
|
90
88
|
Xezat.logger.debug(" Not rewrite #{configure_ac}")
|
@@ -104,7 +102,7 @@ module Xezat
|
|
104
102
|
break
|
105
103
|
end
|
106
104
|
|
107
|
-
commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'Makefile.am')))
|
105
|
+
commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'Makefile.am')))
|
108
106
|
File.atomic_open(makefile_am, 'a') do |fm|
|
109
107
|
fm.write(commands_am)
|
110
108
|
end
|
data/lib/xezat/main.rb
CHANGED
@@ -8,6 +8,7 @@ require 'xezat/version'
|
|
8
8
|
module Xezat
|
9
9
|
class Main < Thor
|
10
10
|
include ZshCompletion::Command
|
11
|
+
|
11
12
|
class_option :config, type: :string, aliases: '-c', desc: 'specify config', default: CONFIG_FILE
|
12
13
|
class_option :help, type: :boolean, aliases: '-h', desc: 'help message'
|
13
14
|
|
data/lib/xezat/variables.rb
CHANGED
@@ -3,11 +3,9 @@
|
|
3
3
|
require 'English'
|
4
4
|
require 'etc'
|
5
5
|
require 'facets/file/atomic_write'
|
6
|
-
require 'facets/string/word_wrap'
|
7
|
-
require 'open3'
|
8
|
-
require 'uri'
|
9
6
|
require 'yaml'
|
10
7
|
require 'xezat'
|
8
|
+
require 'xezat/bashvar'
|
11
9
|
|
12
10
|
module Xezat
|
13
11
|
def variables(cygport)
|
@@ -23,36 +21,13 @@ module Xezat
|
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
result, error, status = Open3.capture3(command.join(' '))
|
28
|
-
raise CygportProcessError, error unless status.success?
|
29
|
-
|
30
|
-
result.gsub!(/^.*\*\*\*.*$/, '')
|
31
|
-
|
32
|
-
begin
|
33
|
-
variables = YAML.safe_load(result, symbolize_names: true, permitted_classes: [Symbol]).each_value do |v|
|
34
|
-
v.strip! if v.respond_to?(:strip)
|
35
|
-
end
|
36
|
-
rescue Psych::SyntaxError => e
|
37
|
-
print_yaml(result)
|
38
|
-
raise e
|
39
|
-
end
|
40
|
-
|
41
|
-
variables[:DESCRIPTION].word_wrap!(79)
|
24
|
+
vars = bashvar(cygport)
|
42
25
|
|
43
26
|
File.atomic_write(cache_file) do |f|
|
44
27
|
Xezat.logger.debug(' Write cache for variables')
|
45
|
-
f.write(YAML.dump(
|
28
|
+
f.write(YAML.dump(vars))
|
46
29
|
end
|
47
30
|
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def print_yaml(result)
|
52
|
-
lineno = 1
|
53
|
-
result.split($INPUT_RECORD_SEPARATOR).each do |line|
|
54
|
-
printf '%<lineno>5d | %<line>s%<ls>s', lineno:, line:, ls: $INPUT_RECORD_SEPARATOR
|
55
|
-
lineno += 1
|
56
|
-
end
|
31
|
+
vars
|
57
32
|
end
|
58
33
|
end
|
data/lib/xezat/version.rb
CHANGED