packaging 0.88.77 → 0.99.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 +5 -5
- data/README.md +128 -74
- data/lib/packaging/artifactory.rb +60 -433
- data/lib/packaging/config/params.rb +7 -28
- data/lib/packaging/config.rb +50 -150
- data/lib/packaging/deb/repo.rb +19 -20
- data/lib/packaging/gem.rb +83 -41
- data/lib/packaging/ips.rb +57 -0
- data/lib/packaging/msi.rb +89 -0
- data/lib/packaging/nuget.rb +1 -1
- data/lib/packaging/osx.rb +36 -0
- data/lib/packaging/paths.rb +87 -225
- data/lib/packaging/platforms.rb +416 -443
- data/lib/packaging/repo.rb +22 -122
- data/lib/packaging/retrieve.rb +7 -36
- data/lib/packaging/rpm/repo.rb +8 -5
- data/lib/packaging/tar.rb +0 -9
- data/lib/packaging/util/date.rb +0 -5
- data/lib/packaging/util/execution.rb +2 -2
- data/lib/packaging/util/git.rb +1 -1
- data/lib/packaging/util/gpg.rb +1 -5
- data/lib/packaging/util/net.rb +37 -79
- data/lib/packaging/util/rake_utils.rb +0 -1
- data/lib/packaging/util/ship.rb +13 -142
- data/lib/packaging/util/tool.rb +1 -1
- data/lib/packaging/util/version.rb +0 -8
- data/lib/packaging/util.rb +2 -2
- data/lib/packaging.rb +3 -3
- data/spec/fixtures/config/params.yaml +2 -0
- data/spec/lib/packaging/artifactory_spec.rb +16 -66
- data/spec/lib/packaging/config_spec.rb +29 -49
- data/spec/lib/packaging/deb/repo_spec.rb +7 -16
- data/spec/lib/packaging/paths_spec.rb +56 -321
- data/spec/lib/packaging/platforms_spec.rb +21 -46
- data/spec/lib/packaging/repo_spec.rb +40 -78
- data/spec/lib/packaging/retrieve_spec.rb +8 -47
- data/spec/lib/packaging/rpm/repo_spec.rb +4 -4
- data/spec/lib/packaging/tar_spec.rb +40 -34
- data/spec/lib/packaging/util/git_tag_spec.rb +1 -1
- data/spec/lib/packaging/util/gpg_spec.rb +1 -1
- data/spec/lib/packaging/util/net_spec.rb +15 -35
- data/spec/lib/packaging/util/ship_spec.rb +63 -145
- data/spec/spec_helper.rb +14 -0
- data/tasks/00_utils.rake +6 -4
- data/tasks/apple.rake +0 -2
- data/tasks/config.rake +0 -5
- data/tasks/education.rake +5 -5
- data/tasks/fetch.rake +14 -17
- data/tasks/gem.rake +121 -134
- data/tasks/jenkins.rake +7 -51
- data/tasks/nightly_repos.rake +69 -20
- data/tasks/pe_ship.rake +11 -16
- data/tasks/retrieve.rake +6 -13
- data/tasks/ship.rake +256 -196
- data/tasks/sign.rake +135 -63
- data/tasks/tar.rake +6 -0
- data/templates/packaging.xml.erb +7 -9
- data/templates/repo.xml.erb +3 -6
- metadata +27 -80
- data/lib/packaging/archive.rb +0 -126
- data/lib/packaging/artifactory/extensions.rb +0 -94
- data/lib/packaging/config/validations.rb +0 -13
- data/lib/packaging/metrics.rb +0 -15
- data/lib/packaging/sign/deb.rb +0 -9
- data/lib/packaging/sign/dmg.rb +0 -41
- data/lib/packaging/sign/ips.rb +0 -57
- data/lib/packaging/sign/msi.rb +0 -124
- data/lib/packaging/sign/rpm.rb +0 -115
- data/lib/packaging/sign.rb +0 -8
- data/spec/lib/packaging/gem_spec.rb +0 -86
- data/spec/lib/packaging/sign_spec.rb +0 -133
- data/tasks/archive.rake +0 -69
data/lib/packaging/platforms.rb
CHANGED
@@ -2,506 +2,479 @@ require 'set'
|
|
2
2
|
|
3
3
|
# Data plus utilities surrounding platforms that the automation in this repo
|
4
4
|
# explicitly supports
|
5
|
-
module Pkg
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
'
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
source_package_formats: ['src.rpm'],
|
20
|
-
repo: false,
|
21
|
-
},
|
5
|
+
module Pkg::Platforms # rubocop:disable Metrics/ModuleLength
|
6
|
+
module_function
|
7
|
+
|
8
|
+
DEBIAN_SOURCE_FORMATS = ['debian.tar.gz', 'orig.tar.gz', 'dsc', 'changes']
|
9
|
+
|
10
|
+
# Each element in this hash
|
11
|
+
PLATFORM_INFO = {
|
12
|
+
'aix' => {
|
13
|
+
'6.1' => {
|
14
|
+
architectures: ['power'],
|
15
|
+
source_architecture: 'SRPMS',
|
16
|
+
package_format: 'rpm',
|
17
|
+
source_package_formats: ['src.rpm'],
|
18
|
+
repo: false,
|
22
19
|
},
|
23
|
-
|
24
|
-
|
25
|
-
'
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
'10' => {
|
42
|
-
codename: 'buster',
|
43
|
-
architectures: ['amd64', 'i386'],
|
44
|
-
source_architecture: 'source',
|
45
|
-
package_format: 'deb',
|
46
|
-
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
47
|
-
repo: true,
|
48
|
-
},
|
20
|
+
'7.1' => {
|
21
|
+
architectures: ['power'],
|
22
|
+
source_architecture: 'SRPMS',
|
23
|
+
package_format: 'rpm',
|
24
|
+
source_package_formats: ['src.rpm'],
|
25
|
+
repo: false,
|
26
|
+
}
|
27
|
+
},
|
28
|
+
|
29
|
+
'cisco-wrlinux' => {
|
30
|
+
'5' => {
|
31
|
+
architectures: ['x86_64'],
|
32
|
+
source_architecture: 'SRPMS',
|
33
|
+
package_format: 'rpm',
|
34
|
+
source_package_formats: ['src.rpm'],
|
35
|
+
signature_format: 'v4',
|
36
|
+
repo: true,
|
49
37
|
},
|
50
|
-
|
51
|
-
|
52
|
-
'
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
'
|
77
|
-
|
78
|
-
|
79
|
-
package_format: 'rpm',
|
80
|
-
source_package_formats: ['src.rpm'],
|
81
|
-
signature_format: 'v4',
|
82
|
-
repo: true,
|
83
|
-
}
|
38
|
+
'7' => {
|
39
|
+
architectures: ['x86_64'],
|
40
|
+
source_architecture: 'SRPMS',
|
41
|
+
package_format: 'rpm',
|
42
|
+
source_package_formats: ['src.rpm'],
|
43
|
+
signature_format: 'v4',
|
44
|
+
repo: true,
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
'cumulus' => {
|
49
|
+
'2.2' => {
|
50
|
+
codename: 'cumulus',
|
51
|
+
architectures: ['amd64'],
|
52
|
+
source_architecture: 'source',
|
53
|
+
package_format: 'deb',
|
54
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
55
|
+
repo: true,
|
56
|
+
}
|
57
|
+
},
|
58
|
+
|
59
|
+
'debian' => {
|
60
|
+
'7' => {
|
61
|
+
codename: 'wheezy',
|
62
|
+
architectures: ['i386', 'amd64'],
|
63
|
+
source_architecture: 'source',
|
64
|
+
package_format: 'deb',
|
65
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
66
|
+
repo: true,
|
84
67
|
},
|
85
|
-
|
86
|
-
|
87
|
-
'
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
signature_format: 'v4',
|
93
|
-
repo: true,
|
94
|
-
},
|
95
|
-
'31' => {
|
96
|
-
architectures: ['x86_64'],
|
97
|
-
source_architecture: 'SRPMS',
|
98
|
-
package_format: 'rpm',
|
99
|
-
source_package_formats: ['src.rpm'],
|
100
|
-
signature_format: 'v4',
|
101
|
-
repo: true,
|
102
|
-
},
|
103
|
-
'32' => {
|
104
|
-
architectures: ['x86_64'],
|
105
|
-
source_architecture: 'SRPMS',
|
106
|
-
package_format: 'rpm',
|
107
|
-
source_package_formats: ['src.rpm'],
|
108
|
-
signature_format: 'v4',
|
109
|
-
repo: true,
|
110
|
-
},
|
111
|
-
'34' => {
|
112
|
-
architectures: ['x86_64'],
|
113
|
-
source_architecture: 'SRPMS',
|
114
|
-
package_format: 'rpm',
|
115
|
-
source_package_formats: ['src.rpm'],
|
116
|
-
signature_format: 'v4',
|
117
|
-
repo: true,
|
118
|
-
},
|
68
|
+
'8' => {
|
69
|
+
codename: 'jessie',
|
70
|
+
architectures: ['i386', 'amd64', 'powerpc'],
|
71
|
+
source_architecture: 'source',
|
72
|
+
package_format: 'deb',
|
73
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
74
|
+
repo: true,
|
119
75
|
},
|
120
|
-
|
121
|
-
|
122
|
-
'
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
'
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
architectures: ['x86_64'],
|
139
|
-
package_format: 'dmg',
|
140
|
-
repo: false,
|
141
|
-
},
|
76
|
+
'9' => {
|
77
|
+
codename: 'stretch',
|
78
|
+
architectures: ['i386', 'amd64'],
|
79
|
+
source_architecture: 'source',
|
80
|
+
package_format: 'deb',
|
81
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
82
|
+
repo: true,
|
83
|
+
}
|
84
|
+
},
|
85
|
+
|
86
|
+
'el' => {
|
87
|
+
'5' => {
|
88
|
+
architectures: ['i386', 'x86_64'],
|
89
|
+
source_architecture: 'SRPMS',
|
90
|
+
package_format: 'rpm',
|
91
|
+
source_package_formats: ['src.rpm'],
|
92
|
+
signature_format: 'v3',
|
93
|
+
repo: true,
|
142
94
|
},
|
143
|
-
|
144
|
-
|
145
|
-
'
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
signature_format: 'v3',
|
151
|
-
repo: true,
|
152
|
-
}
|
95
|
+
'6' => {
|
96
|
+
architectures: ['i386', 'x86_64', 's390x'],
|
97
|
+
source_architecture: 'SRPMS',
|
98
|
+
package_format: 'rpm',
|
99
|
+
source_package_formats: ['src.rpm'],
|
100
|
+
signature_format: 'v4',
|
101
|
+
repo: true,
|
153
102
|
},
|
154
|
-
|
155
|
-
|
156
|
-
'
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
103
|
+
'7' => {
|
104
|
+
architectures: ['x86_64', 's390x', 'ppc64le', 'aarch64'],
|
105
|
+
source_architecture: 'SRPMS',
|
106
|
+
package_format: 'rpm',
|
107
|
+
source_package_formats: ['src.rpm'],
|
108
|
+
signature_format: 'v4',
|
109
|
+
repo: true,
|
110
|
+
}
|
111
|
+
},
|
112
|
+
|
113
|
+
'eos' => {
|
114
|
+
'4' => {
|
115
|
+
architectures: ['i386'],
|
116
|
+
package_format: 'swix',
|
117
|
+
repo: false,
|
118
|
+
}
|
119
|
+
},
|
120
|
+
|
121
|
+
'fedora' => {
|
122
|
+
'f25' => {
|
123
|
+
architectures: ['i386', 'x86_64'],
|
124
|
+
source_architecture: 'SRPMS',
|
125
|
+
package_format: 'rpm',
|
126
|
+
source_package_formats: ['src.rpm'],
|
127
|
+
signature_format: 'v4',
|
128
|
+
repo: true,
|
180
129
|
},
|
181
|
-
|
182
|
-
|
183
|
-
'
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
'11' => {
|
189
|
-
architectures: ['i386', 'sparc'],
|
190
|
-
package_format: 'ips',
|
191
|
-
repo: false,
|
192
|
-
},
|
130
|
+
'f26' => {
|
131
|
+
architectures: ['x86_64'],
|
132
|
+
source_architecture: 'SRPMS',
|
133
|
+
package_format: 'rpm',
|
134
|
+
source_package_formats: ['src.rpm'],
|
135
|
+
signature_format: 'v4',
|
136
|
+
repo: true,
|
193
137
|
},
|
194
|
-
|
195
|
-
|
196
|
-
'
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
'
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
210
|
-
repo: true,
|
211
|
-
},
|
212
|
-
'18.04' => {
|
213
|
-
codename: 'bionic',
|
214
|
-
architectures: ['amd64', 'ppc64el'],
|
215
|
-
source_architecture: 'source',
|
216
|
-
package_format: 'deb',
|
217
|
-
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
218
|
-
repo: true,
|
219
|
-
},
|
220
|
-
'18.10' => {
|
221
|
-
codename: 'cosmic',
|
222
|
-
architectures: ['amd64', 'ppc64el'],
|
223
|
-
source_architecture: 'source',
|
224
|
-
package_format: 'deb',
|
225
|
-
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
226
|
-
repo: true,
|
227
|
-
},
|
228
|
-
'20.04' => {
|
229
|
-
codename: 'focal',
|
230
|
-
architectures: ['amd64', 'aarch64'],
|
231
|
-
source_architecture: 'source',
|
232
|
-
package_format: 'deb',
|
233
|
-
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
234
|
-
repo: true,
|
235
|
-
},
|
138
|
+
'25' => {
|
139
|
+
architectures: ['i386', 'x86_64'],
|
140
|
+
source_architecture: 'SRPMS',
|
141
|
+
package_format: 'rpm',
|
142
|
+
source_package_formats: ['src.rpm'],
|
143
|
+
signature_format: 'v4',
|
144
|
+
repo: true,
|
145
|
+
},
|
146
|
+
'26' => {
|
147
|
+
architectures: ['x86_64'],
|
148
|
+
source_architecture: 'SRPMS',
|
149
|
+
package_format: 'rpm',
|
150
|
+
source_package_formats: ['src.rpm'],
|
151
|
+
signature_format: 'v4',
|
152
|
+
repo: true,
|
236
153
|
},
|
154
|
+
},
|
237
155
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
}
|
156
|
+
'osx' => {
|
157
|
+
'10.10' => {
|
158
|
+
architectures: ['x86_64'],
|
159
|
+
package_format: 'dmg',
|
160
|
+
repo: false,
|
244
161
|
},
|
245
|
-
'
|
246
|
-
'
|
247
|
-
|
248
|
-
|
249
|
-
repo: false,
|
250
|
-
}
|
162
|
+
'10.11' => {
|
163
|
+
architectures: ['x86_64'],
|
164
|
+
package_format: 'dmg',
|
165
|
+
repo: false,
|
251
166
|
},
|
252
|
-
|
167
|
+
'10.12' => {
|
168
|
+
architectures: ['x86_64'],
|
169
|
+
package_format: 'dmg',
|
170
|
+
repo: false,
|
171
|
+
},
|
172
|
+
'10.13' => {
|
173
|
+
architectures: ['x86_64'],
|
174
|
+
package_format: 'dmg',
|
175
|
+
repo: false,
|
176
|
+
}
|
177
|
+
},
|
178
|
+
|
179
|
+
'redhat-fips' => {
|
180
|
+
'7' => {
|
181
|
+
architectures: ['x86_64'],
|
182
|
+
source_architecture: 'SRPMS',
|
183
|
+
package_format: 'rpm',
|
184
|
+
source_package_formats: ['src.rpm'],
|
185
|
+
signature_format: 'v3',
|
186
|
+
repo: true,
|
187
|
+
}
|
188
|
+
},
|
189
|
+
|
190
|
+
'sles' => {
|
191
|
+
'11' => {
|
192
|
+
architectures: ['i386', 'x86_64', 's390x'],
|
193
|
+
source_architecture: 'SRPMS',
|
194
|
+
package_format: 'rpm',
|
195
|
+
source_package_formats: ['src.rpm'],
|
196
|
+
signature_format: 'v3',
|
197
|
+
repo: true,
|
198
|
+
},
|
199
|
+
'12' => {
|
200
|
+
architectures: ['x86_64', 's390x', 'ppc64le'],
|
201
|
+
source_architecture: 'SRPMS',
|
202
|
+
package_format: 'rpm',
|
203
|
+
source_package_formats: ['src.rpm'],
|
204
|
+
signature_format: 'v4',
|
205
|
+
repo: true,
|
206
|
+
}
|
207
|
+
},
|
208
|
+
|
209
|
+
'solaris' => {
|
210
|
+
'10' => {
|
211
|
+
architectures: ['i386', 'sparc'],
|
212
|
+
package_format: 'svr4',
|
213
|
+
repo: false,
|
214
|
+
},
|
215
|
+
'11' => {
|
216
|
+
architectures: ['i386', 'sparc'],
|
217
|
+
package_format: 'ips',
|
218
|
+
repo: false,
|
219
|
+
}
|
220
|
+
},
|
221
|
+
|
222
|
+
'ubuntu' => {
|
223
|
+
'14.04' => {
|
224
|
+
codename: 'trusty',
|
225
|
+
architectures: ['i386', 'amd64'],
|
226
|
+
source_architecture: 'source',
|
227
|
+
package_format: 'deb',
|
228
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
229
|
+
repo: true,
|
230
|
+
},
|
231
|
+
'16.04' => {
|
232
|
+
codename: 'xenial',
|
233
|
+
architectures: ['i386', 'amd64', 'ppc64el'],
|
234
|
+
source_architecture: 'source',
|
235
|
+
package_format: 'deb',
|
236
|
+
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
237
|
+
repo: true,
|
238
|
+
},
|
239
|
+
},
|
240
|
+
|
241
|
+
'windows' => {
|
242
|
+
'2012' => {
|
243
|
+
architectures: ['x86', 'x64'],
|
244
|
+
package_format: 'msi',
|
245
|
+
repo: false,
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}.freeze
|
249
|
+
|
250
|
+
# @return [Array] An array of Strings, containing all of the supported
|
251
|
+
# platforms as defined in PLATFORM_INFO
|
252
|
+
def supported_platforms
|
253
|
+
PLATFORM_INFO.keys
|
254
|
+
end
|
253
255
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
256
|
+
# @return [Array] An Array of Strings, containing all the supported
|
257
|
+
# versions for the given platform
|
258
|
+
def versions_for_platform(platform)
|
259
|
+
PLATFORM_INFO[platform].keys
|
260
|
+
rescue
|
261
|
+
raise "No information found for '#{platform}'"
|
262
|
+
end
|
259
263
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
264
|
+
# @param platform_tag [String] May be either the two or three unit string
|
265
|
+
# that corresponds to a platform in the form of platform-version or
|
266
|
+
# platform-version-arch.
|
267
|
+
# @return [Array] An array of three elements: the platform name, the platform
|
268
|
+
# version, and the architecture. If the architecture was not included in
|
269
|
+
# the original platform tag, then nil is returned in place of the
|
270
|
+
# architecture
|
271
|
+
def parse_platform_tag(platform_tag)
|
272
|
+
platform_elements = platform_tag.split('-')
|
273
|
+
|
274
|
+
# Look for platform. This is probably the only place where we have to look
|
275
|
+
# for a combination of elements rather than a single element
|
276
|
+
platform = (platform_elements & supported_platforms).first
|
277
|
+
codename = (platform_elements & codenames).first
|
278
|
+
|
279
|
+
# This is probably a bad assumption, but I'm assuming if we find a codename,
|
280
|
+
# that's more reliable as it's less likely to give us a false match
|
281
|
+
if codename
|
282
|
+
platform, version = codename_to_platform_version(codename)
|
266
283
|
end
|
267
284
|
|
268
|
-
#
|
269
|
-
#
|
270
|
-
#
|
271
|
-
|
272
|
-
# version, and the architecture. If the architecture was not included in
|
273
|
-
# the original platform tag, then nil is returned in place of the
|
274
|
-
# architecture
|
275
|
-
def parse_platform_tag(platform_tag)
|
276
|
-
platform_elements = platform_tag.split('-')
|
277
|
-
|
278
|
-
# Look for platform. This is probably the only place where we have to look
|
279
|
-
# for a combination of elements rather than a single element
|
280
|
-
platform = (platform_elements & supported_platforms).first
|
281
|
-
codename = (platform_elements & codenames).first
|
282
|
-
|
283
|
-
# This is probably a bad assumption, but I'm assuming if we find a codename,
|
284
|
-
# that's more reliable as it's less likely to give us a false match
|
285
|
-
if codename
|
286
|
-
platform, version = codename_to_platform_version(codename)
|
287
|
-
end
|
288
|
-
|
289
|
-
# There's a possibility that the platform name has a dash in it, in which
|
290
|
-
# case, our assumption that it's an element of the above array is false,
|
291
|
-
# since it would be a combination of elements in that array
|
292
|
-
platform ||= supported_platforms.find { |p| platform_tag =~ /#{p}-/ }
|
285
|
+
# There's a possibility that the platform name has a dash in it, in which
|
286
|
+
# case, our assumption that it's an element of the above array is false,
|
287
|
+
# since it would be a combination of elements in that array
|
288
|
+
platform ||= supported_platforms.find { |p| platform_tag =~ /#{p}-/ }
|
293
289
|
|
294
|
-
|
290
|
+
version ||= (platform_elements & versions_for_platform(platform)).first
|
295
291
|
|
296
292
|
|
297
|
-
|
298
|
-
|
299
|
-
|
293
|
+
# For platform names with a dash in them, because everything is special
|
294
|
+
supported_arches = arches_for_platform_version(platform, version)
|
295
|
+
architecture = platform_tag.sub(/^(#{platform}-#{version}|#{codename})-?/, '')
|
300
296
|
|
301
|
-
|
297
|
+
fail unless supported_arches.include?(architecture) || architecture.empty?
|
298
|
+
return [platform, version, architecture]
|
299
|
+
rescue
|
300
|
+
raise "Could not verify that '#{platform_tag}' is a valid tag"
|
301
|
+
end
|
302
302
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
303
|
+
# @param platform_tag [String] May be either the two or three unit string
|
304
|
+
# that corresponds to a platform in the form of platform-version or
|
305
|
+
# platform-version-arch
|
306
|
+
# @return [Hash] The hash of data associated with the given platform version
|
307
|
+
def platform_lookup(platform_tag)
|
308
|
+
platform, version, _ = parse_platform_tag(platform_tag)
|
309
|
+
PLATFORM_INFO[platform][version]
|
310
|
+
end
|
309
311
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
312
|
+
# @param platform_tag [String] May be either the two or three unit string
|
313
|
+
# that corresponds to a platform in the form of platform-version or
|
314
|
+
# platform-version-arch
|
315
|
+
# @param attribute_name [String, Symbol] The name of the requested attribute
|
316
|
+
# @return [String, Array] the contents of the requested attribute
|
317
|
+
def get_attribute(platform_tag, attribute_name)
|
318
|
+
info = platform_lookup(platform_tag)
|
319
|
+
raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
|
320
|
+
info[attribute_name]
|
321
|
+
end
|
318
322
|
|
319
|
-
|
320
|
-
|
321
|
-
#
|
322
|
-
|
323
|
-
|
324
|
-
def get_attribute(platform_tag, attribute_name)
|
325
|
-
info = platform_lookup(platform_tag)
|
326
|
-
raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
|
327
|
-
info[attribute_name]
|
328
|
-
end
|
323
|
+
def get_attribute_for_platform_version(platform, version, attribute_name)
|
324
|
+
info = PLATFORM_INFO[platform][version]
|
325
|
+
raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
|
326
|
+
info[attribute_name]
|
327
|
+
end
|
329
328
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
329
|
+
# @private List platforms that use a given package format
|
330
|
+
# @param format [String] The name of the packaging format to filter on
|
331
|
+
# @return [Array] An Array of Strings, containing all platforms that
|
332
|
+
# use <format> for their packages
|
333
|
+
def by_package_format(format)
|
334
|
+
PLATFORM_INFO.keys.select do |key|
|
335
|
+
formats = PLATFORM_INFO[key].values.collect { |v| v[:package_format] }
|
336
|
+
formats.include? format
|
334
337
|
end
|
338
|
+
end
|
335
339
|
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
formats = PLATFORM_INFO[key].values.collect { |v| v[:package_format] }
|
343
|
-
formats.include? format
|
340
|
+
# @return [Array] An Array of Strings, containing all of the package
|
341
|
+
# formats defined in Pkg::Platforms
|
342
|
+
def formats
|
343
|
+
fmts = PLATFORM_INFO.flat_map do |_, p|
|
344
|
+
p.collect do |_, r|
|
345
|
+
r[:package_format]
|
344
346
|
end
|
345
347
|
end
|
348
|
+
fmts.to_set.sort
|
349
|
+
end
|
346
350
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
351
|
+
# @return [Array] An Array of Strings, containing all the package formats
|
352
|
+
# and source package formats defined in Pkg::Platforms
|
353
|
+
def all_supported_package_formats
|
354
|
+
fmts = formats
|
355
|
+
source_fmts = PLATFORM_INFO.flat_map do |_, p|
|
356
|
+
p.collect do |_, r|
|
357
|
+
r[:source_package_formats]
|
354
358
|
end
|
355
|
-
fmts.to_set.sort
|
356
359
|
end
|
357
360
|
|
358
|
-
|
359
|
-
|
360
|
-
def all_supported_package_formats
|
361
|
-
fmts = formats
|
362
|
-
source_fmts = PLATFORM_INFO.flat_map do |_, p|
|
363
|
-
p.collect do |_, r|
|
364
|
-
r[:source_package_formats]
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
(fmts + source_fmts).flatten.compact.uniq.to_set.sort
|
369
|
-
end
|
361
|
+
(fmts + source_fmts).flatten.compact.uniq.to_set.sort
|
362
|
+
end
|
370
363
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
end
|
379
|
-
releases.sort
|
364
|
+
# @param platform [String] Optional, the platform to list all codenames for.
|
365
|
+
# Defaults to 'deb'
|
366
|
+
# @return [Array] An Array of Strings, containing all of the codenames
|
367
|
+
# defined for a given Platform
|
368
|
+
def codenames(platform = 'deb')
|
369
|
+
releases = by_package_format(platform).flat_map do |p|
|
370
|
+
PLATFORM_INFO[p].values.collect { |r| r[:codename] }
|
380
371
|
end
|
372
|
+
releases.sort
|
373
|
+
end
|
381
374
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
end
|
375
|
+
# Given a debian codename, return the platform and version it corresponds to
|
376
|
+
def codename_to_platform_version(codename)
|
377
|
+
PLATFORM_INFO.each do |platform, platform_versions|
|
378
|
+
platform_versions.each do |version, info|
|
379
|
+
return [platform, version] if info[:codename] && codename == info[:codename]
|
388
380
|
end
|
389
|
-
raise "Unable to find a platform and version for '#{codename}'"
|
390
381
|
end
|
382
|
+
raise "Unable to find a platform and version for '#{codename}'"
|
383
|
+
end
|
391
384
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
385
|
+
# Given a debian platform and version, return the codename that corresponds to
|
386
|
+
# the set
|
387
|
+
def codename_for_platform_version(platform, version)
|
388
|
+
get_attribute_for_platform_version(platform, version, :codename)
|
389
|
+
end
|
397
390
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
391
|
+
# Given a debian codename, return the arches that we build for that codename
|
392
|
+
def arches_for_codename(codename)
|
393
|
+
platform, version = codename_to_platform_version(codename)
|
394
|
+
arches_for_platform_version(platform, version)
|
395
|
+
end
|
403
396
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
end
|
411
|
-
platform_tags
|
397
|
+
# Given a codename, return an array of associated tags
|
398
|
+
def codename_to_tags(codename)
|
399
|
+
platform_tags = []
|
400
|
+
platform, version = codename_to_platform_version(codename)
|
401
|
+
arches_for_codename(codename).each do |arch|
|
402
|
+
platform_tags << "#{platform}-#{version}-#{arch}"
|
412
403
|
end
|
404
|
+
platform_tags
|
405
|
+
end
|
413
406
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
# isn't found. We don't want this to be a fatal error, we just want to append
|
420
|
-
# the source architecture if it's found
|
421
|
-
source_architecture = []
|
422
|
-
if include_source
|
423
|
-
begin
|
424
|
-
source_architecture = Array(get_attribute_for_platform_version(platform, version, :source_architecture))
|
425
|
-
rescue
|
426
|
-
end
|
427
|
-
end
|
428
|
-
return (platform_architectures + source_architecture).flatten
|
429
|
-
end
|
407
|
+
# Given a platform and version, return the arches that we build for that
|
408
|
+
# platform
|
409
|
+
def arches_for_platform_version(platform, version)
|
410
|
+
get_attribute_for_platform_version(platform, version, :architectures)
|
411
|
+
end
|
430
412
|
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
end
|
413
|
+
# Returns an array of all currently valid platform tags
|
414
|
+
def platform_tags
|
415
|
+
tags = []
|
416
|
+
PLATFORM_INFO.each do |platform, platform_versions|
|
417
|
+
platform_versions.each do |version, info|
|
418
|
+
info[:architectures].each do |arch|
|
419
|
+
tags << "#{platform}-#{version}-#{arch}"
|
439
420
|
end
|
440
421
|
end
|
441
|
-
tags
|
442
422
|
end
|
423
|
+
tags
|
424
|
+
end
|
443
425
|
|
444
|
-
|
445
|
-
|
446
|
-
|
426
|
+
def package_format_for_tag(platform_tag)
|
427
|
+
get_attribute(platform_tag, :package_format)
|
428
|
+
end
|
447
429
|
|
448
|
-
|
449
|
-
|
450
|
-
|
430
|
+
def signature_format_for_tag(platform_tag)
|
431
|
+
get_attribute(platform_tag, :signature_format)
|
432
|
+
end
|
451
433
|
|
452
|
-
|
453
|
-
|
454
|
-
|
434
|
+
def signature_format_for_platform_version(platform, version)
|
435
|
+
get_attribute_for_platform_version(platform, version, :signature_format)
|
436
|
+
end
|
455
437
|
|
456
|
-
|
457
|
-
|
458
|
-
|
438
|
+
def source_architecture_for_platform_tag(platform_tag)
|
439
|
+
get_attribute(platform_tag, :source_architecture)
|
440
|
+
end
|
459
441
|
|
460
|
-
|
461
|
-
|
462
|
-
|
442
|
+
def source_package_formats_for_platform_tag(platform_tag)
|
443
|
+
get_attribute(platform_tag, :source_package_formats)
|
444
|
+
end
|
463
445
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
end
|
446
|
+
# Return an array of platform tags associated with a given package format
|
447
|
+
def platform_tags_for_package_format(format)
|
448
|
+
platform_tags = []
|
449
|
+
PLATFORM_INFO.each do |platform, platform_versions|
|
450
|
+
platform_versions.each do |version, info|
|
451
|
+
info[:architectures].each do |architecture|
|
452
|
+
if info[:package_format] == format
|
453
|
+
platform_tags << "#{platform}-#{version}-#{architecture}"
|
473
454
|
end
|
474
455
|
end
|
475
456
|
end
|
476
|
-
platform_tags
|
477
|
-
end
|
478
|
-
|
479
|
-
# Return a supported platform tag for the given platform, not caring about
|
480
|
-
# version or architecture
|
481
|
-
def generic_platform_tag(platform)
|
482
|
-
version = versions_for_platform(platform).first
|
483
|
-
arch = arches_for_platform_version(platform, version).first
|
484
|
-
return "#{platform}-#{version}-#{arch}"
|
485
|
-
end
|
486
|
-
|
487
|
-
# @method by_deb
|
488
|
-
# @return [Array] An Array of Strings, containing all platforms
|
489
|
-
# that use .deb packages
|
490
|
-
# Helper meta-method to return all platforms that use .deb packages
|
491
|
-
# @scope class
|
492
|
-
def by_deb
|
493
|
-
by_package_format('deb')
|
494
457
|
end
|
458
|
+
platform_tags
|
459
|
+
end
|
495
460
|
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
461
|
+
# @method by_deb
|
462
|
+
# @return [Array] An Array of Strings, containing all platforms
|
463
|
+
# that use .deb packages
|
464
|
+
# Helper meta-method to return all platforms that use .deb packages
|
465
|
+
# @scope class
|
466
|
+
def by_deb
|
467
|
+
by_package_format('deb')
|
468
|
+
end
|
504
469
|
|
505
|
-
|
470
|
+
# @method by_rpm
|
471
|
+
# @return [Array] An Array of Strings, containing all platforms
|
472
|
+
# that use .rpm packages
|
473
|
+
# Helper meta-method to return all platforms that use .rpm packages
|
474
|
+
# @scope class
|
475
|
+
def by_rpm
|
476
|
+
by_package_format('rpm')
|
506
477
|
end
|
478
|
+
|
479
|
+
private :by_package_format
|
507
480
|
end
|