diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 71d28c052..b824a3a9c 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -24,4 +24,12 @@ steps: expeditor: executor: docker: - image: ruby:2.7-buster \ No newline at end of file + image: ruby:2.7-buster + +- label: run-lint-and-specs-ruby-3.0 + command: + - .expeditor/run_linux_tests.sh rake + expeditor: + executor: + docker: + image: ruby:3.0-buster diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..ad5b526df --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "06:00" + timezone: America/Los_Angeles + open-pull-requests-limit: 10 + ignore: + - dependency-name: license_scout + versions: + - "> 1.0" + - dependency-name: aruba + versions: + - 1.0.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 655a97cef..b1909ca5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,27 +1,56 @@ - -## [8.0.9](https://github.com/chef/omnibus/tree/8.0.9) (2020-11-25) + +## [8.1.11](https://github.com/chef/omnibus/tree/8.1.11) (2021-06-23) #### Merged Pull Requests -- Create sleep loop in compress_dmg [#989](https://github.com/chef/omnibus/pull/989) ([jeremiahsnapp](https://github.com/jeremiahsnapp)) +- Updating aruba version from 0.5 to 1.1 [#1019](https://github.com/chef/omnibus/pull/1019) ([skeshari12](https://github.com/skeshari12)) - + ### Changes not yet released to rubygems.org #### Merged Pull Requests -- Create sleep loop in compress_dmg [#989](https://github.com/chef/omnibus/pull/989) ([jeremiahsnapp](https://github.com/jeremiahsnapp)) -- Improve debug messages for macOS code signing [#987](https://github.com/chef/omnibus/pull/987) ([tas50](https://github.com/tas50)) -- Update chefstyle requirement from = 1.5.1 to = 1.5.2 [#986](https://github.com/chef/omnibus/pull/986) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) -- Revert addition of InstallBuilder builder [#985](https://github.com/chef/omnibus/pull/985) ([tas50](https://github.com/tas50)) -- Add Installbuilder packager(installbuilder) [#908](https://github.com/chef/omnibus/pull/908) ([niekrasp](https://github.com/niekrasp)) -- Remove EOL Windows Support (pre-2012) [#983](https://github.com/chef/omnibus/pull/983) ([tas50](https://github.com/tas50)) -- Update chefstyle requirement from = 1.5.0 to = 1.5.1 [#984](https://github.com/chef/omnibus/pull/984) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) -- Switch from fauxhai to fauxhai-ng [#982](https://github.com/chef/omnibus/pull/982) ([tas50](https://github.com/tas50)) -- Remove SLES 11 check [#981](https://github.com/chef/omnibus/pull/981) ([tas50](https://github.com/tas50)) -- Replace chef-sugar for DSL helpers with chef-utils 15.4+ [#980](https://github.com/chef/omnibus/pull/980) ([lamont-granquist](https://github.com/lamont-granquist)) +- Updating aruba version from 0.5 to 1.1 [#1019](https://github.com/chef/omnibus/pull/1019) ([skeshari12](https://github.com/skeshari12)) +- Upgrade to GitHub-native Dependabot [#1012](https://github.com/chef/omnibus/pull/1012) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Revert "argument changes to support ruby 3" [#1016](https://github.com/chef/omnibus/pull/1016) ([tas50](https://github.com/tas50)) +- Add Ruby 3 testing [#1006](https://github.com/chef/omnibus/pull/1006) ([tas50](https://github.com/tas50)) +- Pin to Ohai gem < 17 [#1013](https://github.com/chef/omnibus/pull/1013) ([schisamo](https://github.com/schisamo)) +- Update chefstyle requirement from = 1.7.4 to = 1.7.5 [#1011](https://github.com/chef/omnibus/pull/1011) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Update chefstyle requirement from = 1.7.2 to = 1.7.4 [#1007](https://github.com/chef/omnibus/pull/1007) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Prevent test failures with the latest fauxhai [#1009](https://github.com/chef/omnibus/pull/1009) ([tas50](https://github.com/tas50)) +- Add hostArchitectures to macOS Distribution file [#1005](https://github.com/chef/omnibus/pull/1005) ([tduffield](https://github.com/tduffield)) +- Update chefstyle requirement from = 1.7.1 to = 1.7.2 [#1004](https://github.com/chef/omnibus/pull/1004) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- pull in new fastmsi dll that uses an absolute path to point to 7z.exe [#1003](https://github.com/chef/omnibus/pull/1003) ([mwrock](https://github.com/mwrock)) +- Add support for macOS 11 and multiple architectures [#1002](https://github.com/chef/omnibus/pull/1002) ([tduffield](https://github.com/tduffield)) +- Update chefstyle requirement from = 1.6.2 to = 1.7.1 [#1001](https://github.com/chef/omnibus/pull/1001) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Switch from -02 to -03 on Linux/macOS [#999](https://github.com/chef/omnibus/pull/999) ([tas50](https://github.com/tas50)) +## [8.0.15](https://github.com/chef/omnibus/tree/8.0.15) (2021-02-13) + +#### Merged Pull Requests +- Update chefstyle requirement from = 1.5.2 to = 1.5.8 [#993](https://github.com/chef/omnibus/pull/993) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Update chefstyle requirement from = 1.5.8 to = 1.5.9 [#994](https://github.com/chef/omnibus/pull/994) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Add cumulus platform support [#996](https://github.com/chef/omnibus/pull/996) ([predominant](https://github.com/predominant)) +- Update dmg unmount logging to start at attempt 1 [#990](https://github.com/chef/omnibus/pull/990) ([tas50](https://github.com/tas50)) +- Update chefstyle requirement from = 1.5.9 to = 1.6.1 [#997](https://github.com/chef/omnibus/pull/997) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Update chefstyle requirement from = 1.6.1 to = 1.6.2 [#998](https://github.com/chef/omnibus/pull/998) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) + + +## [8.0.9](https://github.com/chef/omnibus/tree/8.0.9) (2020-12-14) + +#### Merged Pull Requests +- Replace chef-sugar for DSL helpers with chef-utils 15.4+ [#980](https://github.com/chef/omnibus/pull/980) ([lamont-granquist](https://github.com/lamont-granquist)) +- Remove SLES 11 check [#981](https://github.com/chef/omnibus/pull/981) ([tas50](https://github.com/tas50)) +- Switch from fauxhai to fauxhai-ng [#982](https://github.com/chef/omnibus/pull/982) ([tas50](https://github.com/tas50)) +- Update chefstyle requirement from = 1.5.0 to = 1.5.1 [#984](https://github.com/chef/omnibus/pull/984) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Remove EOL Windows Support (pre-2012) [#983](https://github.com/chef/omnibus/pull/983) ([tas50](https://github.com/tas50)) +- Add Installbuilder packager(installbuilder) [#908](https://github.com/chef/omnibus/pull/908) ([niekrasp](https://github.com/niekrasp)) +- Revert addition of InstallBuilder builder [#985](https://github.com/chef/omnibus/pull/985) ([tas50](https://github.com/tas50)) +- Update chefstyle requirement from = 1.5.1 to = 1.5.2 [#986](https://github.com/chef/omnibus/pull/986) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) +- Improve debug messages for macOS code signing [#987](https://github.com/chef/omnibus/pull/987) ([tas50](https://github.com/tas50)) +- Create sleep loop in compress_dmg [#989](https://github.com/chef/omnibus/pull/989) ([jeremiahsnapp](https://github.com/jeremiahsnapp)) + ## [7.0.34](https://github.com/chef/omnibus/tree/7.0.34) (2020-11-11) #### Merged Pull Requests @@ -46,7 +75,6 @@ - Update chefstyle requirement from = 1.4.3 to = 1.4.5 [#976](https://github.com/chef/omnibus/pull/976) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) - use 7zip for FastUnzip MSI action to boost zip expansion performance [#977](https://github.com/chef/omnibus/pull/977) ([mwrock](https://github.com/mwrock)) - Update chefstyle requirement from = 1.4.5 to = 1.5.0 [#978](https://github.com/chef/omnibus/pull/978) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) - ## [7.0.13](https://github.com/chef/omnibus/tree/7.0.13) (2020-06-15) diff --git a/README.md b/README.md index 3f327e6f1..fd682ec39 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ Easily create full-stack installers for your project across a variety of platfor Seth Chisamore and Christopher Maier of CHEF gave an introductory talk on Omnibus at ChefConf 2013, entitled **Eat the Whole Bowl: Building a Full-Stack Installer with Omnibus**: -- [Video](http://www.youtube.com/watch?v=q8iJAntXCNY) - [Slides](https://speakerdeck.com/schisamo/eat-the-whole-bowl-building-a-full-stack-installer-with-omnibus) This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the [CHEF Release Engineering OSS Management Guide](https://docs.google.com/a/opscode.com/document/d/1oJB0vZb_3bl7_ZU2YMDBkMFdL-EWplW1BJv_FXTUOzg/edit). diff --git a/VERSION b/VERSION index 7c6e60d85..08bdb48a7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.0.9 \ No newline at end of file +8.1.11 \ No newline at end of file diff --git a/features/support/env.rb b/features/support/env.rb index 07f722ad8..f3cda8a4a 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,6 +1,6 @@ require "aruba" require "aruba/cucumber" -require "aruba/in_process" +require "aruba/processes/in_process" require "omnibus/cli" diff --git a/lib/omnibus/builder.rb b/lib/omnibus/builder.rb index cbba61c65..831d5424a 100644 --- a/lib/omnibus/builder.rb +++ b/lib/omnibus/builder.rb @@ -373,11 +373,16 @@ def bundle(command, options = {}) # @param (see #command) # @return (see #command) # - def appbundle(software_name, lockdir: nil, gem: nil, without: nil, extra_bin_files: nil , **options) + def appbundle(software_name, options = {}) build_commands << BuildCommand.new("appbundle `#{software_name}'") do bin_dir = "#{install_dir}/bin" appbundler_bin = embedded_bin("appbundler") + lockdir = options[:lockdir] + gem = options[:gem] + without = options[:without] + extra_bin_files = options[:extra_bin_files] + lockdir ||= begin app_software = project.softwares.find do |p| @@ -535,7 +540,7 @@ def erb(options = {}) def mkdir(directory, options = {}) build_commands << BuildCommand.new("mkdir `#{directory}'") do Dir.chdir(software.project_dir) do - FileUtils.mkdir_p(directory, options) + FileUtils.mkdir_p(directory, **options) end end end @@ -557,7 +562,7 @@ def touch(file, options = {}) parent = File.dirname(file) FileUtils.mkdir_p(parent) unless File.directory?(parent) - FileUtils.touch(file, options) + FileUtils.touch(file, **options) end end end @@ -578,7 +583,7 @@ def delete(path, options = {}) build_commands << BuildCommand.new("delete `#{path}'") do Dir.chdir(software.project_dir) do FileSyncer.glob(path).each do |file| - FileUtils.rm_rf(file, options) + FileUtils.rm_rf(file, **options) end end end @@ -629,7 +634,7 @@ def copy(source, destination, options = {}) log.warn(log_key) { "no matched files for glob #{command}" } else files.each do |file| - FileUtils.cp_r(file, destination, options) + FileUtils.cp_r(file, destination, **options) end end end @@ -658,7 +663,7 @@ def move(source, destination, options = {}) log.warn(log_key) { "no matched files for glob #{command}" } else files.each do |file| - FileUtils.mv(file, destination, options) + FileUtils.mv(file, destination, **options) end end end @@ -690,7 +695,7 @@ def link(source, destination, options = {}) log.warn(log_key) { "no matched files for glob #{command}" } else files.each do |file| - FileUtils.ln_s(file, destination, options) + FileUtils.ln_s(file, destination, **options) end end end diff --git a/lib/omnibus/compressors/dmg.rb b/lib/omnibus/compressors/dmg.rb index 22b2eb9d4..0f499f805 100644 --- a/lib/omnibus/compressors/dmg.rb +++ b/lib/omnibus/compressors/dmg.rb @@ -259,8 +259,8 @@ def compress_dmg sync hdiutil unmount "#{@device}" # Give some time to the system so unmount dmg - ATTEMPTS=0 - until [ $ATTEMPTS -eq 5 ] || hdiutil detach "#{@device}"; do + ATTEMPTS=1 + until [ $ATTEMPTS -eq 6 ] || hdiutil detach "#{@device}"; do sleep 10 echo Attempt number $(( ATTEMPTS++ )) done diff --git a/lib/omnibus/manifest_diff.rb b/lib/omnibus/manifest_diff.rb index 6d7c6aa03..098df6e19 100644 --- a/lib/omnibus/manifest_diff.rb +++ b/lib/omnibus/manifest_diff.rb @@ -25,28 +25,22 @@ def initialize(first, second) def updated @updated ||= - begin - (first.entry_names & second.entry_names).collect do |name| - diff(first.entry_for(name), second.entry_for(name)) - end.compact - end + (first.entry_names & second.entry_names).collect do |name| + diff(first.entry_for(name), second.entry_for(name)) + end.compact end def removed @removed ||= - begin - (first.entry_names - second.entry_names).collect do |name| - removed_entry(first.entry_for(name)) - end + (first.entry_names - second.entry_names).collect do |name| + removed_entry(first.entry_for(name)) end end def added @added ||= - begin - (second.entry_names - first.entry_names).collect do |name| - new_entry(second.entry_for(name)) - end + (second.entry_names - first.entry_names).collect do |name| + new_entry(second.entry_for(name)) end end diff --git a/lib/omnibus/metadata.rb b/lib/omnibus/metadata.rb index e7cda2286..b540e0117 100644 --- a/lib/omnibus/metadata.rb +++ b/lib/omnibus/metadata.rb @@ -170,12 +170,16 @@ def platform_shortname # rubocop:disable Lint/DuplicateCaseCondition def truncate_platform_version(platform_version, platform) case platform - when "centos", "debian", "el", "fedora", "freebsd", "omnios", "pidora", "raspbian", "rhel", "sles", "suse", "smartos" + when "centos", "cumulus", "debian", "el", "fedora", "freebsd", "omnios", "pidora", "raspbian", "rhel", "sles", "suse", "smartos" # Only want MAJOR (e.g. Debian 7, OmniOS r151006, SmartOS 20120809T221258Z) platform_version.split(".").first - when "aix", "alpine", "mac_os_x", "openbsd", "slackware", "solaris2", "opensuse", "opensuseleap", "ubuntu", "amazon" - # Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04) + when "aix", "alpine", "openbsd", "slackware", "solaris2", "opensuse", "opensuseleap", "ubuntu", "amazon" + # Only want MAJOR.MINOR (e.g. Ubuntu 12.04) platform_version.split(".")[0..1].join(".") + when "mac_os_x", "darwin", "macos" + # If running macOS >= 11, use only MAJOR version. Otherwise, use MAJOR.MINOR + pv_bits = platform_version.split(".") + pv_bits[0].to_i >= 11 ? pv_bits[0] : pv_bits[0..1].join(".") when "arch", "gentoo", "kali" # Arch Linux / Gentoo do not have a platform_version ohai attribute, they are rolling release (lsb_release -r) "rolling" diff --git a/lib/omnibus/packagers/pkg.rb b/lib/omnibus/packagers/pkg.rb index 2e446417e..950dff91b 100644 --- a/lib/omnibus/packagers/pkg.rb +++ b/lib/omnibus/packagers/pkg.rb @@ -125,7 +125,7 @@ def signing_identity(val = NULL) # @see Base#package_name def package_name - "#{safe_base_package_name}-#{safe_version}-#{safe_build_iteration}.pkg" + "#{safe_base_package_name}-#{safe_version}-#{safe_build_iteration}.#{safe_architecture}.pkg" end # @@ -286,6 +286,7 @@ def write_distribution_file identifier: safe_identifier, version: safe_version, component_pkg: component_pkg, + host_architecture: safe_architecture, }) end @@ -320,6 +321,15 @@ def component_pkg "#{safe_base_package_name}-core.pkg" end + # + # Return the architecture + # + # @return [String] + # + def safe_architecture + @safe_architecture ||= Ohai["kernel"]["machine"] + end + # # Return the PKG-ready base package name, removing any invalid characters. # diff --git a/lib/omnibus/software.rb b/lib/omnibus/software.rb index 714043205..4b1352096 100644 --- a/lib/omnibus/software.rb +++ b/lib/omnibus/software.rb @@ -718,7 +718,7 @@ def with_standard_compiler_flags(env = {}, opts = {}) "CC" => "clang", "CXX" => "clang++", "LDFLAGS" => "-L#{install_dir}/embedded/lib", - "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", } when "windows" arch_flag = windows_arch_i386? ? "-m32" : "-m64" @@ -739,7 +739,7 @@ def with_standard_compiler_flags(env = {}, opts = {}) else { "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib", - "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", } end diff --git a/lib/omnibus/version.rb b/lib/omnibus/version.rb index 0dc45d4a1..a35620741 100644 --- a/lib/omnibus/version.rb +++ b/lib/omnibus/version.rb @@ -15,5 +15,5 @@ # module Omnibus - VERSION = "8.0.9".freeze + VERSION = "8.1.11".freeze end diff --git a/omnibus.gemspec b/omnibus.gemspec index a5a278891..93dcc4cc9 100644 --- a/omnibus.gemspec +++ b/omnibus.gemspec @@ -25,17 +25,18 @@ Gem::Specification.new do |gem| gem.add_dependency "chef-cleanroom", "~> 1.0" gem.add_dependency "ffi-yajl", "~> 2.2" gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0" - gem.add_dependency "ohai", ">= 15" + gem.add_dependency "ohai", ">= 15", "< 17" gem.add_dependency "ruby-progressbar", "~> 1.7" gem.add_dependency "thor", ">= 0.18", "< 2.0" gem.add_dependency "license_scout", "~> 1.0" + gem.add_dependency "contracts", ">= 0.16.0", "< 0.17.0" gem.add_dependency "mixlib-versioning" gem.add_dependency "pedump" gem.add_development_dependency "artifactory", "~> 3.0" - gem.add_development_dependency "aruba", "~> 0.5" - gem.add_development_dependency "chefstyle", "= 1.5.2" + gem.add_development_dependency "aruba", "~> 1.1" + gem.add_development_dependency "chefstyle", "= 1.7.5" gem.add_development_dependency "fauxhai-ng", ">= 7.5" gem.add_development_dependency "rspec", "~> 3.0" gem.add_development_dependency "rspec-json_expectations" diff --git a/resources/msi/CustomActionFastMsi.CA.dll b/resources/msi/CustomActionFastMsi.CA.dll index c7775cab4..7116343f2 100644 Binary files a/resources/msi/CustomActionFastMsi.CA.dll and b/resources/msi/CustomActionFastMsi.CA.dll differ diff --git a/resources/pkg/distribution.xml.erb b/resources/pkg/distribution.xml.erb index d56d81783..bef76cb07 100644 --- a/resources/pkg/distribution.xml.erb +++ b/resources/pkg/distribution.xml.erb @@ -7,7 +7,7 @@ - + diff --git a/spec/functional/fetchers/net_fetcher_spec.rb b/spec/functional/fetchers/net_fetcher_spec.rb index 503e33a52..fe7d2e955 100644 --- a/spec/functional/fetchers/net_fetcher_spec.rb +++ b/spec/functional/fetchers/net_fetcher_spec.rb @@ -127,17 +127,8 @@ def stub_ohai(options = {}, &block); end end end - context "when the source has read-only files" do - let(:source_url) { "http://dl.bintray.com/oneclick/OpenKnapsack/x86/openssl-1.0.0q-x86-windows.tar.lzma" } - let(:source_md5) { "577dbe528415c6f178a9431fd0554df4" } - - it "extracts the asset without crashing" do - subject.clean - expect(extracted).to_not be_a_file - subject.clean - expect(extracted).to_not be_a_file - end - end + # we need to find a new test fixture because this one no longer exists + # context "when the source has read-only files" context "when the source has broken symlinks" do let(:source_url) { "http://www.openssl.org/source/openssl-1.0.1q.tar.gz" } @@ -255,7 +246,7 @@ def stub_ohai(options = {}, &block); end context "when the file is less than 10240 bytes" do let(:source_url) { "https://downloads.chef.io/packages-chef-io-public.key" } - let(:source_md5) { "369efc3a19b9118cdf51c7e87a34f266" } + let(:source_md5) { "012a2c4e2a8edb86b2c072f02eea9f40" } it "downloads the file" do fetch! diff --git a/spec/unit/compressor_spec.rb b/spec/unit/compressor_spec.rb index 6af4b0058..ac52ec359 100644 --- a/spec/unit/compressor_spec.rb +++ b/spec/unit/compressor_spec.rb @@ -3,8 +3,8 @@ module Omnibus describe Compressor do describe ".for_current_system" do - context "on Mac OS X" do - before { stub_ohai(platform: "mac_os_x", version: "10.15") } + context "on macOS" do + before { stub_ohai(platform: "mac_os_x") } context "when :dmg is activated" do it "prefers dmg" do diff --git a/spec/unit/compressors/dmg_spec.rb b/spec/unit/compressors/dmg_spec.rb index 3ddceadff..185bb3bda 100644 --- a/spec/unit/compressors/dmg_spec.rb +++ b/spec/unit/compressors/dmg_spec.rb @@ -190,7 +190,7 @@ module Omnibus expect(contents).to include('set found_disk to do shell script "ls /Volumes/ | grep \'Project One*\'"') expect(contents).to include(" set the bounds of Finder window 1 to {100, 100, 750, 600}") - expect(contents).to include(' set position of item "project-1.2.3-2.pkg" of container window to {535, 50}') + expect(contents).to include(' set position of item "project-1.2.3-2.x86_64.pkg" of container window to {535, 50}') end it "runs the apple script" do @@ -219,8 +219,8 @@ module Omnibus sync hdiutil unmount "#{device}" # Give some time to the system so unmount dmg - ATTEMPTS=0 - until [ $ATTEMPTS -eq 5 ] || hdiutil detach "/dev/sda1"; do + ATTEMPTS=1 + until [ $ATTEMPTS -eq 6 ] || hdiutil detach "/dev/sda1"; do sleep 10 echo Attempt number $(( ATTEMPTS++ )) done @@ -229,7 +229,7 @@ module Omnibus -format UDZO \\ -imagekey \\ zlib-level=9 \\ - -o "#{package_dir}/project-1.2.3-2.dmg" \\ + -o "#{package_dir}/project-1.2.3-2.x86_64.dmg" \\ -puppetstrings EOH @@ -247,7 +247,7 @@ module Omnibus expect(subject).to receive(:shellout!) .with <<-EOH.gsub(/^ {12}/, "") hdiutil verify \\ - "#{package_dir}/project-1.2.3-2.dmg" \\ + "#{package_dir}/project-1.2.3-2.x86_64.dmg" \\ -puppetstrings EOH @@ -289,10 +289,10 @@ module Omnibus DeRez -only icns "#{icon}" > tmp.rsrc # Append the icon reosurce to the DMG - Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.dmg" + Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.x86_64.dmg" # Source the icon - SetFile -a C "#{package_dir}/project-1.2.3-2.dmg" + SetFile -a C "#{package_dir}/project-1.2.3-2.x86_64.dmg" EOH subject.set_dmg_icon @@ -301,11 +301,11 @@ module Omnibus describe "#package_name" do it "reflects the packager's unmodified package_name" do - expect(subject.package_name).to eq("project-1.2.3-2.dmg") + expect(subject.package_name).to eq("project-1.2.3-2.x86_64.dmg") end it "reflects the packager's modified package_name" do - package_basename = "projectsub-1.2.3-3" + package_basename = "projectsub-1.2.3-3.x86_64" allow(project.packagers_for_system[0]).to receive(:package_name) .and_return("#{package_basename}.pkg") diff --git a/spec/unit/compressors/tgz_spec.rb b/spec/unit/compressors/tgz_spec.rb index f6f440067..2f4b0f11c 100644 --- a/spec/unit/compressors/tgz_spec.rb +++ b/spec/unit/compressors/tgz_spec.rb @@ -38,25 +38,25 @@ module Omnibus describe "#package_name" do it "returns the name of the packager" do - expect(subject.package_name).to eq("project-1.2.3-2.pkg.tar.gz") + expect(subject.package_name).to eq("project-1.2.3-2.x86_64.pkg.tar.gz") end end describe "#write_tgz" do before do - File.open("#{staging_dir}/project-1.2.3-2.pkg", "wb") do |f| + File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg", "wb") do |f| f.write " " * 1_000_000 end end it "generates the file" do subject.write_tgz - expect("#{staging_dir}/project-1.2.3-2.pkg.tar.gz").to be_a_file + expect("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz").to be_a_file end it "has the correct content" do subject.write_tgz - file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", "rb") + file = File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz", "rb") contents = file.read file.close diff --git a/spec/unit/fetchers/net_fetcher_spec.rb b/spec/unit/fetchers/net_fetcher_spec.rb index b569f8c14..9c81a32a1 100644 --- a/spec/unit/fetchers/net_fetcher_spec.rb +++ b/spec/unit/fetchers/net_fetcher_spec.rb @@ -278,6 +278,10 @@ module Omnibus let(:cumulative_downloaded_length) { 100 } + let(:uri_open_target) do + RUBY_VERSION.to_f < 2.7 ? subject : URI + end + def capturing_stdout old_stdout, $stdout = $stdout, progress_bar_output yield @@ -286,7 +290,7 @@ def capturing_stdout end before do - expect(subject).to receive(:open).with(source[:url], expected_open_opts) do |_url, open_uri_opts| + expect(uri_open_target).to receive(:open).with(source[:url], expected_open_opts) do |_url, open_uri_opts| open_uri_opts[:content_length_proc].call(reported_content_length) open_uri_opts[:progress_proc].call(cumulative_downloaded_length) diff --git a/spec/unit/metadata_spec.rb b/spec/unit/metadata_spec.rb index bdbe6c64c..e314e6a53 100644 --- a/spec/unit/metadata_spec.rb +++ b/spec/unit/metadata_spec.rb @@ -218,6 +218,8 @@ module Omnibus it_behaves_like "a version manipulator", "gentoo", "4.9.95-gentoo", "rolling" it_behaves_like "a version manipulator", "kali", "rolling", "rolling" it_behaves_like "a version manipulator", "mac_os_x", "10.9.1", "10.9" + it_behaves_like "a version manipulator", "mac_os_x", "10.15.7", "10.15" + it_behaves_like "a version manipulator", "mac_os_x", "11.2.1", "11" it_behaves_like "a version manipulator", "omnios", "r151010", "r151010" it_behaves_like "a version manipulator", "openbsd", "5.4.4", "5.4" it_behaves_like "a version manipulator", "opensuseleap", "42.3", "42.3" diff --git a/spec/unit/packager_spec.rb b/spec/unit/packager_spec.rb index 9dc24a7b1..e6c33fbeb 100644 --- a/spec/unit/packager_spec.rb +++ b/spec/unit/packager_spec.rb @@ -3,8 +3,8 @@ module Omnibus describe Packager do describe ".for_current_system" do - context "on Mac OS X" do - before { stub_ohai(platform: "mac_os_x", version: "10.15") } + context "on macOS" do + before { stub_ohai(platform: "mac_os_x") } it "prefers PKG" do expect(described_class.for_current_system).to eq([Packager::PKG]) end diff --git a/spec/unit/packagers/pkg_spec.rb b/spec/unit/packagers/pkg_spec.rb index c5ffa1eed..45c686f5f 100644 --- a/spec/unit/packagers/pkg_spec.rb +++ b/spec/unit/packagers/pkg_spec.rb @@ -47,8 +47,8 @@ module Omnibus end describe "#package_name" do - it "includes the name, version, and build iteration" do - expect(subject.package_name).to eq("project-full-name-1.2.3-2.pkg") + it "includes the name, version, build iteration, and architecture" do + expect(subject.package_name).to eq("project-full-name-1.2.3-2.x86_64.pkg") end end @@ -290,8 +290,24 @@ module Omnibus expect(contents).to include('') expect(contents).to include('') + expect(contents).to include('hostArchitectures="x86_64"') expect(contents).to include("project-full-name-core.pkg") end + + context "for arm64 builds" do + before do + stub_ohai(platform: "mac_os_x", version: "11.0") do |data| + data["kernel"]["machine"] = "arm64" + end + end + + it "sets the hostArchitectures to include arm64" do + subject.write_distribution_file + contents = File.read("#{staging_dir}/Distribution") + + expect(contents).to include('hostArchitectures="arm64"') + end + end end describe "#build_product_pkg" do @@ -301,7 +317,7 @@ module Omnibus productbuild \\ --distribution "#{staging_dir}/Distribution" \\ --resources "#{staging_dir}/Resources" \\ - "#{package_dir}/project-full-name-1.2.3-2.pkg" + "#{package_dir}/project-full-name-1.2.3-2.x86_64.pkg" EOH subject.build_product_pkg @@ -319,7 +335,7 @@ module Omnibus --distribution "#{staging_dir}/Distribution" \\ --resources "#{staging_dir}/Resources" \\ --sign "My Special Identity" \\ - "#{package_dir}/project-full-name-1.2.3-2.pkg" + "#{package_dir}/project-full-name-1.2.3-2.x86_64.pkg" EOH subject.build_product_pkg end diff --git a/spec/unit/project_spec.rb b/spec/unit/project_spec.rb index f8ace6338..c1d54896a 100644 --- a/spec/unit/project_spec.rb +++ b/spec/unit/project_spec.rb @@ -235,8 +235,8 @@ module Omnibus end end - context "when on OS X" do - let(:fauxhai_options) { { platform: "mac_os_x", version: "10.15" } } + context "when on macOS" do + let(:fauxhai_options) { { platform: "mac_os_x" } } it "returns a generic iteration" do expect(subject.build_iteration).to eq(1) end diff --git a/spec/unit/software_spec.rb b/spec/unit/software_spec.rb index 688a6f7f3..b544f449a 100644 --- a/spec/unit/software_spec.rb +++ b/spec/unit/software_spec.rb @@ -73,9 +73,9 @@ module Omnibus it "sets the defaults" do expect(subject.with_standard_compiler_flags).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -84,9 +84,9 @@ module Omnibus it "overrides LDFLAGS" do expect(subject.with_standard_compiler_flags("LDFLAGS" => "foo")).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -95,9 +95,9 @@ module Omnibus it "overrides CFLAGS" do expect(subject.with_standard_compiler_flags("CFLAGS" => "foo")).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -106,9 +106,9 @@ module Omnibus it "overrides CXXFLAGS" do expect(subject.with_standard_compiler_flags("CXXFLAGS" => "foo")).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -117,9 +117,9 @@ module Omnibus it "overrides CPPFLAGS" do expect(subject.with_standard_compiler_flags("CPPFLAGS" => "foo")).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -129,9 +129,9 @@ module Omnibus expect(subject.with_standard_compiler_flags("numberwang" => 4)).to eq( "numberwang" => 4, "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -191,14 +191,14 @@ module Omnibus end context "on mac_os_x" do - before { stub_ohai(platform: "mac_os_x", version: "10.13") } + before { stub_ohai(platform: "mac_os_x", version: "10.15") } it "sets the defaults" do expect(subject.with_standard_compiler_flags).to eq( "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "LD_RUN_PATH" => "/opt/project/embedded/lib", "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig", "OMNIBUS_INSTALL_DIR" => "/opt/project" @@ -235,9 +235,9 @@ module Omnibus it "sets the defaults" do expect(subject.with_standard_compiler_flags).to eq( "CC" => "clang", - "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", - "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", + "CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector", "CXX" => "clang++", "LDFLAGS" => "-L/opt/project/embedded/lib", "LD_RUN_PATH" => "/opt/project/embedded/lib",