Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2017-03-21 22:47:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Tue Mar 21 22:47:36 2017 rev:398 rq:481344 version:3.2.19 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2017-02-18 03:16:30.810262675 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2017-03-21 22:47:38.594948976 +0100 @@ -1,0 +2,34 @@ +Mon Mar 20 10:11:52 UTC 2017 - [email protected] + +- Added PackageDownloader and PackageExtractor classes for sharing + the package downloading and extracting functions (fate#320772) +- 3.2.19 + +------------------------------------------------------------------- +Mon Mar 20 08:09:06 UTC 2017 - [email protected] + +- bnc#1026027 + - removed insserv calls +- 3.2.18 + +------------------------------------------------------------------- +Thu Mar 16 13:48:06 CET 2017 - [email protected] + +- UnitFileState will be used for evaluating enable state of + services. If it has an invalid value "systemctl is-enabled...." + has to be called instead. (bnc#1012047) +- 3.2.17 + +------------------------------------------------------------------- +Wed Mar 15 14:19:44 UTC 2017 - [email protected] + +- Added FileChanges.created_files (part of fix for bsc#1027582) +- 3.2.16 + +------------------------------------------------------------------- +Wed Mar 8 15:26:48 UTC 2017 - [email protected] + +- Support to add roles through addons (FATE#320772) +- 3.2.15 + +------------------------------------------------------------------- Old: ---- yast2-3.2.14.tar.bz2 New: ---- yast2-3.2.19.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.KQKR2Y/_old 2017-03-21 22:47:39.290850594 +0100 +++ /var/tmp/diff_new_pack.KQKR2Y/_new 2017-03-21 22:47:39.294850029 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.14 +Version: 3.2.19 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0 @@ -47,6 +47,11 @@ BuildRequires: yast2-ruby-bindings >= 3.1.36 BuildRequires: yast2-testsuite BuildRequires: yast2-ycp-ui-bindings >= 3.1.8 +# for the PackageExtractor tests, just make sure they are present, +# these should be installed in the default build anyway +BuildRequires: cpio +BuildRequires: rpm + # for ag_tty (/bin/stty) # for /usr/bin/md5sum Requires: coreutils @@ -97,6 +102,10 @@ Requires: bind-utils %endif Obsoletes: yast2-devel-doc +# for the PackageExtractor class, just make sure they are present, +# these should be present even in a very minimal installation +Requires: cpio +Requires: rpm %description This package contains scripts and data needed for SUSE Linux ++++++ yast2-3.2.14.tar.bz2 -> yast2-3.2.19.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/control/src/modules/ProductControl.rb new/yast2-3.2.19/library/control/src/modules/ProductControl.rb --- old/yast2-3.2.14/library/control/src/modules/ProductControl.rb 2017-02-16 17:10:05.542221488 +0100 +++ new/yast2-3.2.19/library/control/src/modules/ProductControl.rb 2017-03-20 15:26:45.021124529 +0100 @@ -33,6 +33,12 @@ module Yast class ProductControlClass < Module + include Yast::Logger + + # Product control system roles key + # @return [String] System roles + SYSTEM_ROLES_KEY = "system_roles".freeze + def main Yast.import "UI" textdomain "base" @@ -67,6 +73,9 @@ # modules to be offered to clone configuration at the end of installation @clone_modules = [] + # roles + @system_roles = [] + # additional workflow parameters # workflow doesn't only match mode and stage but also these params # bnc #427002 @@ -293,6 +302,7 @@ @proposals = Ops.get_list(@productControl, "proposals", []) @inst_finish = Ops.get_list(@productControl, "inst_finish_stages", []) @clone_modules = Ops.get_list(@productControl, "clone_modules", []) + @system_roles = @productControl.fetch(SYSTEM_ROLES_KEY, []) Builtins.foreach( ["software", "globals", "network", "partitioning", "texts"] @@ -1591,11 +1601,27 @@ nil end + # Add new system roles + # + # For the time being, new roles are appended to the list of roles. + # + # @example Adding a simple role + # ProductControl.system_roles #=> [{"id" => "normal_role"}] + # ProductControl.add_system_roles([{"id" => "new_role"}]) + # ProductControl.system_roles #=> [{"id" => "normal_roles"}, {"id" => "new_role"}] + # + # @param [Array<Hash>] new_roles Roles to add + def add_system_roles(new_roles) + log.info "Adding roles to product control: #{new_roles.inspect}" + system_roles.concat(new_roles) + end + publish variable: :productControl, type: "map" publish variable: :workflows, type: "list <map>" publish variable: :proposals, type: "list <map>" publish variable: :inst_finish, type: "list <map <string, any>>" publish variable: :clone_modules, type: "list <string>" + publish variable: :system_roles, type: "list <map>" publish variable: :custom_control_file, type: "string" publish variable: :y2update_control_file, type: "string" publish variable: :default_control_file, type: "string" @@ -1647,6 +1673,7 @@ publish function: :ProductControl, type: "void ()" publish function: :SetAdditionalWorkflowParams, type: "void (map <string, any>)" publish function: :ResetAdditionalWorkflowParams, type: "void ()" + publish function: :add_system_roles, type: "void (list <map>)" end ProductControl = ProductControlClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/control/src/modules/WorkflowManager.rb new/yast2-3.2.19/library/control/src/modules/WorkflowManager.rb --- old/yast2-3.2.14/library/control/src/modules/WorkflowManager.rb 2017-02-16 17:10:05.554221488 +0100 +++ new/yast2-3.2.19/library/control/src/modules/WorkflowManager.rb 2017-03-20 15:26:45.025124529 +0100 @@ -83,6 +83,7 @@ @wkf_initial_proposals = [] @wkf_initial_inst_finish = [] @wkf_initial_clone_modules = [] + @wkf_initial_system_roles = [] @wkf_initial_product_features = {} @@ -152,6 +153,7 @@ @wkf_initial_proposals = deep_copy(ProductControl.proposals) @wkf_initial_inst_finish = deep_copy(ProductControl.inst_finish) @wkf_initial_clone_modules = deep_copy(ProductControl.clone_modules) + @wkf_initial_system_roles = deep_copy(ProductControl.system_roles) @additional_finish_steps_before_chroot = [] @additional_finish_steps_after_chroot = [] @@ -295,6 +297,7 @@ ProductControl.proposals = deep_copy(@wkf_initial_proposals) ProductControl.inst_finish = deep_copy(@wkf_initial_inst_finish) ProductControl.clone_modules = deep_copy(@wkf_initial_clone_modules) + ProductControl.system_roles = deep_copy(@wkf_initial_system_roles) @additional_finish_steps_before_chroot = [] @additional_finish_steps_after_chroot = [] @@ -892,6 +895,29 @@ true end + # Update sytem roles according to the update section of the control file + # + # The hash is expectd to have the following structure: + # + # "insert_system_roles" => [ + # { + # "system_roles" => + # [ + # { "id" => "additional_role1" }, + # { "id" => "additional_role2" } + # ] + # } + # ] + # + # @param new_roles [Hash] System roles specification + # + # @see ProductControl#add_system_roles + def update_system_roles(system_roles) + system_roles.fetch("insert_system_roles", []).each do |insert| + ProductControl.add_system_roles(insert["system_roles"]) + end + end + # Add specified steps to inst_finish. # Just modifies internal variables, inst_finish grabs them itself # @@ -932,6 +958,7 @@ # # @return [Boolean] true on success def UpdateInstallation(update_file, name, domain) + log.info "Updating installation workflow: #{update_file.inspect}" update_file = deep_copy(update_file) PrepareSystemProposals() PrepareSystemWorkflows() @@ -944,6 +971,8 @@ workflows = PrepareWorkflows(workflows) UpdateWorkflows(workflows, name, domain) + update_system_roles(update_file.fetch("system_roles", {})) + true end @@ -1360,6 +1389,7 @@ # "proposals" : ... # "inst_finish" : ... # "clone_modules" : ... + # "system_roles" : ... # "unmerged_changes" : ... # ]; def DumpCurrentSettings @@ -1368,6 +1398,7 @@ "proposals" => ProductControl.proposals, "inst_finish" => ProductControl.inst_finish, "clone_modules" => ProductControl.clone_modules, + "system_roles" => ProductControl.system_roles, "unmerged_changes" => @unmerged_changes } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/control/test/workflow_manager_test.rb new/yast2-3.2.19/library/control/test/workflow_manager_test.rb --- old/yast2-3.2.14/library/control/test/workflow_manager_test.rb 2017-02-16 17:10:05.558221488 +0100 +++ new/yast2-3.2.19/library/control/test/workflow_manager_test.rb 2017-03-20 15:26:45.025124529 +0100 @@ -55,4 +55,215 @@ end end end + + describe "#IntegrateWorkflow" do + let(:installation_updated) { true } + let(:product_info_updated) { true } + let(:new_proposals_added) { true } + let(:workflows_replaced) { true } + let(:inst_finish_updated) { true } + let(:filename) { "installation.xml" } + + let(:proposal) do + { "name" => "testing", "mode" => "installation", "proposal_modules" => ["prop1"] } + end + + let(:workflow) do + { "mode" => "installation", "modules" => ["mod1"] } + end + + let(:control) do + { + "display_name" => "new workflow", + "proposals" => [proposal], + "workflows" => [workflow], + "textdomain" => "control", + "update" => { + "inst_finish" => { "before_chroot" => ["before_chroot_1"] } + } + } + end + + before do + allow(Yast::XML).to receive(:XMLToYCPFile).with(filename).and_return(control) + allow(subject).to receive(:UpdateInstallation).and_return(installation_updated) + allow(subject).to receive(:UpdateProductInfo).and_return(product_info_updated) + allow(subject).to receive(:AddNewProposals).and_return(new_proposals_added) + allow(subject).to receive(:Replaceworkflows).and_return(workflows_replaced) + allow(subject).to receive(:UpdateInstFinish).and_return(inst_finish_updated) + end + + it "updates the installation" do + expect(subject).to receive(:UpdateInstallation) + .with(control["update"], "new workflow", "control").and_return(true) + expect(subject.IntegrateWorkflow(filename)).to eq(true) + end + + it "updates the product info" do + expect(subject).to receive(:UpdateProductInfo) + .with(control, filename).and_return(true) + expect(subject.IntegrateWorkflow(filename)).to eq(true) + end + + it "adds new proposals" do + expect(subject).to receive(:AddNewProposals) + .with(control["proposals"]).and_return(true) + expect(subject.IntegrateWorkflow(filename)).to eq(true) + end + + it "adds inst_finish steps" do + expect(subject).to receive(:UpdateInstFinish) + .with(control["update"]["inst_finish"]) + expect(subject.IntegrateWorkflow(filename)).to eq(true) + end + + context "when fails to update the installation" do + let(:installation_updated) { false } + + it "logs the error and returns false" do + expect(Yast::Builtins).to receive(:y2error) + .with(/to update installation/) + expect(subject.IntegrateWorkflow(filename)).to eq(false) + end + end + + context "when fails to update the product info" do + let(:product_info_updated) { false } + + it "logs the error and returns false" do + expect(Yast::Builtins).to receive(:y2error) + .with(/to set product options/) + expect(subject.IntegrateWorkflow(filename)).to eq(false) + end + end + + context "when fails to add new proposals" do + let(:new_proposals_added) { false } + + it "logs the error and returns false" do + expect(Yast::Builtins).to receive(:y2error) + .with(/to add new proposals/) + expect(subject.IntegrateWorkflow(filename)).to eq(false) + end + end + + context "when fails to replace workflows" do + let(:workflows_replaced) { false } + + it "logs the error and returns false" do + expect(Yast::Builtins).to receive(:y2error) + .with(/to replace workflows/) + expect(subject.IntegrateWorkflow(filename)).to eq(false) + end + end + + context "when fails to update inst_finish" do + let(:inst_finish_updated) { false } + + it "logs the error and returns false" do + expect(Yast::Builtins).to receive(:y2error) + .with(/inst_finish steps failed/) + expect(subject.IntegrateWorkflow(filename)).to eq(false) + end + end + end + + describe "#UpdateInstallation" do + let(:workflow) do + { "mode" => "installation", + "archs" => "", + "stage" => "", + "defaults" => { "archs" => "" } } + end + let(:proposal) { { "mode" => "installation", "archs" => "", "stage" => "" } } + + let(:update) do + { + "system_roles" => { "insert_system_roles" => [] }, + "workflows" => [workflow], + "proposals" => [proposal] + } + end + + let(:name) { "addon name" } + let(:domain) { "control" } + + it "updates proposals" do + expect(subject).to receive(:UpdateProposals).with(update["proposals"], name, domain) + subject.UpdateInstallation(update, name, domain) + end + + it "updates workflows" do + expect(subject).to receive(:UpdateWorkflows).with(update["workflows"], name, domain) + subject.UpdateInstallation(update, name, domain) + end + + it "updates system roles" do + expect(subject).to receive(:update_system_roles).with(update["system_roles"]) + subject.UpdateInstallation(update, name, domain) + end + end + + describe "#update_system_roles" do + let(:system_roles) do + { + "insert_system_roles" => [ + { + "position" => -1, + "system_roles" => [additional_role] + } + ] + } + end + + let(:additional_role) { { "id" => "additional_role" } } + let(:default_role) { { "id" => "default_role" } } + + before do + Yast::ProductControl.system_roles = [default_role] + end + + it "add system roles at the beginning" do + subject.update_system_roles(system_roles) + expect(Yast::ProductControl.system_roles).to eq([default_role, additional_role]) + end + end + + describe "#DumpCurrentSettings" do + let(:settings) do + { + workflows: ["workflow_1"], + proposals: ["proposal_1"], + system_roles: ["system_role_1"], + clone_modules: ["lan"], + inst_finish: { "before_chroot" => ["before_chroot_1"] } + } + end + + before do + settings.each do |key, value| + allow(Yast::ProductControl).to receive(key).and_return(value) + end + end + + it "returns workflows" do + expect(subject.DumpCurrentSettings["workflows"]).to eq(settings[:workflows]) + end + + it "returns proposals" do + expect(subject.DumpCurrentSettings["proposals"]).to eq(settings[:proposals]) + end + + it "returns inst_finish" do + expect(subject.DumpCurrentSettings["inst_finish"]).to eq(settings[:inst_finish]) + end + + it "returns system_roles" do + expect(subject.DumpCurrentSettings["system_roles"]).to eq(settings[:system_roles]) + end + + it "returns unmerged_changes" do + expect(subject.DumpCurrentSettings["unmerged_changes"]).to eq(false) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/control/testsuite/tests/WorkflowManager.out new/yast2-3.2.19/library/control/testsuite/tests/WorkflowManager.out --- old/yast2-3.2.14/library/control/testsuite/tests/WorkflowManager.out 2017-02-16 17:10:05.558221488 +0100 +++ new/yast2-3.2.19/library/control/testsuite/tests/WorkflowManager.out 2017-03-20 15:26:45.025124529 +0100 @@ -19,4 +19,4 @@ Return true Dump Dump Current Settings -Return $["clone_modules":[], "inst_finish":[], "proposals":[$["archs":"", "mode":"installation", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"demo", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"autoinstallation", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"", "name":"network", "proposal_modules":[$["name":"lan", "presentation_order":"20"], $["name":"dsl", "presentation_order":"30"], $["name":"isdn", "presentation_order":"40"], $["name":"modem", "presentation_order":"50"], $["name":"remote", "presentation_order":"60"], $["name":"firewall", "presentation_order":"10"], $["name":"proxy", "presentation_order":"70"]], "stage":"continue"], $["archs":"", "mode":"", "name":"network", "proposal_modules":[$["name":"lan", "presentation_order":"20"], $["name":"dsl", "presentation_order":"30"], $["name":"isdn", "presentation_order":"40"], $["name":"modem", "presentation_order":"50"], $["name":"remote", "presentation_order":"60"], $["name":"firewall", "presentation_order":"10"], $["name":"proxy", "presentation_order":"70"]], "stage":"normal"]], "unmerged_changes":false, "workflows":[$["defaults":$["archs":"i386"], "label":"Preparation", "mode":"installation", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"x86_64"], "label":"Preparation", "mode":"installation", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"i386"], "label":"Preparation", "mode":"update", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"x86_64"], "label":"Preparation", "mode":"update", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"]]] +Return $["clone_modules":[], "inst_finish":[], "proposals":[$["archs":"", "mode":"installation", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"demo", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"autoinstallation", "name":"initial", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"], "proposal_tabs":[$["label":"Overview", "proposal_modules":["partitions", "software_simple", "language_simple"]], $["label":"Expert", "proposal_modules":["hwinfo", "keyboard", "mouse", "partitions", "software", "bootloader", "timezone", "language", "default_target"]]], "stage":"initial"], $["archs":"", "mode":"", "name":"network", "proposal_modules":[$["name":"lan", "presentation_order":"20"], $["name":"dsl", "presentation_order":"30"], $["name":"isdn", "presentation_order":"40"], $["name":"modem", "presentation_order":"50"], $["name":"remote", "presentation_order":"60"], $["name":"firewall", "presentation_order":"10"], $["name":"proxy", "presentation_order":"70"]], "stage":"continue"], $["archs":"", "mode":"", "name":"network", "proposal_modules":[$["name":"lan", "presentation_order":"20"], $["name":"dsl", "presentation_order":"30"], $["name":"isdn", "presentation_order":"40"], $["name":"modem", "presentation_order":"50"], $["name":"remote", "presentation_order":"60"], $["name":"firewall", "presentation_order":"10"], $["name":"proxy", "presentation_order":"70"]], "stage":"normal"]], "system_roles":[], "unmerged_changes":false, "workflows":[$["defaults":$["archs":"i386"], "label":"Preparation", "mode":"installation", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"x86_64"], "label":"Preparation", "mode":"installation", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"i386"], "label":"Preparation", "mode":"update", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"], $["defaults":$["archs":"x86_64"], "label":"Preparation", "mode":"update", "modules":[$["arguments":$["first_run":"yes"], "enable_back":"no", "enable_next":"yes", "label":"Language", "name":"language", "retranslate":true], $["label":"Perform Installation", "name":"finish"]], "stage":"initial"]]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/network/src/modules/NetworkInterfaces.rb new/yast2-3.2.19/library/network/src/modules/NetworkInterfaces.rb --- old/yast2-3.2.14/library/network/src/modules/NetworkInterfaces.rb 2017-02-16 17:10:06.150221488 +0100 +++ new/yast2-3.2.19/library/network/src/modules/NetworkInterfaces.rb 2017-03-20 15:26:45.057124529 +0100 @@ -29,9 +29,10 @@ # Categorizes the configurations according to type. # Presents them one ifcfg at a time through the {#Current} hash. class NetworkInterfacesClass < Module - Yast.import "String" include Logger + Yast.import "String" + # A single character used to separate alias id ALIAS_SEPARATOR = "#".freeze TYPE_REGEX = "(ip6tnl|mip6mnha|[#{String.CAlpha}]+)".freeze diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/network/src/modules/NetworkService.rb new/yast2-3.2.19/library/network/src/modules/NetworkService.rb --- old/yast2-3.2.14/library/network/src/modules/NetworkService.rb 2017-02-16 17:10:06.150221488 +0100 +++ new/yast2-3.2.19/library/network/src/modules/NetworkService.rb 2017-03-20 15:26:45.061124529 +0100 @@ -212,17 +212,7 @@ stop_service(@current_name) disable_service(@current_name) - case @cached_name - when :network_manager, :wicked - RunSystemCtl(BACKENDS[@cached_name], "--force enable") - when :netconfig - RunSystemCtl(BACKENDS[@current_name], "disable") - - # Workaround for bug #61055: - Builtins.y2milestone("Enabling service %1", "network") - cmd = "cd /; /sbin/insserv -d /etc/init.d/network" - SCR.Execute(path(".target.bash"), cmd) - end + RunSystemCtl(BACKENDS[@cached_name], "--force enable") @initialized = false Read() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/network/test/network_interfaces_helpers_test.rb new/yast2-3.2.19/library/network/test/network_interfaces_helpers_test.rb --- old/yast2-3.2.14/library/network/test/network_interfaces_helpers_test.rb 2017-02-16 17:10:06.210221488 +0100 +++ new/yast2-3.2.19/library/network/test/network_interfaces_helpers_test.rb 2017-03-20 15:26:45.061124529 +0100 @@ -122,7 +122,6 @@ it "doesn't carry empty strings" do expect(subject.get_devices).not_to include "" end - end describe "#canonicalize_config" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/src/Makefile.am new/yast2-3.2.19/library/packages/src/Makefile.am --- old/yast2-3.2.14/library/packages/src/Makefile.am 2017-02-16 17:10:06.246221488 +0100 +++ new/yast2-3.2.19/library/packages/src/Makefile.am 2017-03-20 15:26:45.065124529 +0100 @@ -24,6 +24,8 @@ lib/packages/commit_result.rb \ lib/packages/dummy_callbacks.rb \ lib/packages/file_conflict_callbacks.rb \ + lib/packages/package_downloader.rb \ + lib/packages/package_extractor.rb \ lib/packages/repository.rb \ lib/packages/product.rb \ lib/packages/update_message.rb \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/src/lib/packages/package_downloader.rb new/yast2-3.2.19/library/packages/src/lib/packages/package_downloader.rb --- old/yast2-3.2.14/library/packages/src/lib/packages/package_downloader.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.19/library/packages/src/lib/packages/package_downloader.rb 2017-03-20 15:26:45.065124529 +0100 @@ -0,0 +1,81 @@ +# encoding: utf-8 +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 SUSE LLC +# +# 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. +# +# ------------------------------------------------------------------------------ + +require "yast" + +require "tempfile" +require "shellwords" + +require "yast2/execute" + +Yast.import "Pkg" + +module Packages + # Downloads a package from a known package manager (libzypp) repository. + # + # @note For downloading files outside of a libzypp repository use the + # FileFromUrl::get_file_from_url method: + # https://github.com/yast/yast-installation/blob/fba82c3c9abfc44e3d31c8658bf96079d74e0298/src/lib/transfer/file_from_url.rb#L89 + # + # @example Downloading a package + # begin + # downloader = PackageDownloader.new(3, "yast2") + # tmp = Tempfile.new("downloaded-package-") + # downloader.download(tmp.path) + # # do something with the package... + # ensure + # tmp.close + # tmp.unlink + # end + # + class PackageDownloader + include Yast::Logger + include Yast::I18n + + # @return [Integer] Repository ID + attr_reader :repo_id + # @return [String] Name of the package + attr_reader :package_name + + # Error while downloading the package. + class FetchError < StandardError; end + + # Constructor + # + # @param [Integer] repo_id Repository ID + # @param [String] package_name Name of the package to download + def initialize(repo_id, package_name) + textdomain "base" + + @repo_id = repo_id + @package_name = package_name + end + + # Download the package locally to the given path. + # + # It is responsibility of the caller to remove the downloaded package + # when it is not needed anymore. + # + # @param path [#to_s] path where the downloaded package will be stored + # + # @raise PackageNotFound + def download(path) + log.info("Downloading package #{package_name} from repo #{repo_id} to #{path}") + return if Yast::Pkg.ProvidePackage(repo_id, package_name, path.to_s) + + log.error("Package #{package_name} could not be retrieved.") + raise FetchError + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/src/lib/packages/package_extractor.rb new/yast2-3.2.19/library/packages/src/lib/packages/package_extractor.rb --- old/yast2-3.2.14/library/packages/src/lib/packages/package_extractor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.19/library/packages/src/lib/packages/package_extractor.rb 2017-03-20 15:26:45.069124529 +0100 @@ -0,0 +1,72 @@ +# encoding: utf-8 +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 SUSE LLC +# +# 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. +# +# ------------------------------------------------------------------------------ + +require "shellwords" + +require "yast" +require "yast2/execute" + +module Packages + # Extracts the RPM package contents to a directory. + # + # @example Extracting a package into a temporary directory + # extractor = PackageExtractor("./my_package-0.1-0.noarch.rpm") + # Dir.mktmpdir do |tmpdir| + # extractor.extract(tmpdir) + # # do something with the content in tmpdir... + # end + class PackageExtractor + include Yast::Logger + + # Path to the package to extract. + # @return [String] package path + attr_reader :package_path + + # The package could not be extracted + class ExtractionFailed < StandardError; end + + # Constructor + # + # @param package_path [String] the path to the package to extract + def initialize(package_path) + @package_path = package_path + end + + # Command to extract an RPM, the contents is extracted into the current + # working directory. + EXTRACT_CMD = "rpm2cpio %<source>s | cpio --quiet --sparse -dimu --no-absolute-filenames".freeze + + # Extracts the RPM contents to the given directory. + # + # It is responsibility of the caller to remove the extracted content + # when it is not needed anymore. + # + # @param dir [String] Directory where the RPM contents will be extracted to + # + # @raise ExtractionFailed + def extract(dir) + Dir.chdir(dir) do + cmd = format(EXTRACT_CMD, source: Shellwords.escape(package_path)) + log.info("Extracting package #{package_path} to #{dir}...") + + # we need a shell to process the pipe, + # the "allowed_exitstatus" option forces Cheetah to return the exit code + ret = Yast::Execute.locally("sh", "-c", cmd, allowed_exitstatus: 0..255) + log.info("Extraction result: #{ret}") + + raise ExtractionFailed unless ret.zero? + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/test/Makefile.am new/yast2-3.2.19/library/packages/test/Makefile.am --- old/yast2-3.2.14/library/packages/test/Makefile.am 2017-02-16 17:10:06.322221488 +0100 +++ new/yast2-3.2.19/library/packages/test/Makefile.am 2017-03-20 15:26:45.073124529 +0100 @@ -2,14 +2,16 @@ commit_result_test.rb \ dummy_callbacks_test.rb \ file_conflict_callbacks_test.rb \ + lib/product_test.rb \ + lib/repository_test.rb \ package_callbacks_test.rb \ + lib/package_downloader_test.rb \ + lib/package_extractor_test.rb \ packages_ui_test.rb \ product_test.rb \ signature_check_callbacks_test.rb \ slide_show_test.rb \ - update_messages_view_test.rb \ - lib/repository_test.rb \ - lib/product_test.rb + update_messages_view_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec Binary files old/yast2-3.2.14/library/packages/test/data/rpm/dummy_package-0.1-0.noarch.rpm and new/yast2-3.2.19/library/packages/test/data/rpm/dummy_package-0.1-0.noarch.rpm differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/test/data/rpm/dummy_package.spec new/yast2-3.2.19/library/packages/test/data/rpm/dummy_package.spec --- old/yast2-3.2.14/library/packages/test/data/rpm/dummy_package.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.19/library/packages/test/data/rpm/dummy_package.spec 2017-03-20 15:26:45.073124529 +0100 @@ -0,0 +1,44 @@ +# +# spec file for package dummy_package +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# This is just a testing dummy package for verifying the package +# extraction functionality, it only contains a single testing text file. +# +# Run "rpmbuild -bb dummy_package.spec" to build the package. + +Name: dummy_package + +Version: 0.1 +Release: 0 +Summary: A dummy package +License: MIT +Group: Metapackages +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +%description +This is just a dummy package for testing. + +%prep + +%install +# install a dummy test file +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/share/doc/packages/%{name} +echo "just a testing dummy package" > $RPM_BUILD_ROOT/%{_prefix}/share/doc/packages/%{name}/test + +%files +%defattr(644,root,root,755) +%doc %dir %{_prefix}/share/doc/packages/%{name} +%doc %{_prefix}/share/doc/packages/%{name}/ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/test/lib/package_downloader_test.rb new/yast2-3.2.19/library/packages/test/lib/package_downloader_test.rb --- old/yast2-3.2.14/library/packages/test/lib/package_downloader_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.19/library/packages/test/lib/package_downloader_test.rb 2017-03-20 15:26:45.073124529 +0100 @@ -0,0 +1,27 @@ +#!/usr/bin/env rspec + +require_relative "../test_helper" + +require "packages/package_downloader" + +describe Packages::PackageDownloader do + Yast.import "Pkg" + + let(:repo_id) { 1 } + let(:package) { "package_to_download" } + let(:path) { "dummy" } + + subject { Packages::PackageDownloader.new(repo_id, package) } + + describe "#download" do + it "downloads the requested package" do + expect(Yast::Pkg).to receive(:ProvidePackage).with(repo_id, package, path).and_return(true) + subject.download(path) + end + + it "raises FetchError when download fails" do + expect(Yast::Pkg).to receive(:ProvidePackage).with(repo_id, package, path).and_return(nil) + expect { subject.download(path) }.to raise_error(Packages::PackageDownloader::FetchError) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/packages/test/lib/package_extractor_test.rb new/yast2-3.2.19/library/packages/test/lib/package_extractor_test.rb --- old/yast2-3.2.14/library/packages/test/lib/package_extractor_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.19/library/packages/test/lib/package_extractor_test.rb 2017-03-20 15:26:45.073124529 +0100 @@ -0,0 +1,35 @@ +#!/usr/bin/env rspec + +require "tempfile" +require_relative "../test_helper" +require "packages/package_extractor" + +describe Packages::PackageExtractor do + # a testing RPM package + let(:dummy_package_path) { File.expand_path("../../data/rpm/dummy_package-0.1-0.noarch.rpm", __FILE__) } + # the testing file in the package + let(:dummy_file) { "usr/share/doc/packages/dummy_package/test" } + # the contents of the testing file + let(:dummy_file_contents) { "just a testing dummy package\n" } + + describe "#extract" do + it "extracts the package" do + Dir.mktmpdir do |tmpdir| + extractor = Packages::PackageExtractor.new(dummy_package_path) + extractor.extract(tmpdir) + + # check the extracted content + extracted = File.join(tmpdir, dummy_file) + expect(File.file?(extracted)).to be(true) + expect(File.read(extracted)).to eq(dummy_file_contents) + end + end + + it "raises ExtractionFailed when the extraction fails" do + Dir.mktmpdir do |tmpdir| + extractor = Packages::PackageExtractor.new("non-existing-package") + expect { extractor.extract(tmpdir) }.to raise_error(Packages::PackageExtractor::ExtractionFailed) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/runlevel/src/modules/Service.rb new/yast2-3.2.19/library/runlevel/src/modules/Service.rb --- old/yast2-3.2.14/library/runlevel/src/modules/Service.rb 2017-02-16 17:10:06.330221488 +0100 +++ new/yast2-3.2.19/library/runlevel/src/modules/Service.rb 2017-03-20 15:26:45.077124529 +0100 @@ -191,8 +191,8 @@ # Error Message # # If a Service function returns an error, this function would return - # an error message, including insserv stderr and possibly containing - # newlines. + # an error message, possibly containing newlines. + # # @return error message from the last operation def Error error diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/system/src/modules/FileChanges.rb new/yast2-3.2.19/library/system/src/modules/FileChanges.rb --- old/yast2-3.2.14/library/system/src/modules/FileChanges.rb 2017-02-16 17:10:06.462221488 +0100 +++ new/yast2-3.2.19/library/system/src/modules/FileChanges.rb 2017-03-20 15:26:45.089124529 +0100 @@ -213,6 +213,14 @@ ret == :ok end + # Files that are really new + # + # @param files [Array<String>] candidate files that may be new + # @return [Array<String>] + def created_files(files) + files - @file_checksums.keys + end + # Check if any of the possibly new created files is really new # Issue a question whether to continue if such file was manually created # @param [Array<String>] files a list of files to check @@ -220,9 +228,9 @@ # to continue def CheckNewCreatedFiles(files) - new_files = files - @file_checksums.keys + new_files = created_files(files) - return true unless !new_files.empty? + return true if new_files.empty? # TRANSLATORS: Continue/Cancel question, %s is a single file name or # a comma separated list of file names. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/library/systemd/src/lib/yast2/systemd_unit.rb new/yast2-3.2.19/library/systemd/src/lib/yast2/systemd_unit.rb --- old/yast2-3.2.14/library/systemd/src/lib/yast2/systemd_unit.rb 2017-02-16 17:10:06.514221488 +0100 +++ new/yast2-3.2.19/library/systemd/src/lib/yast2/systemd_unit.rb 2017-03-20 15:26:45.093124529 +0100 @@ -58,7 +58,7 @@ @unit_name, @unit_type = full_unit_name.split(".") raise "Missing unit type suffix" unless unit_type - log.warn "Unsupported unit type '#{unit_type}'" unless SUPPORTED_TYPES.member?(unit_type) + log.warn "Unsupported unit type '#{unit_type}'" unless SUPPORTED_TYPES.include?(unit_type) @input_properties = properties.merge!(DEFAULT_PROPERTIES) @properties = show @@ -159,7 +159,7 @@ self[:loaded?] = load_state == "loaded" self[:not_found?] = load_state == "not-found" self[:enabled?] = read_enabled_state - self[:supported?] = SUPPORTED_STATES.member?(unit_file_state) + self[:supported?] = SUPPORTED_STATES.include?(unit_file_state) end private @@ -167,16 +167,17 @@ # Check the value of #unit_file_state; its value mirrors UnitFileState dbus property # @return [Boolean] True if enabled, False if not def read_enabled_state - # If UnitFileState property is missing due to e.g. legacy sysvinit service - # we must use a different way how to get the real status of the service - if unit_file_state.nil? + # If UnitFileState property is missing (due to e.g. legacy sysvinit service) or + # has an unknown entry (e.g. "bad") we must use a different way how to get the + # real status of the service. + if SUPPORTED_STATES.include?(unit_file_state) + state_name_enabled?(unit_file_state) + else # Check for exit code of `systemctl is-enabled systemd_unit.name` ; additionally # test the stdout of the command for valid values when the service is enabled # http://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20NAME... status = systemd_unit.command("is-enabled") status.exit.zero? && state_name_enabled?(status.stdout) - else - state_name_enabled?(unit_file_state) end end @@ -186,7 +187,7 @@ # a service as enabled. # @return [Boolean] True if enabled, False if not def state_name_enabled?(state) - ["enabled", "enabled-runtime"].member?(state.strip) + ["enabled", "enabled-runtime"].include?(state.strip) end def extract_properties diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/package/yast2.changes new/yast2-3.2.19/package/yast2.changes --- old/yast2-3.2.14/package/yast2.changes 2017-02-16 17:10:06.686221488 +0100 +++ new/yast2-3.2.19/package/yast2.changes 2017-03-20 15:26:45.121124529 +0100 @@ -1,4 +1,38 @@ ------------------------------------------------------------------- +Mon Mar 20 10:11:52 UTC 2017 - [email protected] + +- Added PackageDownloader and PackageExtractor classes for sharing + the package downloading and extracting functions (fate#320772) +- 3.2.19 + +------------------------------------------------------------------- +Mon Mar 20 08:09:06 UTC 2017 - [email protected] + +- bnc#1026027 + - removed insserv calls +- 3.2.18 + +------------------------------------------------------------------- +Thu Mar 16 13:48:06 CET 2017 - [email protected] + +- UnitFileState will be used for evaluating enable state of + services. If it has an invalid value "systemctl is-enabled...." + has to be called instead. (bnc#1012047) +- 3.2.17 + +------------------------------------------------------------------- +Wed Mar 15 14:19:44 UTC 2017 - [email protected] + +- Added FileChanges.created_files (part of fix for bsc#1027582) +- 3.2.16 + +------------------------------------------------------------------- +Wed Mar 8 15:26:48 UTC 2017 - [email protected] + +- Support to add roles through addons (FATE#320772) +- 3.2.15 + +------------------------------------------------------------------- Wed Feb 8 14:39:13 UTC 2017 - [email protected] - Allow Pattern selector to have more generic button names and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.14/package/yast2.spec new/yast2-3.2.19/package/yast2.spec --- old/yast2-3.2.14/package/yast2.spec 2017-02-16 17:10:06.686221488 +0100 +++ new/yast2-3.2.19/package/yast2.spec 2017-03-20 15:26:45.121124529 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.14 +Version: 3.2.19 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0 @@ -47,6 +47,11 @@ BuildRequires: yast2-ruby-bindings >= 3.1.36 BuildRequires: yast2-testsuite BuildRequires: yast2-ycp-ui-bindings >= 3.1.8 +# for the PackageExtractor tests, just make sure they are present, +# these should be installed in the default build anyway +BuildRequires: rpm +BuildRequires: cpio + # for ag_tty (/bin/stty) # for /usr/bin/md5sum Requires: coreutils @@ -97,6 +102,10 @@ Requires: bind-utils %endif Obsoletes: yast2-devel-doc +# for the PackageExtractor class, just make sure they are present, +# these should be present even in a very minimal installation +Requires: rpm +Requires: cpio %description This package contains scripts and data needed for SUSE Linux
