From 176311e0ab2519826aa5dc5cb16c8be77ed5445a Mon Sep 17 00:00:00 2001 From: Max Downey Twiss Date: Mon, 24 Nov 2025 00:18:42 +1100 Subject: [PATCH] decouple lib/fixup.rb from bin/crew (#13596) --- bin/crew | 2 +- lib/fixup.rb | 30 ++---------------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/bin/crew b/bin/crew index a4970754e..b344c145c 100755 --- a/bin/crew +++ b/bin/crew @@ -310,7 +310,7 @@ def update end # Do any fixups necessary after crew has updated from git. - load "#{CREW_LIB_PATH}/lib/fixup.rb" + system "#{CREW_LIB_PATH}/lib/fixup.rb" # Reload device.json in case it was modified by lib/fixup.rb @device = ConvenienceFunctions.load_symbolized_json diff --git a/lib/fixup.rb b/lib/fixup.rb index 26f71c9af..3a651dd5b 100644 --- a/lib/fixup.rb +++ b/lib/fixup.rb @@ -1,37 +1,11 @@ # lib/fixup.rb # Add fixups to be run during crew update here. -require 'English' -require 'etc' +require 'fileutils' require 'json' require_relative 'color' +require_relative 'const' require_relative 'convenience_functions' require_relative 'package' -require_relative 'require_gem' - -require_gem('highline') - -# All needed constants & variables should be defined here in case they -# have not yet been loaded or fixup is being run standalone. - -CREW_UNATTENDED ||= ENV.fetch('CREW_UNATTENDED', false) unless defined?(CREW_UNATTENDED) -CREW_VERBOSE ||= ARGV.intersect?(%w[-v --verbose]) unless defined?(CREW_VERBOSE) - -CREW_PREFIX ||= '/usr/local' -CREW_LIB_PATH ||= File.join(CREW_PREFIX, 'lib/crew') - -CREW_CONFIG_PATH ||= File.join(CREW_PREFIX, 'etc/crew') -CREW_META_PATH ||= File.join(CREW_CONFIG_PATH, 'meta') -CREW_REPO ||= ENV.fetch('CREW_REPO', 'https://github.com/chromebrew/chromebrew.git') unless defined?(CREW_REPO) -CREW_BRANCH ||= ENV.fetch('CREW_BRANCH', 'master') unless defined?(CREW_BRANCH) - -load "#{CREW_LIB_PATH}/lib/const.rb" -load "#{CREW_LIB_PATH}/lib/package.rb" -load "#{CREW_LIB_PATH}/lib/convenience_functions.rb" - -KERN_ARCH ||= Etc.uname[:machine] -ARCH ||= %w[aarch64 armv8l].include?(KERN_ARCH) ? 'armv7l' : KERN_ARCH -LIBC_VERSION ||= Etc.confstr(Etc::CS_GNU_LIBC_VERSION).split.last -CREW_PACKAGES_PATH ||= File.join(CREW_LIB_PATH, 'packages') # Commands run immediately after updating from git.