Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SP3] Fixed repository initialization during installation/upgrade (bsc#1193698) #1226

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions library/packages/src/modules/PackageSystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ def main
# Has Pkg::TargetInit run?
@target_initialized = false

# Has Pkg::SourceStartCache run?
@source_initialized = false

Yast.include self, "packages/common.rb"

@_rpm_query_binary_initialized = false
Expand Down Expand Up @@ -94,7 +91,8 @@ def EnsureTargetInit
def EnsureSourceInit
PackageLock.Check

if @source_initialized
# no repository present (not even a disabled one)
if Pkg.SourceGetCurrent(false).empty?
# this way, if somebody closed the cache outside of Package
# (typically in installation), we will reinitialize
# it's cheap if cache is already initialized
Expand All @@ -107,11 +105,8 @@ def EnsureSourceInit
EnsureTargetInit()
end

sources = Pkg.SourceStartCache(true)

if Ops.greater_than(Builtins.size(sources), 0)
@source_initialized = true
else
# at least one enabled repository?
if Pkg.SourceGetCurrent(true).empty?
# all repositories are disabled or no repository defined
Builtins.y2warning("No package repository available")
end
Expand Down Expand Up @@ -310,7 +305,8 @@ def DoInstallAndRemove(toinstall, toremove)
def Available(package)
EnsureSourceInit()

if !@source_initialized
# at least one enabled repository present?
if Pkg.SourceGetCurrent(true).empty?
# error no source initialized
return nil
end
Expand Down Expand Up @@ -379,7 +375,8 @@ def PackageInstalled(package)
def PackageAvailable(package)
EnsureSourceInit()

if !@source_initialized
# at least one enabled repository present?
if Pkg.SourceGetCurrent(true).empty?
# error no source initialized
return nil
end
Expand Down