restart crew update if there is a new crew version (#8839)

* restart crew update if there is a new crew version

* use verbose switch

* add period

* add comment

* make constant not global
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2023-10-28 02:08:12 -04:00
committed by GitHub
parent 75e3e402d6
commit b093f1c198
2 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
# lib/const.rb
# Defines common constants used in different parts of crew
CREW_VERSION = '1.37.1'
CREW_VERSION = '1.37.2'
CREW_CONST_GIT_COMMIT = `git log -n1 --oneline ../lib/const.rb`.chomp.split.first
# kernel architecture
KERN_ARCH = `uname -m`.chomp

View File

@@ -1,3 +1,4 @@
# lib/fixup.rb
# Add fixups to be run during crew update here.
# remove deprecated directory
@@ -36,10 +37,10 @@ pkg_update_arr = [
{ pkg_name: 'qtwebsockets', pkg_rename: 'qt5_websockets', pkg_deprecated: nil, comments: nil },
{ pkg_name: 'qtx11extras', pkg_rename: 'qt5_x11extras', pkg_deprecated: nil, comments: nil },
{ pkg_name: 'qtchooser', pkg_rename: nil, pkg_deprecated: true, comments: "Doesn't work for newer Qt versions." },
{ pkg_name: 'acli', pkg_rename: 'acquia_cli', pkg_deprecated: nil, comments: "Renamed to better match upstream." },
{ pkg_name: 'agrind', pkg_rename: 'angle_grinder', pkg_deprecated: nil, comments: "Renamed to better match upstream." },
{ pkg_name: 'apriconv', pkg_rename: 'apr_iconv', pkg_deprecated: nil, comments: "Renamed to better match upstream." },
{ pkg_name: 'aprutil', pkg_rename: 'apr_util', pkg_deprecated: nil, comments: "Renamed to better match upstream." }
{ pkg_name: 'acli', pkg_rename: 'acquia_cli', pkg_deprecated: nil, comments: 'Renamed to better match upstream.' },
{ pkg_name: 'agrind', pkg_rename: 'angle_grinder', pkg_deprecated: nil, comments: 'Renamed to better match upstream.' },
{ pkg_name: 'apriconv', pkg_rename: 'apr_iconv', pkg_deprecated: nil, comments: 'Renamed to better match upstream.' },
{ pkg_name: 'aprutil', pkg_rename: 'apr_util', pkg_deprecated: nil, comments: 'Renamed to better match upstream.' }
]
pkg_update_arr.each do |pkg|
@@ -124,3 +125,19 @@ pkg_update_arr.each do |pkg|
puts "#{pkg[:pkg_name].capitalize} not removed.".lightblue
end
end
# Restart crew update if the git commit of ../lib/const.rb loaded in
# const.rb is different from the git commit of the potentially updated
# ../lib/const.rb loaded here after a git pull.
# Handle case of const.rb not yet defining CREW_CONST_GIT_COMMIT.
CREW_CONST_GIT_COMMIT = '0000' unless defined?(CREW_CONST_GIT_COMMIT)
@new_const_git_commit = `git log -n1 --oneline ../lib/const.rb`.chomp.split.first
unless @new_const_git_commit.to_s == CREW_CONST_GIT_COMMIT.to_s
puts 'Restarting crew update since there is an updated crew version.'.lightcyan
puts "CREW_REPO=#{CREW_REPO} CREW_BRANCH=#{CREW_BRANCH} crew update".orange if @opt_verbose
exec "CREW_REPO=#{CREW_REPO} CREW_BRANCH=#{CREW_BRANCH} crew update"
end