Add options for minimal output crew update. (#10584)

* Add options for minimal output crew update.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* bump versions

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-10-08 19:29:49 -04:00
committed by GitHub
parent c76c98be35
commit fc334a6d3a
3 changed files with 16 additions and 7 deletions

View File

@@ -311,9 +311,10 @@ def update
# update compatible packages # update compatible packages
generate_compatible generate_compatible
# check for outdated installed packages # check for outdated installed packages
puts 'Checking for package updates...' puts 'Checking for package updates...' unless CREW_UNATTENDED
can_be_updated = 0 can_be_updated = 0
updatable_packages = []
@device[:installed_packages].each do |package| @device[:installed_packages].each do |package|
search package[:name], silent: true search package[:name], silent: true
unless @pkg unless @pkg
@@ -329,16 +330,21 @@ def update
if different_version && !different_sha && has_sha if different_version && !different_sha && has_sha
unless @pkg.no_compile_needed? unless @pkg.no_compile_needed?
can_be_updated -= 1 can_be_updated -= 1
puts "#{@pkg.name} has a version change but does not have updated binaries".yellow updatable_packages.push(@pkg.name)
puts "#{@pkg.name} has a version change but does not have updated binaries".yellow unless CREW_UNATTENDED
end end
elsif different_version elsif different_version
puts "#{@pkg.name} could be updated from #{package[:version]} to #{@pkg.version}" updatable_packages.push(@pkg.name)
puts "#{@pkg.name} could be updated from #{package[:version]} to #{@pkg.version}" unless CREW_UNATTENDED
elsif !different_version && different_sha elsif !different_version && different_sha
puts "#{@pkg.name} could be updated (rebuild)" updatable_packages.push(@pkg.name)
puts "#{@pkg.name} could be updated (rebuild)" unless CREW_UNATTENDED
end end
end end
if can_be_updated.positive? if CREW_UNATTENDED && can_be_updated.positive?
puts updatable_packages
elsif can_be_updated.positive?
puts "\n#{can_be_updated} packages can be updated." puts "\n#{can_be_updated} packages can be updated."
puts 'Run `crew upgrade` to update all packages or `crew upgrade <package1> [<package2> ...]` to update specific packages.' puts 'Run `crew upgrade` to update all packages or `crew upgrade <package1> [<package2> ...]` to update specific packages.'
else else

View File

@@ -3,7 +3,7 @@
require 'etc' require 'etc'
OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
CREW_VERSION ||= '1.54.0' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION CREW_VERSION ||= '1.54.1' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
# Kernel architecture. # Kernel architecture.
KERN_ARCH ||= Etc.uname[:machine] KERN_ARCH ||= Etc.uname[:machine]
@@ -94,6 +94,7 @@ CREW_CACHE_DIR ||= ENV.fetch('CREW_CACHE_DIR', "#{HOME}/.cache/crewcach
CREW_CACHE_BUILD ||= ENV.fetch('CREW_CACHE_BUILD', false) unless defined?(CREW_CACHE_BUILD) CREW_CACHE_BUILD ||= ENV.fetch('CREW_CACHE_BUILD', false) unless defined?(CREW_CACHE_BUILD)
CREW_CACHE_FAILED_BUILD ||= ENV.fetch('CREW_CACHE_FAILED_BUILD', false) unless defined?(CREW_CACHE_FAILED_BUILD) CREW_CACHE_FAILED_BUILD ||= ENV.fetch('CREW_CACHE_FAILED_BUILD', false) unless defined?(CREW_CACHE_FAILED_BUILD)
CREW_NO_GIT ||= ENV.fetch('CREW_NO_GIT', false) unless defined?(CREW_NO_GIT) CREW_NO_GIT ||= ENV.fetch('CREW_NO_GIT', false) unless defined?(CREW_NO_GIT)
CREW_UNATTENDED ||= ENV.fetch('CREW_UNATTENDED', false) unless defined?(CREW_UNATTENDED)
CREW_DEBUG ||= ARGV.intersect?(%w[-D --debug]) unless defined?(CREW_DEBUG) CREW_DEBUG ||= ARGV.intersect?(%w[-D --debug]) unless defined?(CREW_DEBUG)
CREW_FORCE ||= ARGV.intersect?(%w[-f --force]) unless defined?(CREW_FORCE) CREW_FORCE ||= ARGV.intersect?(%w[-f --force]) unless defined?(CREW_FORCE)

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# build_updated_packages version 1.6 (for Chromebrew) # build_updated_packages version 1.7 (for Chromebrew)
# This updates the versions in python pip packages by calling # This updates the versions in python pip packages by calling
# tools/update_python_pip_packages.rb, checks for updated ruby packages # tools/update_python_pip_packages.rb, checks for updated ruby packages
# by calling tools/update_ruby_gem_packages.rb, and then checks if any # by calling tools/update_ruby_gem_packages.rb, and then checks if any
@@ -170,6 +170,8 @@ else
updated_packages.each { |p| puts p.sub('packages/', '').sub('.rb', '').to_s.lightblue } updated_packages.each { |p| puts p.sub('packages/', '').sub('.rb', '').to_s.lightblue }
end end
updated_packages << `CREW_NO_GIT=1 CREW_UNATTENDED=1 crew update`.chomp
updated_packages.uniq!
updated_packages.each do |pkg| updated_packages.each do |pkg|
name = pkg.sub('packages/', '').sub('.rb', '') name = pkg.sub('packages/', '').sub('.rb', '')