Py updates, fix env variable for timeout, add option to skip remote updates in build_updates script (#10503)

* Update py3_setuptools

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

* Fix Agree timeout env variable, add pip updates, fixup build_updated_packages script and add functionality to skip remote update checks.

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

* Add documentation for the --skip command.

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

* Handle compatibility with commas

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

* Handle empty conpatibility.

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

* Fixup compatibility sections of package files.

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

* Rebuild parted to handle missing binaries, and update build_updated_packages to notice binary_compression and not ask to rebuild if bimaries already exist.

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

* Fix hash for nconvert.

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-09-19 23:22:33 -04:00
committed by GitHub
parent 23265468d1
commit 22d986c981
88 changed files with 674 additions and 439 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# build_updated_packages version 1.2 (for Chromebrew)
# build_updated_packages version 1.3 (for Chromebrew)
# This updates the versions in python pip packages by calling
# tools/update_python_pip_packages.rb, checks for updated ruby packages
# by calling tools/update_ruby_gem_packages.rb, and then checks if any
@@ -7,15 +7,20 @@
# to build those binaries.
#
# Author: Satadru Pramanik (satmandu) satadru at gmail dot com
# Usage in root of cloned chromebrew repo:
# tools/build_updated_packages.rb
# Usage in root of cloned chromebrew repo with a new branch checked out:
# tools/build_updated_packages.rb [--skip]
# Pass '--skip' as an argument to avoid running the pip and gen update scripts.
# This is useful if you have already run this (and thus the update scripts)
# from another container for the same cloned repo.
require_relative '../lib/color'
require_relative '../lib/const'
abort "\nGITLAB_TOKEN environment variable not set.\n".lightred if ENV['GITLAB_TOKEN'].nil?
abort "\nGITLAB_TOKEN_USERNAME environment variable not set.\n".lightred if ENV['GITLAB_TOKEN_USERNAME'].nil?
puts "Setting the CREW_AGREE_TIMEOUT_SECONDS environment variable to less than the default of #{CREW_AGREE_TIMEOUT_SECONDS} may speed this up...".orange if ENV['CREW_AGREE_TIMEOUT_SECONDS'].nil?
SKIP_UPDATE_CHECKS = ARGV.include?('--skip')
def require_gem(gem_name_and_require = nil, require_override = nil)
# Allow only loading gems when needed.
return if gem_name_and_require.nil?
@@ -131,10 +136,14 @@ package_properties = `sed -n '/^\ \ property/,/^$/p' lib/package.rb | sed 's/^\
properties = "#{package_properties} #{buildsystem_properties}"
property(properties.split)
puts 'Checking for pip package version updates...'.orange
load 'tools/update_python_pip_packages.rb'
puts 'Checking for ruby gem package version updates...'.orange
load 'tools/update_ruby_gem_packages.rb'
if SKIP_UPDATE_CHECKS
puts 'Skipping pip and gem remote update checks.'.orange
else
puts 'Checking for pip package version updates...'.orange
load 'tools/update_python_pip_packages.rb'
puts 'Checking for ruby gem package version updates...'.orange
load 'tools/update_ruby_gem_packages.rb'
end
changed_files = `git diff HEAD --name-only`.chomp.split
updated_packages = changed_files.select { |c| c.include?('packages/') }
@@ -161,13 +170,13 @@ updated_packages.each do |pkg|
puts "#{name.capitalize} #{@version} has no binaries and may not need them.".lightgreen
next pkg
else
build = compatibility == 'all' ? %w[x86_64 armv7l i686] : compatibility.split
build.each do |arch|
arch_specific_url = "#{CREW_GITLAB_PKG_REPO}/generic/#{name}/#{@version}_#{arch}/#{name}-#{@version}-chromeos-#{arch}.tar.zst"
if `curl -sI #{arch_specific_url}`.lines.first.split[1] == '200'
build.delete(arch)
next
end
check_builds = compatibility == 'all' ? %w[x86_64 armv7l i686] : compatibility.delete(',').split
check_builds.delete('aarch64')
check_builds = %w[x86_64 armv7l i686] if (check_builds & %w[x86_64 armv7l i686]).nil?
build = check_builds.dup
check_builds.each do |arch|
arch_specific_url = "#{CREW_GITLAB_PKG_REPO}/generic/#{name}/#{@version}_#{arch}/#{name}-#{@version}-chromeos-#{arch}.#{@binary_compression}"
build.delete(arch) if `curl -sI #{arch_specific_url}`.lines.first.split[1] == '200'
end
if build.empty?
puts "No builds are needed for #{name} #{@version}.".lightgreen
@@ -175,9 +184,7 @@ updated_packages.each do |pkg|
else
puts "#{name.capitalize} #{@version} needs builds uploaded for: #{build.join(' ')}".lightblue
end
if build.include?(ARCH) && agree_default_yes("\nWould you like to build #{name} #{@version}")
system "yes | crew build -f #{pkg}"
system "crew upload #{name}"
end
system "yes | crew build -f #{pkg}" if build.include?(ARCH) && !File.file?("release/#{ARCH}#{name}-#{@version}-chromeos-#{ARCH}.#{@binary_compression}") && agree_default_yes("\nWould you like to build #{name} #{@version}")
system "crew upload #{name}" if build.include?(ARCH) && File.file?("release/#{ARCH}#{name}-#{@version}-chromeos-#{ARCH}.#{@binary_compression}") && agree_default_yes("\nWould you like to upload #{name} #{@version}")
end
end