[yast-commit] [ci_new_pac] JFYI yast2-registration -> sle12
Script 'mail_helper' called by ro Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: ro. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-registration -> sle12 Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-03-06 18:56:47.000000000 +0100 +++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-03-10 14:51:55.000000000 +0100 @@ -1,0 +2,8 @@ +Thu Mar 6 20:31:05 UTC 2014 - lslezak@suse.cz + +- display a popup for selecting/deselecting registered repositories + (to allow e.g. disabling Updates and installing GA version) + (FATE#312012) +- 3.1.18 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2-registration ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2-registration (Old) and /mounts/work_src_done/SLE12/yast2-registration (BS:build ID:34128 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-registration-3.1.17.tar.bz2 New: ---- yast2-registration-3.1.18.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.XaWZux/_old 2014-03-10 16:13:54.000000000 +0100 +++ /var/tmp/diff_new_pack.XaWZux/_new 2014-03-10 16:13:54.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.17 +Version: 3.1.18 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-registration-3.1.17.tar.bz2 -> yast2-registration-3.1.18.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/package/yast2-registration.changes new/yast2-registration-3.1.18/package/yast2-registration.changes --- old/yast2-registration-3.1.17/package/yast2-registration.changes 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/package/yast2-registration.changes 2014-03-10 14:49:36.000000000 +0100 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Thu Mar 6 20:31:05 UTC 2014 - lslezak@suse.cz + +- display a popup for selecting/deselecting registered repositories + (to allow e.g. disabling Updates and installing GA version) + (FATE#312012) +- 3.1.18 + +------------------------------------------------------------------- Thu Mar 6 14:18:51 UTC 2014 - lslezak@suse.cz - fixed service refresh loop (bnc#867120) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/package/yast2-registration.spec new/yast2-registration-3.1.18/package/yast2-registration.spec --- old/yast2-registration-3.1.17/package/yast2-registration.spec 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/package/yast2-registration.spec 2014-03-10 14:49:36.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.17 +Version: 3.1.18 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/Makefile.am new/yast2-registration-3.1.18/src/Makefile.am --- old/yast2-registration-3.1.17/src/Makefile.am 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/src/Makefile.am 2014-03-10 14:49:36.000000000 +0100 @@ -3,7 +3,8 @@ client_DATA = \ clients/discover_registration_services.rb \ clients/inst_scc.rb \ - clients/scc.rb + clients/scc.rb \ + clients/scc_finish.rb desktop_DATA = \ desktop/customer_center.desktop @@ -12,6 +13,7 @@ ylib_DATA = \ lib/registration/exceptions.rb \ lib/registration/sw_mgmt.rb \ + lib/registration/repo_state.rb \ lib/registration/helpers.rb EXTRA_DIST = $(client_DATA) $(desktop_DATA) $(ylib_DATA) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/clients/discover_registration_services.rb new/yast2-registration-3.1.18/src/clients/discover_registration_services.rb --- old/yast2-registration-3.1.17/src/clients/discover_registration_services.rb 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/src/clients/discover_registration_services.rb 2014-03-10 14:49:36.000000000 +0100 @@ -83,7 +83,7 @@ selected_service = services[selected.to_i] log.info "Selected service #{selected_service.inspect}" - url = Registration::Helpers.service_url(selected_service.slp_url) + url = ::Registration::Helpers.service_url(selected_service.slp_url) log.info "Selected service URL: #{url}" return url @@ -101,7 +101,7 @@ Left( RadioButton( Id(index.to_s), - Registration::Helpers.service_description(service), + ::Registration::Helpers.service_description(service), false ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/clients/inst_scc.rb new/yast2-registration-3.1.18/src/clients/inst_scc.rb --- old/yast2-registration-3.1.17/src/clients/inst_scc.rb 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/src/clients/inst_scc.rb 2014-03-10 14:49:36.000000000 +0100 @@ -28,6 +28,7 @@ require "registration/exceptions" require "registration/helpers" require "registration/sw_mgmt" +require "registration/repo_state" module Yast class InstSccClient < Client @@ -43,6 +44,7 @@ Yast.import "Wizard" Yast.import "Report" Yast.import "Mode" + Yast.import "Label" # redirect the scc_api log to y2log SccApi::GlobalLogger.instance.log = Y2Logger.instance @@ -85,10 +87,10 @@ else Report.Error(_("Registration failed.")) end - rescue Registration::ServiceError => e + rescue ::Registration::ServiceError => e log.error("Service error: #{e.message % e.service}") Report.Error(_(e.message) % e.service) - rescue Registration::PkgError => e + rescue ::Registration::PkgError => e log.error("Pkg error: #{e.message}") Report.Error(_(e.message)) rescue Exception => e @@ -110,9 +112,9 @@ scc = SccApi::Connection.new(email, reg_code) # set the current language to receive translated error messages - scc.language = Registration::Helpers.language + scc.language = ::Registration::Helpers.language - reg_url = Registration::Helpers.registration_url + reg_url = ::Registration::Helpers.registration_url if reg_url log.info "Using custom registration URL: #{reg_url.inspect}" @@ -125,7 +127,7 @@ end # ensure the zypp config directories are writable in inst-sys - Registration::SwMgmt.zypp_config_writable! + ::Registration::SwMgmt.zypp_config_writable! # write the global credentials credentials.write @@ -133,12 +135,14 @@ # then register the product(s) product_services = run_with_feedback(_("Registering the Product..."), _("Contacting the SUSE Customer Center server")) do # there will be just one base product, but theoretically there can be more... - Registration::SwMgmt.products_to_register.map do |base_product| + ::Registration::SwMgmt.products_to_register.map do |base_product| log.info("Registering base product: #{base_product.inspect}") scc.register(base_product) end end + log.info "product_services: #{product_services.inspect}" + if !product_services.empty? Progress.New( # TRANSLATORS: dialog caption @@ -154,10 +158,13 @@ Progress.NextStage begin - Registration::SwMgmt.add_services(product_services, credentials) + ::Registration::SwMgmt.add_services(product_services, credentials) ensure Progress.Finish end + + # select repositories to use in installation (e.g. enable/disable Updates) + select_repositories(product_services) if Mode.installation end end @@ -196,6 +203,60 @@ ) end + def repo_items(repos) + repos.map{|repo| Item(Id(repo["SrcId"]), repo["name"], repo["enabled"])} + end + + def repo_selection_dialog(repos) + label = _("You can manually change the repository states,\n" + + "select repositories which will be used for installation.") + + VBox( + Heading(_("Repository State")), + VSpacing(0.5), + Label(label), + MultiSelectionBox(Id(:repositories), "", repo_items(repos)), + VSpacing(0.5), + HBox( + PushButton(Id(:ok), Opt(:default), Label.OKButton), + PushButton(Id(:cancel), Label.CancelButton) + ) + ) + end + + def activate_repo_settings(repos) + selected_items = UI.QueryWidget(Id(:repositories), :SelectedItems) + log.info "Selected items: #{selected_items.inspect}" + + repos.each do |repo| + repo_id = repo["SrcId"] + enabled = selected_items.include?(repo["SrcId"]) + + if repo["enabled"] != enabled + # remember the original state + repo_state = ::Registration::RepoState.new(repo["SrcId"], repo["enabled"]) + ::Registration::RepoStateStorage.instance.repositories << repo_state + + log.info "Changing repository state: #{repo["name"]} enabled: #{enabled}" + Pkg.SourceSetEnabled(repo_id, enabled) + end + end + end + + def select_repositories(product_services) + repos = ::Registration::SwMgmt.service_repos(product_services) + + UI.OpenDialog(repo_selection_dialog(repos)) + UI.SetFocus(:ok) + + begin + ret = UI.UserInput + activate_repo_settings(repos) if ret == :ok + ensure + UI.CloseDialog + end + end + def run_with_feedback(header, label, &block) Popup.ShowFeedback(header, label) yield @@ -206,10 +267,10 @@ def confirm_skipping # Popup question: confirm skipping the registration confirmation = _("If you do not register your system we will not be able\n" + - "to grant you access to the update repositories.\n\n" + - "You can register after the installation or visit our\n" + - "Customer Center for online registration.\n\n" + - "Really skip the registration now?") + "to grant you access to the update repositories.\n\n" + + "You can register after the installation or visit our\n" + + "Customer Center for online registration.\n\n" + + "Really skip the registration now?") Popup.YesNo(confirmation) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/clients/scc.rb new/yast2-registration-3.1.18/src/clients/scc.rb --- old/yast2-registration-3.1.17/src/clients/scc.rb 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/src/clients/scc.rb 2014-03-10 14:49:36.000000000 +0100 @@ -29,7 +29,7 @@ import "Wizard" Wizard.CreateDialog - Registration::SwMgmt.init + ::Registration::SwMgmt.init WFM.call("inst_scc") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/clients/scc_finish.rb new/yast2-registration-3.1.18/src/clients/scc_finish.rb --- old/yast2-registration-3.1.17/src/clients/scc_finish.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.18/src/clients/scc_finish.rb 2014-03-10 14:49:36.000000000 +0100 @@ -0,0 +1,71 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2013 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# +# client for setting the original repository states +# + +require "yast" + +require "registration/repo_state" + +module Yast + class SccFinishClient < Client + include Yast::Logger + + def main + Yast.import "Pkg" + + textdomain "registration" + + func = WFM.Args.first + raise "#{File.basename(__FILE__)}: missing parameter" unless func + + log.info "starting #{__FILE__} (func: #{func})" + + if func == "Info" + return { + "steps" => 1, + # progress step title + "title" => _("Setting original repository configuration..."), + "when" => ::Registration::RepoStateStorage.instance.repositories.empty? ? + [] : [:installation, :live_installation, :update, :autoinst] + } + elsif func == "Write" + # nothing to write + changed_repos = ::Registration::RepoStateStorage.instance.repositories + return nil if changed_repos.empty? + + # activate the original repository states + changed_repos.each(&:restore_state) + + # save all repositories + Pkg.SourceSaveAll + else + raise "#{File.basename(__FILE__)}:unknown parameter: #{func.inspect}" + end + + log.info "#{__FILE__} finished" + end + + end +end + +Yast::SccFinishClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/lib/registration/repo_state.rb new/yast2-registration-3.1.18/src/lib/registration/repo_state.rb --- old/yast2-registration-3.1.17/src/lib/registration/repo_state.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.18/src/lib/registration/repo_state.rb 2014-03-10 14:49:36.000000000 +0100 @@ -0,0 +1,59 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# +# + +require "singleton" + +require "yast" + +module Registration + Yast.import "Pkg" + + # storage for changed repositories + class RepoStateStorage + include Singleton + + attr_accessor :repositories + + def initialize + @repositories = [] + end + end + + # store repository ID and it's original state (enabled/disabled) + class RepoState + include Yast::Logger + + attr_reader :repo_id, :enabled + + def initialize(repo_id, enabled) + @repo_id = repo_id + @enabled = enabled + end + + def restore_state + log.info "Restoring the original repository state: id: #{repo_id}, enabled: #{enabled}" + Yast::Pkg.SourceSetEnabled(repo_id, enabled) + end + end +end + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/src/lib/registration/sw_mgmt.rb new/yast2-registration-3.1.18/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-3.1.17/src/lib/registration/sw_mgmt.rb 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/src/lib/registration/sw_mgmt.rb 2014-03-10 14:49:36.000000000 +0100 @@ -134,6 +134,24 @@ Pkg.SourceSaveAll end + # get list of repositories belonging to registered services + def self.service_repos(product_services) + repo_data = Pkg.SourceGetCurrent(false).map do |repo| + data = Pkg.SourceGeneralData(repo) + data["SrcId"] = repo + data + end + + service_names = product_services.map(&:services).flatten.map(&:name) + log.info "Added services: #{service_names.inspect}" + + # select only repositories belonging to the product services + repos = repo_data.select{|repo| service_names.include?(repo["service"])} + log.info "Service repositories: #{repos}" + + repos + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/test/Makefile.am new/yast2-registration-3.1.18/test/Makefile.am --- old/yast2-registration-3.1.17/test/Makefile.am 2014-03-06 16:10:09.000000000 +0100 +++ new/yast2-registration-3.1.18/test/Makefile.am 2014-03-10 14:49:37.000000000 +0100 @@ -1,5 +1,8 @@ TESTS = \ - helpers_spec.rb + discover_registration_services_spec.rb \ + helpers_spec.rb \ + scc_finish_test.rb \ + sw_mgmt_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec --format doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/test/scc_finish_test.rb new/yast2-registration-3.1.18/test/scc_finish_test.rb --- old/yast2-registration-3.1.17/test/scc_finish_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.18/test/scc_finish_test.rb 2014-03-10 14:49:37.000000000 +0100 @@ -0,0 +1,79 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" + +require "yast" + +require "registration/repo_state" + +describe "scc_finish client" do + let(:pkg) { double("Yast::Pkg") } + + before do + stub_const("Yast::Pkg", pkg) + end + + context "with Info parameter" do + it "describes the client" do + # check for the hash keys present + expect(Yast::WFM.call("scc_finish", ["Info"])).to include("steps", "title", "when") + end + end + + context "with Write parameter" do + it "restores the original repository states" do + Registration::RepoStateStorage.instance.repositories = [ + Registration::RepoState.new(1, true), + Registration::RepoState.new(2, false) + ] + + expect(pkg).to receive(:SourceSetEnabled).with(1, true) + expect(pkg).to receive(:SourceSetEnabled).with(2, false) + expect(pkg).to receive(:SourceSaveAll) + + expect(Yast::WFM.call("scc_finish", ["Write"])).to be_nil + end + + it "does not do write anything if no repo was changed" do + Registration::RepoStateStorage.instance.repositories = [] + + expect(pkg).to receive(:SourceSetEnabled).never + expect(pkg).to receive(:SourceSaveAll).never + + expect(Yast::WFM.call("scc_finish", ["Write"])).to be_nil + end + end + + context "without any parameter" do + it "the client call returns false" do + # even when there are some changes they are not saved + Registration::RepoStateStorage.instance.repositories = [ + Registration::RepoState.new(1, true), + Registration::RepoState.new(2, false) + ] + + expect(pkg).to receive(:SourceSetEnabled).never + expect(pkg).to receive(:SourceSaveAll).never + + # WFM.call catches all exceptions and returns false + # see https://github.com/yast/yast-ruby-bindings/blob/master/src/ruby/yast/wfm.rb#... + expect(Yast::WFM.call("scc_finish")).to be_false + expect(Yast::WFM.call("scc_finish", [])).to be_false + end + end + + context "with a wrong parameter" do + it "the client call returns false" do + # even when there are some changes they are not saved + Registration::RepoStateStorage.instance.repositories = [ + Registration::RepoState.new(1, true), + Registration::RepoState.new(2, false) + ] + + expect(pkg).to receive(:SourceSetEnabled).never + expect(pkg).to receive(:SourceSaveAll).never + + expect(Yast::WFM.call("scc_finish", ["Invalid_Parameter"])).to be_false + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.17/test/sw_mgmt_test.rb new/yast2-registration-3.1.18/test/sw_mgmt_test.rb --- old/yast2-registration-3.1.17/test/sw_mgmt_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.18/test/sw_mgmt_test.rb 2014-03-10 14:49:37.000000000 +0100 @@ -0,0 +1,64 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" + +require "registration/sw_mgmt" + +describe Registration::SwMgmt do + describe ".service_repos" do + it "returns list of repositories belonging to a service" do + service_name = "SLES" + repos = { + # installation repository, not from registration + 0 => { + "alias"=>"SLES12", "autorefresh"=>false, + "base_urls"=>["cd:///"], + "enabled"=>true, "is_update_repo"=>false, "keeppackages"=>false, + "mirror_list"=>"", "name"=>"SLES12", "priority"=>99, "product_dir"=>"", + "service"=>"", "type"=>"SUSE", + "url"=>"cd:///" + }, + # pool repo from service + 1 => { + "alias"=>"SLES:SLES12-Pool", "autorefresh"=>true, + "base_urls"=>["https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12-POOL"], + "enabled"=>true, "is_update_repo"=>false, "keeppackages"=>false, + "mirror_list"=>"", "name"=>"SLES12-Pool", "priority"=>99, "product_dir"=>"", + "service"=>service_name, "type"=>"YUM", + "url"=>"https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12-POOL" + }, + # update repo from service + 2 => { + "alias"=>"SLES:SLES12-Updates", "autorefresh"=>true, + "base_urls"=>["https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12"], + "enabled"=>true, "is_update_repo"=>false, "keeppackages"=>false, + "mirror_list"=>"", "name"=>"SLES12-Updates", "priority"=>99, "product_dir"=> "", + "service"=>service_name, "type"=>"YUM", + "url"=>"https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12" + }, + # update repo from a different service + 3 => { + "alias"=>"Another:SLES12-Updates", "autorefresh"=>true, + "base_urls"=>["https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12"], + "enabled"=>true, "is_update_repo"=>false, "keeppackages"=>false, + "mirror_list"=>"", "name"=>"SLES12-Updates", "priority"=>99, "product_dir"=> "", + "service"=> "Another", "type"=>"YUM", + "url"=>"https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12" + } + } + + service = double + expect(service).to receive(:name).and_return(service_name) + services = double + expect(services).to receive(:services).and_return([service]) + + expect(Yast::Pkg).to receive(:SourceGetCurrent).with(false).and_return(repos.keys) + repos.each do |id, repo| + expect(Yast::Pkg).to receive(:SourceGeneralData).with(id).and_return(repo) + end + + expect(Registration::SwMgmt.service_repos([services])).to eq([repos[1], repos[2]]) + end + end + +end continue with "q"... Checked in at Mon Mar 10 16:14:03 CET 2014 by ro Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
ro