crew: Handle attempted removal of essential files (#6229)

* crew: Handle attempted removal of essential files

* Add info about essential files.

* bump version
This commit is contained in:
Satadru Pramanik
2021-09-23 17:43:15 -04:00
committed by GitHub
parent 0da88c7cae
commit 563dfef31d
2 changed files with 19 additions and 5 deletions

View File

@@ -1341,13 +1341,23 @@ def remove(pkgName)
#if the filelist exists, remove the files and directories installed by the package
if File.file?("#{CREW_META_PATH}#{pkgName}.filelist")
Dir.chdir CREW_CONFIG_PATH do
#remove all files installed by the package
File.open("meta/#{pkgName}.filelist").each_line do |line|
begin
# Do not remove essential files from gcc or libssp which ruby
# relies on, especially during package upgrades or reinstalls.
# These essential files are enumerated in const.rb as
# CREW_ESSENTIAL_FILES.
if CREW_ESSENTIAL_FILES.include? line.chomp
if @opt_verbose
puts "Removing #{line.chomp} will break crew. It was " +
'NOT'.lightred + ' deleted.'
end
else
puts 'Removing file ' + line.chomp + ''.lightred if @opt_verbose
File.unlink line.chomp
rescue => exception #swallow exception
begin
File.unlink line.chomp
rescue => exception #swallow exception
end
end
end

View File

@@ -1,6 +1,6 @@
# Defines common constants used in different parts of crew
CREW_VERSION = '1.16.7'
CREW_VERSION = '1.16.8'
ARCH_ACTUAL = `uname -m`.strip
# This helps with virtualized builds on aarch64 machines
@@ -126,3 +126,7 @@ PY_SETUP_INSTALL_OPTIONS = "#{PY_SETUP_INSTALL_OPTIONS_NO_SVEM} --single-version
CREW_FIRST_PACKAGES = %w[libssh curl git pixz shared_mime_info]
CREW_LAST_PACKAGES = %w[ghc mandb gtk3 gtk4 sommelier]
# libssp is in the libssp package
# libatomic is in the gcc package
CREW_ESSENTIAL_FILES = %W[#{CREW_LIB_PREFIX}/libssp.so.0.0.0 #{CREW_LIB_PREFIX}/libatomic.so.1]