Hello community, here is the log from the commit of package yast2-update for openSUSE:Factory checked in at 2014-06-26 08:00:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-update (Old) and /work/SRC/openSUSE:Factory/.yast2-update.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-update" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-update/yast2-update.changes 2014-05-26 10:27:37.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-update.new/yast2-update.changes 2014-06-26 08:00:55.000000000 +0200 @@ -1,0 +2,40 @@ +Wed Jun 25 11:10:44 UTC 2014 - [email protected] + +- display product update summary and check for automatic product + removal at update proposal (bnc#883047) +- 3.1.15 + +------------------------------------------------------------------- +Mon Jun 23 15:12:07 CEST 2014 - [email protected] + +- do not allow to continue if no upgradeable system was found + (bnc#883606) +- 3.1.14 + +------------------------------------------------------------------- +Fri Jun 13 06:20:15 UTC 2014 - [email protected] + +- create backup for software management (bnc#882039) +- 3.1.13 + +------------------------------------------------------------------- +Thu Jun 12 14:48:57 UTC 2014 - [email protected] + +- add method to create upgrade backup (bnc#882039) +- 3.1.12 + +------------------------------------------------------------------- +Thu Jun 12 07:40:30 UTC 2014 - [email protected] + +- fix crash caused by the last change (bnc#882309) +- 3.1.11 + +------------------------------------------------------------------- +Fri Jun 6 13:35:01 UTC 2014 - [email protected] + +- override the target distribution from the system, use the target + distribution from the base product so the service repositories + are compatible with the upgraded (future) product (bnc#881320) +- 3.1.10 + +------------------------------------------------------------------- Old: ---- yast2-update-3.1.9.tar.bz2 New: ---- yast2-update-3.1.15.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-update.spec ++++++ --- /var/tmp/diff_new_pack.tXlgcr/_old 2014-06-26 08:00:56.000000000 +0200 +++ /var/tmp/diff_new_pack.tXlgcr/_new 2014-06-26 08:00:56.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.9 +Version: 3.1.15 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -44,8 +44,11 @@ Requires: yast2 >= 3.1.28 Requires: yast2-installation -# Packages.default_patterns -Requires: yast2-packager >= 3.1.10 +# product update summary +Requires: yast2-packager >= 3.1.24 + +# Pkg.TargetInitializeOptions() +Requires: yast2-pkg-bindings >= 3.1.14 # moved into yast2-update from yast2-installation # to remove dependency on yast2-storage ++++++ yast2-update-3.1.9.tar.bz2 -> yast2-update-3.1.15.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/package/yast2-update.changes new/yast2-update-3.1.15/package/yast2-update.changes --- old/yast2-update-3.1.9/package/yast2-update.changes 2014-05-23 10:23:45.000000000 +0200 +++ new/yast2-update-3.1.15/package/yast2-update.changes 2014-06-25 15:53:23.000000000 +0200 @@ -1,4 +1,44 @@ ------------------------------------------------------------------- +Wed Jun 25 11:10:44 UTC 2014 - [email protected] + +- display product update summary and check for automatic product + removal at update proposal (bnc#883047) +- 3.1.15 + +------------------------------------------------------------------- +Mon Jun 23 15:12:07 CEST 2014 - [email protected] + +- do not allow to continue if no upgradeable system was found + (bnc#883606) +- 3.1.14 + +------------------------------------------------------------------- +Fri Jun 13 06:20:15 UTC 2014 - [email protected] + +- create backup for software management (bnc#882039) +- 3.1.13 + +------------------------------------------------------------------- +Thu Jun 12 14:48:57 UTC 2014 - [email protected] + +- add method to create upgrade backup (bnc#882039) +- 3.1.12 + +------------------------------------------------------------------- +Thu Jun 12 07:40:30 UTC 2014 - [email protected] + +- fix crash caused by the last change (bnc#882309) +- 3.1.11 + +------------------------------------------------------------------- +Fri Jun 6 13:35:01 UTC 2014 - [email protected] + +- override the target distribution from the system, use the target + distribution from the base product so the service repositories + are compatible with the upgraded (future) product (bnc#881320) +- 3.1.10 + +------------------------------------------------------------------- Thu May 22 07:40:27 UTC 2014 - [email protected] - allow to specify target for AutoYaST upgrade via boot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/package/yast2-update.spec new/yast2-update-3.1.15/package/yast2-update.spec --- old/yast2-update-3.1.9/package/yast2-update.spec 2014-05-23 10:23:45.000000000 +0200 +++ new/yast2-update-3.1.15/package/yast2-update.spec 2014-06-25 15:53:23.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.9 +Version: 3.1.15 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -46,8 +46,11 @@ Requires: yast2 >= 3.1.28 Requires: yast2-installation -# Packages.default_patterns -Requires: yast2-packager >= 3.1.10 +# product update summary +Requires: yast2-packager >= 3.1.24 + +# Pkg.TargetInitializeOptions() +Requires: yast2-pkg-bindings >= 3.1.14 # moved into yast2-update from yast2-installation # to remove dependency on yast2-storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/src/clients/update_proposal.rb new/yast2-update-3.1.15/src/clients/update_proposal.rb --- old/yast2-update-3.1.9/src/clients/update_proposal.rb 2014-05-23 10:23:46.000000000 +0200 +++ new/yast2-update-3.1.15/src/clients/update_proposal.rb 2014-06-25 15:53:23.000000000 +0200 @@ -153,7 +153,7 @@ } end - @warning_message = nil + @warning_message = "" # when labels don't match if !Stage.initial && @@ -179,34 +179,9 @@ ) end + products = Pkg.ResolvableProperties("", :product, "") # stores the proposal text output - @summary_text = "" - - @products = Update.SelectedProducts - @already_printed = [] - - Builtins.foreach(@products) do |one_product| - # never print duplicates, bugzilla #331560 - # 'toset' could be used but we want to keep sorting - if Builtins.contains(@already_printed, one_product) - next - else - @already_printed = Builtins.add(@already_printed, one_product) - end - # TRANSLATORS: proposal summary item, %1 is a product name - @summary_text = Ops.add( - Ops.add( - Ops.add(@summary_text, "<li><b>"), - Builtins.sformat(_("Update to %1"), one_product) - ), - "</b></li>\n" - ) - end if @products != nil - - # if (Update::deleteOldPackages) { - # // Proposal for removing packages which are not maintained any more - # summary_text = summary_text + "<li>" + _("Delete unmaintained packages") + "</li>\n"; - # } + @summary_text = Packages.product_update_summary(products).map{|item| "<li>#{item}</li>"}.join if Update.onlyUpdateInstalled # Proposal for backup during update @@ -269,9 +244,12 @@ "help" => @update_options_help } - if @warning_message != nil - Ops.set(@ret, "warning", @warning_message) - Ops.set(@ret, "warning_level", :warning) + product_warning = Packages.product_update_warning(products) + @warning_message << product_warning["warning"] if product_warning["warning"] + + if !@warning_message.empty? + @ret["warning"] = @warning_message + @ret["warning_level"] = product_warning["warning_level"] || :warning end elsif @func == "AskUser" @has_next = Ops.get_boolean(@param, "has_next", false) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/src/include/update/rootpart.rb new/yast2-update-3.1.15/src/include/update/rootpart.rb --- old/yast2-update-3.1.9/src/include/update/rootpart.rb 2014-05-23 10:23:46.000000000 +0200 +++ new/yast2-update-3.1.15/src/include/update/rootpart.rb 2014-06-25 15:53:23.000000000 +0200 @@ -28,8 +28,12 @@ # Purpose: Select root partition for update or booting. # RootPart::rootPartitions must be filled before # calling this module. +require "yast" + module Yast module UpdateRootpartInclude + include Yast::Logger + def initialize_update_rootpart(include_target) Yast.import "UI" Yast.import "Pkg" @@ -45,6 +49,7 @@ Yast.import "Installation" Yast.import "FileSystems" Yast.import "Mode" + Yast.import "Product" end # Returns boolean whether partition can be @@ -343,8 +348,9 @@ freshman ) if Ops.get_string(freshman, :name, "unknown") == "unknown" - cont = Popup.ContinueCancel( - # continue-cancel popup + cont = false + Popup.Error( + # error popup _( "No installed system that can be upgraded with this product was found\non the selected partition." ) @@ -418,8 +424,12 @@ # New partition has been mounted if flavor == :update_dialog && ret == :next - # Target load failed, #466803 - if Pkg.TargetInitialize(Installation.destdir) != true + # override the current target distribution at the system and use + # the target distribution from the base product to make the new service + # repositories compatible with the base product at upgrade (bnc#881320) + if Pkg.TargetInitializeOptions(Installation.destdir, + "target_distro" => target_distribution) != true + # Target load failed, #466803 Builtins.y2error("Pkg::TargetInitialize failed") if Popup.AnyQuestion( Label.ErrorMsg, @@ -470,5 +480,17 @@ Convert.to_symbol(ret) end + + def target_distribution + base_products = Product.FindBaseProducts + + # empty target distribution disables service compatibility check in case + # the base product cannot be found + target_distro = base_products ? base_products.first["register_target"] : "" + log.info "Base product target distribution: #{target_distro}" + + target_distro + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/src/modules/RootPart.rb new/yast2-update-3.1.15/src/modules/RootPart.rb --- old/yast2-update-3.1.9/src/modules/RootPart.rb 2014-05-23 10:23:46.000000000 +0200 +++ new/yast2-update-3.1.15/src/modules/RootPart.rb 2014-06-25 15:53:23.000000000 +0200 @@ -1797,11 +1797,27 @@ # enter the mount points of the newly mounted partitions # in the target map of the storage module AddToTargetMap() + create_backup end success end + # known configuration files that are changed during update, so we need to + # backup them to restore if something goes wrong (bnc#882039) + BACKUP_DIRS = { + "sw_mgmt" => [ + "/etc/zypp/repos.d", + "/etc/zypp/services.d", + "/etc/zypp/credentials.d" + ] + } + def create_backup + BACKUP_DIRS.each_pair do |name, paths| + Update.create_backup(name, paths) + end + end + # Get architecture of an elf file. def GetArchOfELF(filename) bash_out = Convert.to_map( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/src/modules/Update.rb new/yast2-update-3.1.15/src/modules/Update.rb --- old/yast2-update-3.1.9/src/modules/Update.rb 2014-05-23 10:23:46.000000000 +0200 +++ new/yast2-update-3.1.15/src/modules/Update.rb 2014-06-25 15:53:23.000000000 +0200 @@ -29,6 +29,7 @@ # require "yast" +require "fileutils" module Yast class UpdateClass < Module @@ -830,6 +831,34 @@ return nil end + BACKUP_DIR = "var/adm/backup/system-upgrade" + # Creates backup with name based on `name` contaings everything + # matching globs in `paths`. + # @param name[String] name for backup file. Use bash friendly name ;) + # @note Can be called only after target root is mounted. + # + # @example to store repos file and credentials directory + # Update.create_backup("repos", ["/etc/zypp/repos.d/*", "/etc/zypp/credentials"]) + def create_backup(name, paths) + mounted_root = Installation.destdir + + # ensure directory exists + ::FileUtils.mkdir_p(File.join(mounted_root, BACKUP_DIR)) + + target_file = File.join(mounted_root, BACKUP_DIR, "#{name}.tar.bz2") + + paths_without_prefix = paths.map {|p| p.start_with?("/") ? p[1..-1] : p } + + command = "tar cjvf '#{target_file}'" + command << " -C '#{mounted_root}'" + # no shell escaping here, but we backup reasonable files and want to allow globs + command << " " + paths_without_prefix.join(" ") + res = SCR.Execute(path(".target.bash_output"), command) + log.info "backup created with '#{command}' result: #{res}" + + raise "Failed to create backup" if res["exit"] != 0 + end + publish :variable => :packages_to_install, :type => "integer" publish :variable => :packages_to_update, :type => "integer" publish :variable => :packages_to_remove, :type => "integer" @@ -863,6 +892,7 @@ publish :function => :SetDesktopPattern, :type => "void ()" publish :function => :Detach, :type => "void ()" publish :function => :installed_product, :type => "string ()" + publish :function => :create_backup, :type => "void (string,list)" private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.9/test/update_test.rb new/yast2-update-3.1.15/test/update_test.rb --- old/yast2-update-3.1.9/test/update_test.rb 2014-05-23 10:23:46.000000000 +0200 +++ new/yast2-update-3.1.15/test/update_test.rb 2014-06-25 15:53:23.000000000 +0200 @@ -56,6 +56,45 @@ end end + describe "#create_backup" do + before(:each) do + allow(Yast::Installation).to receive(:destdir).and_return("/mnt") + allow(::FileUtils).to receive(:mkdir_p) + end + + it "create tarball including given name with all paths added" do + name = "test-backup" + paths = ["a", "b"] + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), /^tar c.*#{name}.*tar.bz2.*a.*b/). + and_return({"exit" => 0}) + Yast::Update.create_backup(name, paths) + end + + it "strips leading '/' from paths" do + name = "test-backup" + paths = ["/path_with_slash", "path_without_slash"] + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), / path_with_slash/). + and_return({"exit" => 0}) + Yast::Update.create_backup(name, paths) + end + + it "do not store mount prefix in tarball" do + name = "test-backup" + paths = ["/path_with_slash"] + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), /-C '\/mnt'/). + and_return({"exit" => 0}) + Yast::Update.create_backup(name, paths) + end + + it "raise exception if creating tarball failed" do + name = "test-backup" + paths = ["/path_with_slash"] + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), /tar/). + and_return({"exit" => 1}) + expect{Yast::Update.create_backup(name, paths)}.to raise_error + end + end + describe "#SetDesktopPattern" do context "if there is no definition of window manager upgrade path in control file" do it "returns true as there is no upgrade path defined" do -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
