Hello community, here is the log from the commit of package yast2-storage for openSUSE:Factory checked in at 2015-03-01 14:51:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-storage (Old) and /work/SRC/openSUSE:Factory/.yast2-storage.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-storage" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-storage/yast2-storage.changes 2015-02-16 17:50:59.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-storage.new/yast2-storage.changes 2015-03-01 14:51:40.000000000 +0100 @@ -1,0 +2,6 @@ +Mon Feb 16 11:38:11 CET 2015 - aschn...@suse.de + +- install into btrfs subvolume (fate#318392) +- version 3.1.53 + +------------------------------------------------------------------- Old: ---- yast2-storage-3.1.52.tar.bz2 New: ---- yast2-storage-3.1.53.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-storage.spec ++++++ --- /var/tmp/diff_new_pack.SEmG08/_old 2015-03-01 14:51:41.000000000 +0100 +++ /var/tmp/diff_new_pack.SEmG08/_new 2015-03-01 14:51:41.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-storage -Version: 3.1.52 +Version: 3.1.53 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-storage-3.1.52.tar.bz2 -> yast2-storage-3.1.53.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/package/yast2-storage.changes new/yast2-storage-3.1.53/package/yast2-storage.changes --- old/yast2-storage-3.1.52/package/yast2-storage.changes 2015-02-13 11:33:11.000000000 +0100 +++ new/yast2-storage-3.1.53/package/yast2-storage.changes 2015-02-24 18:26:14.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Feb 16 11:38:11 CET 2015 - aschn...@suse.de + +- install into btrfs subvolume (fate#318392) +- version 3.1.53 + +------------------------------------------------------------------- Fri Feb 13 10:46:05 CET 2015 - aschn...@suse.de - updated requires diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/package/yast2-storage.spec new/yast2-storage-3.1.53/package/yast2-storage.spec --- old/yast2-storage-3.1.52/package/yast2-storage.spec 2015-02-13 11:33:11.000000000 +0100 +++ new/yast2-storage-3.1.53/package/yast2-storage.spec 2015-02-24 18:26:14.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-storage -Version: 3.1.52 +Version: 3.1.53 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/src/Makefile.am new/yast2-storage-3.1.53/src/Makefile.am --- old/yast2-storage-3.1.52/src/Makefile.am 2015-02-13 11:33:11.000000000 +0100 +++ new/yast2-storage-3.1.53/src/Makefile.am 2015-02-24 18:26:14.000000000 +0100 @@ -20,7 +20,7 @@ modules/Partitions.rb \ modules/Region.rb \ modules/StorageClients.rb \ - modules/StorageUtils.rb + modules/StorageSnapper.rb client_DATA = \ clients/inst_disk_proposal.rb \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/src/clients/storage_finish.rb new/yast2-storage-3.1.53/src/clients/storage_finish.rb --- old/yast2-storage-3.1.52/src/clients/storage_finish.rb 2015-02-13 11:33:12.000000000 +0100 +++ new/yast2-storage-3.1.53/src/clients/storage_finish.rb 2015-02-24 18:26:14.000000000 +0100 @@ -40,7 +40,7 @@ Yast.import "Storage" Yast.import "StorageSettings" Yast.import "StorageUpdate" - Yast.import "StorageUtils" + Yast.import "StorageSnapper" Yast.import "Mode" Yast.import "Installation" @@ -91,8 +91,8 @@ Storage.SaveUsedFs StorageSettings.Save - if Mode.installation - StorageUtils.ConfigureSnapper() + if Mode.installation && StorageSnapper.configure_snapper? + StorageSnapper.configure_snapper_step4() end else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/src/modules/Storage.rb new/yast2-storage-3.1.53/src/modules/Storage.rb --- old/yast2-storage-3.1.52/src/modules/Storage.rb 2015-02-13 11:33:12.000000000 +0100 +++ new/yast2-storage-3.1.53/src/modules/Storage.rb 2015-02-24 18:26:14.000000000 +0100 @@ -1,6 +1,6 @@ # encoding: utf-8 -# Copyright (c) [2012-2014] Novell, Inc. +# Copyright (c) [2012-2015] Novell, Inc. # # All Rights Reserved. # @@ -52,6 +52,7 @@ Yast.import "StorageInit" Yast.import "StorageDevices" Yast.import "StorageClients" + Yast.import "StorageSnapper" Yast.import "Stage" Yast.import "String" Yast.import "Hotplug" @@ -367,13 +368,18 @@ end + def default_subvolume_name() + return @sint.getDefaultSubvolName() + end + + def ClassicStringToByte(str) ret, bytes = ::Storage::humanStringToByte(str,true) if( !ret ) ts = Ops.add(str, "b") ret, bytes = ::Storage::humanStringToByte(ts,true) if( !ret ) - bytes = 0 + bytes = 0 Builtins.y2error("cannot parse %1 or %2", str, ts) end end @@ -1841,7 +1847,7 @@ vols = 0; vols += p["devices"].size if( p.has_key?("devices") ) vols += p["devices_add"].size if( p.has_key?("devices_add") ) - if vols>1 + if vols>1 !Builtins.isempty(Ops.get_list(p, "devices_add", [])) Ops.set( p, @@ -2069,7 +2075,7 @@ ) end end - Ops.set(@StorageMap, @targets_key, tg) + Ops.set(@StorageMap, @targets_key, tg) #SCR::Write(.target.ycp, "/tmp/upd_all_aft_"+sformat("%1",count), StorageMap[targets_key]:$[] ); #count = count+1; @@ -2105,7 +2111,7 @@ if Ops.greater_than(numbt, 0) || dev == "/dev/btrfs" tg = HandleBtrfsSimpleVolumes(tg) end - Ops.set(@StorageMap, @targets_key, tg) + Ops.set(@StorageMap, @targets_key, tg) #SCR::Write(.target.ycp, "/tmp/upd_disk_aft_"+sformat("%1",count), StorageMap[targets_key]:$[] ); #count = count+1; @@ -2172,7 +2178,7 @@ Ops.set(tg, "/dev/btrfs", getContainerInfo(bt)) tg = HandleBtrfsSimpleVolumes(tg) end - Ops.set(@StorageMap, @targets_key, tg) + Ops.set(@StorageMap, @targets_key, tg) #SCR::Write(.target.ycp, "/tmp/upd_dev_aft_"+sformat("%1",count), StorageMap[targets_key]:$[] ); #count = count+1; @@ -3264,7 +3270,7 @@ Builtins.y2milestone("MdToDev nr_or:%1", nr_or_string) if Ops.is_string?(nr_or_string) ret = nr_or_string - else + else ret = "/dev/md"+nr_or_string.to_s end Builtins.y2milestone("MdToDev ret:%1", ret) @@ -4841,11 +4847,38 @@ end + class MyCommitCallbacks < ::Storage::CommitCallbacks + + def initialize() + super() + end + + def post_root_filesystem_create() + StorageSnapper::configure_snapper_step1() + end + + def post_root_mount() + StorageSnapper::configure_snapper_step2() + end + + def post_root_fstab_add() + StorageSnapper::configure_snapper_step3() + end + + end + + # Apply storage changes # # @return [Fixnum] def CommitChanges Builtins.y2milestone("CommitChanges") + + if Mode.installation && StorageSnapper.configure_snapper? + my_commit_callbacks = MyCommitCallbacks.new() + @sint.setCommitCallbacks(my_commit_callbacks) + end + ret = @sint.commit() if ret<0 Builtins.y2error("CommitChanges sint ret:%1", ret) @@ -6073,7 +6106,7 @@ def FreeCylindersAroundPartition(device, free_before, free_after) - r, free_before.value, free_after.value = + r, free_before.value, free_after.value = @sint.freeCylindersAroundPartition(device) ret = r==0 Builtins.y2milestone( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/src/modules/StorageSnapper.rb new/yast2-storage-3.1.53/src/modules/StorageSnapper.rb --- old/yast2-storage-3.1.52/src/modules/StorageSnapper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-3.1.53/src/modules/StorageSnapper.rb 2015-02-24 18:26:14.000000000 +0100 @@ -0,0 +1,151 @@ +# encoding: utf-8 + +# Copyright (c) [2012-2015] Novell, Inc. +# +# All Rights Reserved. +# +# 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. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may +# find current contact information at www.novell.com. + + +require "yast" + + +module Yast + + class StorageSnapperClass < Module + + + include Yast::Logger + + + def main + + textdomain "storage" + + Yast.import "String" + Yast.import "Installation" + Yast.import "InstExtensionImage" + Yast.import "Storage" + + end + + + def bash_log_output(command) + tmp = SCR.Execute(path(".target.bash_output"), command) + + log.info("exit: #{tmp.fetch("exit")}") + tmp.fetch("stdout").each_line { |line| log.info("stdout #{line}") } + tmp.fetch("stderr").each_line { |line| log.info("stderr #{line}") } + + return tmp.fetch("exit") + end + + + def configure_snapper? + + part = Storage.GetEntryForMountpoint("/") + + if part.fetch("used_fs", :unknown) != :btrfs + return false + end + + userdata = part.fetch("userdata", {}) + if userdata.fetch("/", "") != "snapshots" + return false + end + + return true + + end + + + def configure_snapper_step1() + + log.info("configuring snapper for root fs - step 1") + + if ENV["YAST2_STORAGE_SNAPPER_EXTEND"] != "no" + # TRANSLATORS: message in progress bar + InstExtensionImage.LoadExtension("snapper", _("Retrieving %s extension...") % "snapper") + end + + part = Storage.GetEntryForMountpoint("/") + + if bash_log_output("/usr/lib/snapper/installation-helper --step 1 " << + "--device '#{String.Quote(part["device"])}' " << + "--description 'first root filesystem'") != 0 + log.error("configuring snapper for root fs failed") + end + + end + + + def configure_snapper_step2() + + log.info("configuring snapper for root fs - step 2") + + part = Storage.GetEntryForMountpoint("/") + + if bash_log_output("/usr/lib/snapper/installation-helper --step 2 " << + "--device '#{String.Quote(part["device"])}' " << + "--root-prefix '#{String.Quote(Installation.destdir)}' " << + "--default-subvolume-name '#{String.Quote(Storage.default_subvolume_name())}'") != 0 + log.error("configuring snapper for root fs failed") + end + + end + + + def configure_snapper_step3() + + log.info("configuring snapper for root fs - step 3") + + if bash_log_output("/usr/lib/snapper/installation-helper --step 3 " << + "--root-prefix '#{String.Quote(Installation.destdir)}' " << + "--default-subvolume-name '#{String.Quote(Storage.default_subvolume_name())}'") != 0 + log.error("configuring snapper for root fs failed") + end + + if ENV["YAST2_STORAGE_SNAPPER_EXTEND"] != "no" + # TRANSLATORS: message in progress bar + InstExtensionImage.UnLoadExtension("snapper", _("Releasing %s extension...") % "snapper") + end + + end + + + def configure_snapper_step4() + + log.info("configuring snapper for root fs - step 4") + + if bash_log_output("/usr/lib/snapper/installation-helper --step 4") != 0 + log.error("configuring snapper for root fs failed") + end + + bash_log_output("/usr/bin/snapper --no-dbus set-config " << + "NUMBER_CLEANUP=yes NUMBER_LIMIT=10 NUMBER_LIMIT_IMPORTANT=10 " << + "TIMELINE_CREATE=no") + + SCR.Write(path(".sysconfig.yast2.USE_SNAPPER"), "yes") + SCR.Write(path(".sysconfig.yast2"), nil) + + end + + end + + StorageSnapper = StorageSnapperClass.new + StorageSnapper.main + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/src/modules/StorageUtils.rb new/yast2-storage-3.1.53/src/modules/StorageUtils.rb --- old/yast2-storage-3.1.52/src/modules/StorageUtils.rb 2015-02-13 11:33:12.000000000 +0100 +++ new/yast2-storage-3.1.53/src/modules/StorageUtils.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,68 +0,0 @@ -# encoding: utf-8 - -# Copyright (c) [2012-2014] Novell, Inc. -# -# All Rights Reserved. -# -# 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. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, contact Novell, Inc. -# -# To contact Novell about this file by physical or electronic mail, you may -# find current contact information at www.novell.com. - - -require "yast" - - -module Yast - - class StorageUtilsClass < Module - - - include Yast::Logger - - - def main - - textdomain "storage" - - Yast.import "Storage" - - end - - - def ConfigureSnapper() - part = Storage.GetEntryForMountpoint("/") - if part.fetch("used_fs", :unknown) == :btrfs - userdata = part.fetch("userdata", {}) - if userdata.fetch("/", "") == "snapshots" - log.info("configuring snapper for root fs") - if SCR.Execute(path(".target.bash"), "/usr/bin/snapper --no-dbus create-config " << - "--fstype=btrfs --add-fstab /") == 0 - SCR.Execute(path(".target.bash"), "/usr/bin/snapper --no-dbus set-config " << - "NUMBER_CLEANUP=yes NUMBER_LIMIT=10 NUMBER_LIMIT_IMPORTANT=10 " << - "TIMELINE_CREATE=no") - SCR.Write(path(".sysconfig.yast2.USE_SNAPPER"), "yes") - SCR.Write(path(".sysconfig.yast2"), nil) - else - log.error("configuring snapper for root fs failed") - end - end - end - end - - end - - StorageUtils = StorageUtilsClass.new - StorageUtils.main - -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/test/Makefile.am new/yast2-storage-3.1.53/test/Makefile.am --- old/yast2-storage-3.1.52/test/Makefile.am 2015-02-13 11:33:12.000000000 +0100 +++ new/yast2-storage-3.1.53/test/Makefile.am 2015-02-24 18:26:14.000000000 +0100 @@ -3,7 +3,7 @@ # TESTS = \ - storage_utils_configure_snapper_test.rb \ + storage_snapper_configure_snapper_test.rb \ storage_get_disk_partition.rb TEST_EXTENSIONS = .rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/test/storage_snapper_configure_snapper_test.rb new/yast2-storage-3.1.53/test/storage_snapper_configure_snapper_test.rb --- old/yast2-storage-3.1.52/test/storage_snapper_configure_snapper_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-3.1.53/test/storage_snapper_configure_snapper_test.rb 2015-02-24 18:26:14.000000000 +0100 @@ -0,0 +1,78 @@ +#!/usr/bin/env rspec + +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +require "yast" + +Yast.import "StorageSnapper" +Yast.import "Storage" + + +describe "StorageSnapper#configure_snapper?" do + + + subject { Yast::StorageSnapper.configure_snapper? } + + + it "configures snapper" do + + data = { + "device" => "/dev/sda1", + "mount" => "/", + "used_fs" => :btrfs, + "userdata" => { "/" => "snapshots" } + } + + allow(Yast::Storage).to receive(:GetEntryForMountpoint).with("/").once.and_return(data) + + expect(subject).to eq true + + end + + + it "does not configure snapper" do + + data = { + "device" => "/dev/sda1", + "mount" => "/", + "used_fs" => :btrfs + } + + allow(Yast::Storage).to receive(:GetEntryForMountpoint).with("/").once.and_return(data) + + expect(subject).to eq false + + end + + + it "does not configure snapper" do + + data = { + "device" => "/dev/sda1", + "mount" => "/", + "used_fs" => :xfs, + "userdata" => { "/" => "snapshots" } + } + + allow(Yast::Storage).to receive(:GetEntryForMountpoint).with("/").once.and_return(data) + + expect(subject).to eq false + + end + + + it "does not configure snapper" do + + data = { + "device" => "/dev/sda1", + "mount" => "/", + "used_fs" => :xfs + } + + allow(Yast::Storage).to receive(:GetEntryForMountpoint).with("/").once.and_return(data) + + expect(subject).to eq false + + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.1.52/test/storage_utils_configure_snapper_test.rb new/yast2-storage-3.1.53/test/storage_utils_configure_snapper_test.rb --- old/yast2-storage-3.1.52/test/storage_utils_configure_snapper_test.rb 2015-02-13 11:33:12.000000000 +0100 +++ new/yast2-storage-3.1.53/test/storage_utils_configure_snapper_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,57 +0,0 @@ -#!/usr/bin/env rspec - -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) - -require "yast" - -Yast.import "StorageUtils" -Yast.import "Storage" - - -describe "StorageUtils#ConfigureSnapper" do - - - it "configures snapper" do - - data = { - "device" => "/dev/sda1", - "mount" => "/", - "used_fs" => :btrfs, - "userdata" => { "/" => "snapshots" } - } - - Yast::Storage.stub(:GetEntryForMountpoint).with("/").once.and_return(data) - - Yast::SCR.stub(:Execute).and_return(1) - Yast::SCR.should_receive(:Execute).exactly(2).times.and_return(0) - - Yast::SCR.stub(:Write).and_return(1) - Yast::SCR.should_receive(:Write).exactly(2).times.and_return(0) - - Yast::StorageUtils.ConfigureSnapper() - - end - - - it "does not configure snapper" do - - data = { - "device" => "/dev/sda1", - "mount" => "/", - "used_fs" => :btrfs - } - - Yast::Storage.stub(:GetEntryForMountpoint).with("/").once.and_return(data) - - Yast::SCR.stub(:Execute).and_return(1) - Yast::SCR.should_receive(:Execute).exactly(0).times - - Yast::SCR.stub(:Write).and_return(1) - Yast::SCR.should_receive(:Write).exactly(0).times - - Yast::StorageUtils.ConfigureSnapper() - - end - - -end -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org