mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-11 00:18:06 -05:00
* glibc: Several improvements Signed-off-by: SupeChicken666 <me@supechicken666.dev> * Unset LD_PRELOAD before build Signed-off-by: SupeChicken666 <me@supechicken666.dev> * Adjust make to avoid segfaults. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * build changes Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add built packages for linux/386 to glibc_update * Add built packages for linux/amd64 to glibc_update * Add built packages for linux/arm/v7 to glibc_update * add armv7l binaries Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Make lib64 aarch64 changes clearer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust crew_profile_base to remove LD_LIBRARY_PATH Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust LD_LIBRARY_PATH setting again. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle arm multiarch. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer LD_LIBRARY_PATH Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove core. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update install.sh to working version. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update preload logic... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update hashes, add crew_preload to CREW_ESSENTIAL_PACKAGES. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove preload install sections from install.sh now that there is a separate crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add build instructions reference to crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Bring over more from the old install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Fix install on older systems. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Let CREW_ESSENTIAL_PACKAGES work on older syatems. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Move down setting of repo variables to after initial system checks exit. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use right ldconfig. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove sudo from ldconfig call. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust locale generation. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * cleanup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add condition for crew_preload. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove duplicate hashes. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle some install errors. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update ncurses, readline, bash Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add update of sudo_rs Signed-off-by: Satadru Pramanik <satadru@gmail.com> * ruby updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * llvm => 20.1.6 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rust rebuilds to work on older container glibcs... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove instance variable. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add libxcrypt to core. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use our versions of core apps where possible, since they will likely be newer than system binaries. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Universalize fixup to work with pre_glibc_standalone branch. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rename function to better describe what it does. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild filecmd and update edit. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * package updates/rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates and rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update unit tests. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * fixup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * gettext rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add upx and patchelf to essential packages, to avoid unit test failure. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates & rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Install adjustment. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Install adjustment. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Break out curl dependencies in install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust install.sh for arm. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle remove during upgrade of special packages. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust to notice empty CREW_ESSENTIAL_PACKAGES during remove. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add libxcrypt to CREW_ESSENTIAL_PACKAGES Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust CREW_STANDALONE_UPGRADE_ORDER Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Lint ruby package as per new rubocop. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Simplify getrealdeps.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Ruby rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add usage of docker tmpfs to workflows. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update python3 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild ruby Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild zlib Signed-off-by: Satadru Pramanik <satadru@gmail.com> * install testing Signed-off-by: Satadru Pramanik <satadru@gmail.com> * curl rebuild with older glibc Signed-off-by: Satadru Pramanik <satadru@gmail.com> * cleanup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust packages to reduce subshells during install. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle ELOOP exception. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add gcc15 rebuild. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild binutils without gcc version. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * update cmake Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add date stamp to installer.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update libxml2 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * shared_mime_info rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Many updates rebuilt on a lower glibc Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * sync up from pre_glibc_standalone Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Merge pre_glibc_standalone and master versions of glibc.rb. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Sync back deprecated glibc packages from pre_glibc_standalone. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint packages/rust.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Add versioning to installer error message. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * perl => 5.40.2 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add more variable setting to install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Reverse logic in glibc.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust curl_wrapper logic in install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Allow glibc package to pass rubocop. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Gate new glibc behind CREW_PRE_GLIBC_STANDALONE env variable. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update lib/const.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update mold Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * debug Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild uchardet Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Python Tweaks. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Python Tweaks Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Arm install adjustment Signed-off-by: Satadru Pramanik <satadru@gmail.com> * xzutils rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer to detect i686 in container. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add message to source bashrc to end of install. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Fix Updater workflow Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild lz4, adjust meson buildsystem to handle alternate location for meson files. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild zlib Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild xzutils Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild libyaml Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuilds of acl and attr for i686 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update automake and add no_filefix to autotools buildsystem. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild acl, attr, and revert from gettext 0.25, which is broken when using autopoint on x86_64 and armv7l. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * adjust core for i686 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjustments for i686 installs. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add ruby_prism to ruby_rubocop_ast package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust messages Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update compatibility of uutils_coreutils. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust install for both M136 hatch and M136 strongbad. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use Concurrent Ruby for upx and patchelf. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Switch installer to using static zstd. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update packages/zstd_static.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Make final crew update in install more robust. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * install adjustments. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: SupeChicken666 <me@supechicken666.dev> Signed-off-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: SupeChicken666 <me@supechicken666.dev> Co-authored-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: satmandu <satmandu@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ed Reel <edreel@gmail.com>
116 lines
4.9 KiB
Ruby
116 lines
4.9 KiB
Ruby
require 'fileutils'
|
|
require 'json'
|
|
require_relative '../lib/const'
|
|
require_relative '../lib/convenience_functions'
|
|
require_relative '../lib/package'
|
|
require_relative '../lib/package_utils'
|
|
|
|
class Command
|
|
def self.remove(pkg, verbose: false, force: false)
|
|
device_json = JSON.load_file(File.join(CREW_CONFIG_PATH, 'device.json'))
|
|
|
|
# Make sure the package is actually installed before we attempt to remove it.
|
|
unless PackageUtils.installed?(pkg.name)
|
|
puts "Package #{pkg.name} isn't installed.".lightred
|
|
return
|
|
end
|
|
|
|
# Do not remove any packages in CREW_ESSENTIAL_PACKAGES, as those are needed for ruby and thus crew to run.
|
|
# CREW_ESSENTIAL_PACKAGES is nil if overriding package upgrade list...
|
|
return if CREW_ESSENTIAL_PACKAGES.nil?
|
|
if CREW_ESSENTIAL_PACKAGES.include?(pkg.name) && !force
|
|
return if pkg.in_upgrade
|
|
|
|
puts <<~ESSENTIAL_PACKAGE_WARNING_EOF.gsub(/^(?=\w)/, ' ').lightred
|
|
#{pkg.name.capitalize} is considered an essential package needed for
|
|
Chromebrew to function and thus cannot be removed.
|
|
ESSENTIAL_PACKAGE_WARNING_EOF
|
|
|
|
# Exit with failure if attempt to remove an essential package
|
|
# is made.
|
|
exit 1
|
|
end
|
|
|
|
# Perform any operations required prior to package removal.
|
|
pkg.preremove
|
|
|
|
# Use gem to first try to remove gems...
|
|
if pkg.name.start_with?('ruby_')
|
|
@ruby_gem_name = pkg.name.sub('ruby_', '').sub('_', '-')
|
|
if Kernel.system "gem list -i \"^#{@ruby_gem_name}\$\"", %i[out err] => File::NULL
|
|
puts "Uninstalling #{@ruby_gem_name} before removing gem files. It's ok if this fails.".orange
|
|
system "gem uninstall -aIx --abort-on-dependent #{@ruby_gem_name}", exception: false
|
|
end
|
|
end
|
|
|
|
# Use pip to first try to remove python packages if package uses pip.
|
|
if pkg.name.start_with?('py3_')
|
|
pkg_file = Dir["{#{CREW_LOCAL_REPO_ROOT}/packages,#{CREW_PACKAGES_PATH}}/#{pkg.name}.rb"].max { |a, b| File.mtime(a) <=> File.mtime(b) }
|
|
system "python3 -s -m pip uninstall #{pkg.name.gsub('py3_', '')} -y", exception: false if Kernel.system "grep -q \"^require 'buildsystems/pip\" #{pkg_file}"
|
|
end
|
|
|
|
# Remove the files and directories installed by the package.
|
|
unless pkg.is_fake?
|
|
Dir.chdir CREW_CONFIG_PATH do
|
|
# Remove all files installed by the package in CREW_PREFIX and HOME.
|
|
#
|
|
# Exceptions:
|
|
# 1. The file exists in another installed package.
|
|
filelist_path = File.join(CREW_META_PATH, "#{pkg.name}.filelist")
|
|
if File.file?(filelist_path)
|
|
filelist = File.readlines(filelist_path, chomp: true)
|
|
overlap_files = ConvenienceFunctions.determine_conflicts(pkg.name, filelist_path, verbose: verbose)
|
|
# essential_files should only contain filelists for packages already installed.
|
|
essential_files = CREW_ESSENTIAL_PACKAGES.flat_map { |f| File.readlines(File.join(CREW_META_PATH, "#{f}.filelist"), chomp: true) if File.file?(File.join(CREW_META_PATH, "#{f}.filelist")) }
|
|
overlap_essential_files = filelist & essential_files
|
|
files_to_remove = filelist - overlap_files.values.flatten - overlap_essential_files
|
|
|
|
if overlap_essential_files.any?
|
|
warn "The following file(s) will not be deleted as they are required for Chromebrew to work properly:\n".orange
|
|
warn overlap_essential_files.join("\n").orange
|
|
warn "\n\n"
|
|
end
|
|
|
|
if overlap_files.any?
|
|
warn "The following file(s) in other packages will not be deleted during the removal of #{pkg.name}:\n".orange
|
|
overlap_files.each_pair do |pkg_name, files|
|
|
files.each { |file| puts "#{pkg_name}: #{file}".orange }
|
|
end
|
|
puts
|
|
end
|
|
|
|
files_to_remove.each do |file|
|
|
puts "Removing file #{file}".yellow if verbose
|
|
FileUtils.remove_file file, exception: false
|
|
end
|
|
|
|
FileUtils.remove_file filelist_path
|
|
end
|
|
|
|
# Remove all directories installed by the package.
|
|
dlist = File.join(CREW_META_PATH, "#{pkg.name}.directorylist")
|
|
if File.file?(dlist)
|
|
File.foreach(dlist, chomp: true) do |line|
|
|
next unless Dir.exist?(line) && Dir.empty?(line) && line.include?(CREW_PREFIX)
|
|
puts "Removing directory #{line}".yellow if verbose
|
|
FileUtils.remove_dir line, exception: false
|
|
end
|
|
FileUtils.remove_file dlist
|
|
end
|
|
end
|
|
end
|
|
|
|
# Remove the package from the list of installed packages in device.json.
|
|
puts "Removing package #{pkg.name} from device.json".yellow if verbose
|
|
device_json['installed_packages'].delete_if { |entry| entry['name'] == pkg.name }
|
|
|
|
# Update device.json with our changes.
|
|
ConvenienceFunctions.save_json(device_json)
|
|
|
|
# Perform any operations required after package removal.
|
|
pkg.postremove
|
|
|
|
puts "#{pkg.name} removed!".lightgreen
|
|
end
|
|
end
|