Commit e97dd649 authored by satmandu's avatar satmandu Committed by GitHub

Fix package upgrade order (#5853)

* Fix package upgrade order

* more dependency logic cleanup
parent 13b74e15
......@@ -589,6 +589,20 @@ def upgrade
end
end
# Adjust package install ordering for upgrades.
CREW_FIRST_PACKAGES.each do |pkg|
# Add package to beginning.
toBeUpdated.insert(0,toBeUpdated.delete(pkg)) if toBeUpdated.include? pkg
end
CREW_LAST_PACKAGES.each do |pkg|
if toBeUpdated.include? pkg
# Add package to beginning.
toBeUpdated.insert(0,toBeUpdated.delete(pkg))
# Now rotate first package to last package.
toBeUpdated=toBeUpdated.rotate(1)
end
end
unless toBeUpdated.empty?
puts 'Updating packages...'
toBeUpdated.each do |package|
......@@ -1050,10 +1064,10 @@ def resolve_dependencies
puts 'The following packages also need to be installed: '
deps = @dependencies
begin_packages = []
end_packages = []
first_packages = %w[curl git pixz shared_mime_info]
last_packages = %w[ghc mandb gtk3 gtk4 sommelier]
# populate arrays with common elements
begin_packages = deps & CREW_FIRST_PACKAGES
end_packages = deps & CREW_LAST_PACKAGES
@dependencies.each do |dep|
depends = nil
File.open("#{CREW_PACKAGES_PATH}#{dep}.rb") do |f|
......@@ -1065,19 +1079,13 @@ def resolve_dependencies
end
end
end
begin_packages.push dep if first_packages.include? dep
# if a dependency package has no other dependencies, push to the front
begin_packages.push dep unless depends
end_packages.push dep if last_packages.include? dep
end
i = 0
all_packages = begin_packages + end_packages
deps.each do |dep|
if all_packages.include?(dep)
deps.delete_at(i)
end
i += 1
end
# Remove elements in another array
deps -= begin_packages
deps -= end_packages
@dependencies = (begin_packages + deps + end_packages).uniq
@dependencies.each do |dep|
......
# Defines common constants used in different parts of crew
CREW_VERSION = '1.11.0'
CREW_VERSION = '1.11.1'
ARCH_ACTUAL = `uname -m`.strip
# This helps with virtualized builds on aarch64 machines
......@@ -102,3 +102,6 @@ CREW_CMAKE_LIBSUFFIX_OPTIONS = "#{CREW_CMAKE_OPTIONS} -DLIB_SUFFIX=#{CREW_LIB_SU
PY3_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python3"
PY2_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python2"
PY_SETUP_INSTALL_OPTIONS = "--root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX} -O2 --compile --single-version-externally-managed"
CREW_FIRST_PACKAGES = %w[curl git pixz shared_mime_info]
CREW_LAST_PACKAGES = %w[ghc mandb gtk3 gtk4 sommelier]
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