omnibus 3.2.0.rc.3 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.md +21 -19
- data/README.md +5 -5
- data/lib/omnibus/builder.rb +177 -10
- data/lib/omnibus/config.rb +16 -7
- data/lib/omnibus/exceptions.rb +0 -14
- data/lib/omnibus/package.rb +42 -25
- data/lib/omnibus/project.rb +1 -1
- data/lib/omnibus/publishers/artifactory_publisher.rb +2 -34
- data/lib/omnibus/util.rb +0 -18
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +5 -5
- data/spec/data/complicated/config/projects/chef-windows.rb +1 -1
- data/spec/data/complicated/config/projects/chefdk-windows.rb +1 -1
- data/spec/data/complicated/config/software/cacerts.rb +3 -3
- data/spec/data/complicated/config/software/chef-client-msi.rb +1 -2
- data/spec/data/complicated/config/software/chef-windows.rb +2 -2
- data/spec/data/complicated/config/software/chef.rb +2 -2
- data/spec/data/complicated/config/software/chefdk.rb +1 -1
- data/spec/data/complicated/config/software/openssl.rb +1 -1
- data/spec/data/complicated/config/software/ruby.rb +1 -1
- data/spec/functional/builder_spec.rb +238 -0
- data/spec/unit/builder_spec.rb +2 -0
- data/spec/unit/config_spec.rb +9 -9
- data/spec/unit/package_spec.rb +8 -0
- data/spec/unit/publishers/artifactory_publisher_spec.rb +4 -9
- data/spec/unit/publishers/s3_publisher_spec.rb +0 -12
- metadata +43 -42
- data/NOTICE +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDQ2ZjE2OWViMWMxZGQ1NjIyOGRkZTc5ZGVmNTVlMTVlYmY4Njk0MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmM1ODJlYTM0MzU2M2Y4NzI0ZmVlNTQ0NjFkMDExNDE3ODg2M2FjMA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDQzMjQ2MDk0MDU5NmFhMDczZDNiZTYwZjk3NDE3ZGY5NDU3MjYxYmVhNzUw
|
10
|
+
ZGQxNGQ3YWE2NjFiNWFhYzUxOTM4ZjEwYzcxMjVmY2U2NmU0ZTNjODYwOGZj
|
11
|
+
NTdhNzAxMjZhNjcyNjQzMWU0ZjVkODAzM2M4ZTRjMTU0ZWIxNTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTdiYmVlYmExNzk2NTg4ODAwYjQxNGQ4YWZkOGZiNDlhZmNiZjMwNjA0MTI0
|
14
|
+
OWE4NzljZmI3MTM2MTllZDgyMGM4ZGJmNTdiMzhkNTNjMWMwOTFkYmU0Zjdm
|
15
|
+
ZTdlOWZmYTY4OWY5NjAzYTg0MGY2NjdjNTA0MzA5Y2Y5NDIzNTk=
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Omnibus Ruby CHANGELOG
|
2
2
|
======================
|
3
3
|
|
4
|
-
v3.2.0
|
5
|
-
|
4
|
+
v3.2.0 (July 23, 2014)
|
5
|
+
----------------------
|
6
6
|
- Make build commands output during `log.info` instead of `log.debug`
|
7
7
|
- Refactor Chef Sugar into an includable module, permitting DSL methods in both Software and Project definitions
|
8
8
|
- Refactor `omnibus release` into a non-S3-specific backend "publisher"
|
@@ -48,7 +48,7 @@ v3.2.0.rc.3 (July 21, 2014)
|
|
48
48
|
- Add `with_embedded_path` to software
|
49
49
|
- Add `with_standard_compiler_flags` to software
|
50
50
|
- Add `package_scripts_path` to project
|
51
|
-
- Add builder DSL methods for `mkdir`, `touch`, `delete`, `copy`, `move`, and `
|
51
|
+
- Add builder DSL methods for `mkdir`, `touch`, `delete`, `copy`, `move`, `link`, and `sync`
|
52
52
|
|
53
53
|
### Bug fixes
|
54
54
|
- Fix a small typo in the project generator (come -> some)
|
@@ -70,6 +70,7 @@ v3.2.0.rc.3 (July 21, 2014)
|
|
70
70
|
- Require `net/http`, `net/https`, and `net/ftp` in the base fetcher module
|
71
71
|
- Use -R, not -W1 on FreeBSD's compile flags
|
72
72
|
- Expand all paths relative to the project_root
|
73
|
+
- Unset all Ruby, Bundler, amd Gem-related environment variables before shelling out
|
73
74
|
- Various documentation fixes and updates
|
74
75
|
|
75
76
|
### Potentially breaking changes
|
@@ -80,6 +81,7 @@ v3.2.0.rc.3 (July 21, 2014)
|
|
80
81
|
- Remove the ability to use an overrides file - this was for internal use only and was never exposed as a public API. However, if you dug into the code and found it, it has now been removed. For BC purposes, the value still exists in the configuration object, but is essentially a no-op
|
81
82
|
- Move project loading from INFO to DEBUG
|
82
83
|
- Truncate platforms to short versions
|
84
|
+
- All paths are represented internally as Unix-style paths - previously Omnibus would try to intelligently build your paths differently on Windows for the purposes of shelling out to the system. This proved to be unmaintainable and makes Ruby very unhappy in most circumsatances. As such, we have exposed the `windows_safe_path` method in the Builder DSL that will convert a string to a "Windows-safe path". This is only needed when shelling out to the system.
|
83
85
|
|
84
86
|
|
85
87
|
v3.1.1 (May 20, 2014)
|
@@ -321,22 +323,22 @@ BUG FIXES:
|
|
321
323
|
- The initial release.
|
322
324
|
|
323
325
|
<!--- The following link definition list is generated by PimpMyChangelog --->
|
324
|
-
[#63]: https://github.com/opscode/omnibus
|
325
|
-
[#67]: https://github.com/opscode/omnibus
|
326
|
-
[#70]: https://github.com/opscode/omnibus
|
327
|
-
[#71]: https://github.com/opscode/omnibus
|
328
|
-
[#72]: https://github.com/opscode/omnibus
|
329
|
-
[#73]: https://github.com/opscode/omnibus
|
330
|
-
[#74]: https://github.com/opscode/omnibus
|
331
|
-
[#77]: https://github.com/opscode/omnibus
|
332
|
-
[#78]: https://github.com/opscode/omnibus
|
333
|
-
[#79]: https://github.com/opscode/omnibus
|
334
|
-
[#80]: https://github.com/opscode/omnibus
|
335
|
-
[#81]: https://github.com/opscode/omnibus
|
336
|
-
[#82]: https://github.com/opscode/omnibus
|
337
|
-
[#83]: https://github.com/opscode/omnibus
|
338
|
-
[#85]: https://github.com/opscode/omnibus
|
339
|
-
[#86]: https://github.com/opscode/omnibus
|
326
|
+
[#63]: https://github.com/opscode/omnibus/issues/63
|
327
|
+
[#67]: https://github.com/opscode/omnibus/issues/67
|
328
|
+
[#70]: https://github.com/opscode/omnibus/issues/70
|
329
|
+
[#71]: https://github.com/opscode/omnibus/issues/71
|
330
|
+
[#72]: https://github.com/opscode/omnibus/issues/72
|
331
|
+
[#73]: https://github.com/opscode/omnibus/issues/73
|
332
|
+
[#74]: https://github.com/opscode/omnibus/issues/74
|
333
|
+
[#77]: https://github.com/opscode/omnibus/issues/77
|
334
|
+
[#78]: https://github.com/opscode/omnibus/issues/78
|
335
|
+
[#79]: https://github.com/opscode/omnibus/issues/79
|
336
|
+
[#80]: https://github.com/opscode/omnibus/issues/80
|
337
|
+
[#81]: https://github.com/opscode/omnibus/issues/81
|
338
|
+
[#82]: https://github.com/opscode/omnibus/issues/82
|
339
|
+
[#83]: https://github.com/opscode/omnibus/issues/83
|
340
|
+
[#85]: https://github.com/opscode/omnibus/issues/85
|
341
|
+
[#86]: https://github.com/opscode/omnibus/issues/86
|
340
342
|
[@benjaminws]: https://github.com/benjaminws
|
341
343
|
[@christophergeers]: https://github.com/christophergeers
|
342
344
|
[@christophermaier]: https://github.com/christophermaier
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
![Omnibus Icon](lib/omnibus/assets/README-logo.png) Omnibus
|
2
2
|
===========================================================
|
3
3
|
[![Gem Version](http://img.shields.io/gem/v/omnibus.svg)][gem]
|
4
|
-
[![Build Status](http://img.shields.io/travis/opscode/omnibus
|
4
|
+
[![Build Status](http://img.shields.io/travis/opscode/omnibus.svg)][travis]
|
5
5
|
|
6
6
|
[gem]: https://rubygems.org/gems/omnibus
|
7
|
-
[travis]: http://travis-ci.org/opscode/omnibus
|
7
|
+
[travis]: http://travis-ci.org/opscode/omnibus
|
8
8
|
|
9
9
|
Easily create full-stack installers for your project across a variety of platforms.
|
10
10
|
|
@@ -81,7 +81,7 @@ s3_secret_key ENV['S3_SECRET_KEY']
|
|
81
81
|
s3_bucket ENV['S3_BUCKET']
|
82
82
|
```
|
83
83
|
|
84
|
-
For more information, please see the [`Config` documentation](http://rubydoc.info/github/opscode/omnibus
|
84
|
+
For more information, please see the [`Config` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Config).
|
85
85
|
|
86
86
|
You can tell Omnibus to load a difference configuration file by passing the `--config` option to any command:
|
87
87
|
|
@@ -122,7 +122,7 @@ Some DSL methods available include:
|
|
122
122
|
| `build_iteration` | The package iteration number |
|
123
123
|
| `dependency` | An Omnibus software-defined component to include in this package |
|
124
124
|
|
125
|
-
For more information, please see the [`Project` documentation](http://rubydoc.info/github/opscode/omnibus
|
125
|
+
For more information, please see the [`Project` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Project).
|
126
126
|
|
127
127
|
|
128
128
|
### Software
|
@@ -183,7 +183,7 @@ end
|
|
183
183
|
|
184
184
|
Since the software definitions are simply ruby code, you can conditionally execute anything by wrapping it with pure Ruby that tests for the version number.
|
185
185
|
|
186
|
-
For more DSL methods, please consult the [`Software` documentation](http://rubydoc.info/github/opscode/omnibus
|
186
|
+
For more DSL methods, please consult the [`Software` documentation](http://rubydoc.info/github/opscode/omnibus/Omnibus/Software).
|
187
187
|
|
188
188
|
#### Sharing software definitions
|
189
189
|
The easiest way to share organization-wide software is via bundler and Rubygems. For an example software repository, look at Chef's [omnibus-software](https://github.com/opscode/omnibus-software). For more information, please see the [Rubygems documentation](http://guides.rubygems.org/publishing/).
|
data/lib/omnibus/builder.rb
CHANGED
@@ -15,11 +15,15 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require 'fileutils'
|
18
|
-
require 'ostruct'
|
19
18
|
require 'mixlib/shellout'
|
19
|
+
require 'ostruct'
|
20
|
+
require 'pathname'
|
20
21
|
|
21
22
|
module Omnibus
|
22
23
|
class Builder
|
24
|
+
# Files to be ignored during a directory globbing
|
25
|
+
IGNORED_FILES = %w(. ..).freeze
|
26
|
+
|
23
27
|
include Cleanroom
|
24
28
|
include Digestable
|
25
29
|
include Instrumentation
|
@@ -152,6 +156,30 @@ module Omnibus
|
|
152
156
|
end
|
153
157
|
expose :max_build_jobs
|
154
158
|
|
159
|
+
#
|
160
|
+
# Convert the given path to be appropiate for shelling out on Windows. Most
|
161
|
+
# internal calls will wrap paths automatically, but the +command+ method is
|
162
|
+
# unable to do so.
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# command "#{windows_safe_path(install_dir)}\\embedded\\bin\\gem"
|
166
|
+
#
|
167
|
+
# @param [String, Array<String>] pieces
|
168
|
+
# the pieces of the path to join and fix
|
169
|
+
# @return [String]
|
170
|
+
# the path with applied changes
|
171
|
+
#
|
172
|
+
def windows_safe_path(*pieces)
|
173
|
+
path = File.join(*pieces)
|
174
|
+
|
175
|
+
if File::ALT_SEPARATOR
|
176
|
+
path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
|
177
|
+
else
|
178
|
+
path
|
179
|
+
end
|
180
|
+
end
|
181
|
+
expose :windows_safe_path
|
182
|
+
|
155
183
|
#
|
156
184
|
# @!endgroup
|
157
185
|
# --------------------------------------------------
|
@@ -354,7 +382,8 @@ module Omnibus
|
|
354
382
|
expose :mkdir
|
355
383
|
|
356
384
|
#
|
357
|
-
# Touch the given filepath at runtime.
|
385
|
+
# Touch the given filepath at runtime. This method will also ensure the
|
386
|
+
# containing directory exists first.
|
358
387
|
#
|
359
388
|
# @param [String] file
|
360
389
|
# the path of the file to touch
|
@@ -365,6 +394,9 @@ module Omnibus
|
|
365
394
|
def touch(file, options = {})
|
366
395
|
build_commands << BuildCommand.new("touch `#{file}'") do
|
367
396
|
Dir.chdir(software.install_dir) do
|
397
|
+
parent = File.dirname(file)
|
398
|
+
FileUtils.mkdir_p(parent) unless File.directory?(parent)
|
399
|
+
|
368
400
|
FileUtils.touch(file, options)
|
369
401
|
end
|
370
402
|
end
|
@@ -373,7 +405,8 @@ module Omnibus
|
|
373
405
|
|
374
406
|
#
|
375
407
|
# Delete the given file or directory on the system. This method uses the
|
376
|
-
# equivalent of +rm -rf
|
408
|
+
# equivalent of +rm -rf+, so you may pass in a specific file or a glob of
|
409
|
+
# files.
|
377
410
|
#
|
378
411
|
# @param [String] path
|
379
412
|
# the path of the file to delete
|
@@ -384,14 +417,17 @@ module Omnibus
|
|
384
417
|
def delete(path, options = {})
|
385
418
|
build_commands << BuildCommand.new("delete `#{path}'") do
|
386
419
|
Dir.chdir(software.install_dir) do
|
387
|
-
|
420
|
+
glob(path).each do |file|
|
421
|
+
FileUtils.rm_rf(file, options)
|
422
|
+
end
|
388
423
|
end
|
389
424
|
end
|
390
425
|
end
|
391
426
|
expose :delete
|
392
427
|
|
393
428
|
#
|
394
|
-
# Copy the given source to the destination.
|
429
|
+
# Copy the given source to the destination. This method accepts a single
|
430
|
+
# file or a file pattern to match.
|
395
431
|
#
|
396
432
|
# @param [String] source
|
397
433
|
# the path on disk to copy from
|
@@ -404,14 +440,17 @@ module Omnibus
|
|
404
440
|
def copy(source, destination, options = {})
|
405
441
|
build_commands << BuildCommand.new("copy `#{source}' to `#{destination}'") do
|
406
442
|
Dir.chdir(software.install_dir) do
|
407
|
-
|
443
|
+
glob(source).each do |file|
|
444
|
+
FileUtils.cp_r(file, destination, options)
|
445
|
+
end
|
408
446
|
end
|
409
447
|
end
|
410
448
|
end
|
411
449
|
expose :copy
|
412
450
|
|
413
451
|
#
|
414
|
-
# Copy the given source to the destination.
|
452
|
+
# Copy the given source to the destination. This method accepts a single
|
453
|
+
# file or a file pattern to match
|
415
454
|
#
|
416
455
|
# @param [String] source
|
417
456
|
# the path on disk to move from
|
@@ -424,14 +463,17 @@ module Omnibus
|
|
424
463
|
def move(source, destination, options = {})
|
425
464
|
build_commands << BuildCommand.new("move `#{source}' to `#{destination}'") do
|
426
465
|
Dir.chdir(software.install_dir) do
|
427
|
-
|
466
|
+
glob(source).each do |file|
|
467
|
+
FileUtils.mv(file, destination, options)
|
468
|
+
end
|
428
469
|
end
|
429
470
|
end
|
430
471
|
end
|
431
472
|
expose :move
|
432
473
|
|
433
474
|
#
|
434
|
-
# Link the given source to the destination.
|
475
|
+
# Link the given source to the destination. This method accepts a single
|
476
|
+
# file or a file pattern to match
|
435
477
|
#
|
436
478
|
# @param [String] source
|
437
479
|
# the path on disk to link from
|
@@ -444,12 +486,88 @@ module Omnibus
|
|
444
486
|
def link(source, destination, options = {})
|
445
487
|
build_commands << BuildCommand.new("link `#{source}' to `#{destination}'") do
|
446
488
|
Dir.chdir(software.install_dir) do
|
447
|
-
|
489
|
+
glob(source).each do |file|
|
490
|
+
FileUtils.ln_s(file, destination, options)
|
491
|
+
end
|
448
492
|
end
|
449
493
|
end
|
450
494
|
end
|
451
495
|
expose :link
|
452
496
|
|
497
|
+
#
|
498
|
+
# Copy the files from +source+ to +destination+, while removing any files
|
499
|
+
# in +destination+ that are not present in +source+.
|
500
|
+
#
|
501
|
+
# You can pass the option +:exclude+ option to ignore files and folders that
|
502
|
+
# match the given pattern(s). Note the exclude pattern behaves on paths
|
503
|
+
# relative to the given source. If you want to exclude a nested directory,
|
504
|
+
# you will need to use something like +**/directory+.
|
505
|
+
#
|
506
|
+
# @example
|
507
|
+
# sync "#{project_dir}/**/*.rb", "#{install_dir}/ruby_files"
|
508
|
+
#
|
509
|
+
# @example
|
510
|
+
# sync project_dir, "#{install_dir}/files", exclude: '.git'
|
511
|
+
#
|
512
|
+
# @param [String] source
|
513
|
+
# the path on disk to sync from
|
514
|
+
# @param [String] destination
|
515
|
+
# the path on disk to sync to
|
516
|
+
#
|
517
|
+
# @option options [String, Array<String>] :exclude
|
518
|
+
# a file, folder, or globbing pattern of files to ignore when syncing
|
519
|
+
#
|
520
|
+
# @return (see #command)
|
521
|
+
#
|
522
|
+
def sync(source, destination, options = {})
|
523
|
+
build_commands << BuildCommand.new("sync `#{source}' to `#{destination}'") do
|
524
|
+
Dir.chdir(software.install_dir) do
|
525
|
+
# The source must be a destination in the sync command
|
526
|
+
unless File.directory?(source)
|
527
|
+
raise ArgumentError, "`source' must be a directory, but was a " \
|
528
|
+
"`#{File.ftype(source)}'! If you just want to sync a file, use " \
|
529
|
+
"the `copy' method instead."
|
530
|
+
end
|
531
|
+
|
532
|
+
# Reject any files that match the excludes pattern
|
533
|
+
excludes = Array(options[:exclude]).map do |exclude|
|
534
|
+
[exclude, "#{exclude}/*"]
|
535
|
+
end.flatten
|
536
|
+
|
537
|
+
source_files = all_files(source)
|
538
|
+
source_files = source_files.reject do |source_file|
|
539
|
+
basename = relative_path_for(source_file, source)
|
540
|
+
excludes.any? { |exclude| File.fnmatch?(exclude, basename, File::FNM_DOTMATCH) }
|
541
|
+
end
|
542
|
+
|
543
|
+
# Ensure the destination directory exists
|
544
|
+
FileUtils.mkdir_p(destination) unless File.directory?(destination)
|
545
|
+
|
546
|
+
# Copy over the filtered source files
|
547
|
+
FileUtils.cp_r(source_files, destination)
|
548
|
+
|
549
|
+
# Remove any files in the destination that are not in the source files
|
550
|
+
destination_files = all_files(destination)
|
551
|
+
|
552
|
+
# Calculate the relative paths of files so we can compare to the
|
553
|
+
# source.
|
554
|
+
relative_source_files = source_files.map do |file|
|
555
|
+
relative_path_for(file, source)
|
556
|
+
end
|
557
|
+
relative_destination_files = destination_files.map do |file|
|
558
|
+
relative_path_for(file, destination)
|
559
|
+
end
|
560
|
+
|
561
|
+
# Remove any extra files that are present in the destination, but are
|
562
|
+
# not in the source list
|
563
|
+
extra_files = relative_destination_files - relative_source_files
|
564
|
+
extra_files.each do |file|
|
565
|
+
FileUtils.rm_rf(File.join(destination, file))
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
453
571
|
#
|
454
572
|
# @!endgroup
|
455
573
|
# --------------------------------------------------
|
@@ -701,6 +819,38 @@ module Omnibus
|
|
701
819
|
[candidate_paths, file]
|
702
820
|
end
|
703
821
|
|
822
|
+
#
|
823
|
+
# Get all the regular files and directories at the given path. It is assumed
|
824
|
+
# this path is a fully-qualified path and/or executed from a proper relative
|
825
|
+
# path.
|
826
|
+
#
|
827
|
+
# @param [String] path
|
828
|
+
# the path to get all files from
|
829
|
+
#
|
830
|
+
# @return [Array<String>]
|
831
|
+
# the list of all files
|
832
|
+
#
|
833
|
+
def all_files(path)
|
834
|
+
Dir.glob("#{path}/**/*", File::FNM_DOTMATCH).reject do |file|
|
835
|
+
basename = File.basename(file)
|
836
|
+
IGNORED_FILES.include?(basename)
|
837
|
+
end
|
838
|
+
end
|
839
|
+
|
840
|
+
#
|
841
|
+
# The relative path of the given +path+ to the +parent+.
|
842
|
+
#
|
843
|
+
# @param [String] path
|
844
|
+
# the path to get relative with
|
845
|
+
# @param [String] parent
|
846
|
+
# the parent where the path is contained (hopefully)
|
847
|
+
#
|
848
|
+
# @return [String]
|
849
|
+
#
|
850
|
+
def relative_path_for(path, parent)
|
851
|
+
Pathname.new(path).relative_path_from(Pathname.new(parent)).to_s
|
852
|
+
end
|
853
|
+
|
704
854
|
#
|
705
855
|
# The log key for this class, overriden to incorporate the software name.
|
706
856
|
#
|
@@ -710,6 +860,23 @@ module Omnibus
|
|
710
860
|
@log_key ||= "#{super}: #{software.name}"
|
711
861
|
end
|
712
862
|
|
863
|
+
#
|
864
|
+
# Glob across the given pattern, accounting for dotfiles, removing Ruby's
|
865
|
+
# dumb idea to include +'.'+ and +'..'+ as entries.
|
866
|
+
#
|
867
|
+
# @param [String] path
|
868
|
+
# the path to get all files from
|
869
|
+
#
|
870
|
+
# @return [Array<String>]
|
871
|
+
# the list of all files
|
872
|
+
#
|
873
|
+
def glob(pattern)
|
874
|
+
Dir.glob(pattern, File::FNM_DOTMATCH).reject do |file|
|
875
|
+
basename = File.basename(file)
|
876
|
+
IGNORED_FILES.include?(basename)
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
713
880
|
#
|
714
881
|
# This is an internal wrapper around a command executed on the system. The
|
715
882
|
# block could contain a Ruby command (such as +FileUtils.rm_rf('/')+), or it
|
data/lib/omnibus/config.rb
CHANGED
@@ -120,7 +120,7 @@ module Omnibus
|
|
120
120
|
# @return [String]
|
121
121
|
default(:base_dir) do
|
122
122
|
if Ohai['platform'] == 'windows'
|
123
|
-
'C
|
123
|
+
'C:/omnibus-ruby'
|
124
124
|
else
|
125
125
|
'/var/cache/omnibus'
|
126
126
|
end
|
@@ -130,7 +130,7 @@ module Omnibus
|
|
130
130
|
# code will be cached.
|
131
131
|
#
|
132
132
|
# @return [String]
|
133
|
-
default(:cache_dir) {
|
133
|
+
default(:cache_dir) { File.join(base_dir, 'cache') }
|
134
134
|
|
135
135
|
# The absolute path to the directory on the virtual machine where
|
136
136
|
# git caching will occur and software's will be progressively cached.
|
@@ -140,7 +140,7 @@ module Omnibus
|
|
140
140
|
if defined?(@install_path_cache_dir)
|
141
141
|
@install_path_cache_dir
|
142
142
|
else
|
143
|
-
|
143
|
+
File.join(base_dir, 'cache', 'git_cache')
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
@@ -159,19 +159,19 @@ module Omnibus
|
|
159
159
|
# source code will be downloaded.
|
160
160
|
#
|
161
161
|
# @return [String]
|
162
|
-
default(:source_dir) {
|
162
|
+
default(:source_dir) { File.join(base_dir, 'src') }
|
163
163
|
|
164
164
|
# The absolute path to the directory on the virtual machine where
|
165
165
|
# software will be built.
|
166
166
|
#
|
167
167
|
# @return [String]
|
168
|
-
default(:build_dir) {
|
168
|
+
default(:build_dir) { File.join(base_dir, 'build') }
|
169
169
|
|
170
170
|
# The absolute path to the directory on the virtual machine where
|
171
171
|
# packages will be constructed.
|
172
172
|
#
|
173
173
|
# @return [String]
|
174
|
-
default(:package_dir) {
|
174
|
+
default(:package_dir) { File.join(base_dir, 'pkg') }
|
175
175
|
|
176
176
|
# The absolute path to the directory on the virtual machine where
|
177
177
|
# packagers will store intermediate packaging products. Some packaging
|
@@ -179,7 +179,7 @@ module Omnibus
|
|
179
179
|
# use this setting.
|
180
180
|
#
|
181
181
|
# @return [String]
|
182
|
-
default(:package_tmp) {
|
182
|
+
default(:package_tmp) { File.join(base_dir, 'pkg-tmp') }
|
183
183
|
|
184
184
|
# The relative path of the directory containing {Omnibus::Project}
|
185
185
|
# DSL files. This is relative to {#project_root}.
|
@@ -298,6 +298,15 @@ module Omnibus
|
|
298
298
|
raise MissingConfigOption.new(:artifactory_password, "'password'")
|
299
299
|
end
|
300
300
|
|
301
|
+
# The base path artifacts are published to. This is usually maps to
|
302
|
+
# the artifacts's organization. AKA `orgPath` in the Artifactory
|
303
|
+
# world.
|
304
|
+
#
|
305
|
+
# @return [String]
|
306
|
+
default(:artifactory_base_path) do
|
307
|
+
raise MissingConfigOption.new(:artifactory_base_path, "'com/mycompany'")
|
308
|
+
end
|
309
|
+
|
301
310
|
# The path on disk to an SSL pem file to sign requests with.
|
302
311
|
#
|
303
312
|
# @return [String, nil]
|
data/lib/omnibus/exceptions.rb
CHANGED
@@ -244,20 +244,6 @@ EOH
|
|
244
244
|
end
|
245
245
|
end
|
246
246
|
|
247
|
-
class OldMetadata < Error
|
248
|
-
def initialize(path)
|
249
|
-
@path = path
|
250
|
-
end
|
251
|
-
|
252
|
-
def to_s
|
253
|
-
<<-EOH
|
254
|
-
The metadata at '#{@path}'
|
255
|
-
was generated by an older version of Omnibus. Please regenerate the package with
|
256
|
-
this version of Omnibus and retry.
|
257
|
-
EOH
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
247
|
class InsufficientSpecification < Error
|
262
248
|
def initialize(key, package)
|
263
249
|
@key, @package = key, package
|
data/lib/omnibus/package.rb
CHANGED
@@ -60,6 +60,11 @@ module Omnibus
|
|
60
60
|
data = File.read(path_for(package))
|
61
61
|
hash = JSON.parse(data, symbolize_names: true)
|
62
62
|
|
63
|
+
# Ensure Platform version has been truncated
|
64
|
+
if hash[:platform_version] && hash[:platform]
|
65
|
+
hash[:platform_version] = truncate_platform_version(hash[:platform_version], hash[:platform])
|
66
|
+
end
|
67
|
+
|
63
68
|
# Ensure an interation exists
|
64
69
|
hash[:iteration] ||= 1
|
65
70
|
|
@@ -89,6 +94,33 @@ module Omnibus
|
|
89
94
|
Ohai['kernel']['machine']
|
90
95
|
end
|
91
96
|
|
97
|
+
#
|
98
|
+
# Platform version to be used in package metadata.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
# the platform version
|
102
|
+
#
|
103
|
+
def platform_version
|
104
|
+
truncate_platform_version(Ohai['platform_version'], platform_shortname)
|
105
|
+
end
|
106
|
+
|
107
|
+
#
|
108
|
+
# Platform name to be used when creating metadata for the artifact.
|
109
|
+
# rhel/centos become "el", all others are just platform
|
110
|
+
#
|
111
|
+
# @return [String]
|
112
|
+
# the platform family short name
|
113
|
+
#
|
114
|
+
def platform_shortname
|
115
|
+
if Ohai['platform_family'] == 'rhel'
|
116
|
+
'el'
|
117
|
+
else
|
118
|
+
Ohai['platform']
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
private
|
123
|
+
|
92
124
|
#
|
93
125
|
# On certain platforms we don't care about the full MAJOR.MINOR.PATCH platform
|
94
126
|
# version. This method will properly truncate the version down to a more human
|
@@ -101,17 +133,17 @@ module Omnibus
|
|
101
133
|
# the platform shortname. this might be an Ohai-returned platform or
|
102
134
|
# platform family but it also might be a shortname like `el`
|
103
135
|
#
|
104
|
-
def platform_version
|
105
|
-
case
|
136
|
+
def truncate_platform_version(platform_version, platform)
|
137
|
+
case platform
|
106
138
|
when 'centos', 'debian', 'fedora', 'freebsd', 'rhel', 'el'
|
107
139
|
# Only want MAJOR (e.g. Debian 7)
|
108
|
-
|
140
|
+
platform_version.split('.').first
|
109
141
|
when 'aix', 'arch', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'suse', 'ubuntu'
|
110
142
|
# Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04)
|
111
|
-
|
143
|
+
platform_version.split('.')[0..1].join('.')
|
112
144
|
when 'omnios', 'smartos'
|
113
145
|
# Only want MAJOR (e.g OmniOS r151006, SmartOS 20120809T221258Z)
|
114
|
-
|
146
|
+
platform_version.split('.').first
|
115
147
|
when 'windows'
|
116
148
|
# Windows has this really awesome "feature", where their version numbers
|
117
149
|
# internally do not match the "marketing" name.
|
@@ -126,7 +158,7 @@ module Omnibus
|
|
126
158
|
#
|
127
159
|
# http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes
|
128
160
|
#
|
129
|
-
case
|
161
|
+
case platform_version
|
130
162
|
when '5.0.2195', '2000' then '2000'
|
131
163
|
when '5.1.2600', 'xp' then 'xp'
|
132
164
|
when '5.2.3790', '2003r2' then '2003r2'
|
@@ -138,31 +170,16 @@ module Omnibus
|
|
138
170
|
# version is the same as Windows 8. It's only here for completeness and
|
139
171
|
# documentation.
|
140
172
|
when '6.2.9200', '2012' then '2012'
|
141
|
-
when
|
173
|
+
when /6\.3\.\d+/, '8.1' then '8.1'
|
142
174
|
# The following `when` will never match since Windows 2012R2's platform
|
143
175
|
# version is the same as Windows 8.1. It's only here for completeness
|
144
176
|
# and documentation.
|
145
|
-
when
|
177
|
+
when /6\.3\.\d+/, '2012r2' then '2012r2'
|
146
178
|
else
|
147
|
-
raise UnknownPlatformVersion.new(
|
179
|
+
raise UnknownPlatformVersion.new(platform, platform_version)
|
148
180
|
end
|
149
181
|
else
|
150
|
-
raise UnknownPlatform.new(
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
#
|
155
|
-
# Platform name to be used when creating metadata for the artifact.
|
156
|
-
# rhel/centos become "el", all others are just platform
|
157
|
-
#
|
158
|
-
# @return [String]
|
159
|
-
# the platform family short name
|
160
|
-
#
|
161
|
-
def platform_shortname
|
162
|
-
if Ohai['platform_family'] == 'rhel'
|
163
|
-
'el'
|
164
|
-
else
|
165
|
-
Ohai['platform']
|
182
|
+
raise UnknownPlatform.new(platform)
|
166
183
|
end
|
167
184
|
end
|
168
185
|
end
|
data/lib/omnibus/project.rb
CHANGED
@@ -185,7 +185,7 @@ module Omnibus
|
|
185
185
|
if null?(val)
|
186
186
|
@install_dir || raise(MissingProjectConfiguration.new('install_dir', '/opt/chef'))
|
187
187
|
else
|
188
|
-
@install_dir = File.expand_path(
|
188
|
+
@install_dir = File.expand_path(val, Config.project_root)
|
189
189
|
end
|
190
190
|
end
|
191
191
|
expose :install_dir
|