omnibus 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  3. data/.travis.yml +2 -1
  4. data/CHANGELOG.md +37 -0
  5. data/Gemfile +5 -4
  6. data/MAINTAINERS.md +12 -17
  7. data/README.md +98 -107
  8. data/appveyor.yml +1 -1
  9. data/lib/omnibus.rb +4 -4
  10. data/lib/omnibus/builder.rb +42 -9
  11. data/lib/omnibus/cli.rb +5 -0
  12. data/lib/omnibus/cli/base.rb +1 -1
  13. data/lib/omnibus/cli/publish.rb +5 -3
  14. data/lib/omnibus/compressors/dmg.rb +2 -2
  15. data/lib/omnibus/config.rb +42 -5
  16. data/lib/omnibus/core_extensions/open_uri.rb +1 -0
  17. data/lib/omnibus/download_helpers.rb +4 -4
  18. data/lib/omnibus/fetchers/git_fetcher.rb +15 -5
  19. data/lib/omnibus/fetchers/net_fetcher.rb +1 -1
  20. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  21. data/lib/omnibus/file_syncer.rb +2 -2
  22. data/lib/omnibus/generator_files/omnibus.rb.erb +1 -0
  23. data/lib/omnibus/git_cache.rb +31 -13
  24. data/lib/omnibus/health_check.rb +1 -173
  25. data/lib/omnibus/licensing.rb +48 -7
  26. data/lib/omnibus/manifest.rb +3 -5
  27. data/lib/omnibus/manifest_entry.rb +1 -1
  28. data/lib/omnibus/metadata.rb +2 -1
  29. data/lib/omnibus/packager.rb +3 -1
  30. data/lib/omnibus/packagers/appx.rb +3 -3
  31. data/lib/omnibus/packagers/base.rb +9 -0
  32. data/lib/omnibus/packagers/bff.rb +4 -6
  33. data/lib/omnibus/packagers/deb.rb +95 -1
  34. data/lib/omnibus/packagers/ips.rb +50 -4
  35. data/lib/omnibus/packagers/pkgsrc.rb +112 -0
  36. data/lib/omnibus/packagers/rpm.rb +72 -3
  37. data/lib/omnibus/packagers/solaris.rb +0 -4
  38. data/lib/omnibus/packagers/windows_base.rb +1 -1
  39. data/lib/omnibus/project.rb +13 -3
  40. data/lib/omnibus/publishers/artifactory_publisher.rb +4 -6
  41. data/lib/omnibus/publishers/s3_publisher.rb +8 -3
  42. data/lib/omnibus/reports.rb +1 -1
  43. data/lib/omnibus/s3_cache.rb +18 -5
  44. data/lib/omnibus/s3_helpers.rb +45 -8
  45. data/lib/omnibus/software.rb +55 -37
  46. data/lib/omnibus/sugarable.rb +4 -0
  47. data/lib/omnibus/templating.rb +29 -13
  48. data/lib/omnibus/util.rb +81 -2
  49. data/lib/omnibus/version.rb +1 -1
  50. data/lib/omnibus/whitelist.rb +228 -0
  51. data/omnibus.gemspec +9 -8
  52. data/resources/dmg/create_dmg.osascript.erb +33 -13
  53. data/resources/ips/doc-transform.erb +2 -0
  54. data/resources/rpm/spec.erb +1 -2
  55. data/spec/functional/builder_spec.rb +21 -21
  56. data/spec/functional/fetchers/git_fetcher_spec.rb +6 -6
  57. data/spec/functional/fetchers/net_fetcher_spec.rb +7 -7
  58. data/spec/functional/fetchers/path_fetcher_spec.rb +5 -5
  59. data/spec/functional/file_syncer_spec.rb +6 -6
  60. data/spec/functional/licensing_spec.rb +29 -16
  61. data/spec/functional/templating_spec.rb +23 -22
  62. data/spec/support/git_helpers.rb +30 -24
  63. data/spec/unit/build_version_spec.rb +1 -1
  64. data/spec/unit/builder_spec.rb +36 -24
  65. data/spec/unit/changelogprinter_spec.rb +10 -8
  66. data/spec/unit/cleanroom_spec.rb +6 -6
  67. data/spec/unit/compressors/dmg_spec.rb +23 -37
  68. data/spec/unit/compressors/null_spec.rb +2 -2
  69. data/spec/unit/compressors/tgz_spec.rb +2 -2
  70. data/spec/unit/config_spec.rb +2 -1
  71. data/spec/unit/digestable_spec.rb +2 -2
  72. data/spec/unit/fetchers/git_fetcher_spec.rb +5 -5
  73. data/spec/unit/fetchers/net_fetcher_spec.rb +46 -6
  74. data/spec/unit/fetchers/path_fetcher_spec.rb +5 -5
  75. data/spec/unit/file_syncer_spec.rb +19 -0
  76. data/spec/unit/git_cache_spec.rb +76 -22
  77. data/spec/unit/health_check_spec.rb +1 -1
  78. data/spec/unit/library_spec.rb +2 -2
  79. data/spec/unit/manifest_spec.rb +6 -6
  80. data/spec/unit/metadata_spec.rb +4 -4
  81. data/spec/unit/omnibus_spec.rb +4 -4
  82. data/spec/unit/package_spec.rb +6 -6
  83. data/spec/unit/packagers/appx_spec.rb +16 -12
  84. data/spec/unit/packagers/base_spec.rb +5 -5
  85. data/spec/unit/packagers/bff_spec.rb +45 -15
  86. data/spec/unit/packagers/deb_spec.rb +95 -17
  87. data/spec/unit/packagers/ips_spec.rb +61 -17
  88. data/spec/unit/packagers/makeself_spec.rb +5 -5
  89. data/spec/unit/packagers/msi_spec.rb +43 -43
  90. data/spec/unit/packagers/pkg_spec.rb +15 -15
  91. data/spec/unit/packagers/pkgsrc_spec.rb +77 -0
  92. data/spec/unit/packagers/rpm_spec.rb +94 -17
  93. data/spec/unit/packagers/solaris_spec.rb +11 -11
  94. data/spec/unit/project_spec.rb +53 -22
  95. data/spec/unit/publisher_spec.rb +2 -2
  96. data/spec/unit/publishers/artifactory_publisher_spec.rb +7 -3
  97. data/spec/unit/publishers/s3_publisher_spec.rb +1 -1
  98. data/spec/unit/s3_helpers_spec.rb +41 -3
  99. data/spec/unit/software_spec.rb +115 -37
  100. data/spec/unit/sugarable_spec.rb +23 -3
  101. data/spec/unit/util_spec.rb +42 -11
  102. metadata +49 -29
@@ -34,6 +34,36 @@ module Omnibus
34
34
  environment: {},
35
35
  }.freeze
36
36
 
37
+ #
38
+ # The proper platform-specific "$PATH" key.
39
+ #
40
+ # @return [String]
41
+ #
42
+ def path_key
43
+ # The ruby devkit needs ENV['Path'] set instead of ENV['PATH'] because
44
+ # $WINDOWSRAGE, and if you don't set that your native gem compiles
45
+ # will fail because the magic fixup it does to add the mingw compiler
46
+ # stuff won't work.
47
+ #
48
+ # Turns out there is other build environments that only set ENV['PATH'] and if we
49
+ # modify ENV['Path'] then it ignores that. So, we scan ENV and returns the first
50
+ # one that we find.
51
+ #
52
+ if windows?
53
+ result = ENV.keys.grep(/\Apath\Z/i)
54
+ case result.length
55
+ when 0
56
+ raise "The current omnibus environment has no PATH"
57
+ when 1
58
+ result.first
59
+ else
60
+ raise "The current omnibus environment has multiple PATH/Path variables."
61
+ end
62
+ else
63
+ "PATH"
64
+ end
65
+ end
66
+
37
67
  #
38
68
  # Shells out and runs +command+.
39
69
  #
@@ -53,6 +83,14 @@ module Omnibus
53
83
  options = args.last.kind_of?(Hash) ? args.pop : {}
54
84
  options = SHELLOUT_OPTIONS.merge(options)
55
85
 
86
+ command_string = args.join(" ")
87
+ in_msys = options.delete(:in_msys_bash) && ENV["MSYSTEM"]
88
+ # Mixlib will handle escaping characters for cmd but our command might
89
+ # contain '. For now, assume that won't happen because I don't know
90
+ # whether this command is going to be played via cmd or through
91
+ # ProcessCreate.
92
+ command_string = "bash -c \'#{command_string}\'" if in_msys
93
+
56
94
  # Grab the log_level
57
95
  log_level = options.delete(:log_level)
58
96
 
@@ -74,9 +112,9 @@ module Omnibus
74
112
  end
75
113
 
76
114
  # Log the actual command
77
- log.public_send(log_level, log_key) { "$ #{args.join(' ')}" }
115
+ log.public_send(log_level, log_key) { "$ #{command_string}" }
78
116
 
79
- cmd = Mixlib::ShellOut.new(*args, options)
117
+ cmd = Mixlib::ShellOut.new(command_string, options)
80
118
  cmd.environment["HOME"] = "/tmp" unless ENV["HOME"]
81
119
  cmd.run_command
82
120
  cmd
@@ -103,6 +141,33 @@ module Omnibus
103
141
  raise CommandTimeout.new(cmd)
104
142
  end
105
143
 
144
+ #
145
+ # Retry the given block if a retriable exception is
146
+ # raised. Returns the value of the block call if successful.
147
+ #
148
+ # @param [String] logstr
149
+ # Description of the action being retried. Used in log output.
150
+ #
151
+ # @param [Array<Exception>] retried_exceptions
152
+ # List of exceptions to retry. Any other exceptions are raisesd.
153
+ #
154
+ # @param [Integer] retries
155
+ # Number of times to retry the given block.
156
+ #
157
+ def retry_block(logstr, retried_exceptions = [], retries = Omnibus::Config.fetcher_retries, &block)
158
+ yield
159
+ rescue Exception => e
160
+ raise e unless retried_exceptions.any? { |eclass| e.is_a?(eclass) }
161
+ if retries != 0
162
+ log.info(log_key) { "Retrying failed #{logstr} due to #{e} (#{retries} retries left)..." }
163
+ retries -= 1
164
+ retry
165
+ else
166
+ log.error(log_key) { "#{logstr} failed - #{e.class}!" }
167
+ raise
168
+ end
169
+ end
170
+
106
171
  #
107
172
  # Convert the given path to be appropiate for shelling out on Windows.
108
173
  #
@@ -121,6 +186,20 @@ module Omnibus
121
186
  end
122
187
  end
123
188
 
189
+ #
190
+ # Convert the given path to be appropriate for usage with the given compiler
191
+ #
192
+ # @param [String, Array<String>] pieces
193
+ # the pieces of the path to join and fix
194
+ # @return [String]
195
+ # the path with applied changes
196
+ #
197
+ def compiler_safe_path(*pieces)
198
+ path = File.join(*pieces)
199
+ path = path.sub(/^([A-Za-z]):\//, "/\\1/") if ENV["MSYSTEM"]
200
+ path
201
+ end
202
+
124
203
  #
125
204
  # Create a directory at the given +path+.
126
205
  #
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Omnibus
18
- VERSION = "5.5.0"
18
+ VERSION = "5.6.0"
19
19
  end
@@ -0,0 +1,228 @@
1
+
2
+ # Copyright 2012-2014 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
+ WHITELIST_LIBS = [
18
+ /ld-linux/,
19
+ /libc\.so/,
20
+ /libcrypt\.so/,
21
+ /libdl/,
22
+ /libfreebl\d\.so/,
23
+ /libgcc_s\.so/,
24
+ /libm\.so/,
25
+ /libnsl\.so/,
26
+ /libpthread/,
27
+ /libresolv\.so/,
28
+ /librt\.so/,
29
+ /libstdc\+\+\.so/,
30
+ /libutil\.so/,
31
+ /linux-vdso.+/,
32
+ /linux-gate\.so/,
33
+ ].freeze
34
+
35
+ ARCH_WHITELIST_LIBS = [
36
+ /libc\.so/,
37
+ /libcrypt\.so/,
38
+ /libdb-5\.3\.so/,
39
+ /libdl\.so/,
40
+ /libffi\.so/,
41
+ /libgdbm\.so/,
42
+ /libm\.so/,
43
+ /libnsl\.so/,
44
+ /libpthread\.so/,
45
+ /librt\.so/,
46
+ /libutil\.so/,
47
+ ].freeze
48
+
49
+ AIX_WHITELIST_LIBS = [
50
+ /libpthread\.a/,
51
+ /libpthreads\.a/,
52
+ /libdl.a/,
53
+ /librtl\.a/,
54
+ /libc\.a/,
55
+ /libcrypt\.a/,
56
+ /unix$/,
57
+ ].freeze
58
+
59
+ SOLARIS_WHITELIST_LIBS = [
60
+ /libaio\.so/,
61
+ /libavl\.so/,
62
+ /libcrypt_[di]\.so/,
63
+ /libcrypto.so/,
64
+ /libcurses\.so/,
65
+ /libdoor\.so/,
66
+ /libgen\.so/,
67
+ /libmd5\.so/,
68
+ /libmd\.so/,
69
+ /libmp\.so/,
70
+ /libresolv\.so/,
71
+ /libscf\.so/,
72
+ /libsec\.so/,
73
+ /libsocket\.so/,
74
+ /libssl.so/,
75
+ /libthread.so/,
76
+ /libuutil\.so/,
77
+ /libkstat\.so/,
78
+ # solaris 11 libraries:
79
+ /libc\.so\.1/,
80
+ /libm\.so\.2/,
81
+ /libdl\.so\.1/,
82
+ /libnsl\.so\.1/,
83
+ /libpthread\.so\.1/,
84
+ /librt\.so\.1/,
85
+ /libcrypt\.so\.1/,
86
+ /libgdbm\.so\.3/,
87
+ /libgcc_s\.so\.1/,
88
+ /libcryptoutil\.so\.1/,
89
+ /libucrypto\.so\.1/,
90
+ /libz\.so\.1/, # while we package our own libz, this get dragged along from Solaris 11's libelf library for some reason...
91
+ /libelf\.so\.1/,
92
+ /libssp\.so\.0/,
93
+ # solaris 9 libraries:
94
+ /libm\.so\.1/,
95
+ /libc_psr\.so\.1/,
96
+ /s9_preload\.so\.1/,
97
+ ].freeze
98
+
99
+ SMARTOS_WHITELIST_LIBS = [
100
+ /libm.so/,
101
+ /libpthread.so/,
102
+ /librt.so/,
103
+ /libsocket.so/,
104
+ /libdl.so/,
105
+ /libnsl.so/,
106
+ /libgen.so/,
107
+ /libmp.so/,
108
+ /libmd.so/,
109
+ /libc.so/,
110
+ /libgcc_s.so/,
111
+ /libstdc\+\+\.so/,
112
+ /libcrypt.so/,
113
+ /libcrypto.so/,
114
+ /libssl.so/,
115
+ /libssp\.so/,
116
+ /libumem\.so/,
117
+ /libffi\.so/,
118
+ /libz\.so/, # while we package our own libz, this get dragged along from Solaris 11's libelf library for some reason...
119
+ ].freeze
120
+
121
+ MAC_WHITELIST_LIBS = [
122
+ /libobjc\.A\.dylib/,
123
+ /libSystem\.B\.dylib/,
124
+ /CoreFoundation/,
125
+ /CoreServices/,
126
+ /Tcl$/,
127
+ /Cocoa$/,
128
+ /Carbon$/,
129
+ /IOKit$/,
130
+ /Tk$/,
131
+ /libutil\.dylib/,
132
+ /libffi\.dylib/,
133
+ /libncurses\.5\.4\.dylib/,
134
+ /libiconv/,
135
+ /libstdc\+\+\.6\.dylib/,
136
+ /libc\+\+\.1\.dylib/,
137
+ ].freeze
138
+
139
+ FREEBSD_WHITELIST_LIBS = [
140
+ /libc\.so/,
141
+ /libgcc_s\.so/,
142
+ /libcrypt\.so/,
143
+ /libm\.so/,
144
+ /librt\.so/,
145
+ /libthr\.so/,
146
+ /libutil\.so/,
147
+ /libelf\.so/,
148
+ /libkvm\.so/,
149
+ /libprocstat\.so/,
150
+ /libmd\.so/,
151
+ ].freeze
152
+
153
+ IGNORED_ENDINGS = %w{
154
+ .TXT
155
+ .[ch]
156
+ .[ch]pp
157
+ .[eh]rl
158
+ .app
159
+ .appup
160
+ .bat
161
+ .beam
162
+ .cc
163
+ .cmake
164
+ .conf
165
+ .css
166
+ .e*rb
167
+ .feature
168
+ .gemspec
169
+ .gif
170
+ .gitignore
171
+ .gitkeep
172
+ .h*h
173
+ .jar
174
+ .java
175
+ .jpg
176
+ .js
177
+ .jsm
178
+ .json
179
+ .lock
180
+ .log
181
+ .lua
182
+ .md
183
+ .mkd
184
+ .npmignore
185
+ .out
186
+ .packlist
187
+ .perl
188
+ .pl
189
+ .pm
190
+ .png
191
+ .pod
192
+ .properties
193
+ .py[oc]*
194
+ .r*html
195
+ .rake
196
+ .rdoc
197
+ .ri
198
+ .rst
199
+ .scss
200
+ .sh
201
+ .sql
202
+ .svg
203
+ .toml
204
+ .ttf
205
+ .txt
206
+ .xml
207
+ .yml
208
+ Gemfile
209
+ LICENSE
210
+ Makefile
211
+ README
212
+ Rakefile
213
+ VERSION
214
+ license
215
+ }.freeze
216
+
217
+ IGNORED_PATTERNS = %w{
218
+ /build_info/
219
+ /licenses/
220
+ /LICENSES/
221
+ /man/
222
+ /share/doc/
223
+ /share/info/
224
+ /share/postgresql/
225
+ /share/terminfo/
226
+ /share/timezone/
227
+ /terminfo/
228
+ }.freeze
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.description = gem.summary
14
14
  gem.homepage = "https://github.com/opscode/omnibus"
15
15
 
16
- gem.required_ruby_version = ">= 2.1"
16
+ gem.required_ruby_version = ">= 2.2"
17
17
 
18
18
  gem.files = `git ls-files`.split($/)
19
19
  gem.bindir = "bin"
@@ -21,24 +21,25 @@ Gem::Specification.new do |gem|
21
21
  gem.test_files = gem.files.grep(/^(test|spec|features)\//)
22
22
  gem.require_paths = ["lib"]
23
23
 
24
- # https://github.com/ksubrama/pedump, branch 'patch-1'
25
- # is declared in the Gemfile because of its outdated
26
- # dependency on multipart-post (~> 1.1.4)
24
+ gem.add_dependency "aws-sdk", "~> 2"
27
25
  gem.add_dependency "chef-sugar", "~> 3.3"
28
26
  gem.add_dependency "cleanroom", "~> 1.0"
27
+ gem.add_dependency "ffi-yajl", "~> 2.2"
29
28
  gem.add_dependency "mixlib-shellout", "~> 2.0"
30
- gem.add_dependency "mixlib-versioning"
31
29
  gem.add_dependency "ohai", "~> 8.0"
32
30
  gem.add_dependency "ruby-progressbar", "~> 1.7"
33
- gem.add_dependency "aws-sdk", "~> 2"
34
31
  gem.add_dependency "thor", "~> 0.18"
35
- gem.add_dependency "ffi-yajl", "~> 2.2"
32
+
33
+ gem.add_dependency "mixlib-versioning"
34
+ gem.add_dependency "pedump"
35
+
36
+ # from Gemfile
36
37
  gem.add_dependency "license_scout"
37
38
 
38
39
  gem.add_development_dependency "bundler"
39
40
  gem.add_development_dependency "artifactory", "~> 2.0"
40
41
  gem.add_development_dependency "aruba", "~> 0.5"
41
- gem.add_development_dependency "chefstyle", "~> 0.3"
42
+ gem.add_development_dependency "chefstyle"
42
43
  gem.add_development_dependency "fauxhai", "~> 3.2"
43
44
  gem.add_development_dependency "rspec", "~> 3.0"
44
45
  gem.add_development_dependency "rspec-json_expectations"
@@ -1,17 +1,37 @@
1
+ # find disks that start with <%= volume_name %>
2
+ set found_disk to do shell script "ls /Volumes/ | grep '<%= volume_name %>*'"
3
+
4
+ if found_disk is {} then
5
+ set errormsg to "Disk " & found_disk & " not found"
6
+ error errormsg
7
+ end if
8
+
1
9
  tell application "Finder"
2
- tell disk "<%= volume_name %>"
3
- open
4
- set current view of container window to icon view
5
- set toolbar visible of container window to false
6
- set statusbar visible of container window to false
7
- set the bounds of container window to {<%= window_bounds %>}
8
- set theViewOptions to the icon view options of container window
9
- set arrangement of theViewOptions to not arranged
10
- set icon size of theViewOptions to 72
10
+ # In case finder has been closed somehow
11
+ reopen
12
+ # Reactivate it in case it is "out of focus"
13
+ activate
14
+ # Deactivate any current selections
15
+ set selection to {}
16
+ # Set it to the location of the proper volume
17
+ set target of Finder window 1 to found_disk
18
+ # We like icons
19
+ set current view of Finder window 1 to icon view
20
+ # No toolbar or statusbar
21
+ set toolbar visible of Finder window 1 to false
22
+ set statusbar visible of Finder window 1 to false
23
+ # How big and where does it live on the desktop
24
+ set the bounds of Finder window 1 to {<%= window_bounds %>}
25
+ # We now talk to the disk object that is a subset of the "Finder"
26
+ tell disk found_disk
27
+ # Pull the view options from the Icon View object
28
+ # The container window is how we grab hold of the "Finder" window in the
29
+ # context of the disk object (the disk object is a sub-thing of the app)
30
+ set theViewOptions to the icon view options of container window
11
31
  set background picture of theViewOptions to file ".support:background.png"
12
- delay 5
13
- set position of item "<%= pkg_name %>" of container window to {<%= pkg_position %>}
14
- update without registering applications
15
- delay 5
32
+ set arrangement of theViewOptions to not arranged
33
+ set icon size of theViewOptions to 72
34
+ set position of item "<%= pkg_name %>" of container window to {<%= pkg_position %>}
35
+ update without registering applications
16
36
  end tell
17
37
  end tell
@@ -1,2 +1,4 @@
1
1
  <transform dir path=<%= pathdir %>$ -> edit group bin sys>
2
2
  <transform file depend -> edit pkg.debug.depend.file ruby env>
3
+ <transform file depend -> edit pkg.debug.depend.file make env>
4
+ <transform file depend -> edit pkg.debug.depend.file perl env>