Commit 1db5043d authored by satmandu's avatar satmandu Committed by GitHub

crew: Fix error message when executable scripts are found during build archiving (#5884)

* Fix error message when executable scripts are found

* bump version
parent bfc41bfa
...@@ -961,19 +961,23 @@ def shrink_dir(dir) ...@@ -961,19 +961,23 @@ def shrink_dir(dir)
puts "Using symlinks tool to make absolute symlinks relative" puts "Using symlinks tool to make absolute symlinks relative"
system 'symlinks -cr .' if File.exist?("#{CREW_PREFIX}/bin/symlinks") system 'symlinks -cr .' if File.exist?("#{CREW_PREFIX}/bin/symlinks")
end end
# Issues with non-x86_64 in compressing libraries, so just compress # Issues with non-x86_64 in compressing libraries, so just compress
# non-libraries. Also note that one needs to use "upx -d" on a # non-libraries. Also note that one needs to use "upx -d" on a
# compressed file to use ldd. # compressed file to use ldd.
# sommelier also isn't happy when sommelier and xwayland are compressed # sommelier also isn't happy when sommelier and xwayland are compressed
# so don't compress those packages. # so don't compress those packages.
if File.exist?("#{CREW_PREFIX}/bin/upx") if File.exist?("#{CREW_PREFIX}/bin/upx")
puts "Using upx to shrink binaries." # Logic here is to find executable binaries, compress after making
# Logic here is to find executable files, check if they are ELF files, # a backup, then expand the compressed file with upx. If the
# compress a file while making a backup, expand the file with # expansion doesn't error out then it is ok to delete the backup.
# upx, and if the expansion doesn't error then delete the backup. @execfiles = %x[find . -executable -type f ! \\( -name \"*.so*\" -o -name \"*.a\" \\) -exec sh -c \"file -i \'{}\' | grep -q \'executable; charset=binary\'\" \\; -print].chomp
system "find . -executable -type f ! \\( -name \"*.so*\" -o -name \"*.a\" \\)| xargs file | \ unless @execfiles.empty? or @execfiles.nil?
grep ELF | cut -d: -f1 | xargs -I {} \ puts "Using upx to shrink binaries."
bash -c 'upx --best -k --overlay=skip {} && \( upx -t {} && rm {}.~ || mv {}.~ {}\)'" @execfiles.each_line do |execfile|
system "upx --best -k --overlay=skip #{execfile} && \
\( upx -t #{execfile} && rm #{execfile}.~ || mv #{execfile}.~ #{execfile}\)"
end
end
end end
end end
end end
......
# Defines common constants used in different parts of crew # Defines common constants used in different parts of crew
CREW_VERSION = '1.11.1' CREW_VERSION = '1.11.2'
ARCH_ACTUAL = `uname -m`.strip ARCH_ACTUAL = `uname -m`.strip
# This helps with virtualized builds on aarch64 machines # This helps with virtualized builds on aarch64 machines
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment