You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defshrink_dir(dir)unlessCREW_NOT_SHRINK_ARCHIVEDir.chdirdirdoifFile.exist?("#{CREW_PREFIX}/bin/rdfind")puts'Using rdfind to convert duplicate files to hard links.'system"#{CREW_PREFIX}/bin/rdfind -removeidentinode true -makesymlinks false -makehardlinks true -makeresultsfile false ."end# Issues with non-x86_64 in compressing libraries, so just compress# non-libraries. Also note that one needs to use "upx -d" on a# compressed file to use ldd.# sommelier also isn't happy when sommelier and xwayland are compressed# so don't compress those packages.ifFile.exist?("#{CREW_PREFIX}/bin/upx")# 1. Find executable binaries but also check for hard linked# files by making sure we have a unique set of# inodes for the binaries found.# 2. Copy to a temp file.# 3. Compress using upx. (Uncompressble files are ignored.)# 4. Check compression by expanding the compressed file with# upx.# 5. If the expansion doesn't error out then it is ok to copy# over the original. (This also lets us only avoid compressing# hard linked files multiple times.)# Also disable for sommelier.elf and Xwayland.elf since upx# breaks those binaries.@execfiles=`find . -executable -type f ! \\( -name \"*.so*\" -o -name \"*.a\" -o -name \"Xwayland.elf\" -o -name \"sommelier.elf\"\\) -exec head -c4 {} 2>/dev/null \\; -printf ' %i %p\\n'| grep ^.ELF | sort -u -n -s -k2,2 | awk '{print $3}'`.chompunless@execfiles.to_s.empty?puts'Using upx to shrink binaries.'# Copying in the ThreadPoolExecutor loop fails non-deterministically@execfiles.each_linedo |execfilecp|
execfilecp.slice!'.'execfilecp=dir + execfilecp.chompFileUtils.cpexecfilecp.to_s,"#{execfilecp}-crewupxtmp"endbegingem'concurrent-ruby'rescueGem::LoadErrorputs' -> install gem concurrent-ruby'Gem.install('concurrent-ruby')gem'concurrent-ruby'endrequire'concurrent'pool=Concurrent::ThreadPoolExecutor.new(min_threads: 1,max_threads: CREW_NPROC,max_queue: 0,# unbounded work queuefallback_policy: :caller_runs)@execfiles.each_linedo |execfile|
pool.postdoexecfile.slice!'.'execfile=dir + execfile.chompputs"Attempting to compress #{execfile} ...".orange# Make tmp file for compressionunlesssystem"upx --lzma #{execfile}-crewupxtmp"puts"Compression of #{execfile} failed...".orangeif@opt_verboseFileUtils.rm_f"#{execfile}-crewupxtmp"endifFile.exist?("#{execfile}-crewupxtmp")puts"Testing compressed #{execfile}...".lightblueif@opt_verboseifsystem"upx -t #{execfile}-crewupxtmp && cp #{execfile}-crewupxtmp #{execfile}"puts"#{execfile} successfully compressed...".lightgreenelsifFile.exist?("#{execfile}-crewupxtmp")FileUtils.rm_f"#{execfile}-crewupxtmp"# line 1187 in original fileendendFileUtils.rm_f"#{execfile}-crewupxtmp"endendpool.shutdownpool.wait_for_termination# Make sure temporary compression copies are deleted.system'find . -executable -type f -name "*-crewupxtmp" -delete'endendendendend
Fixesrubocop#10936.
This PR fixes an error for `Lint/NonAtomicFileOperation`
when using `FileTest.exist?` as a condition for `elsif`.
Complex cases such as `if`/`elsif`/`else` don't autocorrect
and respect user changes.
Fixes#10936.
This PR fixes an error for `Lint/NonAtomicFileOperation`
when using `FileTest.exist?` as a condition for `elsif`.
Complex cases such as `if`/`elsif`/`else` don't autocorrect
and respect user changes.
The aformentioned line of code:
RuboCop version
The text was updated successfully, but these errors were encountered: