Hello community, here is the log from the commit of package yast2-registration for openSUSE:Factory checked in at 2018-04-26 13:29:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old) and /work/SRC/openSUSE:Factory/.yast2-registration.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-registration" Thu Apr 26 13:29:11 2018 rev:17 rq:597320 version:4.0.34 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes 2018-04-07 20:51:52.697636936 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-registration.new/yast2-registration.changes 2018-04-26 13:29:14.443405229 +0200 @@ -1,0 +2,20 @@ +Mon Apr 16 11:39:41 UTC 2018 - lsle...@suse.cz + +- Reimplemented AutoYaST autoupgrade, use the same API and workflow + like in a manual upgrade (bsc#1087206) +- 4.0.34 + +------------------------------------------------------------------- +Tue Apr 10 13:43:12 UTC 2018 - igonzalezs...@suse.com + +- Select wanted release packages during SCC based offline + migration (bsc#1086818) +- 4.0.33 + +------------------------------------------------------------------- +Mon Apr 9 09:47:09 UTC 2018 - jsr...@suse.cz + +- do not build on 32-bit architectures (bsc#1088552) +- 4.0.32 + +------------------------------------------------------------------- Old: ---- yast2-registration-4.0.31.tar.bz2 New: ---- yast2-registration-4.0.34.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.onWoc6/_old 2018-04-26 13:29:14.983385451 +0200 +++ /var/tmp/diff_new_pack.onWoc6/_new 2018-04-26 13:29:14.987385305 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.0.31 +Version: 4.0.34 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -58,6 +58,9 @@ BuildRequires: yast2-update >= 3.1.36 BuildArch: noarch +# SUSEConnect does not build for i586 and s390 and is not supported on those architectures +# bsc#1088552 +ExcludeArch: %ix86 s390 # FIXME: it seems can we cannot move it to macros.yast, the yast-rake-ci is not # installed into the chroot, the build fails... ++++++ yast2-registration-4.0.31.tar.bz2 -> yast2-registration-4.0.34.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/.travis.yml new/yast2-registration-4.0.34/.travis.yml --- old/yast2-registration-4.0.31/.travis.yml 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/.travis.yml 2018-04-17 08:58:29.000000000 +0200 @@ -12,3 +12,4 @@ # the "yast-travis-ruby" script is included in the base yastdevel/ruby image # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-registration-image yast-travis-ruby + - docker run -it yast-registration-image rake check:doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/package/yast2-registration.changes new/yast2-registration-4.0.34/package/yast2-registration.changes --- old/yast2-registration-4.0.31/package/yast2-registration.changes 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/package/yast2-registration.changes 2018-04-17 08:58:29.000000000 +0200 @@ -1,4 +1,24 @@ ------------------------------------------------------------------- +Mon Apr 16 11:39:41 UTC 2018 - lsle...@suse.cz + +- Reimplemented AutoYaST autoupgrade, use the same API and workflow + like in a manual upgrade (bsc#1087206) +- 4.0.34 + +------------------------------------------------------------------- +Tue Apr 10 13:43:12 UTC 2018 - igonzalezs...@suse.com + +- Select wanted release packages during SCC based offline + migration (bsc#1086818) +- 4.0.33 + +------------------------------------------------------------------- +Mon Apr 9 09:47:09 UTC 2018 - jsr...@suse.cz + +- do not build on 32-bit architectures (bsc#1088552) +- 4.0.32 + +------------------------------------------------------------------- Thu Apr 5 16:36:49 UTC 2018 - knut.anders...@suse.com - Given a license, remember whether another one with the same diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/package/yast2-registration.spec new/yast2-registration-4.0.34/package/yast2-registration.spec --- old/yast2-registration-4.0.31/package/yast2-registration.spec 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/package/yast2-registration.spec 2018-04-17 08:58:29.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.0.31 +Version: 4.0.34 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -61,6 +61,9 @@ BuildRequires: yast2-update >= 3.1.36 BuildArch: noarch +# SUSEConnect does not build for i586 and s390 and is not supported on those architectures +# bsc#1088552 +ExcludeArch: %ix86 s390 # FIXME: it seems can we cannot move it to macros.yast, the yast-rake-ci is not # installed into the chroot, the build fails... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/src/clients/scc_auto.rb new/yast2-registration-4.0.34/src/clients/scc_auto.rb --- old/yast2-registration-4.0.31/src/clients/scc_auto.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/src/clients/scc_auto.rb 2018-04-17 08:58:29.000000000 +0200 @@ -26,6 +26,7 @@ # # +require "fileutils" require "yast/suse_connect" require "registration/storage" @@ -38,6 +39,7 @@ require "registration/ssl_certificate" require "registration/url_helpers" require "registration/ui/autoyast_config_workflow" +require "registration/ui/offline_migration_workflow" require "registration/erb_renderer.rb" module Yast @@ -187,9 +189,15 @@ # update the registration in AutoUpgrade mode if the old system was registered if Mode.update && old_system_registered? - updated = update_registration - log.info "Registration updated: #{updated}" - return updated + # drop all obsolete repositories and services (manual upgrade contains a dialog + # where the old repositories are deleted, in AY we need to do it automatically here) + # Note: the Update module creates automatically a backup which is restored + # when upgrade is aborted or crashes. + repo_cleanup + + ret = ::Registration::UI::OfflineMigrationWorkflow.new.main + log.info "Migration result: #{ret}" + return ret == :next end ret = ::Registration::ConnectHelpers.catch_registration_errors do @@ -204,6 +212,17 @@ true end + # delete all previous services and repositories + def repo_cleanup + # we cannot use pkg-bindings here because loading services would trigger + # service and repository refresh which we want to avoid (it might easily fail) + old = Dir[File.join(Installation.destdir, "/etc/zypp/repos.d/*")] + + Dir[File.join(Installation.destdir, "/etc/zypp/services.d/*")] + + log.info "Removing #{old}" + ::FileUtils.rm_rf(old) + end + # finish the registration process def finish_registration # save the registered repositories @@ -298,10 +317,8 @@ # update the registration (system, the base product, the installed extensions) def update_registration return false unless update_system_registration - return false unless update_base_product - return false unless update_addons - # register additional addons (e.g. originally not present in SLE11) + # register additional addons (e.g. originally not present in SLE11/SLE12) register_addons end @@ -346,12 +363,6 @@ registration_ui.update_system end - # update the base product registration - # @return [Boolean] true on success - def update_base_product - handle_product_service { registration_ui.update_base_product } - end - # @yieldreturn [Boolean, SUSE::Connect::Remote::Product] success flag and # remote product pair # @return [Boolean] true on success @@ -364,15 +375,6 @@ registration_ui.disable_update_repos(product_service) end - - # @return [Boolean] true on success - # FIXME: share with inst_scc.rb - def update_addons - addons = registration_ui.get_available_addons - - failed_addons = registration_ui.update_addons(addons, enable_updates: @config.install_updates) - failed_addons.empty? - end end unless defined?(SccAutoClient) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/src/lib/registration/registration_ui.rb new/yast2-registration-4.0.34/src/lib/registration/registration_ui.rb --- old/yast2-registration-4.0.31/src/lib/registration/registration_ui.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/src/lib/registration/registration_ui.rb 2018-04-17 08:58:29.000000000 +0200 @@ -353,7 +353,7 @@ # Register those of *selected_addons* that we can without asking # the user for a reg code. The remaining ones are returned. - # @param product [Array<Addon>] + # @param selected_addons [Array<Addon>] # @param known_reg_codes [Hash{String => String}] addon id -> reg code # @return [Array<Addon>] the remaining addons def try_register_addons(selected_addons, known_reg_codes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/src/lib/registration/sw_mgmt.rb new/yast2-registration-4.0.34/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-4.0.31/src/lib/registration/sw_mgmt.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/src/lib/registration/sw_mgmt.rb 2018-04-17 08:58:29.000000000 +0200 @@ -123,7 +123,7 @@ # products use the same version and arch. # # @param self_update_id [String] product name to be used for get the installer updates - # @return product [Hash,nil] with pkg-binding format; return nil if the + # @return [Hash,nil] with pkg-binding format; return nil if the # given self_update_id is empty or there is no base product available def self.installer_update_base_product(self_update_id) return if self_update_id.empty? @@ -508,9 +508,12 @@ end # select products for new added extensions/modules + # + # @param addon_services [Array<SUSE::Connect::Remote::Service] List of services + # If it is not specified, it falls back to {Registration::Storage::Cache#addon_services}. # @return [Boolean] true on success - def self.select_addon_products - addon_services = ::Registration::Storage::Cache.instance.addon_services + def self.select_addon_products(addon_services = nil) + addon_services ||= ::Registration::Storage::Cache.instance.addon_services log.info "New addon services: #{addon_services}" new_repos = addon_services.reduce([]) do |acc, service| @@ -530,13 +533,18 @@ ret = products.all? { |product| Pkg.ResolvableInstall(product, :product) } + select_default_product_patterns unless Mode.update + + ret + end + + # Select default product patterns + def self.select_default_product_patterns # preselect the default product patterns (FATE#320199) # note: must be called *after* selecting the products product_patterns = ProductPatterns.new log.info "Selecting the default product patterns: #{product_patterns.names}" product_patterns.select - - ret end # select remote addons matching the product resolvables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/src/lib/registration/ui/migration_repos_workflow.rb new/yast2-registration-4.0.34/src/lib/registration/ui/migration_repos_workflow.rb --- old/yast2-registration-4.0.31/src/lib/registration/ui/migration_repos_workflow.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/src/lib/registration/ui/migration_repos_workflow.rb 2018-04-17 08:58:29.000000000 +0200 @@ -84,6 +84,7 @@ "register_migration_products" => [->() { register_migration_products }, true], "activate_migration_repos" => [->() { activate_migration_repos }, true], "select_migration_repos" => ->() { select_migration_repos }, + "select_products" => ->() { select_products }, "store_repos_state" => ->() { store_repos_state } } @@ -138,12 +139,15 @@ abort: :rollback, cancel: :rollback, repo_selection: "select_migration_repos", - next: "store_repos_state" + next: "select_products" }, "select_migration_repos" => { abort: :rollback, cancel: :rollback, - next: "store_repos_state" + next: "select_products" + }, + "select_products" => { + next: "store_repos_state" }, "store_repos_state" => { next: :next @@ -154,11 +158,8 @@ # if the system is not registered # @return [Symbol] workflow symbol, :next if registered, :abort when not def registration_check - # handle system upgrade (fate#323163) - if Yast::Stage.initial && Yast::Mode.update - log.info "System upgrade mode detected" - return system_upgrade_check - end + ret = registration_check_at_installation + return ret if ret return :next if Registration.is_registered? @@ -174,6 +175,23 @@ register_system end + # check the current registration status + # @return [nil, Symbol] the workflow symbol (:next, :skip) or nil if not + # in an installation + def registration_check_at_installation + # handle system upgrade (fate#323163) + return nil unless Yast::Stage.initial + # test autoupgrade first, Mode.update covers the autoupgrade as well + return registration_check_at_autoupgrade if Yast::Mode.autoupgrade + return system_upgrade_check if Yast::Mode.update + + nil + end + + def registration_check_at_autoupgrade + Registration.is_registered? ? :next : :skip + end + # run the registration module to register the system # @return [Symbol] the registration result def register_system @@ -246,9 +264,11 @@ addons = Addon.registered_not_installed.each_with_object([]) do |addon, result| - if Yast::Popup.YesNoHeadline(addon.friendly_name, (msg % addon.friendly_name)) - result << SwMgmt.remote_product(addon.to_h) - end + next unless Yast::Mode.auto || Yast::Popup.YesNoHeadline( + addon.friendly_name, (msg % addon.friendly_name) + ) + + result << SwMgmt.remote_product(addon.to_h) end products.concat(addons) @@ -307,6 +327,10 @@ release_type: nil ) + load_migrations_for_products(products, remote_product) + end + + def load_migrations_for_products(products, remote_product) log.info "Loading offline migrations for target product: #{remote_product.inspect}" log.info "Installed products: #{products.inspect}" self.migrations = registration_ui.offline_migration_products(products, remote_product) @@ -314,7 +338,7 @@ if migrations.empty? # TRANSLATORS: Error message Yast::Report.Error(_("No migration product found.")) - return :empty + return Yast::Mode.auto ? :abort : :empty end :next @@ -350,6 +374,8 @@ # run the migration target selection dialog # @return [Symbol] workflow symbol (:next or :abort) def select_migration_products + return select_migration_products_autoyast if Yast::Mode.auto + log.info "Displaying migration target selection dialog" dialog = MigrationSelectionDialog.new(migrations, SwMgmt.installed_products) ret = dialog.run @@ -363,6 +389,20 @@ ret end + # Select the migration product in the AutoYaST mode + # @return [Symbol] workflow symbol (:next) + def select_migration_products_autoyast + # TODO: for now simply select the first found migration (bsc#1087206#c7) + # later we can improve this (either choose the migration with higher product versions + # or allow selecting the migration in the AY profile) + self.selected_migration = migrations.first + self.manual_repo_selection = false + log.warn "More than one migration available, using the first one" if migrations.size > 1 + log.info "Selected migration: #{selected_migration}" + + :next + end + # collect products to migrate # @return [Array<Hash>] installed or registered products def products_to_migrate @@ -451,7 +491,9 @@ migration_repos.services << service end - if migration_repos.service_with_update_repo? + if Yast::Mode.auto + migration_repos.install_updates = ::Registration::Storage::Config.instance.install_updates + elsif migration_repos.service_with_update_repo? migration_repos.install_updates = registration_ui.install_updates? end @@ -466,6 +508,15 @@ UI::MigrationReposSelectionDialog.run end + # Select products for migration + # + # It causes the *-release packages to be installed (see bsc#1086818 for + # further details). + def select_products + SwMgmt.select_addon_products(registered_services) + :next + end + def store_repos_state RepoStateStorage.instance.write :next @@ -491,6 +542,7 @@ # (unregistered system or explicitly requested by user), :next => # continue with the SCC/SMT based upgrade def system_upgrade_check + log.info "System upgrade mode detected" # media based upgrade requested by user if Yast::Linuxrc.InstallInf("MediaUpgrade") == "1" explicit_media_upgrade diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/src/lib/registration/ui/regservice_selection_dialog.rb new/yast2-registration-4.0.34/src/lib/registration/ui/regservice_selection_dialog.rb --- old/yast2-registration-4.0.31/src/lib/registration/ui/regservice_selection_dialog.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/src/lib/registration/ui/regservice_selection_dialog.rb 2018-04-17 08:58:29.000000000 +0200 @@ -85,7 +85,7 @@ # It's needed because the "scc" option is not a proper service, just a # special value. # - # @param [SlpServiceClass::Service,String] Service to describe + # @param service [SlpServiceClass::Service,String] Service to describe # @return [String] Service description # # @see Yast::Dialogs::ServiceSelection#service_to_description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/test/migration_repos_workflow_spec.rb new/yast2-registration-4.0.34/test/migration_repos_workflow_spec.rb --- old/yast2-registration-4.0.31/test/migration_repos_workflow_spec.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/test/migration_repos_workflow_spec.rb 2018-04-17 08:58:29.000000000 +0200 @@ -151,6 +151,15 @@ expect(subject.run_sequence).to eq(:next) end + it "selects products to install" do + set_success_expectations + expect(Registration::SwMgmt).to receive(:select_addon_products) do |services| + expect(services.first.id).to eq(1311) + end + + subject.run_sequence + end + it "displays the custom repository selection if required" do set_success_expectations @@ -238,6 +247,23 @@ allow(Registration::UrlHelpers).to receive(:registration_url) end + context "no migration product found" do + before do + expect(Y2Packager::ProductUpgrade).to receive(:new_base_product).and_return(nil) + allow(Yast::Report).to receive(:Error) + end + + it "displays a warning popup" do + expect(Yast::Report).to receive(:Error).with(/Cannot find a base product/) + subject.send(:load_migration_products_offline, activated_products) + end + + it "returns :empty" do + ret = subject.send(:load_migration_products_offline, activated_products) + expect(ret).to eq(:empty) + end + end + it "loads the possible migrations from the server" do subject.send(:load_migration_products_offline, activated_products) expect(subject.send(:migrations)).to_not be_empty diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.0.31/test/sw_mgmt_spec.rb new/yast2-registration-4.0.34/test/sw_mgmt_spec.rb --- old/yast2-registration-4.0.31/test/sw_mgmt_spec.rb 2018-04-06 09:27:49.000000000 +0200 +++ new/yast2-registration-4.0.34/test/sw_mgmt_spec.rb 2018-04-17 08:58:29.000000000 +0200 @@ -268,13 +268,12 @@ end describe ".select_addon_products" do + let(:legacy_services) { load_yaml_fixture("legacy_module_services.yml") } + before do allow_any_instance_of(Yast::ProductPatterns).to receive(:names).and_return([]) allow_any_instance_of(Yast::ProductPatterns).to receive(:select) - legacy_services = load_yaml_fixture("legacy_module_services.yml") - allow(::Registration::Storage::Cache).to receive(:instance) - .and_return(double("addon_services" => legacy_services)) allow(subject).to receive(:service_repos).with(legacy_services.first) .and_return(load_yaml_fixture("legacy_module_repositories.yml")) allow(Yast::Pkg).to receive(:ResolvableProperties) @@ -285,13 +284,38 @@ it "selects new addon products for installation" do expect(Yast::Pkg).to receive(:ResolvableInstall).with("sle-module-legacy", :product) - subject.select_addon_products + subject.select_addon_products(legacy_services) end it "selects the default patterns for the selected products" do expect_any_instance_of(Yast::ProductPatterns).to receive(:select) - subject.select_addon_products + subject.select_addon_products(legacy_services) + end + + context "when no services list is given" do + before do + allow(::Registration::Storage::Cache).to receive(:instance) + .and_return(double("addon_services" => legacy_services)) + end + + it "defaults to the cached list of addon services" do + expect(Yast::Pkg).to receive(:ResolvableInstall).with("sle-module-legacy", :product) + + subject.select_addon_products + end + end + + context "during update" do + before do + allow(Yast::Mode).to receive(:update).and_return(true) + end + + it "does not select default patterns for the selected products" do + expect(Yast::ProductPatterns).to_not receive(:new) + + subject.select_addon_products(legacy_services) + end end end