commit yast2-update for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-update for openSUSE:Factory checked in at 2014-07-02 15:04:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-06-26 08:00:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-update.new/yast2-update.changes 2014-07-02 15:04:12.000000000 +0200 @@ -1,0 +2,22 @@ +Tue Jul 1 06:38:02 UTC 2014 - lslezak@suse.cz + +- remove all repositories when going back to close the open solv + files and allow successful unmount when changing the target + partition to update (bnc#876677) +- 3.1.18 + +------------------------------------------------------------------- +Mon Jun 30 14:32:39 UTC 2014 - jreidinger@suse.cz + +- Add also restore script to backup to make easier restoring + (bnc#882039) +- 3.1.17 + +------------------------------------------------------------------- +Thu Jun 26 16:16:04 CEST 2014 - schubi@suse.de + +- Checking if the files exist which have to be backuped by the + tar call. (bnc#884384) +- 3.1.16 + +------------------------------------------------------------------- Old: ---- yast2-update-3.1.15.tar.bz2 New: ---- yast2-update-3.1.18.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-update.spec ++++++ --- /var/tmp/diff_new_pack.HGe3FE/_old 2014-07-02 15:04:13.000000000 +0200 +++ /var/tmp/diff_new_pack.HGe3FE/_new 2014-07-02 15:04:13.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.15 +Version: 3.1.18 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-update-3.1.15.tar.bz2 -> yast2-update-3.1.18.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.15/package/yast2-update.changes new/yast2-update-3.1.18/package/yast2-update.changes --- old/yast2-update-3.1.15/package/yast2-update.changes 2014-06-25 15:53:23.000000000 +0200 +++ new/yast2-update-3.1.18/package/yast2-update.changes 2014-07-01 09:08:20.000000000 +0200 @@ -1,4 +1,26 @@ ------------------------------------------------------------------- +Tue Jul 1 06:38:02 UTC 2014 - lslezak@suse.cz + +- remove all repositories when going back to close the open solv + files and allow successful unmount when changing the target + partition to update (bnc#876677) +- 3.1.18 + +------------------------------------------------------------------- +Mon Jun 30 14:32:39 UTC 2014 - jreidinger@suse.cz + +- Add also restore script to backup to make easier restoring + (bnc#882039) +- 3.1.17 + +------------------------------------------------------------------- +Thu Jun 26 16:16:04 CEST 2014 - schubi@suse.de + +- Checking if the files exist which have to be backuped by the + tar call. (bnc#884384) +- 3.1.16 + +------------------------------------------------------------------- Wed Jun 25 11:10:44 UTC 2014 - lslezak@suse.cz - display product update summary and check for automatic product diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.15/package/yast2-update.spec new/yast2-update-3.1.18/package/yast2-update.spec --- old/yast2-update-3.1.15/package/yast2-update.spec 2014-06-25 15:53:23.000000000 +0200 +++ new/yast2-update-3.1.18/package/yast2-update.spec 2014-07-01 09:08:20.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.15 +Version: 3.1.18 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.15/src/modules/Update.rb new/yast2-update-3.1.18/src/modules/Update.rb --- old/yast2-update-3.1.15/src/modules/Update.rb 2014-06-25 15:53:23.000000000 +0200 +++ new/yast2-update-3.1.18/src/modules/Update.rb 2014-07-01 09:08:20.000000000 +0200 @@ -802,6 +802,21 @@ # def Detach + # release mounted devices + Pkg.SourceReleaseAll + + # remove all repos except the initial installation repository + # to close the solv files and allow unmounting the target + repos_to_delete = Pkg.SourceGetCurrent(false) + repos_to_delete.delete(0) + log.info "Removing repositories: #{repos_to_delete}" + + # the changes are not saved to the target system, the repositories + # are removed only from pkg-bindings + repos_to_delete.each do |repo_to_delete| + Pkg.SourceDelete(repo_to_delete) + end + Pkg.TargetFinish @did_init1 = false @did_init2 = false @@ -842,21 +857,12 @@ 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}" + tarball_path = File.join(BACKUP_DIR, "#{name}.tar.bz2") + root_tarball_path = File.join(mounted_root, tarball_path) + create_tarball(root_tarball_path, mounted_root, paths) - raise "Failed to create backup" if res["exit"] != 0 + script_path = File.join(mounted_root, BACKUP_DIR, "restore-#{name}.sh") + create_restore_script(script_path, tarball_path, paths) end publish :variable => :packages_to_install, :type => "integer" @@ -896,6 +902,53 @@ private + def create_tarball(tarball_path, root, paths) + # tar reports an error if a file does not exist. + # So we have to check this before. + existing_paths = paths.select { |p| File.exist?(File.join(root, p)) } + + # ensure directory exists + ::FileUtils.mkdir_p(File.dirname(tarball_path)) + + paths_without_prefix = existing_paths.map {|p| p.start_with?("/") ? p[1..-1] : p } + + command = "tar cjvf '#{tarball_path}'" + command << " -C '#{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}" + + + # tarball can contain sensitive data, so prevent read to non-root + # do it for sure even if tar failed as it can contain partial content + ::FileUtils.chmod(0600, tarball_path) if File.exist?(tarball_path) + + raise "Failed to create backup" if res["exit"] != 0 + end + + def create_restore_script(script_path, tarball_path, paths) + paths_without_prefix = paths.map {|p| p.start_with?("/") ? p[1..-1] : p } + + # remove leading "/" from tarball to allow to run it from different root + tarball_path = tarball_path[1..-1] if tarball_path.start_with?("/") + script_content = <<EOF +#! /bin/sh +# change root to first parameter or use / as default +# it is needed to allow restore in installation +cd ${1:-/} +#{paths_without_prefix.map{ |p| "rm -rf #{p}" }.join("\n")} + +tar xvf #{tarball_path} --overwrite +# return back to original dir +cd - +EOF + + File.write(script_path, script_content) + # allow execution of script + ::FileUtils.chmod(0744, script_path) + end + # Reads the currently selected default desktop from sysconfig # and returns it # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.15/test/update_test.rb new/yast2-update-3.1.18/test/update_test.rb --- old/yast2-update-3.1.15/test/update_test.rb 2014-06-25 15:53:23.000000000 +0200 +++ new/yast2-update-3.1.18/test/update_test.rb 2014-07-01 09:08:20.000000000 +0200 @@ -60,6 +60,11 @@ before(:each) do allow(Yast::Installation).to receive(:destdir).and_return("/mnt") allow(::FileUtils).to receive(:mkdir_p) + allow(::File).to receive(:write) + allow(::FileUtils).to receive(:chmod) + allow(::File).to receive(:exist?).and_return(true) + allow(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), /^tar /). + and_return({"exit" => 0}) end it "create tarball including given name with all paths added" do @@ -86,6 +91,14 @@ Yast::Update.create_backup(name, paths) end + it "change permission of tarball to be readable only for creator" do + name = "test-backup" + paths = ["a", "b"] + expect(::FileUtils).to receive(:chmod).with(0600, /test-backup\.tar.bz2/) + + Yast::Update.create_backup(name, paths) + end + it "raise exception if creating tarball failed" do name = "test-backup" paths = ["/path_with_slash"] @@ -93,6 +106,23 @@ and_return({"exit" => 1}) expect{Yast::Update.create_backup(name, paths)}.to raise_error end + + it "create restore script" do + name = "test-backup" + paths = ["a", "b"] + expect(File).to receive(:write) + + Yast::Update.create_backup(name, paths) + end + + it "set executable permission on restore script" do + name = "test-backup" + paths = ["a", "b"] + + expect(::FileUtils).to receive(:chmod).with(0744, /restore-test-backup\.sh/) + + Yast::Update.create_backup(name, paths) + end end describe "#SetDesktopPattern" do -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de