packaging 0.99.3 → 0.99.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3d51003d5651ebf7f787b4e7521d3106b4b6cbd
4
- data.tar.gz: 74cc5216e07712f93115445bba1bb254cb98ae69
3
+ metadata.gz: 517f281100a098c92bfdb3b38b538d015d215537
4
+ data.tar.gz: dabf433d9fc8641f5619a108ccb7de3b574d9961
5
5
  SHA512:
6
- metadata.gz: 59a10ab93c4cf6fc589f913b7a7e364180a675d3f74ffa145e9469747ae83ac534810083377eae4dbea6920deff67b21428b5ac111ece7fa8c32bc5edc3616a4
7
- data.tar.gz: 32a6cc69cf70489512ed4648a1411a7f1c7ad5d931163be83d63e263993053ecec972d8a6375289f03b92fa610a34c6788253831b87c0d59740a20782b741fa6
6
+ metadata.gz: ac5527ee23314f1103309ffe888fa747aa1389c593cdaf4a9624b3ef3089155cd02222b54cf338f26e96ac19c9c011dc67ed837e2352384817d4f805224bfcc6
7
+ data.tar.gz: bd52d91b00509f4e2feab65e1ff2ce33f6a61843442982066306a3701f03d668f440ea380b0461d537c4205f4fc65579a55b1e60a520d9d58be9f486afd9c2c7
@@ -82,7 +82,6 @@ module Pkg
82
82
  artifacts.each do |artifact|
83
83
  tag = Pkg::Paths.tag_from_artifact_path(artifact)
84
84
  platform, version, arch = Pkg::Platforms.parse_platform_tag(tag)
85
- arch = 'ppc' if platform == 'aix'
86
85
  package_format = Pkg::Platforms.get_attribute(tag, :package_format)
87
86
 
88
87
  # Skip this if it's an unversioned MSI. We create these to help
@@ -58,18 +58,51 @@ module Pkg::Paths
58
58
  # shipped to the development/beta/non-final repo, if there is one defined.
59
59
  # Otherwise, default to the final repo name. We use this for more than just
60
60
  # shipping to the final repos, so we need this to not fail.
61
- def repo_name
62
- if Pkg::Util::Version.final?
63
- Pkg::Config.repo_name || ""
61
+ def repo_name(nonfinal = false)
62
+ if nonfinal && Pkg::Config.nonfinal_repo_name
63
+ Pkg::Config.nonfinal_repo_name
64
+ elsif nonfinal
65
+ fail "Nonfinal is set to true but Pkg::Config.nonfinal_repo_name is unset!"
64
66
  else
65
- if Pkg::Config.nonfinal_repo_name
66
- Pkg::Config.nonfinal_repo_name
67
- else
68
- Pkg::Config.repo_name || ""
69
- end
67
+ Pkg::Config.repo_name || ""
70
68
  end
71
69
  end
72
70
 
71
+ # Method to determine if files should be shipped to legacy or current path
72
+ # structures. Any repo name matching /^puppet/ is a current repo, everything
73
+ # else is should be shipped to legacy paths.
74
+ #
75
+ # @param repo_name The repo name to check
76
+ def is_legacy_repo?(repo_name)
77
+ repo_name !~ /^puppet/
78
+ end
79
+
80
+ # Method to determine the yum repo name. Maintains compatibility with legacy
81
+ # projects, where `Pkg::Config.yum_repo_name` is set instead of
82
+ # `Pkg::Config.repo_name`. Defaults to 'products' if nothing is set.
83
+ def yum_repo_name(nonfinal = false)
84
+ if nonfinal && Pkg::Config.nonfinal_repo_name
85
+ return Pkg::Config.nonfinal_repo_name
86
+ elsif nonfinal
87
+ fail "Nonfinal is set to true but Pkg::Config.nonfinal_repo_name is unset!"
88
+ end
89
+
90
+ return Pkg::Config.repo_name || Pkg::Config.yum_repo_name || 'products'
91
+ end
92
+
93
+ # Method to determine the apt repo name. Maintains compatibility with legacy
94
+ # projects, where `Pkg::Config.apt_repo_name` is set instead of
95
+ # `Pkg::Config.repo_name`. Defaults to 'main' if nothing is set.
96
+ def apt_repo_name(nonfinal = false)
97
+ if nonfinal && Pkg::Config.nonfinal_repo_name
98
+ return Pkg::Config.nonfinal_repo_name
99
+ elsif nonfinal
100
+ fail "Nonfinal is set to true but Pkg::Config.nonfinal_repo_name is unset!"
101
+ end
102
+
103
+ return Pkg::Config.repo_name || Pkg::Config.apt_repo_name || 'main'
104
+ end
105
+
73
106
  def link_name
74
107
  if Pkg::Util::Version.final?
75
108
  Pkg::Config.repo_link_target || nil
@@ -86,43 +119,43 @@ module Pkg::Paths
86
119
  # (2016.4) is EOL'd. Hopefully also we do not choose to further change these
87
120
  # path structures, as it is no bueno.
88
121
  # --MAS 2017-08-16
89
- def artifacts_base_path_and_link_path(platform_tag, path_prefix = 'artifacts')
122
+ def artifacts_base_path_and_link_path(platform_tag, path_prefix = 'artifacts', nonfinal = false)
90
123
  platform, version, architecture = Pkg::Platforms.parse_platform_tag(platform_tag)
91
124
  package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
92
125
 
93
126
  case package_format
94
127
  when 'rpm'
95
- if repo_name == 'PC1'
96
- [File.join(path_prefix, platform, version, repo_name), nil]
128
+ if is_legacy_repo?(yum_repo_name(nonfinal))
129
+ [File.join(path_prefix, platform, version, yum_repo_name(nonfinal)), nil]
97
130
  else
98
- [File.join(path_prefix, repo_name), link_name.nil? ? nil : File.join(path_prefix, link_name)]
131
+ [File.join(path_prefix, yum_repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, link_name)]
99
132
  end
100
133
  when 'swix'
101
- if repo_name == 'PC1'
102
- [File.join(path_prefix, platform, version, repo_name), nil]
134
+ if is_legacy_repo?(repo_name(nonfinal))
135
+ [File.join(path_prefix, platform, version, repo_name(nonfinal)), nil]
103
136
  else
104
- [File.join(path_prefix, platform, repo_name), link_name.nil? ? nil : File.join(path_prefix, platform, link_name)]
137
+ [File.join(path_prefix, platform, repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, platform, link_name)]
105
138
  end
106
139
  when 'deb'
107
- [File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), repo_name),
140
+ [File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), apt_repo_name(nonfinal)),
108
141
  link_name.nil? ? nil : File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), link_name)]
109
142
  when 'svr4', 'ips'
110
- if repo_name == 'PC1'
111
- [File.join(path_prefix, 'solaris', repo_name, version), nil]
143
+ if is_legacy_repo?(repo_name(nonfinal))
144
+ [File.join(path_prefix, 'solaris', repo_name(nonfinal), version), nil]
112
145
  else
113
- [File.join(path_prefix, 'solaris', repo_name), link_name.nil? ? nil : File.join(path_prefix, 'solaris', link_name)]
146
+ [File.join(path_prefix, 'solaris', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'solaris', link_name)]
114
147
  end
115
148
  when 'dmg'
116
- if repo_name == 'PC1'
117
- [File.join(path_prefix, 'mac', version, repo_name), nil]
149
+ if is_legacy_repo?(repo_name(nonfinal))
150
+ [File.join(path_prefix, 'mac', version, repo_name(nonfinal)), nil]
118
151
  else
119
- [File.join(path_prefix, 'mac', repo_name), link_name.nil? ? nil : File.join(path_prefix, 'mac', link_name)]
152
+ [File.join(path_prefix, 'mac', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'mac', link_name)]
120
153
  end
121
154
  when 'msi'
122
- if repo_name == 'PC1'
155
+ if is_legacy_repo?(repo_name(nonfinal))
123
156
  [File.join(path_prefix, 'windows'), nil]
124
157
  else
125
- [File.join(path_prefix, 'windows', repo_name), link_name.nil? ? nil : File.join(path_prefix, 'windows', link_name)]
158
+ [File.join(path_prefix, 'windows', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'windows', link_name)]
126
159
  end
127
160
  else
128
161
  raise "Not sure where to find packages with a package format of '#{package_format}'"
@@ -137,20 +170,20 @@ module Pkg::Paths
137
170
  # (2016.4) is EOL'd. Hopefully also we do not choose to further change these
138
171
  # path structures, as it is no bueno.
139
172
  # --MAS 2017-08-16
140
- def artifacts_path(platform_tag, path_prefix = 'artifacts')
141
- base_path, _ = artifacts_base_path_and_link_path(platform_tag, path_prefix)
173
+ def artifacts_path(platform_tag, path_prefix = 'artifacts', nonfinal = false)
174
+ base_path, _ = artifacts_base_path_and_link_path(platform_tag, path_prefix, nonfinal)
142
175
  platform, version, architecture = Pkg::Platforms.parse_platform_tag(platform_tag)
143
176
  package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
144
177
 
145
178
  case package_format
146
179
  when 'rpm'
147
- if repo_name == 'PC1'
180
+ if is_legacy_repo?(yum_repo_name(nonfinal))
148
181
  File.join(base_path, architecture)
149
182
  else
150
183
  File.join(base_path, platform, version, architecture)
151
184
  end
152
185
  when 'swix'
153
- if repo_name == 'PC1'
186
+ if is_legacy_repo?(repo_name(nonfinal))
154
187
  File.join(base_path, architecture)
155
188
  else
156
189
  File.join(base_path, version, architecture)
@@ -158,13 +191,13 @@ module Pkg::Paths
158
191
  when 'deb'
159
192
  base_path
160
193
  when 'svr4', 'ips'
161
- if repo_name == 'PC1'
194
+ if is_legacy_repo?(repo_name(nonfinal))
162
195
  base_path
163
196
  else
164
197
  File.join(base_path, version)
165
198
  end
166
199
  when 'dmg'
167
- if repo_name == 'PC1'
200
+ if is_legacy_repo?(repo_name(nonfinal))
168
201
  File.join(base_path, architecture)
169
202
  else
170
203
  File.join(base_path, version, architecture)
@@ -176,8 +209,8 @@ module Pkg::Paths
176
209
  end
177
210
  end
178
211
 
179
- def repo_path(platform_tag, options = { :legacy => false })
180
- repo_target = repo_name
212
+ def repo_path(platform_tag, options = { :legacy => false, :nonfinal => false })
213
+ repo_target = repo_name(options[:nonfinal])
181
214
  # in legacy packaging methods, there was no consistent way to determine the
182
215
  # repo name. There were separate variables for apt_repo_name and
183
216
  # yum_repo_name. At times, either or both of these were unset, and they had
@@ -2,514 +2,552 @@ require 'set'
2
2
 
3
3
  # Data plus utilities surrounding platforms that the automation in this repo
4
4
  # explicitly supports
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,
5
+ module Pkg
6
+ module Platforms
7
+
8
+ module_function
9
+
10
+ DEBIAN_SOURCE_FORMATS = ['debian.tar.gz', 'orig.tar.gz', 'dsc', 'changes']
11
+
12
+ # Each element in this hash
13
+ PLATFORM_INFO = {
14
+ 'aix' => {
15
+ '6.1' => {
16
+ architectures: ['power'],
17
+ source_architecture: 'SRPMS',
18
+ package_format: 'rpm',
19
+ source_package_formats: ['src.rpm'],
20
+ repo: false,
21
+ },
22
+ '7.1' => {
23
+ architectures: ['power'],
24
+ source_architecture: 'SRPMS',
25
+ package_format: 'rpm',
26
+ source_package_formats: ['src.rpm'],
27
+ repo: false,
28
+ },
19
29
  },
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,
37
- },
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,
67
- },
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,
75
- },
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,
94
- },
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,
102
- },
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,
129
- },
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,
30
+
31
+ 'cisco-wrlinux' => {
32
+ '5' => {
33
+ architectures: ['x86_64'],
34
+ source_architecture: 'SRPMS',
35
+ package_format: 'rpm',
36
+ source_package_formats: ['src.rpm'],
37
+ signature_format: 'v4',
38
+ repo: true,
39
+ },
40
+ '7' => {
41
+ architectures: ['x86_64'],
42
+ source_architecture: 'SRPMS',
43
+ package_format: 'rpm',
44
+ source_package_formats: ['src.rpm'],
45
+ signature_format: 'v4',
46
+ repo: true,
47
+ },
137
48
  },
138
- 'f27' => {
139
- architectures: ['x86_64'],
140
- source_architecture: 'SRPMS',
141
- package_format: 'rpm',
142
- source_package_formats: ['src.rpm'],
143
- signature_format: 'v4',
144
- repo: true,
49
+
50
+ 'cumulus' => {
51
+ '2.2' => {
52
+ codename: 'cumulus',
53
+ architectures: ['amd64'],
54
+ source_architecture: 'source',
55
+ package_format: 'deb',
56
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
57
+ repo: true,
58
+ },
145
59
  },
146
- '25' => {
147
- architectures: ['i386', 'x86_64'],
148
- source_architecture: 'SRPMS',
149
- package_format: 'rpm',
150
- source_package_formats: ['src.rpm'],
151
- signature_format: 'v4',
152
- repo: true,
60
+
61
+ 'debian' => {
62
+ '7' => {
63
+ codename: 'wheezy',
64
+ architectures: ['i386', 'amd64'],
65
+ source_architecture: 'source',
66
+ package_format: 'deb',
67
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
68
+ repo: true,
69
+ },
70
+ '8' => {
71
+ codename: 'jessie',
72
+ architectures: ['i386', 'amd64', 'powerpc'],
73
+ source_architecture: 'source',
74
+ package_format: 'deb',
75
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
76
+ repo: true,
77
+ },
78
+ '9' => {
79
+ codename: 'stretch',
80
+ architectures: ['i386', 'amd64'],
81
+ source_architecture: 'source',
82
+ package_format: 'deb',
83
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
84
+ repo: true,
85
+ },
86
+ '10' => {
87
+ codename: 'buster',
88
+ architectures: ['i386', 'amd64'],
89
+ source_architecture: 'source',
90
+ package_format: 'deb',
91
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
92
+ repo: true,
93
+ },
153
94
  },
154
- '26' => {
155
- architectures: ['x86_64'],
156
- source_architecture: 'SRPMS',
157
- package_format: 'rpm',
158
- source_package_formats: ['src.rpm'],
159
- signature_format: 'v4',
160
- repo: true,
95
+
96
+ 'el' => {
97
+ '5' => {
98
+ architectures: ['i386', 'x86_64'],
99
+ source_architecture: 'SRPMS',
100
+ package_format: 'rpm',
101
+ source_package_formats: ['src.rpm'],
102
+ signature_format: 'v3',
103
+ repo: true,
104
+ },
105
+ '6' => {
106
+ architectures: ['i386', 'x86_64', 's390x'],
107
+ source_architecture: 'SRPMS',
108
+ package_format: 'rpm',
109
+ source_package_formats: ['src.rpm'],
110
+ signature_format: 'v4',
111
+ repo: true,
112
+ },
113
+ '7' => {
114
+ architectures: ['x86_64', 's390x', 'ppc64le', 'aarch64'],
115
+ source_architecture: 'SRPMS',
116
+ package_format: 'rpm',
117
+ source_package_formats: ['src.rpm'],
118
+ signature_format: 'v4',
119
+ repo: true,
120
+ },
161
121
  },
162
- '27' => {
163
- architectures: ['x86_64'],
164
- source_architecture: 'SRPMS',
165
- package_format: 'rpm',
166
- source_package_formats: ['src.rpm'],
167
- signature_format: 'v4',
168
- repo: true,
122
+
123
+ 'eos' => {
124
+ '4' => {
125
+ architectures: ['i386'],
126
+ package_format: 'swix',
127
+ repo: false,
128
+ },
169
129
  },
170
- },
171
130
 
172
- 'osx' => {
173
- '10.10' => {
174
- architectures: ['x86_64'],
175
- package_format: 'dmg',
176
- repo: false,
131
+ 'fedora' => {
132
+ 'f25' => {
133
+ architectures: ['i386', 'x86_64'],
134
+ source_architecture: 'SRPMS',
135
+ package_format: 'rpm',
136
+ source_package_formats: ['src.rpm'],
137
+ signature_format: 'v4',
138
+ repo: true,
139
+ },
140
+ 'f26' => {
141
+ architectures: ['x86_64'],
142
+ source_architecture: 'SRPMS',
143
+ package_format: 'rpm',
144
+ source_package_formats: ['src.rpm'],
145
+ signature_format: 'v4',
146
+ repo: true,
147
+ },
148
+ 'f27' => {
149
+ architectures: ['x86_64'],
150
+ source_architecture: 'SRPMS',
151
+ package_format: 'rpm',
152
+ source_package_formats: ['src.rpm'],
153
+ signature_format: 'v4',
154
+ repo: true,
155
+ },
156
+ 'f28' => {
157
+ architectures: ['x86_64'],
158
+ source_architecture: 'SRPMS',
159
+ package_format: 'rpm',
160
+ source_package_formats: ['src.rpm'],
161
+ signature_format: 'v4',
162
+ repo: true,
163
+ },
164
+ '25' => {
165
+ architectures: ['i386', 'x86_64'],
166
+ source_architecture: 'SRPMS',
167
+ package_format: 'rpm',
168
+ source_package_formats: ['src.rpm'],
169
+ signature_format: 'v4',
170
+ repo: true,
171
+ },
172
+ '26' => {
173
+ architectures: ['x86_64'],
174
+ source_architecture: 'SRPMS',
175
+ package_format: 'rpm',
176
+ source_package_formats: ['src.rpm'],
177
+ signature_format: 'v4',
178
+ repo: true,
179
+ },
180
+ '27' => {
181
+ architectures: ['x86_64'],
182
+ source_architecture: 'SRPMS',
183
+ package_format: 'rpm',
184
+ source_package_formats: ['src.rpm'],
185
+ signature_format: 'v4',
186
+ repo: true,
187
+ },
188
+ '28' => {
189
+ architectures: ['x86_64'],
190
+ source_architecture: 'SRPMS',
191
+ package_format: 'rpm',
192
+ source_package_formats: ['src.rpm'],
193
+ signature_format: 'v4',
194
+ repo: true,
195
+ },
177
196
  },
178
- '10.11' => {
179
- architectures: ['x86_64'],
180
- package_format: 'dmg',
181
- repo: false,
197
+
198
+ 'osx' => {
199
+ '10.10' => {
200
+ architectures: ['x86_64'],
201
+ package_format: 'dmg',
202
+ repo: false,
203
+ },
204
+ '10.11' => {
205
+ architectures: ['x86_64'],
206
+ package_format: 'dmg',
207
+ repo: false,
208
+ },
209
+ '10.12' => {
210
+ architectures: ['x86_64'],
211
+ package_format: 'dmg',
212
+ repo: false,
213
+ },
214
+ '10.13' => {
215
+ architectures: ['x86_64'],
216
+ package_format: 'dmg',
217
+ repo: false,
218
+ },
182
219
  },
183
- '10.12' => {
184
- architectures: ['x86_64'],
185
- package_format: 'dmg',
186
- repo: false,
220
+
221
+ 'redhatfips' => {
222
+ '7' => {
223
+ architectures: ['x86_64'],
224
+ source_architecture: 'SRPMS',
225
+ package_format: 'rpm',
226
+ source_package_formats: ['src.rpm'],
227
+ signature_format: 'v3',
228
+ repo: true,
229
+ }
187
230
  },
188
- '10.13' => {
189
- architectures: ['x86_64'],
190
- package_format: 'dmg',
191
- repo: false,
192
- }
193
- },
194
-
195
- 'redhat-fips' => {
196
- '7' => {
197
- architectures: ['x86_64'],
198
- source_architecture: 'SRPMS',
199
- package_format: 'rpm',
200
- source_package_formats: ['src.rpm'],
201
- signature_format: 'v3',
202
- repo: true,
203
- }
204
- },
205
-
206
- 'sles' => {
207
- '11' => {
208
- architectures: ['i386', 'x86_64', 's390x'],
209
- source_architecture: 'SRPMS',
210
- package_format: 'rpm',
211
- source_package_formats: ['src.rpm'],
212
- signature_format: 'v3',
213
- repo: true,
231
+
232
+ 'sles' => {
233
+ '11' => {
234
+ architectures: ['i386', 'x86_64', 's390x'],
235
+ source_architecture: 'SRPMS',
236
+ package_format: 'rpm',
237
+ source_package_formats: ['src.rpm'],
238
+ signature_format: 'v3',
239
+ repo: true,
240
+ },
241
+ '12' => {
242
+ architectures: ['x86_64', 's390x', 'ppc64le'],
243
+ source_architecture: 'SRPMS',
244
+ package_format: 'rpm',
245
+ source_package_formats: ['src.rpm'],
246
+ signature_format: 'v4',
247
+ repo: true,
248
+ },
214
249
  },
215
- '12' => {
216
- architectures: ['x86_64', 's390x', 'ppc64le'],
217
- source_architecture: 'SRPMS',
218
- package_format: 'rpm',
219
- source_package_formats: ['src.rpm'],
220
- signature_format: 'v4',
221
- repo: true,
222
- }
223
- },
224
-
225
- 'solaris' => {
226
- '10' => {
227
- architectures: ['i386', 'sparc'],
228
- package_format: 'svr4',
229
- repo: false,
250
+
251
+ 'solaris' => {
252
+ '10' => {
253
+ architectures: ['i386', 'sparc'],
254
+ package_format: 'svr4',
255
+ repo: false,
256
+ },
257
+ '11' => {
258
+ architectures: ['i386', 'sparc'],
259
+ package_format: 'ips',
260
+ repo: false,
261
+ },
230
262
  },
231
- '11' => {
232
- architectures: ['i386', 'sparc'],
233
- package_format: 'ips',
234
- repo: false,
235
- }
236
- },
237
-
238
- 'ubuntu' => {
239
- '14.04' => {
240
- codename: 'trusty',
241
- architectures: ['i386', 'amd64'],
242
- source_architecture: 'source',
243
- package_format: 'deb',
244
- source_package_formats: DEBIAN_SOURCE_FORMATS,
245
- repo: true,
263
+
264
+ 'ubuntu' => {
265
+ '14.04' => {
266
+ codename: 'trusty',
267
+ architectures: ['i386', 'amd64'],
268
+ source_architecture: 'source',
269
+ package_format: 'deb',
270
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
271
+ repo: true,
272
+ },
273
+ '16.04' => {
274
+ codename: 'xenial',
275
+ architectures: ['i386', 'amd64', 'ppc64el'],
276
+ source_architecture: 'source',
277
+ package_format: 'deb',
278
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
279
+ repo: true,
280
+ },
281
+ '18.04' => {
282
+ codename: 'bionic',
283
+ architectures: ['amd64', 'ppc64el'],
284
+ source_architecture: 'source',
285
+ package_format: 'deb',
286
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
287
+ repo: true,
288
+ },
246
289
  },
247
- '16.04' => {
248
- codename: 'xenial',
249
- architectures: ['i386', 'amd64', 'ppc64el'],
250
- source_architecture: 'source',
251
- package_format: 'deb',
252
- source_package_formats: DEBIAN_SOURCE_FORMATS,
253
- repo: true,
290
+
291
+ 'windows' => {
292
+ '2012' => {
293
+ architectures: ['x86', 'x64'],
294
+ package_format: 'msi',
295
+ repo: false,
296
+ }
254
297
  },
255
- },
256
-
257
- 'windows' => {
258
- '2012' => {
259
- architectures: ['x86', 'x64'],
260
- package_format: 'msi',
261
- repo: false,
262
- }
263
- }
264
- }.freeze
265
-
266
- # @return [Array] An array of Strings, containing all of the supported
267
- # platforms as defined in PLATFORM_INFO
268
- def supported_platforms
269
- PLATFORM_INFO.keys
270
- end
298
+ }.freeze
271
299
 
272
- # @return [Array] An Array of Strings, containing all the supported
273
- # versions for the given platform
274
- def versions_for_platform(platform)
275
- PLATFORM_INFO[platform].keys
276
- rescue
277
- raise "No information found for '#{platform}'"
278
- end
300
+ # @return [Array] An array of Strings, containing all of the supported
301
+ # platforms as defined in PLATFORM_INFO
302
+ def supported_platforms
303
+ PLATFORM_INFO.keys
304
+ end
279
305
 
280
- # @param platform_tag [String] May be either the two or three unit string
281
- # that corresponds to a platform in the form of platform-version or
282
- # platform-version-arch.
283
- # @return [Array] An array of three elements: the platform name, the platform
284
- # version, and the architecture. If the architecture was not included in
285
- # the original platform tag, then nil is returned in place of the
286
- # architecture
287
- def parse_platform_tag(platform_tag)
288
- platform_elements = platform_tag.split('-')
289
-
290
- # Look for platform. This is probably the only place where we have to look
291
- # for a combination of elements rather than a single element
292
- platform = (platform_elements & supported_platforms).first
293
- codename = (platform_elements & codenames).first
294
-
295
- # This is probably a bad assumption, but I'm assuming if we find a codename,
296
- # that's more reliable as it's less likely to give us a false match
297
- if codename
298
- platform, version = codename_to_platform_version(codename)
306
+ # @return [Array] An Array of Strings, containing all the supported
307
+ # versions for the given platform
308
+ def versions_for_platform(platform)
309
+ PLATFORM_INFO[platform].keys
310
+ rescue
311
+ raise "No information found for '#{platform}'"
299
312
  end
300
313
 
301
- # There's a possibility that the platform name has a dash in it, in which
302
- # case, our assumption that it's an element of the above array is false,
303
- # since it would be a combination of elements in that array
304
- platform ||= supported_platforms.find { |p| platform_tag =~ /#{p}-/ }
314
+ # @param platform_tag [String] May be either the two or three unit string
315
+ # that corresponds to a platform in the form of platform-version or
316
+ # platform-version-arch.
317
+ # @return [Array] An array of three elements: the platform name, the platform
318
+ # version, and the architecture. If the architecture was not included in
319
+ # the original platform tag, then nil is returned in place of the
320
+ # architecture
321
+ def parse_platform_tag(platform_tag)
322
+ platform_elements = platform_tag.split('-')
323
+
324
+ # Look for platform. This is probably the only place where we have to look
325
+ # for a combination of elements rather than a single element
326
+ platform = (platform_elements & supported_platforms).first
327
+ codename = (platform_elements & codenames).first
328
+
329
+ # This is probably a bad assumption, but I'm assuming if we find a codename,
330
+ # that's more reliable as it's less likely to give us a false match
331
+ if codename
332
+ platform, version = codename_to_platform_version(codename)
333
+ end
305
334
 
306
- version ||= (platform_elements & versions_for_platform(platform)).first
335
+ # There's a possibility that the platform name has a dash in it, in which
336
+ # case, our assumption that it's an element of the above array is false,
337
+ # since it would be a combination of elements in that array
338
+ platform ||= supported_platforms.find { |p| platform_tag =~ /#{p}-/ }
307
339
 
340
+ version ||= (platform_elements & versions_for_platform(platform)).first
308
341
 
309
- # For platform names with a dash in them, because everything is special
310
- supported_arches = arches_for_platform_version(platform, version, true)
311
- architecture = platform_tag.sub(/^(#{platform}-#{version}|#{codename})-?/, '')
312
342
 
313
- fail unless supported_arches.include?(architecture) || architecture.empty?
314
- return [platform, version, architecture]
315
- rescue
316
- raise "Could not verify that '#{platform_tag}' is a valid tag"
317
- end
343
+ # For platform names with a dash in them, because everything is special
344
+ supported_arches = arches_for_platform_version(platform, version, true)
345
+ architecture = platform_tag.sub(/^(#{platform}-#{version}|#{codename})-?/, '')
318
346
 
319
- # @param platform_tag [String] May be either the two or three unit string
320
- # that corresponds to a platform in the form of platform-version or
321
- # platform-version-arch
322
- # @return [Hash] The hash of data associated with the given platform version
323
- def platform_lookup(platform_tag)
324
- platform, version, _ = parse_platform_tag(platform_tag)
325
- PLATFORM_INFO[platform][version]
326
- end
347
+ fail unless supported_arches.include?(architecture) || architecture.empty?
327
348
 
328
- # @param platform_tag [String] May be either the two or three unit string
329
- # that corresponds to a platform in the form of platform-version or
330
- # platform-version-arch
331
- # @param attribute_name [String, Symbol] The name of the requested attribute
332
- # @return [String, Array] the contents of the requested attribute
333
- def get_attribute(platform_tag, attribute_name)
334
- info = platform_lookup(platform_tag)
335
- raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
336
- info[attribute_name]
337
- end
349
+ # AIX uses 'ppc' as its architecture in paths and file names
350
+ architecture = 'ppc' if platform == 'aix'
351
+ return [platform, version, architecture]
352
+ rescue
353
+ raise "Could not verify that '#{platform_tag}' is a valid tag"
354
+ end
338
355
 
339
- def get_attribute_for_platform_version(platform, version, attribute_name)
340
- info = PLATFORM_INFO[platform][version]
341
- raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
342
- info[attribute_name]
343
- end
356
+ # @param platform_tag [String] May be either the two or three unit string
357
+ # that corresponds to a platform in the form of platform-version or
358
+ # platform-version-arch
359
+ # @return [Hash] The hash of data associated with the given platform version
360
+ def platform_lookup(platform_tag)
361
+ platform, version, _ = parse_platform_tag(platform_tag)
362
+ PLATFORM_INFO[platform][version]
363
+ end
344
364
 
345
- # @private List platforms that use a given package format
346
- # @param format [String] The name of the packaging format to filter on
347
- # @return [Array] An Array of Strings, containing all platforms that
348
- # use <format> for their packages
349
- def by_package_format(format)
350
- PLATFORM_INFO.keys.select do |key|
351
- formats = PLATFORM_INFO[key].values.collect { |v| v[:package_format] }
352
- formats.include? format
365
+ # @param platform_tag [String] May be either the two or three unit string
366
+ # that corresponds to a platform in the form of platform-version or
367
+ # platform-version-arch
368
+ # @param attribute_name [String, Symbol] The name of the requested attribute
369
+ # @return [String, Array] the contents of the requested attribute
370
+ def get_attribute(platform_tag, attribute_name)
371
+ info = platform_lookup(platform_tag)
372
+ raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
373
+ info[attribute_name]
353
374
  end
354
- end
355
375
 
356
- # @return [Array] An Array of Strings, containing all of the package
357
- # formats defined in Pkg::Platforms
358
- def formats
359
- fmts = PLATFORM_INFO.flat_map do |_, p|
360
- p.collect do |_, r|
361
- r[:package_format]
376
+ def get_attribute_for_platform_version(platform, version, attribute_name)
377
+ info = PLATFORM_INFO[platform][version]
378
+ raise "#{platform_tag} doesn't have information about #{attribute_name} available" unless info.key?(attribute_name)
379
+ info[attribute_name]
380
+ end
381
+
382
+ # @private List platforms that use a given package format
383
+ # @param format [String] The name of the packaging format to filter on
384
+ # @return [Array] An Array of Strings, containing all platforms that
385
+ # use <format> for their packages
386
+ def by_package_format(format)
387
+ PLATFORM_INFO.keys.select do |key|
388
+ formats = PLATFORM_INFO[key].values.collect { |v| v[:package_format] }
389
+ formats.include? format
362
390
  end
363
391
  end
364
- fmts.to_set.sort
365
- end
366
392
 
367
- # @return [Array] An Array of Strings, containing all the package formats
368
- # and source package formats defined in Pkg::Platforms
369
- def all_supported_package_formats
370
- fmts = formats
371
- source_fmts = PLATFORM_INFO.flat_map do |_, p|
372
- p.collect do |_, r|
373
- r[:source_package_formats]
393
+ # @return [Array] An Array of Strings, containing all of the package
394
+ # formats defined in Pkg::Platforms
395
+ def formats
396
+ fmts = PLATFORM_INFO.flat_map do |_, p|
397
+ p.collect do |_, r|
398
+ r[:package_format]
399
+ end
374
400
  end
401
+ fmts.to_set.sort
375
402
  end
376
403
 
377
- (fmts + source_fmts).flatten.compact.uniq.to_set.sort
378
- end
404
+ # @return [Array] An Array of Strings, containing all the package formats
405
+ # and source package formats defined in Pkg::Platforms
406
+ def all_supported_package_formats
407
+ fmts = formats
408
+ source_fmts = PLATFORM_INFO.flat_map do |_, p|
409
+ p.collect do |_, r|
410
+ r[:source_package_formats]
411
+ end
412
+ end
379
413
 
380
- # @param platform [String] Optional, the platform to list all codenames for.
381
- # Defaults to 'deb'
382
- # @return [Array] An Array of Strings, containing all of the codenames
383
- # defined for a given Platform
384
- def codenames(platform = 'deb')
385
- releases = by_package_format(platform).flat_map do |p|
386
- PLATFORM_INFO[p].values.collect { |r| r[:codename] }
414
+ (fmts + source_fmts).flatten.compact.uniq.to_set.sort
387
415
  end
388
- releases.sort
389
- end
390
416
 
391
- # Given a debian codename, return the platform and version it corresponds to
392
- def codename_to_platform_version(codename)
393
- PLATFORM_INFO.each do |platform, platform_versions|
394
- platform_versions.each do |version, info|
395
- return [platform, version] if info[:codename] && codename == info[:codename]
417
+ # @param platform [String] Optional, the platform to list all codenames for.
418
+ # Defaults to 'deb'
419
+ # @return [Array] An Array of Strings, containing all of the codenames
420
+ # defined for a given Platform
421
+ def codenames(platform = 'deb')
422
+ releases = by_package_format(platform).flat_map do |p|
423
+ PLATFORM_INFO[p].values.collect { |r| r[:codename] }
396
424
  end
425
+ releases.sort
397
426
  end
398
- raise "Unable to find a platform and version for '#{codename}'"
399
- end
400
427
 
401
- # Given a debian platform and version, return the codename that corresponds to
402
- # the set
403
- def codename_for_platform_version(platform, version)
404
- get_attribute_for_platform_version(platform, version, :codename)
405
- end
428
+ # Given a debian codename, return the platform and version it corresponds to
429
+ def codename_to_platform_version(codename)
430
+ PLATFORM_INFO.each do |platform, platform_versions|
431
+ platform_versions.each do |version, info|
432
+ return [platform, version] if info[:codename] && codename == info[:codename]
433
+ end
434
+ end
435
+ raise "Unable to find a platform and version for '#{codename}'"
436
+ end
406
437
 
407
- # Given a debian codename, return the arches that we build for that codename
408
- def arches_for_codename(codename, include_source = false)
409
- platform, version = codename_to_platform_version(codename)
410
- arches_for_platform_version(platform, version, include_source)
411
- end
438
+ # Given a debian platform and version, return the codename that corresponds to
439
+ # the set
440
+ def codename_for_platform_version(platform, version)
441
+ get_attribute_for_platform_version(platform, version, :codename)
442
+ end
412
443
 
413
- # Given a codename, return an array of associated tags
414
- def codename_to_tags(codename)
415
- platform_tags = []
416
- platform, version = codename_to_platform_version(codename)
417
- arches_for_codename(codename).each do |arch|
418
- platform_tags << "#{platform}-#{version}-#{arch}"
444
+ # Given a debian codename, return the arches that we build for that codename
445
+ def arches_for_codename(codename, include_source = false)
446
+ platform, version = codename_to_platform_version(codename)
447
+ arches_for_platform_version(platform, version, include_source)
419
448
  end
420
- platform_tags
421
- end
422
449
 
423
- # Given a platform and version, return the arches that we build for that
424
- # platform
425
- def arches_for_platform_version(platform, version, include_source = false)
426
- platform_architectures = get_attribute_for_platform_version(platform, version, :architectures)
427
- # get_attribute_for_platform_version will raise an exception if the attribute
428
- # isn't found. We don't want this to be a fatal error, we just want to append
429
- # the source architecture if it's found
430
- source_architecture = []
431
- if include_source
432
- begin
433
- source_architecture = Array(get_attribute_for_platform_version(platform, version, :source_architecture))
434
- rescue
450
+ # Given a codename, return an array of associated tags
451
+ def codename_to_tags(codename)
452
+ platform_tags = []
453
+ platform, version = codename_to_platform_version(codename)
454
+ arches_for_codename(codename).each do |arch|
455
+ platform_tags << "#{platform}-#{version}-#{arch}"
435
456
  end
457
+ platform_tags
436
458
  end
437
- return (platform_architectures + source_architecture).flatten
438
- end
439
459
 
440
- # Returns an array of all currently valid platform tags
441
- def platform_tags
442
- tags = []
443
- PLATFORM_INFO.each do |platform, platform_versions|
444
- platform_versions.each do |version, info|
445
- info[:architectures].each do |arch|
446
- tags << "#{platform}-#{version}-#{arch}"
460
+ # Given a platform and version, return the arches that we build for that
461
+ # platform
462
+ def arches_for_platform_version(platform, version, include_source = false)
463
+ platform_architectures = get_attribute_for_platform_version(platform, version, :architectures)
464
+ # get_attribute_for_platform_version will raise an exception if the attribute
465
+ # isn't found. We don't want this to be a fatal error, we just want to append
466
+ # the source architecture if it's found
467
+ source_architecture = []
468
+ if include_source
469
+ begin
470
+ source_architecture = Array(get_attribute_for_platform_version(platform, version, :source_architecture))
471
+ rescue
447
472
  end
448
473
  end
474
+ return (platform_architectures + source_architecture).flatten
449
475
  end
450
- tags
451
- end
452
476
 
453
- def package_format_for_tag(platform_tag)
454
- get_attribute(platform_tag, :package_format)
455
- end
477
+ # Returns an array of all currently valid platform tags
478
+ def platform_tags
479
+ tags = []
480
+ PLATFORM_INFO.each do |platform, platform_versions|
481
+ platform_versions.each do |version, info|
482
+ info[:architectures].each do |arch|
483
+ tags << "#{platform}-#{version}-#{arch}"
484
+ end
485
+ end
486
+ end
487
+ tags
488
+ end
456
489
 
457
- def signature_format_for_tag(platform_tag)
458
- get_attribute(platform_tag, :signature_format)
459
- end
490
+ def package_format_for_tag(platform_tag)
491
+ get_attribute(platform_tag, :package_format)
492
+ end
460
493
 
461
- def signature_format_for_platform_version(platform, version)
462
- get_attribute_for_platform_version(platform, version, :signature_format)
463
- end
494
+ def signature_format_for_tag(platform_tag)
495
+ get_attribute(platform_tag, :signature_format)
496
+ end
464
497
 
465
- def source_architecture_for_platform_tag(platform_tag)
466
- get_attribute(platform_tag, :source_architecture)
467
- end
498
+ def signature_format_for_platform_version(platform, version)
499
+ get_attribute_for_platform_version(platform, version, :signature_format)
500
+ end
468
501
 
469
- def source_package_formats_for_platform_tag(platform_tag)
470
- get_attribute(platform_tag, :source_package_formats)
471
- end
502
+ def source_architecture_for_platform_tag(platform_tag)
503
+ get_attribute(platform_tag, :source_architecture)
504
+ end
505
+
506
+ def source_package_formats_for_platform_tag(platform_tag)
507
+ get_attribute(platform_tag, :source_package_formats)
508
+ end
472
509
 
473
- # Return an array of platform tags associated with a given package format
474
- def platform_tags_for_package_format(format)
475
- platform_tags = []
476
- PLATFORM_INFO.each do |platform, platform_versions|
477
- platform_versions.each do |version, info|
478
- info[:architectures].each do |architecture|
479
- if info[:package_format] == format
480
- platform_tags << "#{platform}-#{version}-#{architecture}"
510
+ # Return an array of platform tags associated with a given package format
511
+ def platform_tags_for_package_format(format)
512
+ platform_tags = []
513
+ PLATFORM_INFO.each do |platform, platform_versions|
514
+ platform_versions.each do |version, info|
515
+ info[:architectures].each do |architecture|
516
+ if info[:package_format] == format
517
+ platform_tags << "#{platform}-#{version}-#{architecture}"
518
+ end
481
519
  end
482
520
  end
483
521
  end
522
+ platform_tags
484
523
  end
485
- platform_tags
486
- end
487
524
 
488
- # Return a supported platform tag for the given platform, not caring about
489
- # version or architecture
490
- def generic_platform_tag(platform)
491
- version = versions_for_platform(platform).first
492
- arch = arches_for_platform_version(platform, version).first
493
- return "#{platform}-#{version}-#{arch}"
494
- end
525
+ # Return a supported platform tag for the given platform, not caring about
526
+ # version or architecture
527
+ def generic_platform_tag(platform)
528
+ version = versions_for_platform(platform).first
529
+ arch = arches_for_platform_version(platform, version).first
530
+ return "#{platform}-#{version}-#{arch}"
531
+ end
495
532
 
496
- # @method by_deb
497
- # @return [Array] An Array of Strings, containing all platforms
498
- # that use .deb packages
499
- # Helper meta-method to return all platforms that use .deb packages
500
- # @scope class
501
- def by_deb
502
- by_package_format('deb')
503
- end
533
+ # @method by_deb
534
+ # @return [Array] An Array of Strings, containing all platforms
535
+ # that use .deb packages
536
+ # Helper meta-method to return all platforms that use .deb packages
537
+ # @scope class
538
+ def by_deb
539
+ by_package_format('deb')
540
+ end
504
541
 
505
- # @method by_rpm
506
- # @return [Array] An Array of Strings, containing all platforms
507
- # that use .rpm packages
508
- # Helper meta-method to return all platforms that use .rpm packages
509
- # @scope class
510
- def by_rpm
511
- by_package_format('rpm')
512
- end
542
+ # @method by_rpm
543
+ # @return [Array] An Array of Strings, containing all platforms
544
+ # that use .rpm packages
545
+ # Helper meta-method to return all platforms that use .rpm packages
546
+ # @scope class
547
+ def by_rpm
548
+ by_package_format('rpm')
549
+ end
513
550
 
514
- private :by_package_format
551
+ private :by_package_format
552
+ end
515
553
  end