pdk 3.2.0 → 3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/pdk/cli/build.rb +6 -3
- data/lib/pdk/cli/exec/command.rb +0 -2
- data/lib/pdk/cli/release.rb +0 -1
- data/lib/pdk/module/convert.rb +2 -2
- data/lib/pdk/module/metadata.rb +17 -9
- data/lib/pdk/module/release.rb +9 -6
- data/lib/pdk/template/renderer/v1/renderer.rb +1 -1
- data/lib/pdk/tests/unit.rb +3 -3
- data/lib/pdk/util.rb +1 -0
- data/lib/pdk/version.rb +2 -2
- metadata +73 -61
- data/lib/pdk/module/build.rb +0 -302
- data/lib/pdk/monkey_patches.rb +0 -268
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ea7fd13c13423022b2ef3e28275d98860b34b9afe9d4b5ccac56c06a0a29346
|
4
|
+
data.tar.gz: 5025806f00ad6d9b36bb0957d8da65765cc46cd335c11ef75cf3b82f88a61e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3b2866a2a221d87d7c87ecc15231b0a97b00bce150cdd97fd6a6a1ee99f36d9ead2fcee2aef644360aaef84e499f1adff1cdb8de9a10ec084ac302743255a6a
|
7
|
+
data.tar.gz: e4fbd9517b238b85d55c59df0a838f831ac1033e84ec2daa96487470f91e1c5954bf96208b223311ab8c8e4c00bc3150570094017576d7e1ffb105c57f2f2eff
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
|
6
6
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
|
7
7
|
|
8
|
+
## [v3.3.0](https://github.com/puppetlabs/pdk/tree/v3.3.0) - 2024-09-10
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v3.2.0...v3.3.0)
|
11
|
+
|
12
|
+
## Added
|
13
|
+
|
14
|
+
- Skip 'name' validation when in a controlrepo context [#1352](https://github.com/puppetlabs/pdk/pull/1352) ([garrettrowell](https://github.com/garrettrowell))
|
15
|
+
- (CAT-1896) - Use puppet-modulebuilder for PDK build [#1374](https://github.com/puppetlabs/pdk/pull/1374) ([jordanbreen28](https://github.com/jordanbreen28))
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- (CAT-1643) Update childprocess and remove patch [#1356](https://github.com/puppetlabs/pdk/pull/1356) ([david22swan](https://github.com/david22swan))
|
20
|
+
- (CAT-2026) Update how pdk test unit --list detects an error [#1388](https://github.com/puppetlabs/pdk/pull/1388) ([david22swan](https://github.com/david22swan))
|
21
|
+
|
8
22
|
## [v3.2.0](https://github.com/puppetlabs/pdk/tree/v3.2.0) - 2024-05-02
|
9
23
|
|
10
24
|
[Full Changelog](https://github.com/puppetlabs/pdk/compare/v3.1.0...v3.2.0)
|
data/lib/pdk/cli/build.rb
CHANGED
@@ -12,7 +12,6 @@ module PDK
|
|
12
12
|
option nil, 'force', 'Skips the prompts and builds the module package.'
|
13
13
|
|
14
14
|
run do |opts, _args, _cmd|
|
15
|
-
require 'pdk/module/build'
|
16
15
|
require 'pdk/module/metadata'
|
17
16
|
require 'pdk/cli/util'
|
18
17
|
|
@@ -37,7 +36,11 @@ module PDK
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
# build module
|
40
|
+
require 'puppet/modulebuilder'
|
41
|
+
module_dir = PDK::Util::Filesystem.expand_path(Dir.pwd)
|
42
|
+
target_dir = PDK::Util::Filesystem.expand_path(opts[:'target-dir'])
|
43
|
+
builder = Puppet::Modulebuilder::Builder.new(module_dir, target_dir, PDK.logger)
|
41
44
|
|
42
45
|
unless opts[:force]
|
43
46
|
if builder.package_already_exists?
|
@@ -49,7 +52,7 @@ module PDK
|
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
52
|
-
unless
|
55
|
+
unless PDK::Util.module_pdk_compatible?(module_dir)
|
53
56
|
PDK.logger.info 'This module is not compatible with PDK, so PDK can not validate or test this build. ' \
|
54
57
|
'Unvalidated modules may have errors when uploading to the Forge. ' \
|
55
58
|
'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.'
|
data/lib/pdk/cli/exec/command.rb
CHANGED
data/lib/pdk/cli/release.rb
CHANGED
data/lib/pdk/module/convert.rb
CHANGED
@@ -163,7 +163,7 @@ module PDK
|
|
163
163
|
when :manage
|
164
164
|
if PDK::Util::Filesystem.exist?(absolute_file_path)
|
165
165
|
update_manager.modify_file(absolute_file_path, file_content)
|
166
|
-
update_manager.make_file_executable(absolute_file_path) if file_executable && !PDK::Util::Filesystem.
|
166
|
+
update_manager.make_file_executable(absolute_file_path) if file_executable && !PDK::Util::Filesystem.stat(absolute_file_path).executable?
|
167
167
|
else
|
168
168
|
update_manager.add_file(absolute_file_path, file_content)
|
169
169
|
update_manager.make_file_executable(absolute_file_path) if file_executable
|
@@ -211,7 +211,7 @@ module PDK
|
|
211
211
|
return if options[:noop]
|
212
212
|
|
213
213
|
project_dir = File.basename(Dir.pwd)
|
214
|
-
options[:module_name] = project_dir.split('-', 2).compact[-1]
|
214
|
+
options[:module_name] = PDK.context.is_a?(PDK::Context::ControlRepo) ? project_dir : project_dir.split('-', 2).compact[-1]
|
215
215
|
options[:prompt] = false
|
216
216
|
options[:'skip-interview'] = true if options[:force]
|
217
217
|
|
data/lib/pdk/module/metadata.rb
CHANGED
@@ -9,7 +9,7 @@ module PDK
|
|
9
9
|
'RedHat based Linux' => [
|
10
10
|
{
|
11
11
|
'operatingsystem' => 'CentOS',
|
12
|
-
'operatingsystemrelease' => ['7']
|
12
|
+
'operatingsystemrelease' => ['7', '8', '9']
|
13
13
|
},
|
14
14
|
{
|
15
15
|
'operatingsystem' => 'OracleLinux',
|
@@ -17,30 +17,38 @@ module PDK
|
|
17
17
|
},
|
18
18
|
{
|
19
19
|
'operatingsystem' => 'RedHat',
|
20
|
-
'operatingsystemrelease' => ['8']
|
20
|
+
'operatingsystemrelease' => ['7', '8', '9']
|
21
21
|
},
|
22
22
|
{
|
23
23
|
'operatingsystem' => 'Scientific',
|
24
24
|
'operatingsystemrelease' => ['7']
|
25
|
+
},
|
26
|
+
{
|
27
|
+
'operatingsystem' => 'Rocky',
|
28
|
+
'operatingsystemrelease' => ['8']
|
29
|
+
},
|
30
|
+
{
|
31
|
+
'operatingsystem' => 'AlmaLinux',
|
32
|
+
'operatingsystemrelease' => ['8']
|
25
33
|
}
|
26
34
|
],
|
27
35
|
'Debian based Linux' => [
|
28
36
|
{
|
29
37
|
'operatingsystem' => 'Debian',
|
30
|
-
'operatingsystemrelease' => ['10']
|
38
|
+
'operatingsystemrelease' => ['10', '11', '12']
|
31
39
|
},
|
32
40
|
{
|
33
41
|
'operatingsystem' => 'Ubuntu',
|
34
|
-
'operatingsystemrelease' => ['18.04']
|
42
|
+
'operatingsystemrelease' => ['18.04', '20.04', '22.04']
|
35
43
|
}
|
36
44
|
],
|
37
45
|
'Fedora' => {
|
38
46
|
'operatingsystem' => 'Fedora',
|
39
|
-
'operatingsystemrelease' => ['
|
47
|
+
'operatingsystemrelease' => ['40']
|
40
48
|
},
|
41
49
|
'OSX' => {
|
42
50
|
'operatingsystem' => 'Darwin',
|
43
|
-
'operatingsystemrelease' => ['
|
51
|
+
'operatingsystemrelease' => ['21', '22', '23']
|
44
52
|
},
|
45
53
|
'SLES' => {
|
46
54
|
'operatingsystem' => 'SLES',
|
@@ -52,11 +60,11 @@ module PDK
|
|
52
60
|
},
|
53
61
|
'Windows' => {
|
54
62
|
'operatingsystem' => 'windows',
|
55
|
-
'operatingsystemrelease' => ['2019', '10']
|
63
|
+
'operatingsystemrelease' => ['2019', '2022', '10', '11']
|
56
64
|
},
|
57
65
|
'AIX' => {
|
58
66
|
'operatingsystem' => 'AIX',
|
59
|
-
'operatingsystemrelease' => ['
|
67
|
+
'operatingsystemrelease' => ['7.2', '7.3']
|
60
68
|
}
|
61
69
|
}.freeze
|
62
70
|
|
@@ -162,7 +170,7 @@ module PDK
|
|
162
170
|
|
163
171
|
# Do basic validation and parsing of the name parameter.
|
164
172
|
def process_name(data)
|
165
|
-
validate_name(data['name'])
|
173
|
+
validate_name(data['name']) unless PDK.context.is_a?(PDK::Context::ControlRepo)
|
166
174
|
author, modname = data['name'].split(%r{[-/]}, 2)
|
167
175
|
data['name'] = [author, modname].join('-')
|
168
176
|
|
data/lib/pdk/module/release.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pdk'
|
2
2
|
require 'uri'
|
3
|
+
require 'puppet/modulebuilder'
|
3
4
|
|
4
5
|
module PDK
|
5
6
|
module Module
|
@@ -77,7 +78,7 @@ module PDK
|
|
77
78
|
# Use the default as a last resort
|
78
79
|
package_file = default_package_filename if package_file.nil?
|
79
80
|
else
|
80
|
-
package_file = run_build
|
81
|
+
package_file = run_build
|
81
82
|
end
|
82
83
|
|
83
84
|
run_publish(options.dup, package_file) unless skip_publish?
|
@@ -95,7 +96,7 @@ module PDK
|
|
95
96
|
def default_package_filename
|
96
97
|
return @default_tarball_filename unless @default_tarball_filename.nil?
|
97
98
|
|
98
|
-
builder =
|
99
|
+
builder = Puppet::Modulebuilder::Builder.new(module_path, nil, PDK.logger)
|
99
100
|
@default_tarball_filename = builder.package_file
|
100
101
|
end
|
101
102
|
|
@@ -135,8 +136,11 @@ module PDK
|
|
135
136
|
end
|
136
137
|
|
137
138
|
# @return [String] Path to the built tarball
|
138
|
-
def run_build
|
139
|
-
PDK::
|
139
|
+
def run_build
|
140
|
+
module_dir = PDK::Util::Filesystem.expand_path(module_path || Dir.pwd)
|
141
|
+
target_dir = File.join(module_dir, 'pkg')
|
142
|
+
builder = Puppet::Modulebuilder::Builder.new(module_dir, target_dir, PDK.logger)
|
143
|
+
builder.build
|
140
144
|
end
|
141
145
|
|
142
146
|
def run_publish(_opts, tarball_path)
|
@@ -238,8 +242,7 @@ module PDK
|
|
238
242
|
def pdk_compatible?
|
239
243
|
return @pdk_compatible unless @pdk_compatible.nil?
|
240
244
|
|
241
|
-
|
242
|
-
@pdk_compatible = builder.module_pdk_compatible?
|
245
|
+
@pdk_compatible = PDK::Util.module_pdk_compatible?(module_path)
|
243
246
|
end
|
244
247
|
# :nocov:
|
245
248
|
|
@@ -95,7 +95,7 @@ module PDK
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
dest_executable = config['manage_execute_permissions'] && PDK::Util::Filesystem.
|
98
|
+
dest_executable = config['manage_execute_permissions'] && PDK::Util::Filesystem.stat(File.join(template_loc, template_file)).executable?
|
99
99
|
|
100
100
|
yield dest_path, dest_content, dest_status, dest_executable
|
101
101
|
end
|
data/lib/pdk/tests/unit.rb
CHANGED
@@ -246,10 +246,10 @@ module PDK
|
|
246
246
|
raise PDK::CLI::FatalError, format('Failed to find valid JSON in output from rspec: %{output}', output: output[:stdout]) unless rspec_json
|
247
247
|
|
248
248
|
if rspec_json['examples'].empty?
|
249
|
-
|
250
|
-
return [] if
|
249
|
+
return [] if rspec_json['messages'][0] == 'No examples found.'
|
250
|
+
return [] if rspec_json['messages'].include?("\nAll examples were filtered out")
|
251
251
|
|
252
|
-
raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message:
|
252
|
+
raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_json['messages'])
|
253
253
|
else
|
254
254
|
examples = []
|
255
255
|
rspec_json['examples'].each do |example|
|
data/lib/pdk/util.rb
CHANGED
data/lib/pdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.15.5
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 2.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.15.5
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: minitar
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: '0.8'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: '0.8'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.1.0
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 3.0.0
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
|
-
- - "
|
61
|
+
- - ">="
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: 2.
|
63
|
+
version: 2.1.0
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 3.0.0
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
68
|
+
name: cri
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
|
-
- - "
|
71
|
+
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
73
|
+
version: 2.15.11
|
68
74
|
type: :runtime
|
69
75
|
prerelease: false
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
|
-
- - "
|
78
|
+
- - "~>"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
80
|
+
version: 2.15.11
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
82
|
+
name: childprocess
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
78
84
|
requirements:
|
79
|
-
- - "
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 1.15.5
|
82
|
-
- - "<"
|
85
|
+
- - "~>"
|
83
86
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
87
|
+
version: '5.0'
|
85
88
|
type: :runtime
|
86
89
|
prerelease: false
|
87
90
|
version_requirements: !ruby/object:Gem::Requirement
|
88
91
|
requirements:
|
89
|
-
- - "
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: 1.15.5
|
92
|
-
- - "<"
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: '5.0'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: hitimes
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,117 +107,131 @@ dependencies:
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 2.0.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
|
-
name:
|
110
|
+
name: tty-prompt
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: '0.23'
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: '0.23'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
|
-
name:
|
124
|
+
name: tty-spinner
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
129
|
+
version: '0.9'
|
130
130
|
type: :runtime
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
136
|
+
version: '0.9'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
138
|
+
name: tty-which
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0.
|
143
|
+
version: '0.5'
|
144
144
|
type: :runtime
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '0.
|
150
|
+
version: '0.5'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
|
-
name:
|
152
|
+
name: json-schema
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
157
|
+
version: '4.0'
|
158
158
|
type: :runtime
|
159
159
|
prerelease: false
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
162
|
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
164
|
+
version: '4.0'
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
|
-
name:
|
166
|
+
name: puppet-modulebuilder
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '0
|
171
|
+
version: '1.0'
|
172
172
|
type: :runtime
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '0
|
178
|
+
version: '1.0'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
|
-
name:
|
180
|
+
name: deep_merge
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - "~>"
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
185
|
+
version: 1.2.2
|
186
186
|
type: :runtime
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - "~>"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: 1.2.2
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
|
-
name:
|
194
|
+
name: diff-lcs
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 1.5.0
|
200
|
+
type: :runtime
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 1.5.0
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: json_pure
|
195
209
|
requirement: !ruby/object:Gem::Requirement
|
196
210
|
requirements:
|
197
211
|
- - "~>"
|
198
212
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
213
|
+
version: 2.6.3
|
200
214
|
type: :runtime
|
201
215
|
prerelease: false
|
202
216
|
version_requirements: !ruby/object:Gem::Requirement
|
203
217
|
requirements:
|
204
218
|
- - "~>"
|
205
219
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
220
|
+
version: 2.6.3
|
207
221
|
- !ruby/object:Gem::Dependency
|
208
|
-
name:
|
222
|
+
name: pathspec
|
209
223
|
requirement: !ruby/object:Gem::Requirement
|
210
224
|
requirements:
|
211
225
|
- - "~>"
|
212
226
|
- !ruby/object:Gem::Version
|
213
|
-
version: 1.
|
227
|
+
version: '1.1'
|
214
228
|
type: :runtime
|
215
229
|
prerelease: false
|
216
230
|
version_requirements: !ruby/object:Gem::Requirement
|
217
231
|
requirements:
|
218
232
|
- - "~>"
|
219
233
|
- !ruby/object:Gem::Version
|
220
|
-
version: 1.
|
234
|
+
version: '1.1'
|
221
235
|
description: A CLI to facilitate easy, unified development workflows for Puppet modules.
|
222
236
|
email:
|
223
237
|
- pdk-maintainers@puppet.com
|
@@ -305,13 +319,11 @@ files:
|
|
305
319
|
- lib/pdk/generate/transport.rb
|
306
320
|
- lib/pdk/logger.rb
|
307
321
|
- lib/pdk/module.rb
|
308
|
-
- lib/pdk/module/build.rb
|
309
322
|
- lib/pdk/module/convert.rb
|
310
323
|
- lib/pdk/module/metadata.rb
|
311
324
|
- lib/pdk/module/release.rb
|
312
325
|
- lib/pdk/module/update.rb
|
313
326
|
- lib/pdk/module/update_manager.rb
|
314
|
-
- lib/pdk/monkey_patches.rb
|
315
327
|
- lib/pdk/report.rb
|
316
328
|
- lib/pdk/report/event.rb
|
317
329
|
- lib/pdk/template.rb
|
@@ -371,7 +383,7 @@ homepage: https://github.com/puppetlabs/pdk
|
|
371
383
|
licenses: []
|
372
384
|
metadata:
|
373
385
|
rubygems_mfa_required: 'true'
|
374
|
-
post_install_message:
|
386
|
+
post_install_message:
|
375
387
|
rdoc_options: []
|
376
388
|
require_paths:
|
377
389
|
- lib
|
@@ -386,8 +398,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
398
|
- !ruby/object:Gem::Version
|
387
399
|
version: '0'
|
388
400
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
390
|
-
signing_key:
|
401
|
+
rubygems_version: 3.5.17
|
402
|
+
signing_key:
|
391
403
|
specification_version: 4
|
392
404
|
summary: A key part of the Puppet Development Kit, the shortest path to better modules
|
393
405
|
test_files: []
|
data/lib/pdk/module/build.rb
DELETED
@@ -1,302 +0,0 @@
|
|
1
|
-
require 'pdk'
|
2
|
-
|
3
|
-
module PDK
|
4
|
-
module Module
|
5
|
-
class Build
|
6
|
-
def self.invoke(options = {})
|
7
|
-
new(options).build
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_reader :module_dir, :target_dir
|
11
|
-
|
12
|
-
def initialize(options = {})
|
13
|
-
@module_dir = PDK::Util::Filesystem.expand_path(options[:module_dir] || Dir.pwd)
|
14
|
-
@target_dir = PDK::Util::Filesystem.expand_path(options[:'target-dir'] || File.join(module_dir, 'pkg'))
|
15
|
-
end
|
16
|
-
|
17
|
-
# Read and parse the values from metadata.json for the module that is
|
18
|
-
# being built.
|
19
|
-
#
|
20
|
-
# @return [Hash{String => Object}] The hash of metadata values.
|
21
|
-
def metadata
|
22
|
-
require 'pdk/module/metadata'
|
23
|
-
|
24
|
-
@metadata ||= PDK::Module::Metadata.from_file(File.join(module_dir, 'metadata.json')).data
|
25
|
-
end
|
26
|
-
|
27
|
-
# Return the path where the built package file will be written to.
|
28
|
-
def package_file
|
29
|
-
@package_file ||= File.join(target_dir, "#{release_name}.tar.gz")
|
30
|
-
end
|
31
|
-
|
32
|
-
# Build a module package from a module directory.
|
33
|
-
#
|
34
|
-
# @return [String] The path to the built package file.
|
35
|
-
def build
|
36
|
-
create_build_dir
|
37
|
-
|
38
|
-
stage_module_in_build_dir
|
39
|
-
build_package
|
40
|
-
|
41
|
-
package_file
|
42
|
-
ensure
|
43
|
-
cleanup_build_dir
|
44
|
-
end
|
45
|
-
|
46
|
-
# Verify if there is an existing package in the target directory and prompts
|
47
|
-
# the user if they want to overwrite it.
|
48
|
-
def package_already_exists?
|
49
|
-
PDK::Util::Filesystem.exist?(package_file)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Check if the module is PDK Compatible. If not, then prompt the user if
|
53
|
-
# they want to run PDK Convert.
|
54
|
-
def module_pdk_compatible?
|
55
|
-
['pdk-version', 'template-url'].any? { |key| metadata.key?(key) }
|
56
|
-
end
|
57
|
-
|
58
|
-
# Return the path to the temporary build directory, which will be placed
|
59
|
-
# inside the target directory and match the release name (see #release_name).
|
60
|
-
def build_dir
|
61
|
-
@build_dir ||= File.join(target_dir, release_name)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Create a temporary build directory where the files to be included in
|
65
|
-
# the package will be staged before building the tarball.
|
66
|
-
#
|
67
|
-
# If the directory already exists, remove it first.
|
68
|
-
def create_build_dir
|
69
|
-
cleanup_build_dir
|
70
|
-
|
71
|
-
PDK::Util::Filesystem.mkdir_p(build_dir)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Remove the temporary build directory and all its contents from disk.
|
75
|
-
#
|
76
|
-
# @return nil.
|
77
|
-
def cleanup_build_dir
|
78
|
-
PDK::Util::Filesystem.rm_rf(build_dir, secure: true)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Combine the module name and version into a Forge-compatible dash
|
82
|
-
# separated string.
|
83
|
-
#
|
84
|
-
# @return [String] The module name and version, joined by a dash.
|
85
|
-
def release_name
|
86
|
-
@release_name ||= [
|
87
|
-
metadata['name'],
|
88
|
-
metadata['version']
|
89
|
-
].join('-')
|
90
|
-
end
|
91
|
-
|
92
|
-
# Iterate through all the files and directories in the module and stage
|
93
|
-
# them into the temporary build directory (unless ignored).
|
94
|
-
#
|
95
|
-
# @return nil
|
96
|
-
def stage_module_in_build_dir
|
97
|
-
require 'find'
|
98
|
-
|
99
|
-
Find.find(module_dir) do |path|
|
100
|
-
next if path == module_dir
|
101
|
-
|
102
|
-
ignored_path?(path) ? Find.prune : stage_path(path)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
# Stage a file or directory from the module into the build directory.
|
107
|
-
#
|
108
|
-
# @param path [String] The path to the file or directory.
|
109
|
-
#
|
110
|
-
# @return nil.
|
111
|
-
def stage_path(path)
|
112
|
-
require 'pathname'
|
113
|
-
|
114
|
-
relative_path = Pathname.new(path).relative_path_from(Pathname.new(module_dir))
|
115
|
-
dest_path = File.join(build_dir, relative_path)
|
116
|
-
|
117
|
-
validate_path_encoding!(relative_path.to_path)
|
118
|
-
|
119
|
-
if PDK::Util::Filesystem.directory?(path)
|
120
|
-
PDK::Util::Filesystem.mkdir_p(dest_path, mode: PDK::Util::Filesystem.stat(path).mode)
|
121
|
-
elsif PDK::Util::Filesystem.symlink?(path)
|
122
|
-
warn_symlink(path)
|
123
|
-
else
|
124
|
-
validate_ustar_path!(relative_path.to_path)
|
125
|
-
PDK::Util::Filesystem.cp(path, dest_path, preserve: true)
|
126
|
-
end
|
127
|
-
rescue ArgumentError => e
|
128
|
-
raise PDK::CLI::ExitWithError, format('%{message} Rename the file or exclude it from the package ' \
|
129
|
-
'by adding it to the .pdkignore file in your module.', message: e.message)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Check if the given path matches one of the patterns listed in the
|
133
|
-
# ignore file.
|
134
|
-
#
|
135
|
-
# @param path [String] The path to be checked.
|
136
|
-
#
|
137
|
-
# @return [Boolean] true if the path matches and should be ignored.
|
138
|
-
def ignored_path?(path)
|
139
|
-
path = "#{path}/" if PDK::Util::Filesystem.directory?(path)
|
140
|
-
|
141
|
-
!ignored_files.match_paths([path], module_dir).empty?
|
142
|
-
end
|
143
|
-
|
144
|
-
# Warn the user about a symlink that would have been included in the
|
145
|
-
# built package.
|
146
|
-
#
|
147
|
-
# @param path [String] The relative or absolute path to the symlink.
|
148
|
-
#
|
149
|
-
# @return nil.
|
150
|
-
def warn_symlink(path)
|
151
|
-
require 'pathname'
|
152
|
-
|
153
|
-
symlink_path = Pathname.new(path)
|
154
|
-
module_path = Pathname.new(module_dir)
|
155
|
-
|
156
|
-
PDK.logger.warn format('Symlinks in modules are not supported and will not be included in the package. Please investigate symlink %{from} -> %{to}.',
|
157
|
-
from: symlink_path.relative_path_from(module_path), to: symlink_path.realpath.relative_path_from(module_path))
|
158
|
-
end
|
159
|
-
|
160
|
-
# Checks if the path length will fit into the POSIX.1-1998 (ustar) tar
|
161
|
-
# header format.
|
162
|
-
#
|
163
|
-
# POSIX.1-2001 (which allows paths of infinite length) was adopted by GNU
|
164
|
-
# tar in 2004 and is supported by minitar 0.7 and above. Unfortunately
|
165
|
-
# much of the Puppet ecosystem still uses minitar 0.6.1.
|
166
|
-
#
|
167
|
-
# POSIX.1-1998 tar format does not allow for paths greater than 256 bytes,
|
168
|
-
# or paths that can't be split into a prefix of 155 bytes (max) and
|
169
|
-
# a suffix of 100 bytes (max).
|
170
|
-
#
|
171
|
-
# This logic was pretty much copied from the private method
|
172
|
-
# {Archive::Tar::Minitar::Writer#split_name}.
|
173
|
-
#
|
174
|
-
# @param path [String] the relative path to be added to the tar file.
|
175
|
-
#
|
176
|
-
# @raise [ArgumentError] if the path is too long or could not be split.
|
177
|
-
#
|
178
|
-
# @return [nil]
|
179
|
-
def validate_ustar_path!(path)
|
180
|
-
raise ArgumentError, format("The path '%{path}' is longer than 256 bytes.", path: path) if path.bytesize > 256
|
181
|
-
|
182
|
-
if path.bytesize <= 100
|
183
|
-
prefix = ''
|
184
|
-
else
|
185
|
-
parts = path.split(File::SEPARATOR)
|
186
|
-
newpath = parts.pop
|
187
|
-
nxt = ''
|
188
|
-
|
189
|
-
loop do
|
190
|
-
nxt = parts.pop || ''
|
191
|
-
break if newpath.bytesize + 1 + nxt.bytesize >= 100
|
192
|
-
|
193
|
-
newpath = File.join(nxt, newpath)
|
194
|
-
end
|
195
|
-
|
196
|
-
prefix = File.join(*parts, nxt)
|
197
|
-
path = newpath
|
198
|
-
end
|
199
|
-
|
200
|
-
return unless path.bytesize > 100 || prefix.bytesize > 155
|
201
|
-
|
202
|
-
raise ArgumentError,
|
203
|
-
format("'%{path}' could not be split at a directory separator into two " \
|
204
|
-
'parts, the first having a maximum length of 155 bytes and the ' \
|
205
|
-
'second having a maximum length of 100 bytes.', path: path)
|
206
|
-
end
|
207
|
-
|
208
|
-
# Checks if the path contains any non-ASCII characters.
|
209
|
-
#
|
210
|
-
# Java will throw an error when it encounters a path containing
|
211
|
-
# characters that are not supported by the hosts locale. In order to
|
212
|
-
# maximise compatibility we limit the paths to contain only ASCII
|
213
|
-
# characters, which should be part of any locale character set.
|
214
|
-
#
|
215
|
-
# @param path [String] the relative path to be added to the tar file.
|
216
|
-
#
|
217
|
-
# @raise [ArgumentError] if the path contains non-ASCII characters.
|
218
|
-
#
|
219
|
-
# @return [nil]
|
220
|
-
def validate_path_encoding!(path)
|
221
|
-
return unless /[^\x00-\x7F]/.match?(path)
|
222
|
-
|
223
|
-
raise ArgumentError, format("'%{path}' can only include ASCII characters in its path or " \
|
224
|
-
'filename in order to be compatible with a wide range of hosts.', path: path)
|
225
|
-
end
|
226
|
-
|
227
|
-
# Creates a gzip compressed tarball of the build directory.
|
228
|
-
#
|
229
|
-
# If the destination package already exists, it will be removed before
|
230
|
-
# creating the new tarball.
|
231
|
-
#
|
232
|
-
# @return nil.
|
233
|
-
def build_package
|
234
|
-
require 'zlib'
|
235
|
-
require 'minitar'
|
236
|
-
require 'find'
|
237
|
-
|
238
|
-
PDK::Util::Filesystem.rm_f(package_file)
|
239
|
-
|
240
|
-
Dir.chdir(target_dir) do
|
241
|
-
gz = Zlib::GzipWriter.new(File.open(package_file, 'wb')) # rubocop:disable PDK/FileOpen
|
242
|
-
tar = Minitar::Output.new(gz)
|
243
|
-
Find.find(release_name) do |entry|
|
244
|
-
entry_meta = {
|
245
|
-
name: entry
|
246
|
-
}
|
247
|
-
|
248
|
-
orig_mode = PDK::Util::Filesystem.stat(entry).mode
|
249
|
-
min_mode = Minitar.dir?(entry) ? 0o755 : 0o644
|
250
|
-
|
251
|
-
entry_meta[:mode] = orig_mode | min_mode
|
252
|
-
|
253
|
-
PDK.logger.debug(format('Updated permissions of packaged \'%{entry}\' to %{new_mode}', entry: entry, new_mode: (entry_meta[:mode] & 0o7777).to_s(8))) if entry_meta[:mode] != orig_mode
|
254
|
-
|
255
|
-
Minitar.pack_file(entry_meta, tar)
|
256
|
-
end
|
257
|
-
ensure
|
258
|
-
tar.close
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
# Select the most appropriate ignore file in the module directory.
|
263
|
-
#
|
264
|
-
# In order of preference, we first try `.pdkignore`, then `.pmtignore`
|
265
|
-
# and finally `.gitignore`.
|
266
|
-
#
|
267
|
-
# @return [String] The path to the file containing the patterns of file
|
268
|
-
# paths to ignore.
|
269
|
-
def ignore_file
|
270
|
-
@ignore_file ||= [
|
271
|
-
File.join(module_dir, '.pdkignore'),
|
272
|
-
File.join(module_dir, '.pmtignore'),
|
273
|
-
File.join(module_dir, '.gitignore')
|
274
|
-
].find { |file| PDK::Util::Filesystem.file?(file) && PDK::Util::Filesystem.readable?(file) }
|
275
|
-
end
|
276
|
-
|
277
|
-
# Instantiate a new PathSpec class and populate it with the pattern(s) of
|
278
|
-
# files to be ignored.
|
279
|
-
#
|
280
|
-
# @return [PathSpec] The populated ignore path matcher.
|
281
|
-
def ignored_files
|
282
|
-
require 'pdk/module'
|
283
|
-
require 'pathspec'
|
284
|
-
|
285
|
-
@ignored_files ||=
|
286
|
-
begin
|
287
|
-
ignored = if ignore_file.nil?
|
288
|
-
PathSpec.new
|
289
|
-
else
|
290
|
-
PathSpec.new(PDK::Util::Filesystem.read_file(ignore_file, open_args: 'rb:UTF-8'))
|
291
|
-
end
|
292
|
-
|
293
|
-
ignored = ignored.add("/#{File.basename(target_dir)}/") if File.realdirpath(target_dir).start_with?(File.realdirpath(module_dir))
|
294
|
-
|
295
|
-
PDK::Module::DEFAULT_IGNORED.each { |r| ignored.add(r) }
|
296
|
-
|
297
|
-
ignored
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
data/lib/pdk/monkey_patches.rb
DELETED
@@ -1,268 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OS
|
4
|
-
# Os detection: Are we on Windows?
|
5
|
-
def self.windows?
|
6
|
-
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
# Patch childprocess so that it is Ruby 3 compliant.
|
11
|
-
# This could be removed if the following PR is ever merged
|
12
|
-
# and released:
|
13
|
-
# https://github.com/enkessler/childprocess/pull/185
|
14
|
-
module ChildProcess
|
15
|
-
class << self
|
16
|
-
def build(*args)
|
17
|
-
case os
|
18
|
-
when :macosx, :linux, :solaris, :bsd, :cygwin, :aix
|
19
|
-
if posix_spawn?
|
20
|
-
Unix::PosixSpawnProcess.new(*args)
|
21
|
-
elsif jruby?
|
22
|
-
JRuby::Process.new(*args)
|
23
|
-
else
|
24
|
-
Unix::ForkExecProcess.new(*args)
|
25
|
-
end
|
26
|
-
when :windows
|
27
|
-
Windows::Process.new(*args)
|
28
|
-
else
|
29
|
-
raise Error, "unsupported platform #{platform_name.inspect}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class AbstractProcess
|
35
|
-
def initialize(*args)
|
36
|
-
raise ArgumentError, "all arguments must be String: #{args.inspect}" unless args.all?(String)
|
37
|
-
|
38
|
-
@args = args
|
39
|
-
@started = false
|
40
|
-
@exit_code = nil
|
41
|
-
@io = nil
|
42
|
-
@cwd = nil
|
43
|
-
@detach = false
|
44
|
-
@duplex = false
|
45
|
-
@leader = false
|
46
|
-
@environment = {}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
if OS.windows?
|
51
|
-
module Windows
|
52
|
-
module Lib
|
53
|
-
extend FFI::Library
|
54
|
-
def self.msvcrt_name
|
55
|
-
RbConfig::CONFIG['RUBY_SO_NAME'][/msvc\w+/] || 'ucrtbase'
|
56
|
-
end
|
57
|
-
|
58
|
-
ffi_lib 'kernel32', msvcrt_name
|
59
|
-
ffi_convention :stdcall
|
60
|
-
|
61
|
-
# We have to redefine the function declarations so that they are available
|
62
|
-
# with the patched ffi_lib.
|
63
|
-
enum :wait_status, [
|
64
|
-
:wait_object_0, 0, # rubocop:disable Naming/VariableNumber
|
65
|
-
:wait_timeout, 0x102,
|
66
|
-
:wait_abandoned, 0x80,
|
67
|
-
:wait_failed, 0xFFFFFFFF
|
68
|
-
]
|
69
|
-
|
70
|
-
#
|
71
|
-
# BOOL WINAPI CreateProcess(
|
72
|
-
# __in_opt LPCTSTR lpApplicationName,
|
73
|
-
# __inout_opt LPTSTR lpCommandLine,
|
74
|
-
# __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
75
|
-
# __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
76
|
-
# __in BOOL bInheritHandles,
|
77
|
-
# __in DWORD dwCreationFlags,
|
78
|
-
# __in_opt LPVOID lpEnvironment,
|
79
|
-
# __in_opt LPCTSTR lpCurrentDirectory,
|
80
|
-
# __in LPSTARTUPINFO lpStartupInfo,
|
81
|
-
# __out LPPROCESS_INFORMATION lpProcessInformation
|
82
|
-
# );
|
83
|
-
#
|
84
|
-
|
85
|
-
attach_function :create_process, :CreateProcessW, [
|
86
|
-
:pointer,
|
87
|
-
:buffer_inout,
|
88
|
-
:pointer,
|
89
|
-
:pointer,
|
90
|
-
:bool,
|
91
|
-
:ulong,
|
92
|
-
:pointer,
|
93
|
-
:pointer,
|
94
|
-
:pointer,
|
95
|
-
:pointer
|
96
|
-
], :bool
|
97
|
-
|
98
|
-
#
|
99
|
-
# DWORD WINAPI FormatMessage(
|
100
|
-
# __in DWORD dwFlags,
|
101
|
-
# __in_opt LPCVOID lpSource,
|
102
|
-
# __in DWORD dwMessageId,
|
103
|
-
# __in DWORD dwLanguageId,
|
104
|
-
# __out LPTSTR lpBuffer,
|
105
|
-
# __in DWORD nSize,
|
106
|
-
# __in_opt va_list *Arguments
|
107
|
-
# );
|
108
|
-
#
|
109
|
-
|
110
|
-
attach_function :format_message, :FormatMessageA, [
|
111
|
-
:ulong,
|
112
|
-
:pointer,
|
113
|
-
:ulong,
|
114
|
-
:ulong,
|
115
|
-
:pointer,
|
116
|
-
:ulong,
|
117
|
-
:pointer
|
118
|
-
], :ulong
|
119
|
-
|
120
|
-
attach_function :close_handle, :CloseHandle, [:pointer], :bool
|
121
|
-
|
122
|
-
#
|
123
|
-
# HANDLE WINAPI OpenProcess(
|
124
|
-
# __in DWORD dwDesiredAccess,
|
125
|
-
# __in BOOL bInheritHandle,
|
126
|
-
# __in DWORD dwProcessId
|
127
|
-
# );
|
128
|
-
#
|
129
|
-
|
130
|
-
attach_function :open_process, :OpenProcess, [:ulong, :bool, :ulong], :pointer
|
131
|
-
|
132
|
-
#
|
133
|
-
# HANDLE WINAPI CreateJobObject(
|
134
|
-
# _In_opt_ LPSECURITY_ATTRIBUTES lpJobAttributes,
|
135
|
-
# _In_opt_ LPCTSTR lpName
|
136
|
-
# );
|
137
|
-
#
|
138
|
-
|
139
|
-
attach_function :create_job_object, :CreateJobObjectA, [:pointer, :pointer], :pointer
|
140
|
-
|
141
|
-
#
|
142
|
-
# BOOL WINAPI AssignProcessToJobObject(
|
143
|
-
# _In_ HANDLE hJob,
|
144
|
-
# _In_ HANDLE hProcess
|
145
|
-
# );
|
146
|
-
|
147
|
-
attach_function :assign_process_to_job_object, :AssignProcessToJobObject, [:pointer, :pointer], :bool
|
148
|
-
|
149
|
-
#
|
150
|
-
# BOOL WINAPI SetInformationJobObject(
|
151
|
-
# _In_ HANDLE hJob,
|
152
|
-
# _In_ JOBOBJECTINFOCLASS JobObjectInfoClass,
|
153
|
-
# _In_ LPVOID lpJobObjectInfo,
|
154
|
-
# _In_ DWORD cbJobObjectInfoLength
|
155
|
-
# );
|
156
|
-
#
|
157
|
-
|
158
|
-
attach_function :set_information_job_object, :SetInformationJobObject, [:pointer, :int, :pointer, :ulong], :bool
|
159
|
-
|
160
|
-
#
|
161
|
-
#
|
162
|
-
# DWORD WINAPI WaitForSingleObject(
|
163
|
-
# __in HANDLE hHandle,
|
164
|
-
# __in DWORD dwMilliseconds
|
165
|
-
# );
|
166
|
-
#
|
167
|
-
|
168
|
-
attach_function :wait_for_single_object, :WaitForSingleObject, [:pointer, :ulong], :wait_status, blocking: true
|
169
|
-
|
170
|
-
#
|
171
|
-
# BOOL WINAPI GetExitCodeProcess(
|
172
|
-
# __in HANDLE hProcess,
|
173
|
-
# __out LPDWORD lpExitCode
|
174
|
-
# );
|
175
|
-
#
|
176
|
-
|
177
|
-
attach_function :get_exit_code, :GetExitCodeProcess, [:pointer, :pointer], :bool
|
178
|
-
|
179
|
-
#
|
180
|
-
# BOOL WINAPI GenerateConsoleCtrlEvent(
|
181
|
-
# __in DWORD dwCtrlEvent,
|
182
|
-
# __in DWORD dwProcessGroupId
|
183
|
-
# );
|
184
|
-
#
|
185
|
-
|
186
|
-
attach_function :generate_console_ctrl_event, :GenerateConsoleCtrlEvent, [:ulong, :ulong], :bool
|
187
|
-
|
188
|
-
#
|
189
|
-
# BOOL WINAPI TerminateProcess(
|
190
|
-
# __in HANDLE hProcess,
|
191
|
-
# __in UINT uExitCode
|
192
|
-
# );
|
193
|
-
#
|
194
|
-
|
195
|
-
attach_function :terminate_process, :TerminateProcess, [:pointer, :uint], :bool
|
196
|
-
|
197
|
-
#
|
198
|
-
# intptr_t _get_osfhandle(
|
199
|
-
# int fd
|
200
|
-
# );
|
201
|
-
#
|
202
|
-
|
203
|
-
attach_function :get_osfhandle, :_get_osfhandle, [:int], :intptr_t
|
204
|
-
|
205
|
-
#
|
206
|
-
# int _open_osfhandle (
|
207
|
-
# intptr_t osfhandle,
|
208
|
-
# int flags
|
209
|
-
# );
|
210
|
-
#
|
211
|
-
|
212
|
-
attach_function :open_osfhandle, :_open_osfhandle, [:pointer, :int], :int
|
213
|
-
|
214
|
-
# BOOL WINAPI SetHandleInformation(
|
215
|
-
# __in HANDLE hObject,
|
216
|
-
# __in DWORD dwMask,
|
217
|
-
# __in DWORD dwFlags
|
218
|
-
# );
|
219
|
-
|
220
|
-
attach_function :set_handle_information, :SetHandleInformation, [:pointer, :ulong, :ulong], :bool
|
221
|
-
|
222
|
-
# BOOL WINAPI GetHandleInformation(
|
223
|
-
# __in HANDLE hObject,
|
224
|
-
# __out LPDWORD lpdwFlags
|
225
|
-
# );
|
226
|
-
|
227
|
-
attach_function :get_handle_information, :GetHandleInformation, [:pointer, :pointer], :bool
|
228
|
-
|
229
|
-
# BOOL WINAPI CreatePipe(
|
230
|
-
# __out PHANDLE hReadPipe,
|
231
|
-
# __out PHANDLE hWritePipe,
|
232
|
-
# __in_opt LPSECURITY_ATTRIBUTES lpPipeAttributes,
|
233
|
-
# __in DWORD nSize
|
234
|
-
# );
|
235
|
-
|
236
|
-
attach_function :create_pipe, :CreatePipe, [:pointer, :pointer, :pointer, :ulong], :bool
|
237
|
-
|
238
|
-
#
|
239
|
-
# HANDLE WINAPI GetCurrentProcess(void);
|
240
|
-
#
|
241
|
-
|
242
|
-
attach_function :current_process, :GetCurrentProcess, [], :pointer
|
243
|
-
|
244
|
-
#
|
245
|
-
# BOOL WINAPI DuplicateHandle(
|
246
|
-
# __in HANDLE hSourceProcessHandle,
|
247
|
-
# __in HANDLE hSourceHandle,
|
248
|
-
# __in HANDLE hTargetProcessHandle,
|
249
|
-
# __out LPHANDLE lpTargetHandle,
|
250
|
-
# __in DWORD dwDesiredAccess,
|
251
|
-
# __in BOOL bInheritHandle,
|
252
|
-
# __in DWORD dwOptions
|
253
|
-
# );
|
254
|
-
#
|
255
|
-
|
256
|
-
attach_function :_duplicate_handle, :DuplicateHandle, [
|
257
|
-
:pointer,
|
258
|
-
:pointer,
|
259
|
-
:pointer,
|
260
|
-
:pointer,
|
261
|
-
:ulong,
|
262
|
-
:bool,
|
263
|
-
:ulong
|
264
|
-
], :bool
|
265
|
-
end
|
266
|
-
end
|
267
|
-
end
|
268
|
-
end
|