Skip to content

Commit

Permalink
Use the new way for finding the product upgrade (bsc#1086259) (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Apr 4, 2018
1 parent 787701f commit 5484baa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
7 changes: 0 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ Yast::Tasks.configuration do |conf|
# lets ignore license check for now
conf.skip_license_check << /.*/
end

task "test:unit" => "test:unit:env"

task "test:unit:env" do
# run tests in English locale (to avoid problems with translations)
ENV["LC_ALL"] = "en_US.UTF-8"
end
8 changes: 8 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Apr 3 15:44:53 UTC 2018 - lslezak@suse.cz

- Better evaluate the product to upgrade, do not use the package
solver if there is only one base product to install, use some
fallbacks when the solver fails (bsc#1086259)
- 4.0.30

-------------------------------------------------------------------
Tue Mar 27 14:58:42 UTC 2018 - jreidinger@suse.com

Expand Down
9 changes: 5 additions & 4 deletions package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 4.0.29
Version: 4.0.30
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand All @@ -26,8 +26,8 @@ Source0: %{name}-%{version}.tar.bz2
Group: System/YaST
License: GPL-2.0

## UI::TextHelpers wrap_text
Requires: yast2 >= 4.0.1
# Y2Packager::ProductUpgrad
Requires: yast2 >= 4.0.62
# "dupAllowVendorChange" option in Pkg.SetSolverFlags()
Requires: yast2-pkg-bindings >= 3.1.34
# N_() method
Expand All @@ -48,7 +48,8 @@ Requires: yast2-add-on >= 3.1.8
Requires: yast2-packager >= 3.1.95
Requires: yast2-update >= 3.1.36

BuildRequires: yast2 >= 4.0.1
# Y2Packager::ProductUpgrade
BuildRequires: yast2 >= 4.0.62
BuildRequires: update-desktop-files
BuildRequires: yast2-devtools >= 3.1.39
BuildRequires: rubygem(yast-rake) >= 0.2.5
Expand Down
18 changes: 2 additions & 16 deletions src/lib/registration/ui/migration_repos_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

require "yast"
require "yast2/popup"
require "y2packager/product_upgrade"

require "registration/registration"
require "registration/registration_ui"
Expand Down Expand Up @@ -289,7 +290,7 @@ def load_migration_products_online
# on a system that is not running (offline migration)
# @return [Symbol] workflow symbol (:next or :abort)
def load_migration_products_offline(activations)
base_product = upgraded_base_product
base_product = Y2Packager::ProductUpgrade.new_base_product
if !base_product
# TRANSLATORS: Error message
Yast::Report.Error(_("Cannot find a base product to upgrade."))
Expand Down Expand Up @@ -574,21 +575,6 @@ def media_upgrade(registered)
"using the previous product. The packages from the registration " \
"repositories can conflict with the new packages.</p>")
end

def upgraded_base_product
# temporarily run the update mode to let the solver select the product for upgrade
# (this will correctly handle possible product renames)
Yast::Pkg.PkgUpdateAll({})
product = Y2Packager::Product.selected_base

# restore the initial status, the package update will be turned on later again
Yast::Pkg.PkgReset
changed = Yast::Pkg.GetPackages(:removed, true) + Yast::Pkg.GetPackages(:selected, true)
changed.each { |p| Yast::Pkg.PkgNeutral(p) }

log.info("Upgraded base product: #{product.inspect}")
product
end
end
end
end
2 changes: 1 addition & 1 deletion test/migration_repos_workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
let(:selected_base) { load_yaml_fixture("migration_sles15_selected_base.yml") }

before do
allow(Y2Packager::Product).to receive(:selected_base).and_return(selected_base)
allow(Y2Packager::ProductUpgrade).to receive(:new_base_product).and_return(selected_base)
allow_any_instance_of(Registration::RegistrationUI).to receive(:offline_migration_products)
.and_return(offline_migrations)

Expand Down
3 changes: 3 additions & 0 deletions test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
TESTS_PATH = Pathname.new(File.dirname(__FILE__))
FIXTURES_PATH = TESTS_PATH.join("fixtures")

# run tests in English locale (to avoid problems with translations)
ENV["LC_ALL"] = "en_US.UTF-8"

if ENV["COVERAGE"]
require "simplecov"

Expand Down

0 comments on commit 5484baa

Please sign in to comment.