Skip to content

Commit

Permalink
Refresh repositories with changed URL and reload them again
Browse files Browse the repository at this point in the history
...to activate the changes (related to bsc#1215884)
- 4.5.18
  • Loading branch information
lslezak committed Oct 27, 2023
1 parent 5ed2d9b commit 0664ba9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package/yast2-installation.changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
Fri Oct 27 14:13:14 UTC 2023 - Ladislav Slezák <[email protected]>

- Refresh repositories with changed URL and reload them again
to activate the changes (related to bsc#1215884)
- 4.5.18

-------------------------------------------------------------------
Thu Jun 15 15:01:13 UTC 2023 - Stefan Hundhammer <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-installation.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-installation
Version: 4.5.17
Version: 4.5.18
Release: 0
Summary: YaST2 - Installation Parts
License: GPL-2.0-only
Expand Down
4 changes: 4 additions & 0 deletions src/lib/installation/clients/inst_upgrade_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

require "yast"
require "installation/upgrade_repo_manager"
require "y2packager/medium_type"
require "y2packager/repository"

Yast.import "GetInstArgs"
Expand Down Expand Up @@ -297,6 +298,9 @@ def save_pkg_mgr
# do not save the changes in the test mode
Pkg.SourceSaveAll unless test?

# reload repositories only when using the openSUSE Leap media
Pkg.SourceLoad if Y2Packager::MediumType.standard?

# clear the old repositories
Y2Packager::OriginalRepositorySetup.instance.repositories.clear
end
Expand Down
11 changes: 11 additions & 0 deletions src/lib/installation/upgrade_repo_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def activate_changes
update_urls
process_repos
remove_services

# reload the package manager to activate the changes
Yast::Pkg.SourceSaveAll
Yast::Pkg.SourceFinishAll
Yast::Pkg.SourceRestore
Yast::Pkg.SourceLoad
end

private
Expand Down Expand Up @@ -167,6 +173,11 @@ def process_repos
def update_urls
new_urls.each do |repo, url|
repo.url = url

# if the repository will be enabled refresh the content
if status_map[repo] == :enabled
Yast::Pkg.SourceForceRefreshNow(repo.repo_id)
end
end
end

Expand Down

0 comments on commit 0664ba9

Please sign in to comment.