omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
data/lib/omnibus/metadata.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "ffi_yajl"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Metadata
|
@@ -63,7 +63,7 @@ module Omnibus
|
|
63
63
|
iteration: project.build_iteration,
|
64
64
|
license: project.license,
|
65
65
|
version_manifest: project.built_manifest.to_hash,
|
66
|
-
license_content: File.exist?(project.license_file_path) ? File.read(project.license_file_path) :
|
66
|
+
license_content: File.exist?(project.license_file_path) ? File.read(project.license_file_path) : "",
|
67
67
|
}
|
68
68
|
|
69
69
|
instance = new(package, data)
|
@@ -84,9 +84,9 @@ module Omnibus
|
|
84
84
|
hash = FFI_Yajl::Parser.parse(data, symbolize_names: true)
|
85
85
|
|
86
86
|
# Ensure Platform version has been truncated
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
if hash[:platform_version] && hash[:platform]
|
88
|
+
hash[:platform_version] = truncate_platform_version(hash[:platform_version], hash[:platform])
|
89
|
+
end
|
90
90
|
|
91
91
|
# Ensure an interation exists
|
92
92
|
hash[:iteration] ||= 1
|
@@ -115,15 +115,15 @@ module Omnibus
|
|
115
115
|
#
|
116
116
|
def arch
|
117
117
|
if windows? && windows_arch_i386?
|
118
|
-
|
118
|
+
"i386"
|
119
119
|
elsif solaris?
|
120
120
|
if intel?
|
121
|
-
|
121
|
+
"i386"
|
122
122
|
elsif sparc?
|
123
|
-
|
123
|
+
"sparc"
|
124
124
|
end
|
125
125
|
else
|
126
|
-
Ohai[
|
126
|
+
Ohai["kernel"]["machine"]
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -134,7 +134,7 @@ module Omnibus
|
|
134
134
|
# the platform version
|
135
135
|
#
|
136
136
|
def platform_version
|
137
|
-
truncate_platform_version(Ohai[
|
137
|
+
truncate_platform_version(Ohai["platform_version"], platform_shortname)
|
138
138
|
end
|
139
139
|
|
140
140
|
#
|
@@ -145,11 +145,11 @@ module Omnibus
|
|
145
145
|
#
|
146
146
|
def platform_shortname
|
147
147
|
if rhel?
|
148
|
-
|
148
|
+
"el"
|
149
149
|
elsif suse?
|
150
|
-
|
150
|
+
"sles"
|
151
151
|
else
|
152
|
-
Ohai[
|
152
|
+
Ohai["platform"]
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -169,16 +169,16 @@ module Omnibus
|
|
169
169
|
#
|
170
170
|
def truncate_platform_version(platform_version, platform)
|
171
171
|
case platform
|
172
|
-
when
|
172
|
+
when "centos", "debian", "el", "fedora", "freebsd", "omnios", "pidora", "raspbian", "rhel", "sles", "suse", "smartos", "nexus", "ios_xr"
|
173
173
|
# Only want MAJOR (e.g. Debian 7, OmniOS r151006, SmartOS 20120809T221258Z)
|
174
|
-
platform_version.split(
|
175
|
-
when
|
174
|
+
platform_version.split(".").first
|
175
|
+
when "aix", "gentoo", "mac_os_x", "openbsd", "slackware", "solaris2", "opensuse", "ubuntu"
|
176
176
|
# Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04)
|
177
|
-
platform_version.split(
|
178
|
-
when
|
177
|
+
platform_version.split(".")[0..1].join(".")
|
178
|
+
when "arch"
|
179
179
|
# Arch Linux does not have a platform_version ohai attribute, it is rolling release (lsb_release -r)
|
180
|
-
|
181
|
-
when
|
180
|
+
"rolling"
|
181
|
+
when "windows"
|
182
182
|
# Windows has this really awesome "feature", where their version numbers
|
183
183
|
# internally do not match the "marketing" name.
|
184
184
|
#
|
@@ -197,23 +197,23 @@ module Omnibus
|
|
197
197
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
|
198
198
|
#
|
199
199
|
case platform_version
|
200
|
-
when
|
201
|
-
when
|
202
|
-
when
|
203
|
-
when
|
204
|
-
when
|
205
|
-
when
|
206
|
-
when
|
207
|
-
# The following `when` will never match since Windows
|
208
|
-
# version is the same as Windows
|
200
|
+
when "5.0.2195", "2000" then "2000"
|
201
|
+
when "5.1.2600", "xp" then "xp"
|
202
|
+
when "5.2.3790", "2003r2" then "2003r2"
|
203
|
+
when "6.0.6001", "2008" then "2008"
|
204
|
+
when "6.1.7600", "7" then "7"
|
205
|
+
when "6.1.7601", "2008r2" then "2008r2"
|
206
|
+
when "6.2.9200", "2012" then "2012"
|
207
|
+
# The following `when` will never match since Windows 8's platform
|
208
|
+
# version is the same as Windows 2012. It's only here for completeness and
|
209
209
|
# documentation.
|
210
|
-
when
|
211
|
-
when /6\.3\.\d+/,
|
212
|
-
# The following `when` will never match since Windows
|
213
|
-
# version is the same as Windows
|
210
|
+
when "6.2.9200", "8" then "8"
|
211
|
+
when /6\.3\.\d+/, "2012r2" then "2012r2"
|
212
|
+
# The following `when` will never match since Windows 8.1's platform
|
213
|
+
# version is the same as Windows 2012R2. It's only here for completeness
|
214
214
|
# and documentation.
|
215
|
-
when /6\.3\.\d+/,
|
216
|
-
when /^10\.0/ then
|
215
|
+
when /6\.3\.\d+/, "8.1" then "8.1"
|
216
|
+
when /^10\.0/ then "10"
|
217
217
|
else
|
218
218
|
raise UnknownPlatformVersion.new(platform, platform_version)
|
219
219
|
end
|
@@ -267,7 +267,7 @@ module Omnibus
|
|
267
267
|
# @return [true]
|
268
268
|
#
|
269
269
|
def save
|
270
|
-
File.open(path,
|
270
|
+
File.open(path, "w+") do |f|
|
271
271
|
f.write(FFI_Yajl::Encoder.encode(to_hash, pretty: true))
|
272
272
|
end
|
273
273
|
|
data/lib/omnibus/ohai.rb
CHANGED
@@ -14,16 +14,15 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "ohai"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Ohai
|
21
|
-
PLUGINS =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
].freeze
|
21
|
+
PLUGINS = %w{
|
22
|
+
cpu
|
23
|
+
kernel
|
24
|
+
os
|
25
|
+
platform}.freeze
|
27
26
|
|
28
27
|
class << self
|
29
28
|
def method_missing(m, *args, &block)
|
data/lib/omnibus/package.rb
CHANGED
data/lib/omnibus/packager.rb
CHANGED
@@ -19,15 +19,16 @@ module Omnibus
|
|
19
19
|
include Logging
|
20
20
|
include Sugarable
|
21
21
|
|
22
|
-
autoload :Base,
|
23
|
-
autoload :BFF,
|
24
|
-
autoload :DEB,
|
25
|
-
autoload :Makeself,
|
26
|
-
autoload :MSI,
|
27
|
-
autoload :
|
28
|
-
autoload :
|
29
|
-
autoload :
|
30
|
-
autoload :
|
22
|
+
autoload :Base, "omnibus/packagers/base"
|
23
|
+
autoload :BFF, "omnibus/packagers/bff"
|
24
|
+
autoload :DEB, "omnibus/packagers/deb"
|
25
|
+
autoload :Makeself, "omnibus/packagers/makeself"
|
26
|
+
autoload :MSI, "omnibus/packagers/msi"
|
27
|
+
autoload :APPX, "omnibus/packagers/appx"
|
28
|
+
autoload :PKG, "omnibus/packagers/pkg"
|
29
|
+
autoload :Solaris, "omnibus/packagers/solaris"
|
30
|
+
autoload :IPS, "omnibus/packagers/ips"
|
31
|
+
autoload :RPM, "omnibus/packagers/rpm"
|
31
32
|
|
32
33
|
#
|
33
34
|
# The list of Ohai platform families mapped to the respective packager
|
@@ -36,44 +37,52 @@ module Omnibus
|
|
36
37
|
# @return [Hash<String, Class>]
|
37
38
|
#
|
38
39
|
PLATFORM_PACKAGER_MAP = {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
40
|
+
"debian" => DEB,
|
41
|
+
"fedora" => RPM,
|
42
|
+
"suse" => RPM,
|
43
|
+
"rhel" => RPM,
|
44
|
+
"wrlinux" => RPM,
|
45
|
+
"aix" => BFF,
|
46
|
+
"solaris" => Solaris,
|
47
|
+
"ips" => IPS,
|
48
|
+
"windows" => [MSI, APPX],
|
49
|
+
"mac_os_x" => PKG,
|
49
50
|
}.freeze
|
50
51
|
|
51
52
|
#
|
52
|
-
# Determine the packager for the current system. This method returns the
|
53
|
+
# Determine the packager(s) for the current system. This method returns the
|
53
54
|
# class, not an instance of the class.
|
54
55
|
#
|
55
56
|
# @example
|
56
|
-
# Packager.for_current_system #=> Packager::RPM
|
57
|
+
# Packager.for_current_system #=> [Packager::RPM]
|
57
58
|
#
|
58
|
-
# @return [~Packager::Base]
|
59
|
+
# @return [[~Packager::Base]]
|
59
60
|
#
|
60
61
|
def for_current_system
|
61
|
-
family = Ohai[
|
62
|
-
version = Ohai[
|
62
|
+
family = Ohai["platform_family"]
|
63
|
+
version = Ohai["platform_version"]
|
63
64
|
|
64
|
-
if family ==
|
65
|
+
if family == "solaris2" && Chef::Sugar::Constraints::Version.new(version).satisfies?(">= 5.11")
|
65
66
|
family = "ips"
|
66
|
-
elsif family ==
|
67
|
+
elsif family == "solaris2" && Chef::Sugar::Constraints::Version.new(version).satisfies?(">= 5.10")
|
67
68
|
family = "solaris"
|
68
69
|
end
|
69
70
|
if klass = PLATFORM_PACKAGER_MAP[family]
|
70
|
-
klass
|
71
|
+
package_types = klass.is_a?(Array) ? klass : [ klass ]
|
72
|
+
|
73
|
+
if package_types.include?(APPX) &&
|
74
|
+
!Chef::Sugar::Constraints::Version.new(version).satisfies?(">= 6.2")
|
75
|
+
log.warn(log_key) { "APPX generation is only supported on Windows versions 2012 and above" }
|
76
|
+
package_types = package_types - [APPX]
|
77
|
+
end
|
78
|
+
|
79
|
+
package_types
|
71
80
|
else
|
72
81
|
log.warn(log_key) do
|
73
82
|
"Could not determine packager for `#{family}', defaulting " \
|
74
83
|
"to `makeself'!"
|
75
84
|
end
|
76
|
-
Makeself
|
85
|
+
[Makeself]
|
77
86
|
end
|
78
87
|
end
|
79
88
|
module_function :for_current_system
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Chef Software, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "omnibus/packagers/windows_base"
|
18
|
+
|
19
|
+
module Omnibus
|
20
|
+
class Packager::APPX < Packager::WindowsBase
|
21
|
+
id :appx
|
22
|
+
|
23
|
+
setup do
|
24
|
+
# Render the manifest
|
25
|
+
write_manifest_file
|
26
|
+
|
27
|
+
# Copy all the staging assets from vendored Omnibus into the resources
|
28
|
+
# directory.
|
29
|
+
FileSyncer.glob("#{Omnibus.source_root}/resources/#{id}/assets/*").each do |file|
|
30
|
+
copy_file(file, "#{project.install_dir}/#{File.basename(file)}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Copy all assets in the user's project directory - this may overwrite
|
34
|
+
# files copied in the previous step, but that's okay :)
|
35
|
+
FileSyncer.glob("#{resources_path}/assets/*").each do |file|
|
36
|
+
copy_file(file, "#{project.install_dir}/#{File.basename(file)}")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
build do
|
41
|
+
# Pack the files with makeappx.exe, recursively generate fragment for
|
42
|
+
# project directory
|
43
|
+
Dir.chdir(staging_dir) do
|
44
|
+
appx_file = windows_safe_path(Config.package_dir, package_name)
|
45
|
+
shellout!(pack_command(appx_file))
|
46
|
+
|
47
|
+
if signing_identity
|
48
|
+
sign_package(appx_file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# @see Base#package_name
|
54
|
+
def package_name
|
55
|
+
"#{project.package_name}-#{project.build_version}-#{project.build_iteration}.appx"
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Write the manifest file into the staging directory.
|
60
|
+
#
|
61
|
+
# @return [void]
|
62
|
+
#
|
63
|
+
def write_manifest_file
|
64
|
+
render_template(resource_path("AppxManifest.xml.erb"),
|
65
|
+
destination: "#{windows_safe_path(project.install_dir)}/AppxManifest.xml",
|
66
|
+
variables: {
|
67
|
+
name: project.package_name,
|
68
|
+
friendly_name: project.friendly_name,
|
69
|
+
version: windows_package_version,
|
70
|
+
maintainer: project.maintainer,
|
71
|
+
certificate_subject: certificate_subject,
|
72
|
+
}
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Get the shell command to run pack in order to create a
|
78
|
+
# an appx package
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
#
|
82
|
+
def pack_command(appx_file)
|
83
|
+
"makeappx.exe pack /d \"#{windows_safe_path(project.install_dir)}\" /p #{appx_file}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -14,12 +14,13 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "fileutils"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Packager::Base
|
21
21
|
include Cleanroom
|
22
22
|
include Digestable
|
23
|
+
include Instrumentation
|
23
24
|
include Logging
|
24
25
|
include NullArgumentable
|
25
26
|
include Sugarable
|
@@ -98,12 +99,12 @@ module Omnibus
|
|
98
99
|
# @return [Array<String>]
|
99
100
|
#
|
100
101
|
def exclusions
|
101
|
-
project.exclusions + %w
|
102
|
+
project.exclusions + %w{
|
102
103
|
**/.git
|
103
104
|
**/.hg
|
104
105
|
**/.svn
|
105
106
|
**/.gitkeep
|
106
|
-
|
107
|
+
}
|
107
108
|
end
|
108
109
|
|
109
110
|
#
|
@@ -140,21 +141,23 @@ module Omnibus
|
|
140
141
|
# Ensure the package directory exists
|
141
142
|
create_directory(Config.package_dir)
|
142
143
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
144
|
+
measure("Packaging time") do
|
145
|
+
# Run the setup and build sequences
|
146
|
+
instance_eval(&self.class.setup) if self.class.setup
|
147
|
+
instance_eval(&self.class.build) if self.class.build
|
148
|
+
|
149
|
+
# Render the metadata
|
150
|
+
Metadata.generate(package_path, project)
|
151
|
+
|
152
|
+
# Ensure the temporary directory is removed at the end of a successful
|
153
|
+
# run. Without removal, successful builds will "leak" in /tmp and cause
|
154
|
+
# increased disk usage.
|
155
|
+
#
|
156
|
+
# Instead of having this as an +ensure+ block, failed builds will persist
|
157
|
+
# this directory so developers can go poke around and figure out why the
|
158
|
+
# build failed.
|
159
|
+
remove_directory(staging_dir)
|
160
|
+
end
|
158
161
|
end
|
159
162
|
|
160
163
|
#
|
@@ -19,12 +19,12 @@ module Omnibus
|
|
19
19
|
# @return [Hash]
|
20
20
|
SCRIPT_MAP = {
|
21
21
|
# Default Omnibus naming
|
22
|
-
preinst:
|
23
|
-
postinst:
|
24
|
-
config:
|
25
|
-
unconfig:
|
26
|
-
prerm:
|
27
|
-
postrm:
|
22
|
+
preinst: "Pre-installation Script",
|
23
|
+
postinst: "Post-installation Script",
|
24
|
+
config: "Configuration Script",
|
25
|
+
unconfig: "Unconfiguration Script",
|
26
|
+
prerm: "Pre_rm Script",
|
27
|
+
postrm: "Unconfiguration Script",
|
28
28
|
}.freeze
|
29
29
|
|
30
30
|
id :bff
|
@@ -63,7 +63,7 @@ module Omnibus
|
|
63
63
|
# @return [String]
|
64
64
|
#
|
65
65
|
def scripts_install_dir
|
66
|
-
File.expand_path(File.join(project.install_dir,
|
66
|
+
File.expand_path(File.join(project.install_dir, "embedded/share/installp"))
|
67
67
|
end
|
68
68
|
|
69
69
|
#
|
@@ -129,7 +129,6 @@ module Omnibus
|
|
129
129
|
# Unconfiguration Script: /path/script
|
130
130
|
#
|
131
131
|
def write_gen_template
|
132
|
-
|
133
132
|
# Get a list of all files
|
134
133
|
files = FileSyncer.glob("#{staging_dir}/**/*").reject do |path|
|
135
134
|
# remove any files with spaces.
|
@@ -141,36 +140,36 @@ module Omnibus
|
|
141
140
|
files.map! do |path|
|
142
141
|
# If paths have colons or commas, rename them and add them to a post-install,
|
143
142
|
# post-sysck renaming script ('config') which is created if needed
|
144
|
-
if path
|
145
|
-
alt = path.gsub(/(:|,)/,
|
143
|
+
if path =~ /:|,/
|
144
|
+
alt = path.gsub(/(:|,)/, "__")
|
146
145
|
log.debug(log_key) { "Renaming #{path} to #{alt}" }
|
147
146
|
|
148
147
|
File.rename(path, alt) if File.exists?(path)
|
149
148
|
|
150
149
|
# Create a config script if needed based on resources/bff/config.erb
|
151
|
-
config_script_path = File.join(scripts_staging_dir,
|
150
|
+
config_script_path = File.join(scripts_staging_dir, "config")
|
152
151
|
unless File.exists? config_script_path
|
153
|
-
render_template(resource_path(
|
152
|
+
render_template(resource_path("config.erb"),
|
154
153
|
destination: "#{scripts_staging_dir}/config",
|
155
154
|
variables: {
|
156
|
-
name: project.name
|
155
|
+
name: project.name,
|
157
156
|
}
|
158
157
|
)
|
159
158
|
end
|
160
159
|
|
161
|
-
File.open(File.join(scripts_staging_dir,
|
160
|
+
File.open(File.join(scripts_staging_dir, "config"), "a") do |file|
|
162
161
|
file.puts "mv '#{alt.gsub(/^#{staging_dir}/, '')}' '#{path.gsub(/^#{staging_dir}/, '')}'"
|
163
162
|
end
|
164
163
|
|
165
164
|
path = alt
|
166
165
|
end
|
167
166
|
|
168
|
-
path.gsub(/^#{staging_dir}/,
|
167
|
+
path.gsub(/^#{staging_dir}/, "")
|
169
168
|
end
|
170
169
|
|
171
170
|
# Create a map of scripts that exist to inject into the template
|
172
171
|
scripts = SCRIPT_MAP.inject({}) do |hash, (script, installp_key)|
|
173
|
-
staging_path =
|
172
|
+
staging_path = File.join(scripts_staging_dir, script.to_s)
|
174
173
|
|
175
174
|
if File.file?(staging_path)
|
176
175
|
hash[installp_key] = staging_path
|
@@ -180,8 +179,8 @@ module Omnibus
|
|
180
179
|
hash
|
181
180
|
end
|
182
181
|
|
183
|
-
render_template(resource_path(
|
184
|
-
destination: File.join(staging_dir,
|
182
|
+
render_template(resource_path("gen.template.erb"),
|
183
|
+
destination: File.join(staging_dir, "gen.template"),
|
185
184
|
variables: {
|
186
185
|
name: safe_base_package_name,
|
187
186
|
install_dir: project.install_dir,
|
@@ -194,7 +193,7 @@ module Omnibus
|
|
194
193
|
)
|
195
194
|
|
196
195
|
# Print the full contents of the rendered template file for mkinstallp's use
|
197
|
-
log.debug(log_key) { "Rendered Template:\n" + File.read(File.join(staging_dir,
|
196
|
+
log.debug(log_key) { "Rendered Template:\n" + File.read(File.join(staging_dir, "gen.template")) }
|
198
197
|
end
|
199
198
|
|
200
199
|
#
|
@@ -233,7 +232,7 @@ module Omnibus
|
|
233
232
|
end
|
234
233
|
|
235
234
|
# Copy the resulting package up to the package_dir
|
236
|
-
FileSyncer.glob(File.join(staging_dir,
|
235
|
+
FileSyncer.glob(File.join(staging_dir, "tmp/*.bff")).each do |bff|
|
237
236
|
copy_file(bff, File.join(Config.package_dir, create_bff_file_name))
|
238
237
|
end
|
239
238
|
|
@@ -258,7 +257,6 @@ module Omnibus
|
|
258
257
|
"#{safe_base_package_name}-#{project.build_version}-#{project.build_iteration}.#{safe_architecture}.bff"
|
259
258
|
end
|
260
259
|
|
261
|
-
|
262
260
|
#
|
263
261
|
# Return the BFF-ready base package name, converting any invalid characters to
|
264
262
|
# dashes (+-+).
|
@@ -269,7 +267,7 @@ module Omnibus
|
|
269
267
|
if project.package_name =~ /\A[a-z0-9\.\+\-]+\z/
|
270
268
|
project.package_name.dup
|
271
269
|
else
|
272
|
-
converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/,
|
270
|
+
converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/, "-")
|
273
271
|
|
274
272
|
log.warn(log_key) do
|
275
273
|
"The `name' component of BFF package names can only include " \
|
@@ -293,7 +291,7 @@ module Omnibus
|
|
293
291
|
# @return [String]
|
294
292
|
#
|
295
293
|
def bff_version
|
296
|
-
version = project.build_version.split(/[^\d]/)[0..2].join(
|
294
|
+
version = project.build_version.split(/[^\d]/)[0..2].join(".")
|
297
295
|
"#{version}.#{project.build_iteration}"
|
298
296
|
end
|
299
297
|
|
@@ -303,7 +301,7 @@ module Omnibus
|
|
303
301
|
# @return [String]
|
304
302
|
#
|
305
303
|
def safe_architecture
|
306
|
-
Ohai[
|
304
|
+
Ohai["kernel"]["machine"]
|
307
305
|
end
|
308
306
|
end
|
309
307
|
end
|