Skip to content

Commit

Permalink
Merge pull request #411 from yast/master-1127818
Browse files Browse the repository at this point in the history
AY: Disabling local repositories in second stage only.
  • Loading branch information
dgdavid committed Mar 19, 2019
2 parents 945934c + 8b482bb commit 5205253
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Mar 15 15:51:00 CET 2019 - schubi@suse.de

- AutoYaST: Disabling local repositories in second stage only.
(bsc#1127818)
- 4.1.33

-------------------------------------------------------------------
Thu Mar 7 17:08:01 CET 2019 - schubi@suse.de

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


Name: yast2-packager
Version: 4.1.32
Version: 4.1.33
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
14 changes: 13 additions & 1 deletion src/lib/packager/clients/pkg_finish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def initialize
Yast.import "Packages"
Yast.import "Directory"
Yast.import "ProductFeatures"
Yast.import "InstFunctions"
end

# @see Implements ::Installation::FinishClient#modes
Expand All @@ -62,6 +63,16 @@ def title

# @see Implements ::Installation::FinishClient#write
def write
if Stage.cont
# AutoYaST second stage. We only have to disable local repos.
Pkg.SourceLoad
disable_local_repos
# save all repositories and finish target
Pkg.SourceSaveAll
Pkg.TargetFinish
return nil
end

# Remove (backup) all sources not used during the update
# BNC #556469: Backup and remove all the old repositories before any Pkg::SourceSaveAll call
backup_all_target_sources if Stage.initial && Mode.update
Expand All @@ -76,7 +87,8 @@ def write
# if online repositories were not enabled), resolvables should be loaded now.
Pkg.SourceLoad
remove_auto_added_sources
disable_local_repos
# AutoYaST: disable_local_repos will be called in second install
disable_local_repos unless InstFunctions.second_stage_required?

# save all repositories and finish target
Pkg.SourceSaveAll
Expand Down
41 changes: 38 additions & 3 deletions test/pkg_finish_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,44 @@
allow(remote_repo).to receive(:products).and_return([sles_product])
end

it "disables the local repository" do
expect(local_repo).to receive(:disable!)
client.run
context "second stage will not be called" do
before do
allow(Yast::Stage).to receive(:cont).and_return(false)
allow(Yast::InstFunctions).to receive(:second_stage_required?).and_return(false)
end

it "disables the local repository" do
expect(local_repo).to receive(:disable!)
client.run
end
end

context "second stage will be called due AutoYaST" do
before do
allow(Yast::InstFunctions).to receive(:second_stage_required?).and_return(true)
end

context "in first installation stage" do
before do
allow(Yast::Stage).to receive(:cont).and_return(false)
end

it "does not disable the local repository" do
expect(local_repo).not_to receive(:disable!)
client.run
end
end

context "in second installation stage" do
before do
allow(Yast::Stage).to receive(:cont).and_return(true)
end

it "disables the local repository" do
expect(local_repo).to receive(:disable!)
client.run
end
end
end
end

Expand Down

0 comments on commit 5205253

Please sign in to comment.