From 770a4b80679a28610a7ee648625a9eef088fe005 Mon Sep 17 00:00:00 2001 From: "Satadru Pramanik, DO, MPH, MEng" Date: Wed, 18 Jun 2025 11:44:27 -0400 Subject: [PATCH] Install and build adjustments (#12057) Signed-off-by: Satadru Pramanik --- bin/crew | 8 ++++++-- lib/const.rb | 2 +- lib/downloader.rb | 2 +- lib/fixup.rb | 2 +- tests/unit_test.sh | 4 +++- tools/build_updated_packages.rb | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/crew b/bin/crew index 5b5669b77..6c7ae9899 100755 --- a/bin/crew +++ b/bin/crew @@ -1024,7 +1024,11 @@ def install_package(pkgdir) unless CREW_NOT_LINKS || @pkg.no_links? Find.find(Dir.pwd) do |path| - next unless File.symlink?(path) + begin + next unless File.symlink?(path) + rescue Errno::ENOENT + next + end begin File.stat(path) rescue Errno::ENOENT, Errno::ELOOP @@ -1034,7 +1038,7 @@ def install_package(pkgdir) fixedlink_loc = File.join(pkgdir, path.delete_prefix('.')) # If no changes were made, don't replace symlink unless fixedtarget == brokentarget - FileUtils.ln_sf fixedtarget, fixedlink_loc + FileUtils.ln_sf fixedtarget, fixedlink_loc if File.file?(fixedlink_loc) puts "Fixed: #{fixedtarget} -> #{path.delete_prefix('.')}".orange if CREW_VERBOSE end end diff --git a/lib/const.rb b/lib/const.rb index 4e925af59..397a0cf63 100644 --- a/lib/const.rb +++ b/lib/const.rb @@ -4,7 +4,7 @@ require 'etc' require 'open3' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' -CREW_VERSION ||= '1.61.9' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION +CREW_VERSION ||= '1.62.0' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION # Kernel architecture. KERN_ARCH ||= Etc.uname[:machine] diff --git a/lib/downloader.rb b/lib/downloader.rb index 1ff5c959d..502232575 100644 --- a/lib/downloader.rb +++ b/lib/downloader.rb @@ -70,7 +70,7 @@ def downloader(url, sha256sum, filename = File.basename(url), verbose: false) puts "Updating checksum for #{filename}".lightblue puts "from #{sha256sum} to #{calc_sha256sum}".lightblue puts "in #{CREW_LOCAL_REPO_ROOT}/packages/#{pkg_name}.rb .".lightblue - system "sed -i 's/#{sha256sum}/#{calc_sha256sum}/' #{CREW_LOCAL_REPO_ROOT}/packages/#{pkg_name}.rb" + system "sed 's/#{sha256sum}/#{calc_sha256sum}/g;w #{CREW_LOCAL_REPO_ROOT}/packages/#{pkg_name}.rb' #{CREW_LOCAL_REPO_ROOT}/packages/#{pkg_name}.rb" else FileUtils.rm_f filename diff --git a/lib/fixup.rb b/lib/fixup.rb index 74c822b91..8accf403b 100644 --- a/lib/fixup.rb +++ b/lib/fixup.rb @@ -92,7 +92,7 @@ def refresh_crew_json end # Rename the binary_sha256 variable to sha256 in the device.json file -system(" sed -i 's/binary_sha256/sha256/g' #{File.join(CREW_CONFIG_PATH, 'device.json')}") +system("sed -i 's/binary_sha256/sha256/g' #{File.join(CREW_CONFIG_PATH, 'device.json')}") # Check for renamed and deprecated packages, and handle them. diff --git a/tests/unit_test.sh b/tests/unit_test.sh index 744d636b4..02005d201 100755 --- a/tests/unit_test.sh +++ b/tests/unit_test.sh @@ -1,8 +1,10 @@ #!/bin/bash # This is for use as a Github CI Unit Test. -# Version 1.3 +# Version 1.4 set -e cd /usr/local/lib/crew/packages/ +echo "CREW_BRANCH: $CREW_BRANCH" +crew update && yes | crew upgrade git clone --depth=1 --branch="$CREW_BRANCH" "$CREW_REPO" ~/build_test # Check if rubocop-chromebrew is installed and working, and if not install it. rubocop --require rubocop-chromebrew &>/dev/null || gem install rubocop-chromebrew diff --git a/tools/build_updated_packages.rb b/tools/build_updated_packages.rb index 9a9cb38ef..293d88f21 100755 --- a/tools/build_updated_packages.rb +++ b/tools/build_updated_packages.rb @@ -65,7 +65,7 @@ def self.check_build_uploads(architectures_to_check = nil, name = nil) unless @remote_hash == binary_sha256_hash[arch.to_sym] puts "#{arch}/#{name}: Adjusting sha256sum in package file to the remote binary sha256sum".lightpurple puts "#{binary_sha256_hash[arch.to_sym]} =>\n#{@remote_hash}".blue - system "sed -i 's,#{binary_sha256_hash[arch.to_sym]},#{@remote_hash},g' packages/#{name}.rb" + system "sed 's,#{binary_sha256_hash[arch.to_sym]},#{@remote_hash},g;w packages/#{name}.rb' packages/#{name}.rb" # Do a force install to make sure the package hashes are ok. puts "Checking install of #{name} to confirm binary hashes are correct.".lightpurple system "yes | crew install -f #{name} ; crew remove #{name}", exception: false