mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
crew: Fix file size calculation (#12578)
Signed-off-by: SupeChicken666 <supechicken666@gmail.com>
This commit is contained in:
14
bin/crew
14
bin/crew
@@ -868,13 +868,17 @@ def prepare_package(destdir)
|
||||
# Allow postbuild to override the filelist contents
|
||||
@pkg.postbuild
|
||||
|
||||
# create file list
|
||||
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.join(CREW_DEST_DIR, file)) ? File.size(File.join(CREW_DEST_DIR, file)) : 0 }
|
||||
# Create file list and calculate file size
|
||||
filelist = Dir[".{#{CREW_PREFIX},#{HOME}}/**/{*,.?*}"].select do |e|
|
||||
File.file?(e) || File.symlink?(e)
|
||||
end.to_h do |e|
|
||||
# Ignore symlinks to prevent duplicating calculation.
|
||||
[e[1..], File.symlink?(e) ? 0 : File.size(e)]
|
||||
end
|
||||
|
||||
File.write 'filelist', <<~EOF
|
||||
# Total size: #{total_size}
|
||||
#{filelist.join("\n")}
|
||||
# Total size: #{filelist.values.sum}
|
||||
#{filelist.keys.sort.join("\n")}
|
||||
EOF
|
||||
|
||||
if Dir.exist?("#{CREW_LOCAL_REPO_ROOT}/manifest") && File.writable?("#{CREW_LOCAL_REPO_ROOT}/manifest")
|
||||
|
||||
Reference in New Issue
Block a user