Script 'mail_helper' called by bg Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: bg. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-update -> sle12 ## BNC# 882039 : "[UPGRADE] Upgrade process modifies data on installed system and does not restore them" (ASSIGNED/) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-update/yast2-update.changes 2014-06-12 14:39:49.000000000 +0200 +++ /mounts/work_src_done/SLE12/yast2-update/yast2-update.changes 2014-06-13 07:35:22.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Jun 12 14:48:57 UTC 2014 - jreidinger@suse.com + +- add method to create upgrade backup (bnc#882039) +- 3.1.12 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2-product-creator - yast2-schema - yast2-update ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2-update (Old) and /mounts/work_src_done/SLE12/yast2-update (BS:build ID:39435 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-update", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-update-3.1.11.tar.bz2 New: ---- yast2-update-3.1.12.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-update.spec ++++++ --- /var/tmp/diff_new_pack.3NyMKL/_old 2014-06-13 15:04:12.000000000 +0200 +++ /var/tmp/diff_new_pack.3NyMKL/_new 2014-06-13 15:04:12.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.11 +Version: 3.1.12 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-update-3.1.11.tar.bz2 -> yast2-update-3.1.12.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.11/package/yast2-update.changes new/yast2-update-3.1.12/package/yast2-update.changes --- old/yast2-update-3.1.11/package/yast2-update.changes 2014-06-12 11:23:22.000000000 +0200 +++ new/yast2-update-3.1.12/package/yast2-update.changes 2014-06-13 07:33:39.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Jun 12 14:48:57 UTC 2014 - jreidinger@suse.com + +- add method to create upgrade backup (bnc#882039) +- 3.1.12 + +------------------------------------------------------------------- Thu Jun 12 07:40:30 UTC 2014 - jreidinger@suse.com - fix crash caused by the last change (bnc#882309) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.11/package/yast2-update.spec new/yast2-update-3.1.12/package/yast2-update.spec --- old/yast2-update-3.1.11/package/yast2-update.spec 2014-06-12 11:23:22.000000000 +0200 +++ new/yast2-update-3.1.12/package/yast2-update.spec 2014-06-13 07:33:39.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.11 +Version: 3.1.12 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.11/src/modules/Update.rb new/yast2-update-3.1.12/src/modules/Update.rb --- old/yast2-update-3.1.11/src/modules/Update.rb 2014-06-12 11:23:22.000000000 +0200 +++ new/yast2-update-3.1.12/src/modules/Update.rb 2014-06-13 07:33:40.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.11/test/update_test.rb new/yast2-update-3.1.12/test/update_test.rb --- old/yast2-update-3.1.11/test/update_test.rb 2014-06-12 11:23:22.000000000 +0200 +++ new/yast2-update-3.1.12/test/update_test.rb 2014-06-13 07:33:40.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 continue with "q"... Checked in at Fri Jun 13 15:04:28 CEST 2014 by bg Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org