Minor crew adjustments. (#10512)

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-09-23 15:38:58 -04:00
committed by GitHub
parent 1d8723e5b8
commit c3a5b4f4a3
2 changed files with 9 additions and 4 deletions

View File

@@ -112,6 +112,10 @@ String.use_color = args['--color'] || !args['--no-color']
@verbose = CREW_VERBOSE ? 'v' : '' @verbose = CREW_VERBOSE ? 'v' : ''
@short_verbose = CREW_VERBOSE ? '-v' : '' @short_verbose = CREW_VERBOSE ? '-v' : ''
# Make sure crew work directories exist.
FileUtils.mkdir_p CREW_BREW_DIR
FileUtils.mkdir_p CREW_DEST_DIR
class ExitMessage class ExitMessage
@messages = [] @messages = []
@@ -1494,14 +1498,15 @@ def upload(pkg_name = nil, pkg_version = nil, gitlab_token = nil, gitlab_token_u
new_url = "#{CREW_GITLAB_PKG_REPO}/generic/#{package}/#{new_version}_#{arch}/#{new_tarfile}".gsub("#{release_dir}/", '') new_url = "#{CREW_GITLAB_PKG_REPO}/generic/#{package}/#{new_version}_#{arch}/#{new_tarfile}".gsub("#{release_dir}/", '')
token_label = gitlab_token.split('-').first == 'glpat' ? 'PRIVATE-TOKEN' : 'DEPLOY-TOKEN' token_label = gitlab_token.split('-').first == 'glpat' ? 'PRIVATE-TOKEN' : 'DEPLOY-TOKEN'
if `curl -sI #{new_url}`.lines.first.split[1] == '200' puts "\e[1A\e[KChecking for existing upload ...\r".orange
if `curl -fsI #{new_url}`.lines.first.split[1] == '200'
puts "\n#{File.basename(new_tarfile)} has already been uploaded.\nPlease change the #{package} package version from #{new_version} and try again.\n".lightred puts "\n#{File.basename(new_tarfile)} has already been uploaded.\nPlease change the #{package} package version from #{new_version} and try again.\n".lightred
if Package.agree_default_no('Do you want to overwrite the existing upload instead') if Package.agree_default_no('Do you want to overwrite the existing upload instead')
puts "\e[1A\e[KOverwriting existing upload...\r".orange puts "\e[1A\e[KOverwriting existing upload...\r".orange
crewlog "#{arch} = #{new_sha256}" crewlog "#{arch} = #{new_sha256}"
binary_sha256_hash[arch.to_sym] = new_sha256 binary_sha256_hash[arch.to_sym] = new_sha256
else else
puts "\e[1A\e[KWill NOT overwite the existing upload.\r".orange puts "\e[1A\e[KWill NOT overwite the existing upload. Determining sha256 of already uploaded file...\r".orange
upstream_sha256 = `curl -Ls #{new_url} | sha256sum`.chomp.split.first upstream_sha256 = `curl -Ls #{new_url} | sha256sum`.chomp.split.first
crewlog "#{arch} = #{upstream_sha256}" crewlog "#{arch} = #{upstream_sha256}"
binary_sha256_hash[arch.to_sym] = upstream_sha256 binary_sha256_hash[arch.to_sym] = upstream_sha256

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.52.8' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION CREW_VERSION ||= '1.52.9' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
# Kernel architecture. # Kernel architecture.
KERN_ARCH ||= Etc.uname[:machine] KERN_ARCH ||= Etc.uname[:machine]
@@ -43,7 +43,7 @@ end
CREW_ESSENTIAL_PACKAGES ||= %w[gcc_lib glibc gmp lz4 ruby xzutils zlib zstd] CREW_ESSENTIAL_PACKAGES ||= %w[gcc_lib glibc gmp lz4 ruby xzutils zlib zstd]
CREW_IN_CONTAINER ||= File.exist?('/.dockerenv') || ENV.fetch('CREW_IN_CONTAINER', false) CREW_IN_CONTAINER ||= File.exist?('/.dockerenv') || ENV.fetch('CREW_IN_CONTAINER', false) unless defined?(CREW_IN_CONTAINER)
CREW_CPU_VENDOR ||= CPUINFO['vendor_id'] unless defined?(CREW_CPU_VENDOR) CREW_CPU_VENDOR ||= CPUINFO['vendor_id'] unless defined?(CREW_CPU_VENDOR)
# The cpuinfo vendor_id may not exist on non-x86 platforms, or when a # The cpuinfo vendor_id may not exist on non-x86 platforms, or when a