Hello community, here is the log from the commit of package yast2-add-on for openSUSE:Factory checked in at 2018-06-19 11:51:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-add-on (Old) and /work/SRC/openSUSE:Factory/.yast2-add-on.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-add-on" Tue Jun 19 11:51:59 2018 rev:92 rq:615965 version:4.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-add-on/yast2-add-on.changes 2018-04-26 13:28:37.844745684 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-add-on.new/yast2-add-on.changes 2018-06-19 11:52:03.335890924 +0200 @@ -1,0 +2,6 @@ +Mon Jun 11 08:09:18 UTC 2018 - [email protected] + +- Do not ignore "priority" property when store sources (bsc#1081509) +- 4.1.0 + +------------------------------------------------------------------- Old: ---- yast2-add-on-4.0.8.tar.bz2 New: ---- yast2-add-on-4.1.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-add-on.spec ++++++ --- /var/tmp/diff_new_pack.Dz4q0C/_old 2018-06-19 11:52:04.079863301 +0200 +++ /var/tmp/diff_new_pack.Dz4q0C/_new 2018-06-19 11:52:04.083863153 +0200 @@ -17,7 +17,7 @@ Name: yast2-add-on -Version: 4.0.8 +Version: 4.1.0 Release: 0 Summary: YaST2 - Add-On media installation code License: GPL-2.0 ++++++ yast2-add-on-4.0.8.tar.bz2 -> yast2-add-on-4.1.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/package/yast2-add-on.changes new/yast2-add-on-4.1.0/package/yast2-add-on.changes --- old/yast2-add-on-4.0.8/package/yast2-add-on.changes 2018-04-13 09:23:34.000000000 +0200 +++ new/yast2-add-on-4.1.0/package/yast2-add-on.changes 2018-06-11 11:56:39.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jun 11 08:09:18 UTC 2018 - [email protected] + +- Do not ignore "priority" property when store sources (bsc#1081509) +- 4.1.0 + +------------------------------------------------------------------- Thu Apr 12 06:44:36 UTC 2018 - [email protected] - Allow the user to change the CD/DVD when using addon=dvd:/// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/package/yast2-add-on.spec new/yast2-add-on-4.1.0/package/yast2-add-on.spec --- old/yast2-add-on-4.0.8/package/yast2-add-on.spec 2018-04-13 09:23:34.000000000 +0200 +++ new/yast2-add-on-4.1.0/package/yast2-add-on.spec 2018-06-11 11:56:39.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-add-on -Version: 4.0.8 +Version: 4.1.0 Release: 0 Summary: YaST2 - Add-On media installation code License: GPL-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/src/clients/add-on_auto.rb new/yast2-add-on-4.1.0/src/clients/add-on_auto.rb --- old/yast2-add-on-4.0.8/src/clients/add-on_auto.rb 2018-04-13 09:23:34.000000000 +0200 +++ new/yast2-add-on-4.1.0/src/clients/add-on_auto.rb 2018-06-11 11:56:39.000000000 +0200 @@ -1,329 +1,3 @@ -# encoding: utf-8 - -# File: -# add-on_auto.ycp -# -# Module: -# Add-On autoinstallation and configuration -# -# Summary: -# Add-On autoinstallation preparation -# -# Authors: -# Jiri Srain <[email protected]> -# -# $Id$ -# -module Yast - class AddOnAutoClient < Client - def main - Yast.import "Pkg" - Yast.import "UI" - textdomain "add-on" - - Builtins.y2milestone("----------------------------------------") - Builtins.y2milestone("add-on auto started") - - Yast.import "AddOnProduct" - Yast.import "Progress" - Yast.import "AutoinstSoftware" - Yast.import "PackageCallbacks" - Yast.import "Label" - Yast.import "AutoinstGeneral" - Yast.import "PackageLock" - Yast.import "Installation" - Yast.import "String" - - Yast.include self, "add-on/add-on-workflow.rb" - - @progress_orig = Progress.set(false) - - - @ret = nil - @func = "" - @param = {} - - # Check arguments - if Ops.greater_than(Builtins.size(WFM.Args), 0) && - Ops.is_string?(WFM.Args(0)) - @func = Convert.to_string(WFM.Args(0)) - if Ops.greater_than(Builtins.size(WFM.Args), 1) && - Ops.is_map?(WFM.Args(1)) - @param = Convert.to_map(WFM.Args(1)) - end - end - Builtins.y2debug("func=%1", @func) - Builtins.y2debug("param=%1", @param) - - if @func == "Import" - add_on_products = @param["add_on_products"] || [] - count = 0 - # Checking needed values - add_on_products.reject! do |product| - count += 1 - if product["media_url"].nil? || product["media_url"] == "" - # Report missing media_url entry in the AutoYaST configuration file - # TRANSLATORS: The placeholder points to the location in the AutoYaST configuration file. - error_string = format(_("Error in the AutoYaST <add_on> section.\n" \ - "Missing mandatory <media_url> value at index %d in the <add_on_products> definition.\n" \ - "Skip the invalid product definition and continue with the installation?"), - count) - log.error "Missing <media_url> value in the #{count}. add-on-product definition" - return false unless Popup.ContinueCancel(error_string) # user abort - true - else - false - end - end - @ret = AddOnProduct.Import("add_on_products"=>add_on_products) - # Create a summary - # return string - elsif @func == "Summary" - @ret = "<ul>\n" - Builtins.foreach(AddOnProduct.add_on_products) do |prod| - @ret = Ops.add( - Convert.to_string(@ret), - Builtins.sformat( - _("<li>Media: %1, Path: %2, Product: %3</li>\n"), - Ops.get_string(prod, "media_url", ""), - Ops.get_string(prod, "product_dir", "/"), - Ops.get_string(prod, "product", "") - ) - ) - end - @ret = Ops.add(Convert.to_string(@ret), "</ul>") - # did configuration changed - # return boolean - elsif @func == "GetModified" - @ret = AddOnProduct.modified - # set configuration as changed - # return boolean - elsif @func == "SetModified" - AddOnProduct.modified = true - @ret = true - # Reset configuration - # return map or list - elsif @func == "Reset" - AddOnProduct.add_on_products = [] - @ret = {} - # Change configuration - # return symbol (i.e. `finish || `accept || `next || `cancel || `abort) - elsif @func == "Change" - Wizard.CreateDialog - AutoinstSoftware.pmInit - PackageCallbacks.InitPackageCallbacks - @ret = RunAddOnMainDialog( - false, - true, - true, - Label.BackButton, - Label.OKButton, - Label.CancelButton, - false - ) - UI.CloseDialog - return deep_copy(@ret) - # Return configuration data - # return map or list - elsif @func == "Export" - @ret = AddOnProduct.Export - # Write configuration data - # return boolean - # - # - # **Structure:** - # - # - # <add-on> - # <add_on_products config:type="list"> - # <listentry> - # <media_url>http://software.opensuse.org/download/server:/dns/SLE_10/</media_url> - # <product>buildservice</product> - # <product_dir>/</product_dir> - # <!-- (optional) --> - # <name>User-Defined Product Name</name> - # <signature-handling> - # <accept_unsigned_file config:type="boolean">true</accept_unsigned_file> - # <accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum> - # <accept_verification_failed config:type="boolean">true</accept_verification_failed> - # <accept_unknown_gpg_key> - # <all config:type="boolean">true</all> - # <keys config:type="list"> - # <keyid>...</keyid> - # <keyid>3B3011B76B9D6523</keyid> - # </keys> - # </accept_unknown_gpg_key> - # <accept_non_trusted_gpg_key> - # <all config:type="boolean">true</all> - # <keys config:type="list"> - # <keyid>...</keyid> - # </keys> - # </accept_non_trusted_gpg_key> - # <import_gpg_key> - # <all config:type="boolean">true</all> - # <keys config:type="list"> - # <keyid>...</keyid> - # </keys> - # </import_gpg_key> - # </signature-handling> - # </listentry> - # </add_on_products> - # </add-on> - # - elsif @func == "Write" - @sources = {} - - AddOnProduct.add_on_products.each do |prod| - media = Ops.get_string(prod, "media_url", "") - pth = Ops.get_string(prod, "product_dir", "/") - if String.StartsWith(media, "relurl://") - base = AddOnProduct.GetBaseProductURL - media = AddOnProduct.GetAbsoluteURL(base, media) - Builtins.y2milestone("relurl changed to %1", media) - end - Ops.set(@sources, media, Ops.get(@sources, media, {})) - # set addon specific sig-handling - AddOnProduct.SetSignatureCallbacks( - Ops.get_string(prod, "product", "") - ) - srcid = -1 - begin - url = AddOnProduct.SetRepoUrlAlias( - # Expanding URL in order to "translate" tags like $releasever - Pkg.ExpandedUrl(media), - Ops.get_string(prod, "alias", ""), - Ops.get_string(prod, "name", "") - ) - - srcid = Pkg.SourceCreate(url, pth) - - if (srcid == -1 || srcid == nil) - # revert back to the unexpanded URL to have the original URL - # in the saved /etc/zypp/repos.d file - Pkg.SourceChangeUrl(srcid, media) - - if Ops.get_boolean(prod, "ask_on_error", false) - prod["ask_on_error"] = Popup.ContinueCancel( - Builtins.sformat( - _("Make the add-on \"%1\" available via \"%2\"."), - Ops.get_string(prod, "product", ""), - media - ) - ) - else - # just report an error - # TRANSLATORS: The placeholders are for the product name and the URL. - error_string = format(_("Failed to add product \"%s\" via\n%s."), - # TRANSLATORS: a fallback string for undefined product name - prod["product"] || _("<not_defined_name>"), media) - Report.Error(error_string) - end - elsif Ops.get_boolean(prod, "confirm_license", false) - accepted = AddOnProduct.AcceptedLicenseAndInfoFile( srcid ) - if accepted == false - Builtins.y2warning("License not accepted, delete the repository and halt the system") - Pkg.SourceDelete(srcid) - SCR.Execute(path(".target.bash"), "/sbin/halt -f -n -p") - end - end - - Ops.set(@sources, [media, pth], srcid) - Builtins.y2milestone("New source ID: %1", srcid) - - # bugzilla #260613 - AddOnProduct.Integrate(srcid) if srcid != -1 - - end while Ops.get(@sources, [media, pth], -1) == -1 && - Ops.get_boolean(prod, "ask_on_error", false) == true - Ops.set(prod, "media", Ops.get(@sources, [media, pth], -1)) - # Adjust "name", bnc #434708 - if srcid != nil && srcid != -1 - repos = Pkg.SourceEditGet - - found_at = -1 - counter = -1 - - Builtins.foreach(repos) do |one_repo| - counter = Ops.add(counter, 1) - if Ops.get_integer(one_repo, "SrcId", -1) == srcid - found_at = counter - raise Break - end - end - - if found_at != -1 - name = Ops.get_string(repos, [found_at, "name"], "") - - # Possibility to set name in control file, bnc #433981 - if Builtins.haskey(prod, "name") - name = Ops.get_string(prod, "name", "") - Builtins.y2milestone("Preferred name: %1", name) - # Or use the one returned by Pkg::RepositoryScan - else - repos_at_url = Pkg.RepositoryScan(Pkg.ExpandedUrl(media)) - # [ ["Product Name", "Path" ] ] - Builtins.foreach(repos_at_url) do |one_repo| - if Ops.get(one_repo, 1, "") == pth - name = Ops.get(one_repo, 0, "") - raise Break - end - end - Builtins.y2milestone("Preferred name: %1", name) - end - - Ops.set(repos, [found_at, "name"], name) - Pkg.SourceEditSet(repos) - end - end - if Ops.get_string(prod, "product", "") != "" - Builtins.y2milestone( - "Installing product: %1", - Ops.get_string(prod, "product", "") - ) - Pkg.ResolvableInstall(Ops.get_string(prod, "product", ""), :product) - else - Builtins.y2warning("No product to install") - end - end - - # reread agents, redraw wizard steps, etc. - AddOnProduct.ReIntegrateFromScratch - - @ret = true - # Reads configuration of add-ons from the current system - # to memory. To get that configuration, use Export() functionality. - # - # @return [Boolean] - elsif @func == "Read" - if !PackageLock.Check - Builtins.y2error("Cannot get package lock") - return false - end - Builtins.y2milestone("Reseting Pkg") - Pkg.PkgApplReset - Pkg.PkgReset - - Pkg.TargetInitialize(Installation.destdir) - Pkg.TargetLoad - Pkg.SourceStartManager(true) - Pkg.PkgSolve(true) - - @ret = ReadFromSystem() - else - Builtins.y2error("unknown function: %1", @func) - @ret = false - end - Progress.set(@progress_orig) - - Builtins.y2debug("ret=%1", @ret) - Builtins.y2milestone("add-on_auto finished") - Builtins.y2milestone("----------------------------------------") - - deep_copy(@ret) - - # EOF - end - end -end +require "add-on/clients/add-on_auto" Yast::AddOnAutoClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/src/lib/add-on/clients/add-on_auto.rb new/yast2-add-on-4.1.0/src/lib/add-on/clients/add-on_auto.rb --- old/yast2-add-on-4.0.8/src/lib/add-on/clients/add-on_auto.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-add-on-4.1.0/src/lib/add-on/clients/add-on_auto.rb 2018-06-11 11:56:39.000000000 +0200 @@ -0,0 +1,328 @@ +# encoding: utf-8 + +# File: +# add-on_auto.ycp +# +# Module: +# Add-On autoinstallation and configuration +# +# Summary: +# Add-On autoinstallation preparation +# +# Authors: +# Jiri Srain <[email protected]> +# +# $Id$ +# +module Yast + class AddOnAutoClient < Client + def main + Yast.import "Pkg" + Yast.import "UI" + textdomain "add-on" + + Builtins.y2milestone("----------------------------------------") + Builtins.y2milestone("add-on auto started") + + Yast.import "AddOnProduct" + Yast.import "Progress" + Yast.import "AutoinstSoftware" + Yast.import "PackageCallbacks" + Yast.import "Label" + Yast.import "AutoinstGeneral" + Yast.import "PackageLock" + Yast.import "Installation" + Yast.import "String" + + Yast.include self, "add-on/add-on-workflow.rb" + + @progress_orig = Progress.set(false) + + + @ret = nil + @func = "" + @param = {} + + # Check arguments + if Ops.greater_than(Builtins.size(WFM.Args), 0) && + Ops.is_string?(WFM.Args(0)) + @func = Convert.to_string(WFM.Args(0)) + if Ops.greater_than(Builtins.size(WFM.Args), 1) && + Ops.is_map?(WFM.Args(1)) + @param = Convert.to_map(WFM.Args(1)) + end + end + Builtins.y2debug("func=%1", @func) + Builtins.y2debug("param=%1", @param) + + if @func == "Import" + add_on_products = @param["add_on_products"] || [] + count = 0 + # Checking needed values + add_on_products.reject! do |product| + count += 1 + if product["media_url"].nil? || product["media_url"] == "" + # Report missing media_url entry in the AutoYaST configuration file + # TRANSLATORS: The placeholder points to the location in the AutoYaST configuration file. + error_string = format(_("Error in the AutoYaST <add_on> section.\n" \ + "Missing mandatory <media_url> value at index %d in the <add_on_products> definition.\n" \ + "Skip the invalid product definition and continue with the installation?"), + count) + log.error "Missing <media_url> value in the #{count}. add-on-product definition" + return false unless Popup.ContinueCancel(error_string) # user abort + true + else + false + end + end + @ret = AddOnProduct.Import("add_on_products"=>add_on_products) + # Create a summary + # return string + elsif @func == "Summary" + @ret = "<ul>\n" + Builtins.foreach(AddOnProduct.add_on_products) do |prod| + @ret = Ops.add( + Convert.to_string(@ret), + Builtins.sformat( + _("<li>Media: %1, Path: %2, Product: %3</li>\n"), + Ops.get_string(prod, "media_url", ""), + Ops.get_string(prod, "product_dir", "/"), + Ops.get_string(prod, "product", "") + ) + ) + end + @ret = Ops.add(Convert.to_string(@ret), "</ul>") + # did configuration changed + # return boolean + elsif @func == "GetModified" + @ret = AddOnProduct.modified + # set configuration as changed + # return boolean + elsif @func == "SetModified" + AddOnProduct.modified = true + @ret = true + # Reset configuration + # return map or list + elsif @func == "Reset" + AddOnProduct.add_on_products = [] + @ret = {} + # Change configuration + # return symbol (i.e. `finish || `accept || `next || `cancel || `abort) + elsif @func == "Change" + Wizard.CreateDialog + AutoinstSoftware.pmInit + PackageCallbacks.InitPackageCallbacks + @ret = RunAddOnMainDialog( + false, + true, + true, + Label.BackButton, + Label.OKButton, + Label.CancelButton, + false + ) + UI.CloseDialog + return deep_copy(@ret) + # Return configuration data + # return map or list + elsif @func == "Export" + @ret = AddOnProduct.Export + # Write configuration data + # return boolean + # + # + # **Structure:** + # + # + # <add-on> + # <add_on_products config:type="list"> + # <listentry> + # <media_url>http://software.opensuse.org/download/server:/dns/SLE_10/</media_url> + # <product>buildservice</product> + # <product_dir>/</product_dir> + # <!-- (optional) --> + # <name>User-Defined Product Name</name> + # <signature-handling> + # <accept_unsigned_file config:type="boolean">true</accept_unsigned_file> + # <accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum> + # <accept_verification_failed config:type="boolean">true</accept_verification_failed> + # <accept_unknown_gpg_key> + # <all config:type="boolean">true</all> + # <keys config:type="list"> + # <keyid>...</keyid> + # <keyid>3B3011B76B9D6523</keyid> + # </keys> + # </accept_unknown_gpg_key> + # <accept_non_trusted_gpg_key> + # <all config:type="boolean">true</all> + # <keys config:type="list"> + # <keyid>...</keyid> + # </keys> + # </accept_non_trusted_gpg_key> + # <import_gpg_key> + # <all config:type="boolean">true</all> + # <keys config:type="list"> + # <keyid>...</keyid> + # </keys> + # </import_gpg_key> + # </signature-handling> + # </listentry> + # </add_on_products> + # </add-on> + # + elsif @func == "Write" + @sources = {} + + AddOnProduct.add_on_products.each do |prod| + media = Ops.get_string(prod, "media_url", "") + pth = Ops.get_string(prod, "product_dir", "/") + if String.StartsWith(media, "relurl://") + base = AddOnProduct.GetBaseProductURL + media = AddOnProduct.GetAbsoluteURL(base, media) + Builtins.y2milestone("relurl changed to %1", media) + end + Ops.set(@sources, media, Ops.get(@sources, media, {})) + # set addon specific sig-handling + AddOnProduct.SetSignatureCallbacks( + Ops.get_string(prod, "product", "") + ) + srcid = -1 + begin + url = AddOnProduct.SetRepoUrlAlias( + # Expanding URL in order to "translate" tags like $releasever + Pkg.ExpandedUrl(media), + Ops.get_string(prod, "alias", ""), + Ops.get_string(prod, "name", "") + ) + + srcid = Pkg.SourceCreate(url, pth) + + if (srcid == -1 || srcid == nil) + # revert back to the unexpanded URL to have the original URL + # in the saved /etc/zypp/repos.d file + Pkg.SourceChangeUrl(srcid, media) + + if Ops.get_boolean(prod, "ask_on_error", false) + prod["ask_on_error"] = Popup.ContinueCancel( + Builtins.sformat( + _("Make the add-on \"%1\" available via \"%2\"."), + Ops.get_string(prod, "product", ""), + media + ) + ) + else + # just report an error + # TRANSLATORS: The placeholders are for the product name and the URL. + error_string = format(_("Failed to add product \"%s\" via\n%s."), + # TRANSLATORS: a fallback string for undefined product name + prod["product"] || _("<not_defined_name>"), media) + Report.Error(error_string) + end + elsif Ops.get_boolean(prod, "confirm_license", false) + accepted = AddOnProduct.AcceptedLicenseAndInfoFile( srcid ) + if accepted == false + Builtins.y2warning("License not accepted, delete the repository and halt the system") + Pkg.SourceDelete(srcid) + SCR.Execute(path(".target.bash"), "/sbin/halt -f -n -p") + end + end + + Ops.set(@sources, [media, pth], srcid) + Builtins.y2milestone("New source ID: %1", srcid) + + # bugzilla #260613 + AddOnProduct.Integrate(srcid) if srcid != -1 + + end while Ops.get(@sources, [media, pth], -1) == -1 && + Ops.get_boolean(prod, "ask_on_error", false) == true + Ops.set(prod, "media", Ops.get(@sources, [media, pth], -1)) + # Adjust "name", bnc #434708 + if srcid != nil && srcid != -1 + repos = Pkg.SourceEditGet + + found_at = -1 + counter = -1 + + Builtins.foreach(repos) do |one_repo| + counter = Ops.add(counter, 1) + if Ops.get_integer(one_repo, "SrcId", -1) == srcid + found_at = counter + raise Break + end + end + + if found_at != -1 + name = Ops.get_string(repos, [found_at, "name"], "") + + # Possibility to set name in control file, bnc #433981 + if Builtins.haskey(prod, "name") + name = Ops.get_string(prod, "name", "") + Builtins.y2milestone("Preferred name: %1", name) + # Or use the one returned by Pkg::RepositoryScan + else + repos_at_url = Pkg.RepositoryScan(Pkg.ExpandedUrl(media)) + # [ ["Product Name", "Path" ] ] + Builtins.foreach(repos_at_url) do |one_repo| + if Ops.get(one_repo, 1, "") == pth + name = Ops.get(one_repo, 0, "") + raise Break + end + end + Builtins.y2milestone("Preferred name: %1", name) + end + + Ops.set(repos, [found_at, "name"], name) + Ops.set(repos, [found_at, "priority"], prod["priority"]) if prod.key?("priority") + Pkg.SourceEditSet(repos) + end + end + if Ops.get_string(prod, "product", "") != "" + Builtins.y2milestone( + "Installing product: %1", + Ops.get_string(prod, "product", "") + ) + Pkg.ResolvableInstall(Ops.get_string(prod, "product", ""), :product) + else + Builtins.y2warning("No product to install") + end + end + + # reread agents, redraw wizard steps, etc. + AddOnProduct.ReIntegrateFromScratch + + @ret = true + # Reads configuration of add-ons from the current system + # to memory. To get that configuration, use Export() functionality. + # + # @return [Boolean] + elsif @func == "Read" + if !PackageLock.Check + Builtins.y2error("Cannot get package lock") + return false + end + Builtins.y2milestone("Reseting Pkg") + Pkg.PkgApplReset + Pkg.PkgReset + + Pkg.TargetInitialize(Installation.destdir) + Pkg.TargetLoad + Pkg.SourceStartManager(true) + Pkg.PkgSolve(true) + + @ret = ReadFromSystem() + else + Builtins.y2error("unknown function: %1", @func) + @ret = false + end + Progress.set(@progress_orig) + + Builtins.y2debug("ret=%1", @ret) + Builtins.y2milestone("add-on_auto finished") + Builtins.y2milestone("----------------------------------------") + + deep_copy(@ret) + + # EOF + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/test/test_helper.rb new/yast2-add-on-4.1.0/test/test_helper.rb --- old/yast2-add-on-4.0.8/test/test_helper.rb 2018-04-13 09:23:34.000000000 +0200 +++ new/yast2-add-on-4.1.0/test/test_helper.rb 2018-06-11 11:56:39.000000000 +0200 @@ -8,6 +8,17 @@ require "yast" +# Stub a module to prevent its importation +# +# Useful for modules from different YaST packages, to avoid build dependencies +def stub_module(name) + Yast.const_set name.to_sym, Class.new { def self.fake_method; end } +end + +# Stub classes from other modules to speed up a build +stub_module("AutoinstGeneral") +stub_module("AutoinstSoftware") + if ENV["COVERAGE"] require "simplecov" SimpleCov.start do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.0.8/test/y2add_on/clients/add-on_auto_test.rb new/yast2-add-on-4.1.0/test/y2add_on/clients/add-on_auto_test.rb --- old/yast2-add-on-4.0.8/test/y2add_on/clients/add-on_auto_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-add-on-4.1.0/test/y2add_on/clients/add-on_auto_test.rb 2018-06-11 11:56:39.000000000 +0200 @@ -0,0 +1,89 @@ +#!/usr/bin/env rspec + +require_relative "../../test_helper" +require "add-on/clients/add-on_auto" + +Yast.import "Packages" + +describe Yast::AddOnAutoClient do + describe "#main" do + before do + allow(Yast::WFM).to receive(:Args).with(no_args).and_return([func]) + allow(Yast::WFM).to receive(:Args).with(0).and_return(func) + end + + context "when 'func' is 'Write'" do + let(:func) { "Write" } + let(:repos) do + [ + { "SrcId" => 1, + "autorefresh" => true, + "enabled" => true, + "keeppackaged" => false, + "name" => "repo_to_be_updated", + "priority" => 99, + "service" => "" + }, + { + "SrcId" => 2, + "autorefresh" => true, + "enabled" => true, + "keeppackaged" => false, + "name" => "untouched_repo", + "priority" => 99, + "service" => "" + } + ] + end + + context "and there are add-ons products" do + let(:add_on_products) do + [ + { + "alias" => "produc_alias", + "media_url" => "http://product.url", + "name" => "updated_repo", + "priority" => 20, + "product_dir" => "/" + } + ] + end + let(:repos_to_store) do + [ + { + "SrcId" => 1, + "autorefresh" => true, + "enabled" => true, + "keeppackaged" => false, + "name" => "updated_repo", + "priority" => 20, + "service" => "" + }, + { + "SrcId" => 2, + "autorefresh" => true, + "enabled" => true, + "keeppackaged" => false, + "name" => "untouched_repo", + "priority" => 99, + "service" => "" + } + ] + end + + before do + allow(Yast::AddOnProduct).to receive(:add_on_products).and_return(add_on_products) + allow(Yast::Pkg).to receive(:SourceEditSet) + allow(Yast::Pkg).to receive(:SourceCreate).and_return(1) + allow(Yast::Pkg).to receive(:SourceEditGet).and_return(repos) + end + + it "stores repos according to information given" do + expect(Yast::Pkg).to receive(:SourceEditSet).with(repos_to_store) + + subject.main + end + end + end + end +end
