mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
Reland: Download the correct file when there are multiple versions of a package binary (#10336)
This commit is contained in:
committed by
GitHub
parent
03a8088300
commit
a532c3fc47
9
bin/crew
9
bin/crew
@@ -435,6 +435,8 @@ def download
|
||||
|
||||
uri = URI.parse url
|
||||
filename = File.basename(uri.path)
|
||||
# # If we're downloading a binary, reset the filename to what it would have been if we didn't download from the API.
|
||||
filename = "#{@pkg.name}-#{@pkg.version}-chromeos-#{ARCH}.#{@pkg.binary_compression}" if filename.eql?('download')
|
||||
sha256sum = PackageUtils.get_sha256(@pkg, build_from_source: @opt_source || @pkg.build_from_source)
|
||||
@extract_dir = "#{@pkg.name}.#{Time.now.utc.strftime('%Y%m%d%H%M%S')}.dir"
|
||||
|
||||
@@ -1448,13 +1450,6 @@ def upload(pkg_name = nil, pkg_version = nil, gitlab_token = nil, binary_compres
|
||||
new_url = "#{base_url}/#{package}/#{new_version}_#{arch}/#{new_tarfile}".gsub("#{release_dir}/", '')
|
||||
token_label = gitlab_token.split('-').first == 'glpat' ? 'PRIVATE-TOKEN' : 'DEPLOY-TOKEN'
|
||||
|
||||
if `curl -sI #{new_url}`.lines.first.split[1] == '200'
|
||||
puts "\n#{new_tarfile} has already been uploaded.\nPlease change the #{package} package version from #{new_version} and try again.\n".lightred
|
||||
unless Package.agree_default_no('Do you want to overwrite the existing upload instead')
|
||||
puts 'Will NOT overwite the existing upload.'.orange
|
||||
next
|
||||
end
|
||||
end
|
||||
puts "curl -# --header \"#{token_label}: #{gitlab_token}\" --upload-file \"#{new_tarfile}\" \"#{new_url}\" | cat" if CREW_VERBOSE
|
||||
output = `curl -# --header "#{token_label}: #{gitlab_token}" --upload-file "#{new_tarfile}" "#{new_url}" | cat`.chomp
|
||||
if output.include?('201 Created')
|
||||
|
||||
Reference in New Issue
Block a user