xezat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +207 -0
- data/Rakefile +2 -0
- data/bin/xezat +14 -0
- data/lib/xezat.rb +6 -0
- data/lib/xezat/command/bump.rb +174 -0
- data/lib/xezat/command/create.rb +105 -0
- data/lib/xezat/command/debug.rb +30 -0
- data/lib/xezat/command/doctor.rb +45 -0
- data/lib/xezat/command/generate.rb +50 -0
- data/lib/xezat/command/validate.rb +43 -0
- data/lib/xezat/commands.rb +32 -0
- data/lib/xezat/cygchangelog.rb +53 -0
- data/lib/xezat/cygclasses.rb +33 -0
- data/lib/xezat/detector/autoconf.rb +16 -0
- data/lib/xezat/detector/automake.rb +16 -0
- data/lib/xezat/detector/boost.m4.rb +20 -0
- data/lib/xezat/detector/cmake.rb +16 -0
- data/lib/xezat/detector/gengetopt.rb +16 -0
- data/lib/xezat/detector/libtool.rb +16 -0
- data/lib/xezat/detector/make.rb +19 -0
- data/lib/xezat/detectors.rb +36 -0
- data/lib/xezat/main.rb +13 -0
- data/lib/xezat/packages.rb +21 -0
- data/lib/xezat/refine/linguist/file_blob.rb +14 -0
- data/lib/xezat/validator/m4.rb +30 -0
- data/lib/xezat/validator/pkgconfig.rb +23 -0
- data/lib/xezat/validators.rb +38 -0
- data/lib/xezat/variables.rb +48 -0
- data/lib/xezat/version.rb +3 -0
- data/share/xezat/compilers.json +39 -0
- data/share/xezat/invoke_cygport_dep.sh +5 -0
- data/share/xezat/repository/bitbucket.json +5 -0
- data/share/xezat/repository/github.json +5 -0
- data/share/xezat/repository/google.json +7 -0
- data/share/xezat/repository/sourceforge.json +6 -0
- data/share/xezat/show_cygport_description.sh +8 -0
- data/share/xezat/show_cygport_variable.sh +30 -0
- data/share/xezat/template/README.erb +60 -0
- data/share/xezat/template/cygport.erb +19 -0
- data/share/xezat/template/pkgconfig.erb +10 -0
- data/share/xezat/template/setup.erb +17 -0
- data/test/test.rb +18 -0
- data/test/xezat/command/fixture/doctor/a.lst.gz +0 -0
- data/test/xezat/command/fixture/doctor/b1.lst.gz +0 -0
- data/test/xezat/command/fixture/doctor/b2.lst.gz +0 -0
- data/test/xezat/command/test_create.rb +47 -0
- data/test/xezat/command/test_doctor.rb +16 -0
- data/test/xezat/detector/fixture/autoconf/no/configure.scan +1 -0
- data/test/xezat/detector/fixture/autoconf/yes_root/configure.ac +1 -0
- data/test/xezat/detector/fixture/autoconf/yes_subdir/subdir/configure.ac +1 -0
- data/test/xezat/detector/fixture/automake/no/Makefile.in +1 -0
- data/test/xezat/detector/fixture/automake/yes_root/Makefile.am +1 -0
- data/test/xezat/detector/fixture/automake/yes_subdir/subdir/Makefile.am +1 -0
- data/test/xezat/detector/fixture/boost.m4/no/configure.ac +1 -0
- data/test/xezat/detector/fixture/boost.m4/yes/configure.ac +1 -0
- data/test/xezat/detector/fixture/cmake/no/CMakeList.txt +1 -0
- data/test/xezat/detector/fixture/cmake/yes_root/CMakeLists.txt +1 -0
- data/test/xezat/detector/fixture/cmake/yes_subdir/subdir/CMakeLists.txt +1 -0
- data/test/xezat/detector/fixture/gengetopt/no/xezat.log +1 -0
- data/test/xezat/detector/fixture/gengetopt/yes_root/xezat.ggo +1 -0
- data/test/xezat/detector/fixture/gengetopt/yes_subdir/subdir/xezat.ggo +1 -0
- data/test/xezat/detector/test_autoconf.rb +23 -0
- data/test/xezat/detector/test_automake.rb +23 -0
- data/test/xezat/detector/test_boost.m4.rb +19 -0
- data/test/xezat/detector/test_cmake.rb +23 -0
- data/test/xezat/detector/test_gengetopt.rb +23 -0
- data/test/xezat/test_cygchangelog.rb +25 -0
- data/test/xezat/test_cygclasses.rb +31 -0
- data/test/xezat/test_variables.rb +15 -0
- data/test/xezat/validator/fixture/m4/no/usr/share/aclocal/.gitkeep +0 -0
- data/test/xezat/validator/fixture/m4/skip/usr/share/aclocal/.gitkeep +0 -0
- data/test/xezat/validator/fixture/m4/yes/usr/share/aclocal/test.m4 +1 -0
- data/test/xezat/validator/test_m4.rb +23 -0
- data/xezat.gemspec +28 -0
- metadata +239 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 434544489f11dad9eb18797864e6c479b23cb880
|
4
|
+
data.tar.gz: 091d9668f15f5fe5081f5198d939a4504b4d97f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e64e0ac2fec95c6aa030c854eb943efef16ed8327318dcbfffaafdfa3eadfa807ddcffd1383d59a9148a76c306e3cc874c71faf21feb54e9c7701e05200c17f
|
7
|
+
data.tar.gz: 1d79d6d8c4be0ff6c265678c3bce99f3250bb05b14411adc8307f1e25a7e3d9a7831bacf3bbb01bce5c9919e234808a68315fff7c4df4f99995996805ad27184
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 fd0
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
# Xezat
|
2
|
+
|
3
|
+
Complement of cygport
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'xezat'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install xezat
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
xezat 0.0.1 -- Xezat is the complement of cygport
|
24
|
+
|
25
|
+
Usage:
|
26
|
+
|
27
|
+
xezat <subcommand> [options]
|
28
|
+
|
29
|
+
Options:
|
30
|
+
-h, --help Show this message
|
31
|
+
-v, --version Print the name and version
|
32
|
+
-t, --trace Show the full backtrace when an error occurs
|
33
|
+
|
34
|
+
Subcommands:
|
35
|
+
bump update CYGWIN-PATCHES/README
|
36
|
+
create create new cygport
|
37
|
+
debug show cygport variables
|
38
|
+
doctor diagnose installed packages
|
39
|
+
generate generate additional files
|
40
|
+
validate validate package contents
|
41
|
+
|
42
|
+
### create
|
43
|
+
|
44
|
+
xezat create -- create new cygport
|
45
|
+
|
46
|
+
Usage:
|
47
|
+
|
48
|
+
xezat create [options] cygport
|
49
|
+
|
50
|
+
Options:
|
51
|
+
-a, --app-only application only
|
52
|
+
-c, --category category specify category
|
53
|
+
--description description specify description
|
54
|
+
-i, --inherit cygclass inherit cygclasses
|
55
|
+
-o, --overwrite overwrite cygport
|
56
|
+
--repository repository specify repository (github, google, sourceforge)
|
57
|
+
-s, --summary summary specify summary
|
58
|
+
-h, --help Show this message
|
59
|
+
-v, --version Print the name and version
|
60
|
+
-t, --trace Show the full backtrace when an error occurs
|
61
|
+
|
62
|
+
Example.1
|
63
|
+
|
64
|
+
% xezat create xezat-0.0.1-1bl1.cygport
|
65
|
+
% cat xezat-0.0.1-1bl1.cygport
|
66
|
+
|
67
|
+
```bash
|
68
|
+
HOMEPAGE=""
|
69
|
+
SRC_URI=""
|
70
|
+
|
71
|
+
CATEGORY=""
|
72
|
+
SUMMARY=""
|
73
|
+
DESCRIPTION=""
|
74
|
+
|
75
|
+
PKG_NAMES="
|
76
|
+
${PN}
|
77
|
+
lib${PN}0
|
78
|
+
lib${PN}-devel
|
79
|
+
"
|
80
|
+
```
|
81
|
+
|
82
|
+
Example.2
|
83
|
+
|
84
|
+
% xezat create -a -c Libs -i git --repository=github -s 'Complement of Cygport' -o xezat-0.0.1-1bl1.cygport
|
85
|
+
% cat xezat-0.0.1-1bl1.cygport
|
86
|
+
|
87
|
+
```bash
|
88
|
+
HOMEPAGE="https://github.com/fd00/${PN}"
|
89
|
+
GIT_URI="https://github.com/fd00/${PN}.git"
|
90
|
+
|
91
|
+
CATEGORY="Libs"
|
92
|
+
SUMMARY="Complement of Cygport"
|
93
|
+
DESCRIPTION=""
|
94
|
+
|
95
|
+
inherit git
|
96
|
+
|
97
|
+
PKG_NAMES="
|
98
|
+
${PN}
|
99
|
+
"
|
100
|
+
```
|
101
|
+
|
102
|
+
### debug
|
103
|
+
|
104
|
+
xezat debug -- show cygport variables
|
105
|
+
|
106
|
+
Usage:
|
107
|
+
|
108
|
+
xezat debug cygport
|
109
|
+
|
110
|
+
Options:
|
111
|
+
-h, --help Show this message
|
112
|
+
-v, --version Print the name and version
|
113
|
+
-t, --trace Show the full backtrace when an error occurs
|
114
|
+
|
115
|
+
Example.1
|
116
|
+
|
117
|
+
% xezat debug xezat-0.0.1-1bl1.cygport
|
118
|
+
#<Xezat::VariableManager:0x000006011ba808
|
119
|
+
@variables=
|
120
|
+
{:AR=>"ar",
|
121
|
+
:ARCH=>"x86_64",
|
122
|
+
:ARCH_x86_64=>"1",
|
123
|
+
:B=>"/usr/src/xezat-0.0.1-1bl1.x86_64/build",
|
124
|
+
:BASH=>"/usr/bin/bash",
|
125
|
+
(snip)
|
126
|
+
:mirror_apache=>"http://www.apache.org/dist",
|
127
|
+
:mirror_berlios=>"http://download.berlios.de http://download2.berlios.de",
|
128
|
+
:mirror_cpan=>"http://search.cpan.org/CPAN",
|
129
|
+
:mirror_cran=>"http://cran.r-project.org",
|
130
|
+
:mirror_ctan=>"http://mirror.ctan.org/",
|
131
|
+
(snip)
|
132
|
+
:src_patchfile=>"xezat-0.0.1-1bl1.src.patch",
|
133
|
+
:srcdir=>"/usr/src/xezat-0.0.1-1bl1.x86_64/src",
|
134
|
+
:top=>"/usr/src",
|
135
|
+
:workdir=>"/usr/src/xezat-0.0.1-1bl1.x86_64"}>
|
136
|
+
%
|
137
|
+
|
138
|
+
### doctor
|
139
|
+
|
140
|
+
xezat doctor -- diagnose installed packages
|
141
|
+
|
142
|
+
Usage:
|
143
|
+
|
144
|
+
xezat doctor
|
145
|
+
|
146
|
+
Options:
|
147
|
+
-h, --help Show this message
|
148
|
+
-v, --version Print the name and version
|
149
|
+
-t, --trace Show the full backtrace when an error occurs
|
150
|
+
|
151
|
+
Example.1
|
152
|
+
|
153
|
+
% xezat doctor
|
154
|
+
xezat doctor | Warn: usr/include/attr/xattr.h is in multiple packages: [:"cygwin-devel", :"libattr-devel"]
|
155
|
+
xezat doctor | Warn: usr/share/man/man1/sha.1.gz is in multiple packages: [:openssl, :sha]
|
156
|
+
xezat doctor | Warn: usr/share/man/man3/Socket.3pm.gz is in multiple packages: [:"perl-Socket", :perl]
|
157
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
158
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Big5.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
159
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.GB2312.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
160
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.JISX0208.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
161
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Korean.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
162
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Pinyin.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
163
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Stroke.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
164
|
+
xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.Locale.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
|
165
|
+
%
|
166
|
+
|
167
|
+
### generate
|
168
|
+
|
169
|
+
xezat generate -- generate additional files
|
170
|
+
|
171
|
+
Usage:
|
172
|
+
|
173
|
+
xezat generate [options] cygport
|
174
|
+
|
175
|
+
Options:
|
176
|
+
-c, --cmake generate *.cmake
|
177
|
+
-o, --overwrite overwrite file
|
178
|
+
-p, --pkg-config generate *.pc
|
179
|
+
-h, --help Show this message
|
180
|
+
-v, --version Print the name and version
|
181
|
+
-t, --trace Show the full backtrace when an error occurs
|
182
|
+
|
183
|
+
### validate
|
184
|
+
|
185
|
+
xezat validate -- validate package contents
|
186
|
+
|
187
|
+
Usage:
|
188
|
+
|
189
|
+
xezat validate [options] cygport
|
190
|
+
|
191
|
+
Options:
|
192
|
+
-h, --help Show this message
|
193
|
+
-v, --version Print the name and version
|
194
|
+
-t, --trace Show the full backtrace when an error occurs
|
195
|
+
|
196
|
+
### bump
|
197
|
+
|
198
|
+
xezat bump -- update CYGWIN-PATCHES/README
|
199
|
+
|
200
|
+
Usage:
|
201
|
+
|
202
|
+
xezat bump cygport
|
203
|
+
|
204
|
+
Options:
|
205
|
+
-h, --help Show this message
|
206
|
+
-v, --version Print the name and version
|
207
|
+
-t, --trace Show the full backtrace when an error occurs
|
data/Rakefile
ADDED
data/bin/xezat
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Encoding::default_external = 'UTF-8'
|
4
|
+
|
5
|
+
self_file =
|
6
|
+
if File.symlink?(__FILE__)
|
7
|
+
require 'pathname'
|
8
|
+
Pathname.new(__FILE__).realpath
|
9
|
+
else
|
10
|
+
__FILE__
|
11
|
+
end
|
12
|
+
$:.unshift File.expand_path(File.join(File.dirname(self_file), '..', 'lib'))
|
13
|
+
|
14
|
+
require 'xezat/main'
|
data/lib/xezat.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
module Xezat
|
2
|
+
ROOT_DIR = File::expand_path(File::join(File::dirname(__FILE__), '..'))
|
3
|
+
DATA_DIR = File::expand_path(File::join(ROOT_DIR, 'share', 'xezat'))
|
4
|
+
REPOSITORY_DIR = File::expand_path(File::join(DATA_DIR, 'repository'))
|
5
|
+
TEMPLATE_DIR = File::expand_path(File::join(DATA_DIR, 'template'))
|
6
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'facets/file/atomic_write'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'xezat'
|
6
|
+
require 'xezat/commands'
|
7
|
+
require 'xezat/cygchangelog'
|
8
|
+
require 'xezat/cygclasses'
|
9
|
+
require 'xezat/detectors'
|
10
|
+
require 'xezat/refine/linguist/file_blob'
|
11
|
+
require 'xezat/packages'
|
12
|
+
require 'xezat/variables'
|
13
|
+
|
14
|
+
module Xezat
|
15
|
+
# ファイルのパーミッションが適切でない場合に投げられる例外
|
16
|
+
class FilePermissionError < StandardError
|
17
|
+
end
|
18
|
+
|
19
|
+
# cygport の他のコマンドが終わっておらずに呼び出すべき状態ではない場合に投げられる例外
|
20
|
+
class IllegalStateError < StandardError
|
21
|
+
end
|
22
|
+
|
23
|
+
module Command
|
24
|
+
# README を生成または更新する
|
25
|
+
class Bump
|
26
|
+
def initialize(program)
|
27
|
+
program.command(:bump) do |c|
|
28
|
+
c.syntax 'bump cygport'
|
29
|
+
c.description 'update CYGWIN-PATCHES/README'
|
30
|
+
c.action do |args, options|
|
31
|
+
execute(c, args, options)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
CommandManager::register(:bump, self)
|
37
|
+
|
38
|
+
def execute(c, args, options)
|
39
|
+
cygport = args.shift
|
40
|
+
raise ArgumentError, 'wrong number of arguments (0 for 1)' unless cygport
|
41
|
+
c.logger.info "ignore extra arguments: #{args.to_s}" unless args.empty?
|
42
|
+
|
43
|
+
variables = VariableManager::get_default_variables(cygport)
|
44
|
+
packages = PackageManager::get_installed_packages()
|
45
|
+
readme_file = File::expand_path(File::join(variables[:C], 'README'))
|
46
|
+
|
47
|
+
info = {}
|
48
|
+
info[:src_uri] = get_src_uri(variables)
|
49
|
+
info[:runtimes] = get_runtime_packages(cygport)
|
50
|
+
info[:developments] = get_development_packages(variables, packages)
|
51
|
+
info[:files] = get_files(variables)
|
52
|
+
info[:changelog] = get_changelog(variables, options, readme_file)
|
53
|
+
|
54
|
+
File::atomic_write(readme_file) do |f|
|
55
|
+
f.write(get_embedded_contents(variables, info))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# changelog を取得する
|
60
|
+
def get_changelog(variables, options, readme_file)
|
61
|
+
current_version = variables[:PVR].intern
|
62
|
+
if FileTest::exist?(readme_file)
|
63
|
+
raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest::readable?(readme_file)
|
64
|
+
raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest::writable?(readme_file)
|
65
|
+
changelog = Cygchangelog.new(File::read(readme_file))
|
66
|
+
options['message'] ||= 'Version bump.'
|
67
|
+
changelog[current_version] = options['message'] unless changelog.key?(current_version)
|
68
|
+
else
|
69
|
+
changelog = Cygchangelog.new
|
70
|
+
changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
|
71
|
+
end
|
72
|
+
changelog
|
73
|
+
end
|
74
|
+
|
75
|
+
# vcs に対応した SRC_URI を取得する
|
76
|
+
def get_src_uri(variables, cygclass_manager = CygclassManager.new)
|
77
|
+
cygclass_manager.vcs.each do |vcs|
|
78
|
+
src_uri_key = "#{vcs.to_s.upcase}_URI".intern
|
79
|
+
return variables[src_uri_key] if variables.key?(src_uri_key)
|
80
|
+
end
|
81
|
+
variables[:SRC_URI]
|
82
|
+
end
|
83
|
+
|
84
|
+
# package が依存している runtime のリストを取得する
|
85
|
+
def get_runtime_packages(cygport)
|
86
|
+
command = ['bash', File.expand_path(File.join(DATA_DIR, 'invoke_cygport_dep.sh')), cygport]
|
87
|
+
result, error, status = Open3.capture3(command.join(' '))
|
88
|
+
raise CygportProcessError, error unless status.success?
|
89
|
+
result.split($/).map! do |runtime|
|
90
|
+
runtime.lstrip
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# package を build するために必要な development package のリストを取得する
|
95
|
+
def get_development_packages(variables, packages)
|
96
|
+
compilers = get_compilers(variables)
|
97
|
+
tools = get_tools(variables)
|
98
|
+
development_packages = (compilers + tools + [:cygport]).uniq.sort
|
99
|
+
development_packages.map! do |package|
|
100
|
+
packages[package] || ''
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# package を build するために必要な compiler package のリストを取得する
|
105
|
+
def get_compilers(variables)
|
106
|
+
|
107
|
+
# ファイルの内容からプログラミング言語を特定する
|
108
|
+
languages = []
|
109
|
+
Find::find(variables[:S]) do |path|
|
110
|
+
unless FileTest::directory?(path)
|
111
|
+
language = Xezat::Refine::Linguist::FileBlob.new(path).language
|
112
|
+
unless language.nil?
|
113
|
+
if language.name == 'Objective-C' # Objective-C は誤検知があるため suffix で再確認
|
114
|
+
next unless path.end_with?('.m')
|
115
|
+
end
|
116
|
+
languages << language.name
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# 言語から対応する compiler package を取得する
|
122
|
+
compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
|
123
|
+
compiler_candidates = JSON.parse(File::read(compiler_file))
|
124
|
+
compilers = []
|
125
|
+
languages.uniq.each do |language|
|
126
|
+
if compiler_candidates.key?(language)
|
127
|
+
compiler_candidate = compiler_candidates[language]
|
128
|
+
compilers << compiler_candidate['package'].intern
|
129
|
+
if compiler_candidate.key?('dependencies')
|
130
|
+
compiler_candidate['dependencies'].each do |dependency|
|
131
|
+
compilers << dependency.intern
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
compilers.uniq
|
137
|
+
end
|
138
|
+
|
139
|
+
# packages を build するために必要な tool package のリストを取得する
|
140
|
+
def get_tools(variables)
|
141
|
+
DetectorManager::load_default_detectors
|
142
|
+
DetectorManager::detect(variables)
|
143
|
+
end
|
144
|
+
|
145
|
+
# package で生成されるチェック用の *.lst から README に埋め込むファイルのリストを取得する
|
146
|
+
def get_files(variables)
|
147
|
+
pkg2files = {}
|
148
|
+
variables[:pkg_name].each do |pkg_name|
|
149
|
+
lst_file = File::expand_path(File::join(variables[:T], ".#{pkg_name}.lst"))
|
150
|
+
raise IllegalStateError, "No such file: #{lst_file}" unless FileTest::readable?(lst_file)
|
151
|
+
lines = File::readlines(lst_file)
|
152
|
+
lines.delete_if do |path|
|
153
|
+
path.strip!
|
154
|
+
path[-1] == File::SEPARATOR
|
155
|
+
end.map! do |path|
|
156
|
+
File::SEPARATOR + path
|
157
|
+
end
|
158
|
+
if variables[:PN] == pkg_name
|
159
|
+
readme = File::SEPARATOR + File.join('usr', 'share', 'doc', 'Cygwin', "#{pkg_name}.README")
|
160
|
+
lines << readme.strip unless lines.include?(readme)
|
161
|
+
end
|
162
|
+
pkg2files[pkg_name.intern] = lines.sort
|
163
|
+
end
|
164
|
+
pkg2files
|
165
|
+
end
|
166
|
+
|
167
|
+
# テンプレートにデータを埋め込んだ結果の文字列を取得する
|
168
|
+
def get_embedded_contents(variables, info)
|
169
|
+
erb = File::expand_path(File::join(TEMPLATE_DIR, 'README.erb'))
|
170
|
+
ERB.new(File::readlines(erb).join(nil), nil, '%-').result(binding)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|