mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-06 22:24:12 -05:00
crew; Include file size in file list (#12515)
* crew; Include file size in file list Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Bump version Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Use `.grep` instead of `.reject` Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Bump version Signed-off-by: SupeChicken666 <supechicken666@gmail.com> --------- Signed-off-by: SupeChicken666 <supechicken666@gmail.com> Co-authored-by: Satadru Pramanik, DO, MPH, MEng <satadru@gmail.com>
This commit is contained in:
9
bin/crew
9
bin/crew
@@ -833,8 +833,13 @@ def prepare_package(destdir)
|
||||
@pkg.postbuild
|
||||
|
||||
# create file list
|
||||
filelist = Dir[".{#{CREW_PREFIX},#{HOME}}/**/{*,.?*}"].filter_map { |e| File.file?(e) || File.symlink?(e) ? e[1..] : nil }.sort
|
||||
File.write('filelist', "#{filelist.join("\n")}\n")
|
||||
filelist = Dir[".{#{CREW_PREFIX},#{HOME}}/**/{*,.?*}"].filter_map { |e| File.file?(e) || File.symlink?(e) ? e[1..] : nil }.sort
|
||||
total_size = filelist.sum { |file| File.file?(file) ? File.size(file) : 0 }
|
||||
|
||||
File.write 'filelist', <<~EOF
|
||||
# Total size: #{total_size}
|
||||
#{filelist.join("\n")}
|
||||
EOF
|
||||
|
||||
if Dir.exist?("#{CREW_LOCAL_REPO_ROOT}/manifest") && File.writable?("#{CREW_LOCAL_REPO_ROOT}/manifest")
|
||||
FileUtils.mkdir_p "#{CREW_LOCAL_REPO_ROOT}/manifest/#{ARCH}/#{@pkg.name.chr.downcase}"
|
||||
|
||||
@@ -26,7 +26,7 @@ class Command
|
||||
puts pkg.name.lightgreen + ": #{pkg.description}".lightblue
|
||||
|
||||
# Read the file into memory as an array of lines.
|
||||
filelist = File.readlines(filelist_path, chomp: true)
|
||||
filelist = File.readlines(filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
size = 0
|
||||
|
||||
filelist.each do |filename|
|
||||
|
||||
@@ -76,7 +76,7 @@ class Command
|
||||
# 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)
|
||||
filelist = File.readlines(filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
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")) }
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'etc'
|
||||
require 'open3'
|
||||
|
||||
OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
|
||||
CREW_VERSION ||= '1.64.9' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
CREW_VERSION ||= '1.64.10' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
|
||||
# Kernel architecture.
|
||||
KERN_ARCH ||= Etc.uname[:machine]
|
||||
|
||||
@@ -18,7 +18,7 @@ class String; def blank? = strip.empty?; end
|
||||
class ConvenienceFunctions
|
||||
def self.determine_conflicts(pkg_name, filelist = File.join(CREW_META_PATH, "#{pkg_name}.filelist"), exclude_suffix = nil, verbose: false)
|
||||
conflicts = {}
|
||||
target_filelist = File.readlines(filelist, chomp: true)
|
||||
target_filelist = File.readlines(filelist, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
puts 'Checking for conflicts with files from installed packages...'.orange if verbose
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class Gcc_dev < Package
|
||||
puts 'Installing Gcc_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'gcc_build.filelist')
|
||||
abort 'File list for Gcc_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && !filename.include?('libgccjit')
|
||||
|
||||
@@ -30,7 +30,7 @@ class Gcc_lib < Package
|
||||
puts 'Installing Gcc_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'gcc_build.filelist')
|
||||
abort 'File list for Gcc_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless filename.include?('.so') && !filename.include?('libgccjit')
|
||||
|
||||
@@ -283,7 +283,7 @@ class Glibc_build233 < Package
|
||||
# This is the array of locales to save:
|
||||
@locales = %w[C cs_CZ de_DE en es_MX fa_IR fr_FR it_IT ja_JP ru_RU tr_TR zh]
|
||||
@localedirs = %W[#{CREW_PREFIX}/share/locale #{CREW_PREFIX}/share/i18n/locales]
|
||||
@filelist = File.readlines("#{CREW_META_PATH}/glibc_build233.filelist")
|
||||
@filelist = File.readlines("#{CREW_META_PATH}/glibc_build233.filelist").grep(/^(?!#)/)
|
||||
@localedirs.each do |localedir|
|
||||
Dir.chdir localedir do
|
||||
Dir['*'].each do |f|
|
||||
|
||||
@@ -278,7 +278,7 @@ class Glibc_build235 < Package
|
||||
# This is the array of locales to save:
|
||||
@locales = %w[C cs_CZ de_DE en es_MX fa_IR fr_FR it_IT ja_JP ru_RU tr_TR zh]
|
||||
@localedirs = %W[#{CREW_PREFIX}/share/locale #{CREW_PREFIX}/share/i18n/locales]
|
||||
@filelist = File.readlines("#{CREW_META_PATH}/glibc_build235.filelist")
|
||||
@filelist = File.readlines("#{CREW_META_PATH}/glibc_build235.filelist").grep(/^(?!#)/)
|
||||
@localedirs.each do |localedir|
|
||||
Dir.chdir localedir do
|
||||
Dir['*'].each do |f|
|
||||
|
||||
@@ -27,7 +27,7 @@ class Glibc_dev235 < Package
|
||||
puts 'Installing Glibc_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'glibc_build235.filelist')
|
||||
abort 'File list for Glibc_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') || filename.include?('bin/')
|
||||
|
||||
@@ -31,7 +31,7 @@ class Glibc_dev237 < Package
|
||||
puts 'Installing Glibc_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'glibc_build237.filelist')
|
||||
abort 'File list for Glibc_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') || filename.include?('bin/')
|
||||
|
||||
@@ -27,7 +27,7 @@ class Glibc_lib235 < Package
|
||||
puts 'Installing Glibc_build235 to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'glibc_build235.filelist')
|
||||
abort 'File list for Glibc_build235 does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless filename.include?('.so') || filename.include?('bin/')
|
||||
|
||||
@@ -30,7 +30,7 @@ class Glibc_lib237 < Package
|
||||
puts 'Installing Glibc_build237 to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'glibc_build237.filelist')
|
||||
abort 'File list for Glibc_build237 does not exist! Please run: crew reinstall glibc_build237'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') || filename.include?('bin/')) && File.file?(filename)
|
||||
|
||||
@@ -36,7 +36,7 @@ class Llvm16_dev < Package
|
||||
puts 'Installing llvm16_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm16_build.filelist')
|
||||
abort 'File list for llvm16_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && filename.include?('libLLVM')
|
||||
|
||||
@@ -33,7 +33,7 @@ class Llvm16_lib < Package
|
||||
puts 'Installing llvm16_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm16_build.filelist')
|
||||
abort 'File list for llvm16_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') && filename.include?('libLLVM')) || filename.include?('llvm-strip')
|
||||
|
||||
@@ -39,7 +39,7 @@ class Llvm17_dev < Package
|
||||
puts 'Installing llvm17_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm17_build.filelist')
|
||||
abort 'File list for llvm17_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && filename.include?('libLLVM')
|
||||
|
||||
@@ -36,7 +36,7 @@ class Llvm17_lib < Package
|
||||
puts 'Installing llvm17_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm17_build.filelist')
|
||||
abort 'File list for llvm17_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') && filename.include?('libLLVM')) || filename.include?('llvm-strip')
|
||||
|
||||
@@ -40,7 +40,7 @@ class Llvm18_dev < Package
|
||||
puts 'Installing llvm18_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm18_build.filelist')
|
||||
abort 'File list for llvm18_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && filename.include?('libLLVM')
|
||||
|
||||
@@ -37,7 +37,7 @@ class Llvm18_lib < Package
|
||||
puts 'Installing llvm18_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm18_build.filelist')
|
||||
abort 'File list for llvm18_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') && filename.include?('libLLVM')) || filename.include?('llvm-strip')
|
||||
|
||||
@@ -38,7 +38,7 @@ class Llvm19_dev < Package
|
||||
puts 'Installing llvm19_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm19_build.filelist')
|
||||
abort 'File list for llvm19_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && filename.include?('libLLVM')
|
||||
|
||||
@@ -37,7 +37,7 @@ class Llvm19_lib < Package
|
||||
puts 'Installing llvm19_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm19_build.filelist')
|
||||
abort 'File list for llvm19_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') && filename.include?('libLLVM')) || filename.include?('llvm-strip')
|
||||
|
||||
@@ -38,7 +38,7 @@ class Llvm20_dev < Package
|
||||
puts 'Installing llvm20_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm20_build.filelist')
|
||||
abort 'File list for llvm20_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next if filename.include?('.so') && filename.include?('libLLVM')
|
||||
|
||||
@@ -37,7 +37,7 @@ class Llvm20_lib < Package
|
||||
puts 'Installing llvm20_build to pull files for build...'.lightblue
|
||||
@filelist_path = File.join(CREW_META_PATH, 'llvm20_build.filelist')
|
||||
abort 'File list for llvm20_build does not exist!'.lightred unless File.file?(@filelist_path)
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).sort
|
||||
@filelist = File.readlines(@filelist_path, chomp: true).grep(/^(?!#)/)
|
||||
|
||||
@filelist.each do |filename|
|
||||
next unless (filename.include?('.so') && filename.include?('libLLVM')) || filename.include?('llvm-strip')
|
||||
|
||||
Reference in New Issue
Block a user