Fix fake package removal bug (#9766)

This commit is contained in:
Ed Reel
2024-05-08 04:02:27 -05:00
committed by GitHub
parent f4154bb0c5
commit 45fe6cb4c6
2 changed files with 22 additions and 20 deletions

View File

@@ -23,28 +23,30 @@ class Command
pkg.preremove
# Remove the files and directories installed by the package.
Dir.chdir CREW_CONFIG_PATH do
# Remove all files installed by the package.
File.foreach(File.join(CREW_META_PATH, "#{pkg.name}.filelist"), chomp: true) do |line|
next unless line.start_with?(CREW_PREFIX)
if system("grep --exclude #{pkg.name}.filelist -Fxq '#{line}' ./meta/*.filelist")
puts "#{line} is in another package. It will not be removed during the removal of #{pkg.name}.".orange
else
puts "Removing file #{line}".yellow if verbose
FileUtils.remove_file line, exception: false
unless pkg.is_fake
Dir.chdir CREW_CONFIG_PATH do
# Remove all files installed by the package.
File.foreach(File.join(CREW_META_PATH, "#{pkg.name}.filelist"), chomp: true) do |line|
next unless line.start_with?(CREW_PREFIX)
if system("grep --exclude #{pkg.name}.filelist -Fxq '#{line}' ./meta/*.filelist")
puts "#{line} is in another package. It will not be removed during the removal of #{pkg.name}.".orange
else
puts "Removing file #{line}".yellow if verbose
FileUtils.remove_file line, exception: false
end
end
end
# Remove all directories installed by the package.
File.foreach(File.join(CREW_META_PATH, "#{pkg.name}.directorylist"), 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
# Remove all directories installed by the package.
File.foreach(File.join(CREW_META_PATH, "#{pkg.name}.directorylist"), 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
# Remove the file and directory lists.
FileUtils.remove_file File.join(CREW_META_PATH, "#{pkg.name}.filelist")
FileUtils.remove_file File.join(CREW_META_PATH, "#{pkg.name}.directorylist")
# Remove the file and directory lists.
FileUtils.remove_file File.join(CREW_META_PATH, "#{pkg.name}.filelist")
FileUtils.remove_file File.join(CREW_META_PATH, "#{pkg.name}.directorylist")
end
end
# Remove the package from the list of installed packages in device.json.

View File

@@ -2,7 +2,7 @@
# Defines common constants used in different parts of crew
require 'etc'
CREW_VERSION = '1.47.8'
CREW_VERSION = '1.47.9'
# kernel architecture
KERN_ARCH = Etc.uname[:machine]