openSUSE Commits
Threads by month
- ----- 2025 -----
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
March 2017
- 2 participants
- 2028 discussions
Hello community,
here is the log from the commit of package yast2-packager for openSUSE:Factory checked in at 2017-03-29 13:23:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old)
and /work/SRC/openSUSE:Factory/.yast2-packager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-packager"
Wed Mar 29 13:23:18 2017 rev:333 rq:482992 version:3.2.21
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes 2017-02-18 03:16:40.424904743 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes 2017-03-29 13:23:19.802986398 +0200
@@ -1,0 +2,40 @@
+Tue Mar 28 08:31:49 UTC 2017 - igonzalezsosa(a)suse.com
+
+- Do not crash when changing the priority of a just created
+ repository (bsc#1027111)
+- 3.2.21
+
+-------------------------------------------------------------------
+Mon Mar 27 08:42:41 UTC 2017 - mvidner(a)suse.com
+
+- Do not ignore solver problems after touching the partitioning
+ (bsc#1029306)
+- 3.2.20
+
+-------------------------------------------------------------------
+Fri Mar 24 16:17:23 UTC 2017 - lslezak(a)suse.cz
+
+- Download the addon y2update.tgz file from a package referenced
+ by the "installerextension()" provides dependency (FATE#320772)
+- 3.2.19
+
+-------------------------------------------------------------------
+Mon Mar 20 12:33:35 UTC 2017 - jreidinger(a)suse.com
+
+- make minimal changes when modify zypp.conf (bsc#1023204)
+- 3.2.18
+
+-------------------------------------------------------------------
+Tue Mar 7 09:37:15 CET 2017 - schubi(a)suse.de
+
+- Product selection: Do not reinstall already installed products
+ or products which are already included in another product.
+
+ Fixes SLES4SAP autoupgrade with SUSE Manager repositories.
+ These repositories contain SLES_SAP and SLES product. SLES
+ product will not be installed because SLES_SAP already includes
+ the SLES product.
+ (bnc#1014861)
+- 3.2.17
+
+-------------------------------------------------------------------
Old:
----
yast2-packager-3.2.16.tar.bz2
New:
----
yast2-packager-3.2.21.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.9QmQEL/_old 2017-03-29 13:23:20.662864790 +0200
+++ /var/tmp/diff_new_pack.9QmQEL/_new 2017-03-29 13:23:20.666864224 +0200
@@ -17,7 +17,7 @@
Name: yast2-packager
-Version: 3.2.16
+Version: 3.2.21
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -29,6 +29,7 @@
BuildRequires: yast2-xml
# needed for space calculator to parse and convert sizes
BuildRequires: yast2-storage
+BuildRequires: rubygem(cfa) >= 0.5.0
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(yast-rake)
@@ -71,6 +72,9 @@
# Augeas lenses
Requires: augeas-lenses
+# zypp.conf model and minimal modifications (bsc#1023204)
+Requires: rubygem(cfa) >= 0.5.0
+
# setenv() builtin
Conflicts: yast2-core < 2.15.10
++++++ yast2-packager-3.2.16.tar.bz2 -> yast2-packager-3.2.21.tar.bz2 ++++++
++++ 5468 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2017-03-29 13:23:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2 (Old)
and /work/SRC/openSUSE:Factory/.yast2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2"
Wed Mar 29 13:23:10 2017 rev:399 rq:482978 version:3.2.23
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2017-03-21 22:47:38.594948976 +0100
+++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2017-03-29 13:23:11.740126687 +0200
@@ -1,0 +2,31 @@
+Tue Mar 28 07:25:39 WEST 2017 - knut.anderssen(a)suse.com
+
+- SlideShow: Escape plain text release notes being shown properly
+ in RichText (bsc#1028721).
+- 3.2.23
+
+-------------------------------------------------------------------
+Fri Mar 24 09:37:44 UTC 2017 - lslezak(a)suse.cz
+
+- Download the addon installation.xml file from a package
+ referenced by the "installerextension" provides dependency
+ (FATE#320772)
+- 3.2.22
+
+-------------------------------------------------------------------
+
+Wed Mar 22 16:53:07 UTC 2017 - jreidinger(a)suse.com
+
+- Use for Yast::TargetFile and Yast::Execute real path where scr
+ operates. It allows easier switching scr in unit tests.
+ (needed for testing fix for bsc#1023204)
+- 3.2.21
+
+-------------------------------------------------------------------
+Wed Mar 22 15:37:51 UTC 2017 - ancor(a)suse.com
+
+- Added options to CWM::RadioButtons to set some extra spaces
+ (related to poo#14936 and bsc#1025415).
+- 3.2.20
+
+-------------------------------------------------------------------
Old:
----
yast2-3.2.19.tar.bz2
New:
----
yast2-3.2.23.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2.spec ++++++
--- /var/tmp/diff_new_pack.eRZxNh/_old 2017-03-29 13:23:12.548012432 +0200
+++ /var/tmp/diff_new_pack.eRZxNh/_new 2017-03-29 13:23:12.552011867 +0200
@@ -17,7 +17,7 @@
Name: yast2
-Version: 3.2.19
+Version: 3.2.23
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0
@@ -43,8 +43,8 @@
BuildRequires: yast2-core >= 2.18.12
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: yast2-pkg-bindings >= 2.20.3
-# To have Yast::CoreExt::AnsiString
-BuildRequires: yast2-ruby-bindings >= 3.1.36
+# To have Yast::WFM.scr_root
+BuildRequires: yast2-ruby-bindings >= 3.2.8
BuildRequires: yast2-testsuite
BuildRequires: yast2-ycp-ui-bindings >= 3.1.8
# for the PackageExtractor tests, just make sure they are present,
@@ -76,7 +76,7 @@
Requires: yast2-perl-bindings
# changed StartPackage callback signature
Requires: yast2-pkg-bindings >= 2.20.3
-Requires: yast2-ruby-bindings >= 3.1.33
+Requires: yast2-ruby-bindings >= 3.2.8
Requires: yast2-xml
# new UI::SetApplicationIcon
Requires: yast2-ycp-ui-bindings >= 3.1.8
++++++ yast2-3.2.19.tar.bz2 -> yast2-3.2.23.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/control/src/modules/WorkflowManager.rb new/yast2-3.2.23/library/control/src/modules/WorkflowManager.rb
--- old/yast2-3.2.19/library/control/src/modules/WorkflowManager.rb 2017-03-20 15:26:45.025124529 +0100
+++ new/yast2-3.2.23/library/control/src/modules/WorkflowManager.rb 2017-03-28 10:04:21.924733274 +0200
@@ -21,7 +21,7 @@
# you may find current contact information at www.novell.com
#
# ***************************************************************************
-# File: modules/WorkflowManager.ycp
+# File: modules/WorkflowManager.rb
# Package: yast2
# Summary: Provides API for configuring workflows
# Authors: Lukas Ocilka <locilka(a)suse.cz>
@@ -34,9 +34,11 @@
#
# Module unifies Add-Ons and Patterns modifying the workflow.
#
-# $Id: $
require "yast"
+require "packages/package_downloader"
+require "packages/package_extractor"
+
module Yast
class WorkflowManagerClass < Module
include Yast::Logger
@@ -393,6 +395,60 @@
file_location
end
+ # Download and extract the control file (installation.xml) from the add-on
+ # repository.
+ #
+ # @param src_id [Fixnum] repository ID
+ # @return [String, nil] path to downloaded installation.xml file or nil
+ # or nil when no workflow is defined or the workflow package is missing
+ def addon_control_file(src_id)
+ product = find_product(src_id)
+ return nil unless product && product["product_package"]
+
+ # the dependencies are bound to the product's -release package
+ release_package = Pkg.ResolvableDependencies(product["product_package"], :package, "").first
+
+ # find the package name with installer update in its Provide dependencies
+ control_file_package = find_control_package(release_package)
+ return nil unless control_file_package
+
+ # get the repository ID of the package
+ src = package_repository(control_file_package)
+ return nil unless src
+
+ # ensure the previous content is removed, the src_id should avoid
+ # collisions but rather be safe...
+ dir = addon_control_dir(src_id, cleanup: true)
+ fetch_package(src, control_file_package, dir)
+
+ path = File.join(dir, "installation.xml")
+ return nil unless File.exist?(path)
+
+ log.info("installation.xml path: #{path}")
+ path
+ rescue Packages::PackageDownloader::FetchError
+ # TRANSLATORS: an error message
+ Report.Error(_("Downloading the installer extension package failed."))
+ nil
+ rescue Packages::PackageExtractor::ExtractionFailed
+ # TRANSLATORS: an error message
+ Report.Error(_("Extracting the installer extension failed."))
+ nil
+ end
+
+ # Create a temporary directory for storing the installer extension package content.
+ # The directory is automatically removed at exit.
+ # @param src_id [Fixnum] repository ID
+ # @param cleanup [Boolean] remove the content if the directory already exists
+ # @return [String] directory path
+ def addon_control_dir(src_id, cleanup: false)
+ # Directory.tmpdir is automatically removed at exit
+ dir = File.join(Directory.tmpdir, "installer-extension-#{src_id}")
+ ::FileUtils.remove_entry(dir) if cleanup && Dir.exist?(dir)
+ ::FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
+ dir
+ end
+
# Returns requested control filename. Parameter 'name' is ignored
# for Add-Ons.
#
@@ -411,7 +467,7 @@
# Trying to get the file from source
else
Builtins.y2milestone("File %1 not cached", disk_filename)
- # using a file from source
+ # using a file from source, works only for SUSE tags repositories
use_filename = Pkg.SourceProvideDigestedFile(
src_id,
1,
@@ -419,6 +475,10 @@
true
)
+ # The most generic way it to use the package referenced by the "installerextension()"
+ # provides, this works with all repository types, including the RPM-MD repositories.
+ use_filename ||= addon_control_file(src_id)
+
# File exists?
return use_filename.nil? ? nil : StoreWorkflowFile(use_filename, disk_filename)
end
@@ -1427,6 +1487,93 @@
publish function: :SetAllUsedControlFiles, type: "void (list <string>)"
publish function: :HaveAdditionalWorkflows, type: "boolean ()"
publish function: :DumpCurrentSettings, type: "map <string, any> ()"
+
+ private
+
+ # Find the product from a repository.
+ # @param repo_id [Fixnum] repository ID
+ # @return [Hash,nil] pkg-bindings product hash or nil if not found
+ def find_product(repo_id)
+ # identify the product
+ products = Pkg.ResolvableDependencies("", :product, "")
+ return nil unless products
+
+ products.select! { |p| p["source"] == repo_id }
+
+ if products.size > 1
+ log.warn("More than one product found in the repository: #{products}")
+ log.warn("Using the first one: #{products.first}")
+ end
+
+ products.first
+ end
+
+ # Find the extension package name for the specified release package.
+ # The extension package is defined by the "installerextension()"
+ # RPM "Provides" dependency.
+ # @return [String,nil] a package name or nil if not found
+ def find_control_package(release_package)
+ return nil unless release_package && release_package["deps"]
+
+ release_package["deps"].each do |dep|
+ provide = dep["provides"]
+ next unless provide
+
+ control_file_package = provide[/\Ainstallerextension\((.+)\)\z/, 1]
+ next unless control_file_package
+
+ log.info("Found referenced package with control file: #{control_file_package}")
+ return control_file_package.strip
+ end
+
+ nil
+ end
+
+ # Find the repository ID for the package.
+ # @param package_name [String] name of the package
+ # @return [Fixnum,nil] repository ID or nil if not found
+ def package_repository(package_name)
+ # Identify the installation repository with the package
+ pkgs = Pkg.ResolvableProperties(package_name, :package, "")
+
+ if pkgs.empty?
+ log.warn("The installer extension package #{package_name} was not found")
+ return nil
+ elsif pkgs.size > 1
+ log.warn("More than one control package found: #{pkgs}")
+ log.warn("Using the first one: #{pkgs.first}")
+ end
+
+ pkgs.first["source"]
+ end
+
+ # Download and extract a package from a repository.
+ # @param repo_id [Fixnum] repository ID
+ # @param package [String] name of the package
+ # @raise [Packages::PackageDownloader::FetchError] if package download failed
+ # @raise [Packages::PackageExtractor::ExtractionFailed] if package extraction failed
+ def fetch_package(repo_id, package, dir)
+ downloader = Packages::PackageDownloader.new(repo_id, package)
+
+ Tempfile.open("downloaded-package-") do |tmp|
+ downloader.download(tmp.path)
+ extract(tmp, dir)
+ # the RPM package file is not needed after extracting it's content,
+ # remove it explicitly now, do not wait for the garbage collector
+ # (in inst-syst it is stored in a RAM disk and eats the RAM memory)
+ tmp.unlink
+ end
+ end
+
+ # Extract an RPM package into the given directory.
+ # @param package_file [String] the RPM package path
+ # @param dir [String] a directory where the package will be extracted to
+ # @raise [Packages::PackageExtractor::ExtractionFailed] if package extraction failed
+ def extract(package_file, dir)
+ log.info("Extracting file #{package_file}")
+ extractor = Packages::PackageExtractor.new(package_file)
+ extractor.extract(dir)
+ end
end
WorkflowManager = WorkflowManagerClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/control/test/workflow_manager_test.rb new/yast2-3.2.23/library/control/test/workflow_manager_test.rb
--- old/yast2-3.2.19/library/control/test/workflow_manager_test.rb 2017-03-20 15:26:45.025124529 +0100
+++ new/yast2-3.2.23/library/control/test/workflow_manager_test.rb 2017-03-28 10:04:21.924733274 +0200
@@ -266,4 +266,154 @@
expect(subject.DumpCurrentSettings["unmerged_changes"]).to eq(false)
end
end
+
+ describe "#addon_control_file" do
+ # setup fake products and their packages
+ let(:repo_id) { 42 }
+ let(:product_package) { "foo-release" }
+ let(:product) { { "name" => "foo", "source" => repo_id, "product_package" => product_package } }
+ let(:ext_package) { "foo-installation" }
+ let(:extension) { { "name" => ext_package, "source" => repo_id } }
+ let(:release) do
+ { "name" => product_package, "source" => repo_id,
+ "deps" => ["provides" => "installerextension(#{ext_package})"] }
+ end
+
+ before do
+ # generic mocks, can be are overriden in the tests
+ allow(Yast::Pkg).to receive(:ResolvableDependencies).with("", :product, "").and_return([product])
+ allow(Yast::Pkg).to receive(:ResolvableDependencies).with(product_package, :package, "").and_return([release])
+ allow(Yast::Pkg).to receive(:ResolvableProperties).with(ext_package, :package, "").and_return([extension])
+ allow_any_instance_of(Packages::PackageDownloader).to receive(:download)
+ allow_any_instance_of(Packages::PackageExtractor).to receive(:extract)
+ # allow using it at other places
+ allow(File).to receive(:exist?).and_call_original
+ end
+
+ it "returns nil if the repository does not provide any product" do
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with("", :product, "").and_return([])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the product does not refer to a release package" do
+ product = { "name" => "foo", "source" => repo_id }
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with("", :product, "").and_return([product])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the product belongs to a different repository" do
+ product = { "name" => "foo", "source" => repo_id + 1 }
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with("", :product, "").and_return([product])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the release package cannot be found" do
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with(product_package, :package, "").and_return([])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the release package does not have any dependencies" do
+ release = { "name" => "foo", "source" => repo_id }
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with(product_package, :package, "").and_return([release])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the release package does not have any installerextension() provides" do
+ release = { "name" => "foo", "source" => repo_id, "deps" => ["provides" => "foo"] }
+ expect(Yast::Pkg).to receive(:ResolvableDependencies).with(product_package, :package, "").and_return([release])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns nil if the installer extension package is not found" do
+ expect(Yast::Pkg).to receive(:ResolvableProperties).with(ext_package, :package, "").and_return([])
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ context "downloading the installer extension package fails" do
+ before do
+ expect_any_instance_of(Packages::PackageDownloader).to receive(:download).and_raise(Packages::PackageDownloader::FetchError)
+ allow(Yast::Report).to receive(:Error)
+ end
+
+ it "reports an error" do
+ expect(Yast::Report).to receive(:Error)
+ subject.addon_control_file(repo_id)
+ end
+
+ it "returns nil" do
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+ end
+
+ context "extracting the installer extension package fails" do
+ before do
+ expect_any_instance_of(Packages::PackageExtractor).to receive(:extract).and_raise(Packages::PackageExtractor::ExtractionFailed)
+ allow(Yast::Report).to receive(:Error)
+ end
+
+ it "reports an error" do
+ expect(Yast::Report).to receive(:Error)
+ subject.addon_control_file(repo_id)
+ end
+
+ it "returns nil" do
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+ end
+
+ it "downloads and extracts the extension package" do
+ expect_any_instance_of(Packages::PackageDownloader).to receive(:download)
+ expect_any_instance_of(Packages::PackageExtractor).to receive(:extract)
+ allow(File).to receive(:exist?)
+ subject.addon_control_file(repo_id)
+ end
+
+ it "returns nil if the extracted package does not contain installation.xml" do
+ expect(File).to receive(:exist?).with(/installation\.xml\z/).and_return(false)
+ expect(subject.addon_control_file(repo_id)).to be nil
+ end
+
+ it "returns the installation.xml path if the extracted package contains it" do
+ expect(File).to receive(:exist?).with(/installation.xml\z/).and_return(true)
+ # the returned path contains "/installation.xml" at the end
+ expect(subject.addon_control_file(repo_id)).to end_with("/installation.xml")
+ end
+ end
+
+ describe "#addon_control_dir" do
+ let(:src_id) { 3 }
+
+ after do
+ # remove the created directory after each run to ensure the same initial state
+ FileUtils.remove_entry(subject.addon_control_dir(src_id))
+ end
+
+ it "returns a directory path" do
+ expect(File.directory?(subject.addon_control_dir(src_id))).to be true
+ end
+
+ context "a file already exists in the target directory" do
+ let(:path) { subject.addon_control_dir(src_id) + "/test" }
+
+ before do
+ # write some dummy file first
+ File.write(path, "")
+ end
+
+ it "removes the existing content if cleanup is requested" do
+ expect { subject.addon_control_dir(src_id, cleanup: true) }.to change { File.exist?(path) }.from(true).to(false)
+ end
+
+ it "keeps the existing content if cleanup is not requested" do
+ expect { subject.addon_control_dir(src_id) }.to_not change { File.exist?(path) }
+ end
+ end
+
+ it "does not create the directory if it already exists" do
+ dir = subject.addon_control_dir(src_id)
+ expect(File.directory?(subject.addon_control_dir(src_id))).to be true
+ expect(FileUtils).to_not receive(:mkdir_p).with(dir)
+ subject.addon_control_dir(src_id)
+ end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/cwm/src/lib/cwm/widget.rb new/yast2-3.2.23/library/cwm/src/lib/cwm/widget.rb
--- old/yast2-3.2.19/library/cwm/src/lib/cwm/widget.rb 2017-03-20 15:26:45.033124529 +0100
+++ new/yast2-3.2.23/library/cwm/src/lib/cwm/widget.rb 2017-03-28 10:04:22.012733274 +0200
@@ -602,6 +602,12 @@
include ItemsSelection
abstract_method :label
+ # @!method vspacing
+ # @return [Fixnum] space between the options
+
+ # @!method hspacing
+ # @return [Fixnum] margin at both sides of the options list
+
def value
Yast::UI.QueryWidget(Id(widget_id), :CurrentButton)
end
@@ -609,6 +615,27 @@
def value=(val)
Yast::UI.ChangeWidget(Id(widget_id), :CurrentButton, val)
end
+
+ # See AbstractWidget#cwm_definition
+ # In addition to the base definition, this honors possible
+ # `vspacing` and `hspacing` methods
+ #
+ # @example defining additional space between the options
+ # def vspacing
+ # 1
+ # end
+ #
+ # @example defining some margin at both sides of the list of options
+ # def hspacing
+ # 3
+ # end
+ def cwm_definition
+ additional = {}
+ additional["vspacing"] = vspacing if respond_to?(:vspacing)
+ additional["hspacing"] = hspacing if respond_to?(:hspacing)
+
+ super.merge(additional)
+ end
end
# Widget representing button.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/cwm/test/widgets_test.rb new/yast2-3.2.23/library/cwm/test/widgets_test.rb
--- old/yast2-3.2.19/library/cwm/test/widgets_test.rb 2017-03-20 15:26:45.033124529 +0100
+++ new/yast2-3.2.23/library/cwm/test/widgets_test.rb 2017-03-28 10:04:22.016733274 +0200
@@ -214,6 +214,61 @@
end
end
+describe CWM::RadioButtons do
+
+ class TestRadioButtons < CWM::RadioButtons
+ def label
+ "Choose a number"
+ end
+
+ def items
+ [[:one, "One"], [:two, "Two"], [:three, "Three"]]
+ end
+ end
+
+ class TestSpacedRadioButtons < TestRadioButtons
+ def vspacing
+ 2
+ end
+
+ def hspacing
+ 3
+ end
+ end
+
+ describe "#cwm_definition" do
+ context "if #vspacing and #hspacing are not defined" do
+ subject { TestRadioButtons.new }
+
+ it "does not include the vspacing key" do
+ expect(subject.cwm_definition.keys).to_not include("vspacing")
+ end
+
+ it "does not include the hspacing key" do
+ expect(subject.cwm_definition.keys).to_not include("hspacing")
+ end
+ end
+
+ context "if #vspacing is defined" do
+ subject { TestSpacedRadioButtons.new }
+
+ it "sets vspacing based on the method result" do
+ expect(subject.cwm_definition.keys).to include("vspacing")
+ expect(subject.cwm_definition["vspacing"]).to eq 2
+ end
+ end
+
+ context "if #hspacing is defined" do
+ subject { TestSpacedRadioButtons.new }
+
+ it "sets hspacing based on the method result" do
+ expect(subject.cwm_definition.keys).to include("hspacing")
+ expect(subject.cwm_definition["hspacing"]).to eq 3
+ end
+ end
+ end
+end
+
describe CWM::ReplacePoint do
class ReplacePointTestWidget < CWM::InputField
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/packages/src/modules/SlideShow.rb new/yast2-3.2.23/library/packages/src/modules/SlideShow.rb
--- old/yast2-3.2.19/library/packages/src/modules/SlideShow.rb 2017-03-20 15:26:45.073124529 +0100
+++ new/yast2-3.2.23/library/packages/src/modules/SlideShow.rb 2017-03-28 10:04:22.196733274 +0200
@@ -568,7 +568,15 @@
# @return A term describing the widgets
#
def RelNotesPageWidgets(id)
- widgets = AddProgressWidgets(:relNotesPage, RichText(@_rn_tabs[id]))
+ # Release notes in plain text need to be escaped to be shown properly (bsc#1028721)
+ rel_notes =
+ if @_rn_tabs[id] =~ /<\/.*>/
+ @_rn_tabs[id]
+ else
+ "<pre>#{String.EscapeTags(@_rn_tabs[id])}</pre>"
+ end
+
+ widgets = AddProgressWidgets(:relNotesPage, RichText(rel_notes))
Builtins.y2debug("widget term: \n%1", widgets)
deep_copy(widgets)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/system/src/lib/yast2/execute.rb new/yast2-3.2.23/library/system/src/lib/yast2/execute.rb
--- old/yast2-3.2.19/library/system/src/lib/yast2/execute.rb 2017-03-20 15:26:45.085124529 +0100
+++ new/yast2-3.2.23/library/system/src/lib/yast2/execute.rb 2017-03-28 10:04:22.216733274 +0200
@@ -23,8 +23,6 @@
require "yast"
require "cheetah"
-Yast.import "Installation"
-
module Yast
# Module for executing scripts/programs in safe way. Uses cheetah as backend,
# but adds support for chrooting in installation.
@@ -39,8 +37,7 @@
# @see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run parameter docs
# @raise Cheetah::ExecutionFailed
def self.on_target(*args)
- root = "/"
- root = Yast::Installation.destdir if Yast::WFM.scr_chrooted?
+ root = Yast::WFM.scr_root
if args.last.is_a? ::Hash
args.last[:chroot] = root
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/system/src/lib/yast2/target_file.rb new/yast2-3.2.23/library/system/src/lib/yast2/target_file.rb
--- old/yast2-3.2.19/library/system/src/lib/yast2/target_file.rb 2017-03-20 15:26:45.089124529 +0100
+++ new/yast2-3.2.23/library/system/src/lib/yast2/target_file.rb 2017-03-28 10:04:22.216733274 +0200
@@ -24,8 +24,6 @@
require "cfa/base_model"
-Yast.import "Installation"
-
module Yast
# A file handler suitable for CFA::BaseModel (from config_files_api.gem)
# that respects Yast::Installation.destdir. When this class is `require`d,
@@ -42,8 +40,7 @@
end
def self.final_path(path)
- root = "/"
- root = Yast::Installation.destdir if Yast::WFM.scr_chrooted?
+ root = Yast::WFM.scr_root
::File.join(root, path)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/library/system/test/execute_test.rb new/yast2-3.2.23/library/system/test/execute_test.rb
--- old/yast2-3.2.19/library/system/test/execute_test.rb 2017-03-20 15:26:45.089124529 +0100
+++ new/yast2-3.2.23/library/system/test/execute_test.rb 2017-03-28 10:04:22.236733274 +0200
@@ -29,8 +29,7 @@
describe ".on_target" do
it "adds to passed arguments chroot option if scr chrooted" do
- Yast::Installation.destdir = "/mnt"
- allow(Yast::WFM).to receive(:scr_chrooted?).and_return(true)
+ allow(Yast::WFM).to receive(:scr_root).and_return("/mnt")
expect(Cheetah).to receive(:run).with("ls", "-a", chroot: "/mnt")
Yast::Execute.on_target("ls", "-a")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/package/yast2.changes new/yast2-3.2.23/package/yast2.changes
--- old/yast2-3.2.19/package/yast2.changes 2017-03-20 15:26:45.121124529 +0100
+++ new/yast2-3.2.23/package/yast2.changes 2017-03-28 10:04:22.320733274 +0200
@@ -1,4 +1,35 @@
-------------------------------------------------------------------
+Tue Mar 28 07:25:39 WEST 2017 - knut.anderssen(a)suse.com
+
+- SlideShow: Escape plain text release notes being shown properly
+ in RichText (bsc#1028721).
+- 3.2.23
+
+-------------------------------------------------------------------
+Fri Mar 24 09:37:44 UTC 2017 - lslezak(a)suse.cz
+
+- Download the addon installation.xml file from a package
+ referenced by the "installerextension" provides dependency
+ (FATE#320772)
+- 3.2.22
+
+-------------------------------------------------------------------
+
+Wed Mar 22 16:53:07 UTC 2017 - jreidinger(a)suse.com
+
+- Use for Yast::TargetFile and Yast::Execute real path where scr
+ operates. It allows easier switching scr in unit tests.
+ (needed for testing fix for bsc#1023204)
+- 3.2.21
+
+-------------------------------------------------------------------
+Wed Mar 22 15:37:51 UTC 2017 - ancor(a)suse.com
+
+- Added options to CWM::RadioButtons to set some extra spaces
+ (related to poo#14936 and bsc#1025415).
+- 3.2.20
+
+-------------------------------------------------------------------
Mon Mar 20 10:11:52 UTC 2017 - lslezak(a)suse.cz
- Added PackageDownloader and PackageExtractor classes for sharing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.19/package/yast2.spec new/yast2-3.2.23/package/yast2.spec
--- old/yast2-3.2.19/package/yast2.spec 2017-03-20 15:26:45.121124529 +0100
+++ new/yast2-3.2.23/package/yast2.spec 2017-03-28 10:04:22.320733274 +0200
@@ -17,7 +17,7 @@
Name: yast2
-Version: 3.2.19
+Version: 3.2.23
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0
@@ -43,8 +43,8 @@
BuildRequires: yast2-core >= 2.18.12
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: yast2-pkg-bindings >= 2.20.3
-# To have Yast::CoreExt::AnsiString
-BuildRequires: yast2-ruby-bindings >= 3.1.36
+# To have Yast::WFM.scr_root
+BuildRequires: yast2-ruby-bindings >= 3.2.8
BuildRequires: yast2-testsuite
BuildRequires: yast2-ycp-ui-bindings >= 3.1.8
# for the PackageExtractor tests, just make sure they are present,
@@ -76,7 +76,7 @@
Requires: yast2-perl-bindings
# changed StartPackage callback signature
Requires: yast2-pkg-bindings >= 2.20.3
-Requires: yast2-ruby-bindings >= 3.1.33
+Requires: yast2-ruby-bindings >= 3.2.8
Requires: yast2-xml
# new UI::SetApplicationIcon
Requires: yast2-ycp-ui-bindings >= 3.1.8
1
0
Hello community,
here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at 2017-03-29 13:22:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old)
and /work/SRC/openSUSE:Factory/.yast2-bootloader.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-bootloader"
Wed Mar 29 13:22:57 2017 rev:244 rq:482535 version:3.2.18
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes 2017-02-04 16:52:24.598274559 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes 2017-03-29 13:23:03.241328627 +0200
@@ -1,0 +2,23 @@
+Fri Mar 24 14:17:00 UTC 2017 - jreidinger(a)suse.com
+
+- Report user friendly message when no root partition is detected
+ instead of internal error. (bsc#1029293)
+- 3.2.18
+
+-------------------------------------------------------------------
+Wed Mar 1 17:42:18 UTC 2017 - jreidinger(a)suse.com
+
+- provide more helpful error message when invalid arguments for
+ serial console are provided (bsc#1012383)
+- 3.2.17
+
+-------------------------------------------------------------------
+Wed Mar 1 16:42:18 UTC 2017 - jreidinger(a)suse.com
+
+- propose for xen hypervisor vga parameter if framebuffer is used
+ ( should fix issue with text only environment when fbdev driver
+ is used )
+ (FATE#322200)
+- 3.2.16
+
+-------------------------------------------------------------------
Old:
----
yast2-bootloader-3.2.15.tar.bz2
New:
----
yast2-bootloader-3.2.18.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.1dePso/_old 2017-03-29 13:23:05.477012447 +0200
+++ /var/tmp/diff_new_pack.1dePso/_new 2017-03-29 13:23:05.477012447 +0200
@@ -17,7 +17,7 @@
Name: yast2-bootloader
-Version: 3.2.15
+Version: 3.2.18
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-bootloader-3.2.15.tar.bz2 -> yast2-bootloader-3.2.18.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/package/yast2-bootloader.changes new/yast2-bootloader-3.2.18/package/yast2-bootloader.changes
--- old/yast2-bootloader-3.2.15/package/yast2-bootloader.changes 2017-01-30 16:16:35.911538944 +0100
+++ new/yast2-bootloader-3.2.18/package/yast2-bootloader.changes 2017-03-24 16:41:55.807983895 +0100
@@ -1,4 +1,27 @@
-------------------------------------------------------------------
+Fri Mar 24 14:17:00 UTC 2017 - jreidinger(a)suse.com
+
+- Report user friendly message when no root partition is detected
+ instead of internal error. (bsc#1029293)
+- 3.2.18
+
+-------------------------------------------------------------------
+Wed Mar 1 17:42:18 UTC 2017 - jreidinger(a)suse.com
+
+- provide more helpful error message when invalid arguments for
+ serial console are provided (bsc#1012383)
+- 3.2.17
+
+-------------------------------------------------------------------
+Wed Mar 1 16:42:18 UTC 2017 - jreidinger(a)suse.com
+
+- propose for xen hypervisor vga parameter if framebuffer is used
+ ( should fix issue with text only environment when fbdev driver
+ is used )
+ (FATE#322200)
+- 3.2.16
+
+-------------------------------------------------------------------
Wed Jan 25 12:57:38 UTC 2017 - mvidner(a)suse.com
- Implement simple_mode -> label_proposal (FATE#322328)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/package/yast2-bootloader.spec new/yast2-bootloader-3.2.18/package/yast2-bootloader.spec
--- old/yast2-bootloader-3.2.15/package/yast2-bootloader.spec 2017-01-30 16:16:35.911538944 +0100
+++ new/yast2-bootloader-3.2.18/package/yast2-bootloader.spec 2017-03-24 16:41:55.807983895 +0100
@@ -17,7 +17,7 @@
Name: yast2-bootloader
-Version: 3.2.15
+Version: 3.2.18
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/src/lib/bootloader/exceptions.rb new/yast2-bootloader-3.2.18/src/lib/bootloader/exceptions.rb
--- old/yast2-bootloader-3.2.15/src/lib/bootloader/exceptions.rb 2017-01-30 16:16:36.043538944 +0100
+++ new/yast2-bootloader-3.2.18/src/lib/bootloader/exceptions.rb 2017-03-24 16:41:55.811983895 +0100
@@ -25,4 +25,15 @@
"Please use YaST2 bootloader to fix it. Details: %s") % msg
end
end
+
+ # Represents error when serial console arguments are not valid
+ class InvalidSerialConsoleArguments < BrokenConfiguration
+ MESSAGE = "Invalid serial console arguments".freeze
+ def initialize(msg = MESSAGE)
+ super
+ end
+ end
+
+ class NoRoot < RuntimeError
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/src/lib/bootloader/grub2_widgets.rb new/yast2-bootloader-3.2.18/src/lib/bootloader/grub2_widgets.rb
--- old/yast2-bootloader-3.2.15/src/lib/bootloader/grub2_widgets.rb 2017-01-30 16:16:36.071538944 +0100
+++ new/yast2-bootloader-3.2.18/src/lib/bootloader/grub2_widgets.rb 2017-03-24 16:41:55.811983895 +0100
@@ -2,6 +2,7 @@
require "bootloader/generic_widgets"
require "bootloader/device_map_dialog"
+require "bootloader/serial_console"
require "cfa/matcher"
Yast.import "BootStorage"
@@ -460,6 +461,22 @@
)
end
+ def help
+ # Translators: do not translate the quoted parts like "unit"
+ _(
+ "<p>When a graphical console is used it allows to use various " \
+ "display resolutions. The <tt>auto</tt> option tries to find " \
+ "the best one when booting starts.</p>\n" \
+ "<p>When a serial console is used the boot output " \
+ "will be printed to a serial device like <tt>ttyS0</tt>. " \
+ "At least the <tt>--unit</tt> option has to be specified, " \
+ "and the complete syntax is <tt>%s</tt>. " \
+ "Other parts are optional and if not set, a default is used. " \
+ "<tt>NUM</tt> in commands stands for a positive number like 8. " \
+ "Example parameters are <tt>serial --speed=38400 --unit=0</tt>.</p>"
+ ) % syntax
+ end
+
def init
enable = grub_default.terminal == :serial
Yast::UI.ChangeWidget(Id(:console_frame), :Value, enable)
@@ -488,6 +505,14 @@
Yast::UI.SetFocus(Id(:console_args))
return false
end
+ if ::Bootloader::SerialConsole.load_from_console_args(console_value).nil?
+ # Translators: do not translate "unit"
+ msg = _("To enable the serial console you must provide the corresponding arguments.\n" \
+ "The \"unit\" argument is required, the complete syntax is:\n%s") % syntax
+ Yast::Report.Error(msg)
+ Yast::UI.SetFocus(Id(:console_args))
+ return false
+ end
end
true
end
@@ -533,6 +558,16 @@
private
+ # Explanation for help and error messages
+ def syntax
+ # Translators: NUM is an abbreviation for "number",
+ # to be substituted in a command like
+ # "serial --unit=NUM --speed=NUM --parity={odd|even|no} --word=NUM --stop=NUM"
+ # so do not use punctuation
+ n = _("NUM")
+ "serial --unit=#{n} --speed=#{n} --parity={odd|even|no} --word=#{n} --stop=#{n}"
+ end
+
def graphical_console_frame
CheckBoxFrame(
Id(:gfxterm_frame),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/src/lib/bootloader/grub2base.rb new/yast2-bootloader-3.2.18/src/lib/bootloader/grub2base.rb
--- old/yast2-bootloader-3.2.15/src/lib/bootloader/grub2base.rb 2017-01-30 16:16:36.071538944 +0100
+++ new/yast2-bootloader-3.2.18/src/lib/bootloader/grub2base.rb 2017-03-24 16:41:55.811983895 +0100
@@ -3,6 +3,7 @@
require "yast2/execute"
require "yast2/target_file" # adds ability to work with cfa in inst-sys
require "bootloader/bootloader_base"
+require "bootloader/exceptions"
require "bootloader/sections"
require "bootloader/grub2pwd"
require "bootloader/udev_mapping"
@@ -119,6 +120,7 @@
grub_default.generic_set("SUSE_BTRFS_SNAPSHOT_BOOTING", "true")
propose_serial
+ propose_xen_hypervisor
nil
end
@@ -134,7 +136,7 @@
def enable_serial_console(console)
console = SerialConsole.load_from_console_args(console)
- raise "Invalid console parameters" unless console
+ raise ::Bootloader::InvalidSerialConsoleArguments unless console
grub_default.serial_console = console.console_args
@@ -269,6 +271,14 @@
grub_default.serial_console = console.console_args
end
+ def propose_xen_hypervisor
+ return if Dir["/dev/fb*"].empty?
+
+ matcher = CFA::Matcher.new(key: "vga")
+ placer = CFA::ReplacePlacer.new(matcher)
+ grub_default.xen_hypervisor_params.add_parameter("vga", "gfx-1024x768x16", placer)
+ end
+
def propose_resume
swap_parts = Yast::BootStorage.available_swap_partitions
largest_swap_part = (swap_parts.max_by { |_part, size| size } || [""]).first
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/src/lib/bootloader/proposal_client.rb new/yast2-bootloader-3.2.18/src/lib/bootloader/proposal_client.rb
--- old/yast2-bootloader-3.2.15/src/lib/bootloader/proposal_client.rb 2017-01-30 16:16:36.107538944 +0100
+++ new/yast2-bootloader-3.2.18/src/lib/bootloader/proposal_client.rb 2017-03-24 16:41:55.811983895 +0100
@@ -1,4 +1,5 @@
require "installation/proposal_client"
+require "bootloader/exceptions"
require "bootloader/main_dialog"
require "bootloader/bootloader_factory"
@@ -62,6 +63,12 @@
Yast::PackagesProposal.AddResolvables("yast2-bootloader", :package, bl.packages)
construct_proposal_map
+ rescue ::Bootloader::NoRoot
+ {
+ "label_proposal" => [],
+ "warning_level" => :fatal,
+ "warning" => _("Cannot detect device mounted as root. Please check partitioning.")
+ }
end
def ask_user(param)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/src/modules/BootStorage.rb new/yast2-bootloader-3.2.18/src/modules/BootStorage.rb
--- old/yast2-bootloader-3.2.15/src/modules/BootStorage.rb 2017-01-30 16:16:36.183538944 +0100
+++ new/yast2-bootloader-3.2.18/src/modules/BootStorage.rb 2017-03-24 16:41:55.815983895 +0100
@@ -19,6 +19,7 @@
#
require "yast"
require "bootloader/udev_mapping"
+require "bootloader/exceptions"
module Yast
class BootStorageClass < Module
@@ -199,7 +200,7 @@
log.info "mountdata_boot #{mountdata_boot}"
@RootPartitionDevice = mountdata_root ? mountdata_root.first || "" : ""
- raise "No mountpoint for / !!" if @RootPartitionDevice.empty?
+ raise ::Bootloader::NoRoot, "Missing '/' mount point" if @RootPartitionDevice.empty?
# if /boot changed, re-configure location
@BootPartitionDevice = mountdata_boot.first
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/test/boot_storage_test.rb new/yast2-bootloader-3.2.18/test/boot_storage_test.rb
--- old/yast2-bootloader-3.2.15/test/boot_storage_test.rb 2017-01-30 16:16:36.219538944 +0100
+++ new/yast2-bootloader-3.2.18/test/boot_storage_test.rb 2017-03-24 16:41:55.815983895 +0100
@@ -79,7 +79,7 @@
it "raises exception if there is no mount point for root" do
allow(Yast::Storage).to receive(:GetMountPoints).and_return({})
- expect { subject.detect_disks }.to raise_error(RuntimeError)
+ expect { subject.detect_disks }.to raise_error(::Bootloader::NoRoot)
end
it "sets BootStorage.mbr_disk" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/test/grub2_widgets_test.rb new/yast2-bootloader-3.2.18/test/grub2_widgets_test.rb
--- old/yast2-bootloader-3.2.15/test/grub2_widgets_test.rb 2017-01-30 16:16:36.319538944 +0100
+++ new/yast2-bootloader-3.2.18/test/grub2_widgets_test.rb 2017-03-24 16:41:55.823983895 +0100
@@ -483,7 +483,7 @@
it "is valid if serial console arguments are provided" do
stub_widget_value(:console_frame, true)
- stub_widget_value(:console_args, "console=ttyS0,9600n8")
+ stub_widget_value(:console_args, "serial --unit=0 --speed=9600 --parity=no --stop=8")
expect(subject.validate).to eq true
end
@@ -496,6 +496,16 @@
expect(Yast::UI).to receive(:SetFocus).with(Id(:console_args))
expect(subject.validate).to eq false
end
+
+ it "reports an error if serial console is not correct" do
+ stub_widget_value(:console_frame, true)
+ stub_widget_value(:console_args, "serial --speed=5")
+
+ expect(Yast::Report).to receive(:Error)
+ expect(Yast::UI).to receive(:SetFocus).with(Id(:console_args))
+ expect(subject.validate).to eq false
+ end
+
end
context "initialization" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.2.15/test/grub2base_test.rb new/yast2-bootloader-3.2.18/test/grub2base_test.rb
--- old/yast2-bootloader-3.2.15/test/grub2base_test.rb 2017-01-30 16:16:36.331538944 +0100
+++ new/yast2-bootloader-3.2.18/test/grub2base_test.rb 2017-03-24 16:41:55.823983895 +0100
@@ -310,6 +310,24 @@
end
end
+ context "xen hyperviser kernel parameters proposal" do
+ it "do nothing if there is no framebuffer" do
+ allow(Dir).to receive(:[]).and_return([])
+
+ subject.propose
+
+ expect(subject.grub_default.xen_hypervisor_params.parameter("vga")).to eq false
+ end
+
+ it "propose vga parameter if there is framebuffer" do
+ allow(Dir).to receive(:[]).and_return(["/dev/fb0"])
+
+ subject.propose
+
+ expect(subject.grub_default.xen_hypervisor_params.parameter("vga")).to eq "gfx-1024x768x16"
+ end
+ end
+
it "proposes gfx mode to auto" do
subject.propose
1
0
Hello community,
here is the log from the commit of package yast2-country for openSUSE:Factory checked in at 2017-03-29 13:22:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-country (Old)
and /work/SRC/openSUSE:Factory/.yast2-country.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-country"
Wed Mar 29 13:22:52 2017 rev:181 rq:482442 version:3.2.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-country/yast2-country.changes 2017-03-10 20:39:53.439137092 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-country.new/yast2-country.changes 2017-03-29 13:22:53.502705908 +0200
@@ -1,0 +2,8 @@
+Thu Mar 23 18:45:42 UTC 2017 - igonzalezsosa(a)suse.com
+
+- Fix GetLocaleString to use the given locale instead of
+ Language.language
+- Fix build problems (bsc#1030745)
+- 3.2.11
+
+-------------------------------------------------------------------
Old:
----
yast2-country-3.2.10.tar.bz2
New:
----
yast2-country-3.2.11.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-country.spec ++++++
--- /var/tmp/diff_new_pack.VFgeBp/_old 2017-03-29 13:22:54.758528303 +0200
+++ /var/tmp/diff_new_pack.VFgeBp/_new 2017-03-29 13:22:54.762527738 +0200
@@ -17,7 +17,7 @@
Name: yast2-country
-Version: 3.2.10
+Version: 3.2.11
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-country-3.2.10.tar.bz2 -> yast2-country-3.2.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/console/Makefile.am new/yast2-country-3.2.11/console/Makefile.am
--- old/yast2-country-3.2.10/console/Makefile.am 2017-03-03 12:02:48.752000000 +0100
+++ new/yast2-country-3.2.11/console/Makefile.am 2017-03-24 10:23:53.399701869 +0100
@@ -1,3 +1,3 @@
#
# Makefile.am for country/console
-SUBDIRS = src
+SUBDIRS = src test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/console/test/Makefile.am new/yast2-country-3.2.11/console/test/Makefile.am
--- old/yast2-country-3.2.10/console/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-country-3.2.11/console/test/Makefile.am 2017-03-24 10:23:53.399701869 +0100
@@ -0,0 +1,12 @@
+#
+# Makefile.am for console/test
+#
+
+TESTS = \
+ console_test.rb
+
+TEST_EXTENSIONS = .rb
+RB_LOG_COMPILER = rspec
+VERBOSE = 1
+EXTRA_DIST = $(TESTS)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/console/test/console_test.rb new/yast2-country-3.2.11/console/test/console_test.rb
--- old/yast2-country-3.2.10/console/test/console_test.rb 2017-03-03 12:02:48.756000000 +0100
+++ new/yast2-country-3.2.11/console/test/console_test.rb 2017-03-24 10:23:53.399701869 +0100
@@ -12,7 +12,7 @@
describe "#SelectFont" do
let(:braille) { false }
let(:full_language) { "es_ES.UTF-8" }
- let(:language) { "es" }
+ let(:language) { "es_ES" }
let(:os_release_id) { "sles" }
before do
@@ -22,12 +22,12 @@
it "sets console fonts for the given language" do
expect(Yast::UI).to receive(:SetConsoleFont)
- .with("(K", "lat9w-16.psfu", "trivial", "", "es")
+ .with("(K", "lat9w-16.psfu", "trivial", "", "es_ES")
console.SelectFont(language)
end
it "returns the encoding" do
- expect(console.SelectFont(language)).to eq("UTF-8")
+ expect(console.SelectFont(language)).to eq("ISO-8859-1")
end
context "when no console font is available" do
@@ -37,7 +37,7 @@
end
it "returns the encoding" do
- expect(console.SelectFont(language)).to eq("UTF-8")
+ expect(console.SelectFont(language)).to eq("ISO-8859-1")
end
end
@@ -46,7 +46,7 @@
it "sets console fonts for the given language" do
expect(Yast::UI).to receive(:SetConsoleFont)
- .with("", "eurlatgr.psfu", "none", "", "es")
+ .with("", "eurlatgr.psfu", "none", "", "es_ES")
console.SelectFont(language)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/language/src/modules/Language.rb new/yast2-country-3.2.11/language/src/modules/Language.rb
--- old/yast2-country-3.2.10/language/src/modules/Language.rb 2017-03-03 12:02:48.868000000 +0100
+++ new/yast2-country-3.2.11/language/src/modules/Language.rb 2017-03-24 10:23:53.539701869 +0100
@@ -530,12 +530,8 @@
end
# full language code
- val = @language
- if @use_utf8
- val = Ops.add(val, Ops.get_string(language_info, 2, ""))
- else
- val = Ops.add(val, Ops.get_string(language_info, 3, ""))
- end
+ idx = @use_utf8 ? 2 : 3
+ val = lang + (language_info[idx] || "")
Builtins.y2milestone("locale %1", val)
val
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/language/test/Language_test.rb new/yast2-country-3.2.11/language/test/Language_test.rb
--- old/yast2-country-3.2.10/language/test/Language_test.rb 2017-03-03 12:02:48.876000000 +0100
+++ new/yast2-country-3.2.11/language/test/Language_test.rb 2017-03-24 10:23:53.539701869 +0100
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# coding: utf-8
require_relative "test_helper"
@@ -160,4 +161,35 @@
end
end
+ describe "#GetLocaleString" do
+ context "when using UTF-8" do
+ it "returns the full locale" do
+ expect(subject.GetLocaleString("de_ZU")).to eq("de_ZU.UTF-8")
+ end
+
+ context "and the language is not found in the database" do
+ it "returns the full locale" do
+ expect(subject.GetLocaleString("ma_MA")).to eq("ma_MA.UTF-8")
+ end
+ end
+ end
+
+ context "and the suffix '@' is already include in the given locale" do
+ it "returns the same locale" do
+ expect(subject.GetLocaleString("es_ES@euro")).to eq("es_ES@euro")
+ end
+ end
+
+ context "when UTF-8 is not being used" do
+ around do |example|
+ subject.SetExpertValues("use_utf8" => false) # disable UTF-8
+ example.run
+ subject.SetExpertValues("use_utf8" => true) # restore to the default value
+ end
+
+ it "returns the full language identifier with no encoding" do
+ expect(subject.GetLocaleString("ma_MA")).to eq("ma_MA")
+ end
+ end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/package/yast2-country.changes new/yast2-country-3.2.11/package/yast2-country.changes
--- old/yast2-country-3.2.10/package/yast2-country.changes 2017-03-03 12:02:48.880000000 +0100
+++ new/yast2-country-3.2.11/package/yast2-country.changes 2017-03-24 10:23:53.555701869 +0100
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Mar 23 18:45:42 UTC 2017 - igonzalezsosa(a)suse.com
+
+- Fix GetLocaleString to use the given locale instead of
+ Language.language
+- Fix build problems (bsc#1030745)
+- 3.2.11
+
+-------------------------------------------------------------------
Thu Mar 2 12:24:03 UTC 2017 - kanderssen(a)suse.com
merge CASP changes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.2.10/package/yast2-country.spec new/yast2-country-3.2.11/package/yast2-country.spec
--- old/yast2-country-3.2.10/package/yast2-country.spec 2017-03-03 12:02:48.880000000 +0100
+++ new/yast2-country-3.2.11/package/yast2-country.spec 2017-03-24 10:23:53.555701869 +0100
@@ -17,7 +17,7 @@
Name: yast2-country
-Version: 3.2.10
+Version: 3.2.11
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
1
0
Hello community,
here is the log from the commit of package yast2-ntp-client for openSUSE:Factory checked in at 2017-03-29 13:22:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ntp-client (Old)
and /work/SRC/openSUSE:Factory/.yast2-ntp-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ntp-client"
Wed Mar 29 13:22:38 2017 rev:93 rq:482428 version:3.2.6
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ntp-client/yast2-ntp-client.changes 2017-02-03 20:07:49.655388997 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-ntp-client.new/yast2-ntp-client.changes 2017-03-29 13:22:47.335578090 +0200
@@ -1,0 +2,6 @@
+Tue Mar 21 14:48:29 UTC 2017 - jreidinger(a)suse.com
+
+- Adapt to new version of rubygem-cfa ( updated for bsc#1023204)
+- 3.2.6
+
+-------------------------------------------------------------------
@@ -25 +31 @@
- lense (bsc#983486).
+ lens (bsc#983486).
Old:
----
yast2-ntp-client-3.2.5.tar.bz2
New:
----
yast2-ntp-client-3.2.6.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ntp-client.spec ++++++
--- /var/tmp/diff_new_pack.lbbft5/_old 2017-03-29 13:22:49.915213266 +0200
+++ /var/tmp/diff_new_pack.lbbft5/_new 2017-03-29 13:22:49.915213266 +0200
@@ -17,7 +17,7 @@
Name: yast2-ntp-client
-Version: 3.2.5
+Version: 3.2.6
Release: 0
Summary: YaST2 - NTP Client Configuration
License: GPL-2.0+
@@ -28,21 +28,19 @@
BuildRequires: autoyast2-installation
BuildRequires: perl-XML-Writer
BuildRequires: update-desktop-files
-BuildRequires: yast2 >= 3.1.11
+BuildRequires: yast2 >= 3.2.21
BuildRequires: yast2-country-data
BuildRequires: yast2-devtools >= 3.1.10
-BuildRequires: rubygem(%rb_default_ruby_abi:cfa) >= 0.4.2
+BuildRequires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
BuildRequires: rubygem(%rb_default_ruby_abi:rspec)
BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake)
-#SLPAPI.pm
-# Hostname::CurrentDomain
-# Wizard::SetDesktopTitleAndIcon
+# proper acting TargetFile when scr is switched
Requires: augeas-lenses
-Requires: yast2 >= 3.1.11
+Requires: yast2 >= 3.2.21
Requires: yast2-country-data
Requires: yast2-ruby-bindings >= 1.0.0
-Requires: rubygem(%rb_default_ruby_abi:cfa) >= 0.4.2
+Requires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
BuildArch: noarch
# New sntp command line syntax
Conflicts: ntp < 4.2.8
++++++ yast2-ntp-client-3.2.5.tar.bz2 -> yast2-ntp-client-3.2.6.tar.bz2 ++++++
++++ 2491 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package yast2-ruby-bindings for openSUSE:Factory checked in at 2017-03-29 13:22:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings"
Wed Mar 29 13:22:29 2017 rev:78 rq:482277 version:3.2.9
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes 2017-03-15 02:00:02.842433784 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new/yast2-ruby-bindings.changes 2017-03-29 13:22:32.465681052 +0200
@@ -1,0 +2,15 @@
+Wed Mar 22 14:45:50 UTC 2017 - jreidinger(a)suse.com
+
+- Use more friendly exception when an invalid Yast::Path is
+ constructed (one with a component starting or ending with
+ a dash; bsc#1028081)
+- 3.2.9
+
+-------------------------------------------------------------------
+Wed Mar 22 14:41:50 UTC 2017 - jreidinger(a)suse.com
+
+- add method Yast::WFM.scr_root to get scr changed root directory
+ (needed for testing fix for bsc#1023204)
+- 3.2.8
+
+-------------------------------------------------------------------
@@ -42 +56,0 @@
-
Old:
----
yast2-ruby-bindings-3.2.7.tar.bz2
New:
----
yast2-ruby-bindings-3.2.9.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.iRNG1z/_old 2017-03-29 13:22:33.477537951 +0200
+++ /var/tmp/diff_new_pack.iRNG1z/_new 2017-03-29 13:22:33.481537385 +0200
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 3.2.7
+Version: 3.2.9
Release: 0
Url: https://github.com/yast/yast-ruby-bindings
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-ruby-bindings-3.2.7.tar.bz2 -> yast2-ruby-bindings-3.2.9.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/package/yast2-ruby-bindings.changes new/yast2-ruby-bindings-3.2.9/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-3.2.7/package/yast2-ruby-bindings.changes 2017-03-14 17:47:00.112198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/package/yast2-ruby-bindings.changes 2017-03-23 15:46:15.160272844 +0100
@@ -1,4 +1,19 @@
-------------------------------------------------------------------
+Wed Mar 22 14:45:50 UTC 2017 - jreidinger(a)suse.com
+
+- Use more friendly exception when an invalid Yast::Path is
+ constructed (one with a component starting or ending with
+ a dash; bsc#1028081)
+- 3.2.9
+
+-------------------------------------------------------------------
+Wed Mar 22 14:41:50 UTC 2017 - jreidinger(a)suse.com
+
+- add method Yast::WFM.scr_root to get scr changed root directory
+ (needed for testing fix for bsc#1023204)
+- 3.2.8
+
+-------------------------------------------------------------------
Tue Mar 14 16:25:59 UTC 2017 - ancor(a)suse.com
- Use tmux instead of screen to run the Ncurses integration test
@@ -40,7 +55,6 @@
loading namespace to component system failed (bsc#932331)
- 3.2.4
-
-------------------------------------------------------------------
Thu Dec 15 16:29:13 UTC 2016 - igonzalezsosa(a)suse.com
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/package/yast2-ruby-bindings.spec new/yast2-ruby-bindings-3.2.9/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-3.2.7/package/yast2-ruby-bindings.spec 2017-03-14 17:47:00.112198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/package/yast2-ruby-bindings.spec 2017-03-23 15:46:15.160272844 +0100
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 3.2.7
+Version: 3.2.9
Url: https://github.com/yast/yast-ruby-bindings
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/src/ruby/yast/path.rb new/yast2-ruby-bindings-3.2.9/src/ruby/yast/path.rb
--- old/yast2-ruby-bindings-3.2.7/src/ruby/yast/path.rb 2017-03-14 17:47:00.120198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/src/ruby/yast/path.rb 2017-03-23 15:46:15.168272844 +0100
@@ -6,6 +6,9 @@
class Path
include Comparable
+ # @param value [String] string representation of path
+ # @raise RuntimeError if invalid path is passed. Invalid path is one where
+ # any element starts or ends with dash like ".-etc", ".etc-" or ".e.t-.c"
def initialize(value)
if !value.is_a?(::String)
raise ArgumentError, "Yast::Path constructor has to get ::String as " \
@@ -85,7 +88,7 @@
when :simple
if c == "."
state = :dot
- break if invalid_buffer?(buffer)
+ raise "Invalid path '#{value}'" if invalid_buffer?(buffer)
@components << modify_buffer(buffer)
buffer = ""
@@ -116,15 +119,13 @@
return if buffer.empty?
- return if invalid_buffer?(buffer)
+ raise "Invalid path '#{value}'" if invalid_buffer?(buffer)
@components << modify_buffer(buffer)
end
def invalid_buffer?(buffer)
if buffer.start_with?("-") || buffer.end_with?("-")
- Yast.y2error "Cannot have dash before or after dot '#{value}'"
- @components.clear
return true
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/src/ruby/yast/wfm.rb new/yast2-ruby-bindings-3.2.9/src/ruby/yast/wfm.rb
--- old/yast2-ruby-bindings-3.2.7/src/ruby/yast/wfm.rb 2017-03-14 17:47:00.120198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/src/ruby/yast/wfm.rb 2017-03-23 15:46:15.172272844 +0100
@@ -119,6 +119,20 @@
SCRGetName(SCRGetDefault()) != "scr"
end
+ # Returns root on which scr operates.
+ # @return [String] path e.g. "/" when scr not switched
+ # or "/mnt" when installation was switched.
+ def self.scr_root
+ case SCRGetName(SCRGetDefault())
+ when "scr"
+ "/"
+ when /chroot=(.*):scr/
+ Regexp.last_match(1)
+ else
+ raise "invalid SCR instance #{SCRGetName(SCRGetDefault())}"
+ end
+ end
+
# Creates new SCR instance
#
# It is useful for installation where agents start operation on installed system
@@ -264,6 +278,5 @@
return false
end
end
-
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/tests/path_spec.rb new/yast2-ruby-bindings-3.2.9/tests/path_spec.rb
--- old/yast2-ruby-bindings-3.2.7/tests/path_spec.rb 2017-03-14 17:47:00.136198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/tests/path_spec.rb 2017-03-23 15:46:15.176272844 +0100
@@ -10,15 +10,25 @@
it "works for simple paths" do
expect(Yast::Path.new(".etc").to_s).to eq(".etc")
end
+
it "works for complex paths" do
expect(Yast::Path.new(".et?c").to_s).to eq('."et?c"')
end
+
+ it "raise RuntimeError if path is invalid" do
+ expect{Yast::Path.new(".-etc")}.to raise_error(RuntimeError)
+ end
+
+ it "raise ArgumentError if argument is not String" do
+ expect{Yast::Path.new(nil)}.to raise_error(ArgumentError)
+ end
end
describe ".from_string" do
it "works for simple paths" do
expect(Yast::Path.from_string("etc").to_s).to eq(".\"etc\"")
end
+
it "works for complex paths" do
expect(Yast::Path.from_string("et?c").to_s).to eq('."et?c"')
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/tests/scr_spec.rb new/yast2-ruby-bindings-3.2.9/tests/scr_spec.rb
--- old/yast2-ruby-bindings-3.2.7/tests/scr_spec.rb 2017-03-14 17:47:00.136198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/tests/scr_spec.rb 2017-03-23 15:46:15.176272844 +0100
@@ -16,7 +16,7 @@
end
it "raises exception if first is not String or Yast::Path" do
- expect{Yast::SCR.public_send(method, 1, *args)}.to raise_error(ArgumentError)
+ expect { Yast::SCR.public_send(method, 1, *args) }.to raise_error(ArgumentError)
end
it "passed path arguments with method name prepended to underlayer wrapper" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-3.2.7/tests/wfm_spec.rb new/yast2-ruby-bindings-3.2.9/tests/wfm_spec.rb
--- old/yast2-ruby-bindings-3.2.7/tests/wfm_spec.rb 2017-03-14 17:47:00.140198654 +0100
+++ new/yast2-ruby-bindings-3.2.9/tests/wfm_spec.rb 2017-03-23 15:46:15.180272844 +0100
@@ -59,5 +59,19 @@
WFM.SCRSetDefault(old_handle)
end
end
+
+ describe ".scr_root" do
+ it "returns root path of scr" do
+ expect(WFM.scr_root).to eq "/"
+
+ old_handle = WFM.SCRGetDefault
+ handle = WFM.SCROpen("chroot=/tmp:scr", false)
+ WFM.SCRSetDefault(handle)
+
+ expect(WFM.scr_root).to eq "/tmp"
+
+ WFM.SCRSetDefault(old_handle)
+ end
+ end
end
end
1
0
Hello community,
here is the log from the commit of package yast2-storage for openSUSE:Factory checked in at 2017-03-29 13:22:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-storage (Old)
and /work/SRC/openSUSE:Factory/.yast2-storage.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-storage"
Wed Mar 29 13:22:23 2017 rev:291 rq:482178 version:3.2.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-storage/yast2-storage.changes 2017-03-20 17:04:53.001514385 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-storage.new/yast2-storage.changes 2017-03-29 13:22:27.486385244 +0200
@@ -1,0 +2,15 @@
+Wed Mar 22 08:45:22 UTC 2017 - mfilka(a)suse.com
+
+- bnc#1026027
+ - dropped /etc/init.d/boot.crypto* invocations. Since these SysV
+ scripts were replaced by native systemd implementation already.
+- 3.2.11
+
+-------------------------------------------------------------------
+Mon Mar 20 09:12:25 UTC 2017 - mfilka(a)suse.com
+
+- bnc#1026027
+ - dropped calls to /sbin/insserv
+- 3.2.10
+
+-------------------------------------------------------------------
Old:
----
yast2-storage-3.2.9.tar.bz2
New:
----
yast2-storage-3.2.11.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-storage.spec ++++++
--- /var/tmp/diff_new_pack.oGIar3/_old 2017-03-29 13:22:28.162289654 +0200
+++ /var/tmp/diff_new_pack.oGIar3/_new 2017-03-29 13:22:28.162289654 +0200
@@ -17,7 +17,7 @@
Name: yast2-storage
-Version: 3.2.9
+Version: 3.2.11
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-storage-3.2.9.tar.bz2 -> yast2-storage-3.2.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.2.9/package/yast2-storage.changes new/yast2-storage-3.2.11/package/yast2-storage.changes
--- old/yast2-storage-3.2.9/package/yast2-storage.changes 2017-03-14 15:03:58.180625056 +0100
+++ new/yast2-storage-3.2.11/package/yast2-storage.changes 2017-03-23 10:55:36.734441739 +0100
@@ -1,4 +1,19 @@
-------------------------------------------------------------------
+Wed Mar 22 08:45:22 UTC 2017 - mfilka(a)suse.com
+
+- bnc#1026027
+ - dropped /etc/init.d/boot.crypto* invocations. Since these SysV
+ scripts were replaced by native systemd implementation already.
+- 3.2.11
+
+-------------------------------------------------------------------
+Mon Mar 20 09:12:25 UTC 2017 - mfilka(a)suse.com
+
+- bnc#1026027
+ - dropped calls to /sbin/insserv
+- 3.2.10
+
+-------------------------------------------------------------------
Tue Mar 14 10:24:01 CET 2017 - snwint(a)suse.de
- in simple_mode, block installation unless snapshots are enabled (bsc#1019652)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.2.9/package/yast2-storage.spec new/yast2-storage-3.2.11/package/yast2-storage.spec
--- old/yast2-storage-3.2.9/package/yast2-storage.spec 2017-03-14 15:03:58.180625056 +0100
+++ new/yast2-storage-3.2.11/package/yast2-storage.spec 2017-03-23 10:55:36.734441739 +0100
@@ -17,7 +17,7 @@
Name: yast2-storage
-Version: 3.2.9
+Version: 3.2.11
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.2.9/src/modules/Storage.rb new/yast2-storage-3.2.11/src/modules/Storage.rb
--- old/yast2-storage-3.2.9/src/modules/Storage.rb 2017-03-14 15:03:58.276625056 +0100
+++ new/yast2-storage-3.2.11/src/modules/Storage.rb 2017-03-23 10:55:36.758441739 +0100
@@ -6474,23 +6474,6 @@
deep_copy(ret)
end
-
- def CallInsserv(on, name)
- Builtins.y2milestone("CallInsserv on: %1 name: %2", on, name)
- scrname = Ops.add("/etc/init.d/", name)
- if Ops.greater_than(SCR.Read(path(".target.size"), scrname), 0)
- cmd = "cd / && /sbin/insserv "
- cmd = Ops.add(cmd, "-r ") if !on
- cmd = Ops.add(cmd, scrname)
- Builtins.y2milestone("CallInsserv cmd %1", cmd)
- bo = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
- Builtins.y2milestone("CallInsserv bo %1", bo)
- end
-
- nil
- end
-
-
def FinishInstall
Builtins.y2milestone("FinishInstall initial: %1", Stage.initial)
@@ -6531,8 +6514,6 @@
need_dmmultipath
)
- CallInsserv(need_md, "boot.md")
- CallInsserv(need_dmraid, "boot.dmraid")
Service.Enable("multipathd") if need_dmmultipath
Builtins.y2milestone("FinishInstall done")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-3.2.9/src/modules/StorageUpdate.rb new/yast2-storage-3.2.11/src/modules/StorageUpdate.rb
--- old/yast2-storage-3.2.9/src/modules/StorageUpdate.rb 2017-03-14 15:03:58.296625056 +0100
+++ new/yast2-storage-3.2.11/src/modules/StorageUpdate.rb 2017-03-23 10:55:36.762441739 +0100
@@ -728,24 +728,11 @@
Ops.get_integer(oldv, "minor", 0) == 0
UpdateFstabIseriesVd() if Arch.board_iseries
end
- if Ops.less_than(Ops.get_integer(oldv, "major", 0), 10) ||
- Ops.get_integer(oldv, "major", 0) == 10 &&
- Ops.less_or_equal(Ops.get_integer(oldv, "minor", 0), 2)
- cmd = "cd / && /sbin/insserv /etc/init.d/boot.crypto"
- bo = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
- Builtins.y2milestone("Update bo %1", bo)
-
- cmd = "cd / && /sbin/insserv /etc/init.d/boot.crypto-early"
- bo = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
- Builtins.y2milestone("Update bo %1", bo)
- end
if Ops.less_than(Ops.get_integer(oldv, "major", 0), 11) ||
Ops.get_integer(oldv, "major", 0) == 11 &&
Ops.less_or_equal(Ops.get_integer(oldv, "minor", 0), 2)
UpdateFstabCryptNofail()
end
- # if( oldv["major"]:0<=11 || (oldv["major"]:0==12 && oldv["minor"]:0<=1))
- # UpdateFstabWindowsMounts();
if Ops.less_than(Ops.get_integer(oldv, "major", 0), 13)
UpdateFstabRemoveSystemdMps()
end
1
0
Hello community,
here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2017-03-29 13:22:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-network (Old)
and /work/SRC/openSUSE:Factory/.yast2-network.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network"
Wed Mar 29 13:22:20 2017 rev:370 rq:481973 version:3.2.21
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2017-03-10 20:38:48.880285239 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2017-03-29 13:22:21.867179933 +0200
@@ -1,0 +2,6 @@
+Tue Mar 21 09:24:29 UTC 2017 - jreidinger(a)suse.com
+
+- adapt to new version of cfa (new cfa needed for bsc#1023204)
+- 3.2.21
+
+-------------------------------------------------------------------
Old:
----
yast2-network-3.2.20.tar.bz2
New:
----
yast2-network-3.2.21.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.ddvlQc/_old 2017-03-29 13:22:22.547083778 +0200
+++ /var/tmp/diff_new_pack.ddvlQc/_new 2017-03-29 13:22:22.547083778 +0200
@@ -17,7 +17,7 @@
Name: yast2-network
-Version: 3.2.20
+Version: 3.2.21
Release: 0
BuildArch: noarch
@@ -46,9 +46,9 @@
Requires: yast2-storage >= 2.21.11
# Packages::vnc_packages
Requires: yast2-packager >= 3.1.47
-# cfa for parsing hosts
-BuildRequires: rubygem(%rb_default_ruby_abi:cfa)
-Requires: rubygem(%rb_default_ruby_abi:cfa)
+# cfa for parsing hosts, AugeasTree#unique_id
+BuildRequires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
+Requires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
# lenses are needed to use cfa
BuildRequires: augeas-lenses
Requires: augeas-lenses
++++++ yast2-network-3.2.20.tar.bz2 -> yast2-network-3.2.21.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.20/package/yast2-network.changes new/yast2-network-3.2.21/package/yast2-network.changes
--- old/yast2-network-3.2.20/package/yast2-network.changes 2017-03-03 12:00:02.764000000 +0100
+++ new/yast2-network-3.2.21/package/yast2-network.changes 2017-03-22 13:09:17.716003918 +0100
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Mar 21 09:24:29 UTC 2017 - jreidinger(a)suse.com
+
+- adapt to new version of cfa (new cfa needed for bsc#1023204)
+- 3.2.21
+
+-------------------------------------------------------------------
Wed Feb 22 10:49:17 UTC 2017 - mfilka(a)suse.com
- bnc#1020074
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.20/package/yast2-network.spec new/yast2-network-3.2.21/package/yast2-network.spec
--- old/yast2-network-3.2.20/package/yast2-network.spec 2017-03-03 12:00:02.768000000 +0100
+++ new/yast2-network-3.2.21/package/yast2-network.spec 2017-03-22 13:09:17.716003918 +0100
@@ -17,7 +17,7 @@
Name: yast2-network
-Version: 3.2.20
+Version: 3.2.21
Release: 0
BuildArch: noarch
@@ -48,9 +48,9 @@
Requires: yast2-storage >= 2.21.11
# Packages::vnc_packages
Requires: yast2-packager >= 3.1.47
-# cfa for parsing hosts
-BuildRequires: rubygem(%rb_default_ruby_abi:cfa)
-Requires: rubygem(%rb_default_ruby_abi:cfa)
+# cfa for parsing hosts, AugeasTree#unique_id
+BuildRequires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
+Requires: rubygem(%rb_default_ruby_abi:cfa) >= 0.6.0
# lenses are needed to use cfa
BuildRequires: augeas-lenses
Requires: augeas-lenses
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.20/src/lib/cfa/hosts.rb new/yast2-network-3.2.21/src/lib/cfa/hosts.rb
--- old/yast2-network-3.2.20/src/lib/cfa/hosts.rb 2017-03-03 12:00:03.004000000 +0100
+++ new/yast2-network-3.2.21/src/lib/cfa/hosts.rb 2017-03-22 13:09:17.984003918 +0100
@@ -123,7 +123,7 @@
aliases.each do |a|
aliases_col.add(a)
end
- data.add(unique_id, entry_line)
+ data.add(data.unique_id, entry_line)
end
# Removes hostname from all entries in hosts table.
@@ -193,14 +193,5 @@
result.concat(aliases_for(entry))
result.join(" ")
end
-
- # helper to generate unique id for cfa entry
- def unique_id
- id = 1
- loop do
- return id.to_s unless data[id.to_s]
- id += 1
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.20/test/host_test.rb new/yast2-network-3.2.21/test/host_test.rb
--- old/yast2-network-3.2.20/test/host_test.rb 2017-03-03 12:00:03.136000000 +0100
+++ new/yast2-network-3.2.21/test/host_test.rb 2017-03-22 13:09:18.080003918 +0100
@@ -206,7 +206,7 @@
content = file.content
- expect(content.lines).to include("127.0.0.2 localmachine.domain.local localmachine\n")
+ expect(content.lines).to include("127.0.0.2\tlocalmachine.domain.local localmachine\n")
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.20/test/remote_test.rb new/yast2-network-3.2.21/test/remote_test.rb
--- old/yast2-network-3.2.20/test/remote_test.rb 2017-03-03 12:00:03.172000000 +0100
+++ new/yast2-network-3.2.21/test/remote_test.rb 2017-03-22 13:09:18.112003918 +0100
@@ -291,9 +291,12 @@
end
context "when remote adminitration is being disabled" do
- before(:each) do
+ before do
Remote.Disable()
allow(Service).to receive(:active?).with("xinetd").and_return(active_xinetd)
+ # do not call reload or stop
+ allow(Service).to receive(:Reload).and_return(true)
+ allow(Service).to receive(:Stop).and_return(true)
end
context "xinetd is active" do
1
0
Hello community,
here is the log from the commit of package rubygem-cfa for openSUSE:Factory checked in at 2017-03-29 13:22:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cfa (Old)
and /work/SRC/openSUSE:Factory/.rubygem-cfa.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-cfa"
Wed Mar 29 13:22:16 2017 rev:5 rq:481826 version:0.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cfa/rubygem-cfa.changes 2016-12-09 09:35:02.879490124 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-cfa.new/rubygem-cfa.changes 2017-03-29 13:22:17.559789099 +0200
@@ -1,0 +2,34 @@
+Tue Mar 21 09:15:39 UTC 2017 - jreidinger(a)suse.com
+
+- fix writting two new following nested trees ( also caused by fix
+ for bsc#1023204)
+- fix writing new element with same key as only existing key
+- fix writing new element with same key as removed element
+- add new method AugeasTree#unique_id that helps with writing new
+ entries for augeas sequences
+- 0.6.0
+
+-------------------------------------------------------------------
+Tue Mar 21 08:10:38 UTC 2017 - jreidinger(a)suse.com
+
+- fix AugeasTree#select to not return elements marked as deleted
+ (caused by fix for bsc#1023204)
+- 0.5.1
+
+-------------------------------------------------------------------
+Thu Mar 2 12:12:00 UTC 2017 - jreidinger(a)suse.com
+
+- allow generic set/get also on subtree (bsc#1023204)
+- do minimal changes when editing file, especially do not eat
+ white spaces if value is not modified (bsc#1023204)
+- AugeasTree#data now return frozen hash as it is just filtered
+ view of data, which cannot be modified
+- 0.5.0
+
+-------------------------------------------------------------------
+Mon Dec 5 15:38:36 UTC 2016 - joseivanlopez(a)gmail.com
+
+- fix regression when passing nil to AugeasTree#delete (bsc#983486)
+- 0.4.3
+
+-------------------------------------------------------------------
Old:
----
cfa-0.4.2.gem
New:
----
cfa-0.6.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-cfa.spec ++++++
--- /var/tmp/diff_new_pack.mkZUdV/_old 2017-03-29 13:22:18.175701995 +0200
+++ /var/tmp/diff_new_pack.mkZUdV/_new 2017-03-29 13:22:18.179701429 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-cfa
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: rubygem-cfa
-Version: 0.4.2
+Version: 0.6.0
Release: 0
%define mod_name cfa
%define mod_full_name %{mod_name}-%{version}
++++++ cfa-0.4.2.gem -> cfa-0.6.0.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/augeas_parser/keys_cache.rb new/lib/cfa/augeas_parser/keys_cache.rb
--- old/lib/cfa/augeas_parser/keys_cache.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/cfa/augeas_parser/keys_cache.rb 2017-03-21 16:50:58.000000000 +0100
@@ -0,0 +1,41 @@
+module CFA
+ # A cache that holds all avaiable keys in an Augeas tree. It is used to
+ # prevent too many `aug.match` calls which are expensive.
+ class AugeasKeysCache
+ # initialize cache from passed Augeas object
+ # @param aug [::Augeas]
+ # @param prefix [String] Augeas path for which cache should be created
+ def initialize(aug, prefix)
+ fill_cache(aug, prefix)
+ end
+
+ # @return list of keys available on given prefix
+ def keys_for_prefix(prefix)
+ @cache[prefix] || []
+ end
+
+ private
+
+ def fill_cache(aug, prefix)
+ @cache = {}
+ search_path = "#{prefix}/*"
+ loop do
+ matches = aug.match(search_path)
+ break if matches.empty?
+ assign_matches(matches, @cache)
+
+ search_path += "/*"
+ end
+ end
+
+ def assign_matches(matches, cache)
+ matches.each do |match|
+ split_index = match.rindex("/")
+ prefix = match[0..(split_index - 1)]
+ key = match[(split_index + 1)..-1]
+ cache[prefix] ||= []
+ cache[prefix] << key
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/augeas_parser/reader.rb new/lib/cfa/augeas_parser/reader.rb
--- old/lib/cfa/augeas_parser/reader.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/cfa/augeas_parser/reader.rb 2017-03-21 16:50:58.000000000 +0100
@@ -0,0 +1,67 @@
+require "cfa/augeas_parser/keys_cache"
+require "cfa/augeas_parser"
+
+module CFA
+ # A class responsible for reading {AugeasTree} from Augeas
+ class AugeasReader
+ class << self
+ # Creates *tree* from *prefix* in *aug*.
+ # @param aug [::Augeas]
+ # @param prefix [String] Augeas path prefix
+ # @return [AugeasTree]
+ def read(aug, prefix)
+ keys_cache = AugeasKeysCache.new(aug, prefix)
+
+ tree = AugeasTree.new
+ load_tree(aug, prefix, tree, keys_cache)
+
+ tree
+ end
+
+ private
+
+ # fills *tree* with data
+ def load_tree(aug, prefix, tree, keys_cache)
+ data = keys_cache.keys_for_prefix(prefix).map do |key|
+ aug_key = prefix + "/" + key
+ {
+ key: load_key(prefix, aug_key),
+ value: load_value(aug, aug_key, keys_cache),
+ orig_key: stripped_path(prefix, aug_key),
+ operation: :keep
+ }
+ end
+
+ tree.all_data.concat(data)
+ end
+
+ # loads a key in a format that AugeasTree expects
+ def load_key(prefix, aug_key)
+ # clean from key prefix and for collection remove number inside []
+ key = stripped_path(prefix, aug_key)
+ key.end_with?("]") ? key.sub(/\[\d+\]$/, "[]") : key
+ end
+
+ # path without prefix we are not interested in
+ def stripped_path(prefix, aug_key)
+ # +1 for size due to ending '/' not part of prefix
+ aug_key[(prefix.size + 1)..-1]
+ end
+
+ # loads value from auges. If value have tree under, it will also read it
+ def load_value(aug, aug_key, keys_cache)
+ subkeys = keys_cache.keys_for_prefix(aug_key)
+
+ nested = !subkeys.empty?
+ value = aug.get(aug_key)
+ if nested
+ subtree = AugeasTree.new
+ load_tree(aug, aug_key, subtree, keys_cache)
+ value ? AugeasTreeValue.new(subtree, value) : subtree
+ else
+ value
+ end
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/augeas_parser/writer.rb new/lib/cfa/augeas_parser/writer.rb
--- old/lib/cfa/augeas_parser/writer.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/cfa/augeas_parser/writer.rb 2017-03-21 16:50:58.000000000 +0100
@@ -0,0 +1,356 @@
+module CFA
+ # The goal of this class is to write the data stored in {AugeasTree}
+ # back to Augeas.
+ #
+ # It tries to make only the needed changes, as internally Augeas keeps
+ # a flag whether data has been modified,
+ # and keeps the unmodified parts of the file untouched.
+ #
+ # @note internal only, unstable API
+ # @api private
+ class AugeasWriter
+ # @param aug result of Augeas.create
+ def initialize(aug)
+ @aug = aug
+ end
+
+ # Writes the data in *tree* to a given *prefix* in Augeas
+ # @param prefix [String] where to write *tree* in Augeas
+ # @param tree [CFA::AugeasTree] tree to write
+ def write(prefix, tree, top_level: true)
+ @lazy_operations = LazyOperations.new(aug) if top_level
+ tree.all_data.each do |entry|
+ located_entry = LocatedEntry.new(tree, entry, prefix)
+ process_operation(located_entry)
+ end
+ @lazy_operations.run if top_level
+ end
+
+ private
+
+ # {AugeasElement} together with information about its location and a few
+ # helper methods to detect siblings.
+ #
+ # @example data for an already existing comment living under /main
+ # entry.orig_key # => "#comment[15]"
+ # entry.path # => "/main/#comment[15]"
+ # entry.key # => "#comment"
+ # entry.entry_tree # => AugeasTree.new
+ # entry.entry_value # => "old boring comment"
+ #
+ # @example data for a new comment under /main
+ # entry.orig_key # => nil
+ # entry.path # => nil
+ # entry.key # => "#comment"
+ # entry.entry_tree # => AugeasTree.new
+ # entry.entry_value # => "new boring comment"
+ #
+ # @example data for new tree placed at /main
+ # entry.orig_key # => "main"
+ # entry.path # => "/main"
+ # entry.key # => "main"
+ # entry.entry_tree # => entry[:value]
+ # entry.entry_value # => nil
+ #
+ class LocatedEntry
+ attr_reader :prefix
+ attr_reader :entry
+ attr_reader :tree
+
+ def initialize(tree, entry, prefix)
+ @tree = tree
+ @entry = entry
+ @prefix = prefix
+ detect_tree_value_modification
+ end
+
+ def orig_key
+ entry[:orig_key]
+ end
+
+ def path
+ return @path if @path
+ return nil unless orig_key
+
+ @path = @prefix + "/" + orig_key
+ end
+
+ def key
+ return @key if @key
+
+ @key = @entry[:key]
+ @key = @key[0..-3] if @key.end_with?("[]")
+ @key
+ end
+
+ # @return [LocatedEntry, nil]
+ # a preceding entry that already exists in the Augeas tree
+ # or nil if it does not exist.
+ def preceding_existing
+ preceding_entry = preceding_entries.reverse_each.find do |entry|
+ entry[:operation] != :add
+ end
+
+ return nil unless preceding_entry
+
+ LocatedEntry.new(tree, preceding_entry, prefix)
+ end
+
+ # @return [true, false] returns true if there is any following entry
+ # in the Augeas tree
+ def any_following?
+ following_entries.any? { |e| e[:operation] != :remove }
+ end
+
+ # @return [AugeasTree] the Augeas tree nested under this entry.
+ # If there is no such tree, it creates an empty one.
+ def entry_tree
+ value = entry[:value]
+ case value
+ when AugeasTree then value
+ when AugeasTreeValue then value.tree
+ else AugeasTree.new
+ end
+ end
+
+ # @return [String, nil] the Augeas value of this entry. Can be nil.
+ # If the value is an {AugeasTree} then return nil.
+ def entry_value
+ value = entry[:value]
+ case value
+ when AugeasTree then nil
+ when AugeasTreeValue then value.value
+ else value
+ end
+ end
+
+ private
+
+ # For {AugeasTreeValue} we have a problem with detection of
+ # value modification as it is enclosed in a diferent object.
+ # So propagate it to this entry here.
+ def detect_tree_value_modification
+ return unless entry[:value].is_a?(AugeasTreeValue)
+ return if entry[:operation] != :keep
+
+ entry[:operation] = entry[:value].modified? ? :modify : :keep
+ end
+
+ # the entries preceding this entry
+ def preceding_entries
+ return [] if index.zero? # first entry
+ tree.all_data[0..(index - 1)]
+ end
+
+ # the entries following this entry
+ def following_entries
+ tree.all_data[(index + 1)..-1]
+ end
+
+ # the index of this entry in its tree
+ def index
+ @index ||= tree.all_data.index(entry)
+ end
+ end
+
+ # Represents an operation that needs to be done after all modifications.
+ #
+ # The reason to have this class is that Augeas renumbers its arrays after
+ # some operations like `rm` or `insert` so previous paths are no longer
+ # valid. For this reason these sensitive operations that change paths need
+ # to be done at the end and with careful order.
+ # See https://www.redhat.com/archives/augeas-devel/2017-March/msg00002.html
+ #
+ # @note This class depends on ordered operations. So adding and removing
+ # entries has to be done in order how they are placed in tree.
+ class LazyOperations
+ # @param aug result of Augeas.create
+ def initialize(aug)
+ @aug = aug
+ @operations = []
+ end
+
+ def add(located_entry)
+ @operations << { type: :add, located_entry: located_entry }
+ end
+
+ def remove(located_entry)
+ @operations << { type: :remove, path: located_entry.path }
+ end
+
+ # starts all previously inserted operations
+ def run
+ # the reverse order is needed because if there are two operations
+ # one after another then the latter cannot affect the former
+ @operations.reverse_each do |operation|
+ case operation[:type]
+ when :remove then remove_entry(operation[:path])
+ when :add
+ located_entry = operation[:located_entry]
+ add_entry(located_entry)
+ else
+ raise "Invalid lazy operation #{operation.inspect}"
+ end
+ end
+ end
+
+ private
+
+ attr_reader :aug
+
+ # Removes entry from tree. If *path* does not exist, then tries if it
+ # has changed to a collection:
+ # If we remove and re-add a single key then because of the laziness
+ # Augeas will first see the addition, making a 2 member collection,
+ # so we need to remove "key[1]" instead of "key".
+ # @param path [String] original path name to remove
+ def remove_entry(path)
+ aug.rm(path_to_remove(path))
+ end
+
+ # Finds path to remove, as path can be meanwhile renumbered, see
+ # #remove_entry
+ def path_to_remove(path)
+ if aug.match(path).size == 1
+ path
+ elsif !aug.match(path + "[1]").empty?
+ path + "[1]"
+ else
+ raise "Unknown augeas path #{path}"
+ end
+ end
+
+ # Adds entry to tree. At first it finds where to add it to be in correct
+ # place and then sets its value. Recursive if needed. In recursive case
+ # it is already known that whole sub-tree is also new and just added.
+ def add_entry(located_entry)
+ path = insert_entry(located_entry)
+ set_new_value(path, located_entry)
+ end
+
+ # Sets new value to given path. It is used for values that are not yet in
+ # Augeas tree. If needed it does recursive adding.
+ # @param path [String] path which can contain Augeas path expression for
+ # key of new value
+ # @param located_entry [LocatedEntry] entry to write
+ # @see https://github.com/hercules-team/augeas/wiki/Path-expressions
+ def set_new_value(path, located_entry)
+ aug.set(path, located_entry.entry_value)
+ prefix = path[/(^.*)\[[^\]]*\]/, 1] || path
+ # we need to get new path as set can look like [last() + 1]
+ # which creates new entry and we do not want to add subtree to new
+ # entries
+ new_path = aug.match(prefix + "[last()]").first
+ add_subtree(located_entry.entry_tree, new_path)
+ end
+
+ # Adds new subtree. Simplified version of common write as it is known
+ # that all entries will be just added.
+ # @param tree [CFA::AugeasTree] to add
+ # @param prefix [String] prefix where to place *tree*
+ def add_subtree(tree, prefix)
+ tree.all_data.each do |entry|
+ located_entry = LocatedEntry.new(tree, entry, prefix)
+ # universal path that handles also new elements for arrays
+ path = "#{prefix}/#{located_entry.key}[last()+1]"
+ set_new_value(path, located_entry)
+ end
+ end
+
+ # It inserts a key at given position without setting its value.
+ # Its logic is to set it after the last valid entry. If it is not defined
+ # then tries to place it before the first valid entry in tree. If there is
+ # no entry in tree, then does not insert a position, which means that
+ # subsequent setting of value appends it to the end.
+ #
+ # @param located_entry [LocatedEntry] entry to insert
+ # @return [String] where value should be written. Can
+ # contain path expressions.
+ # See https://github.com/hercules-team/augeas/wiki/Path-expressions
+ def insert_entry(located_entry)
+ # entries with add not exist yet
+ preceding = located_entry.preceding_existing
+ prefix = located_entry.prefix
+ if preceding
+ insert_after(preceding, located_entry)
+ # entries with remove is already removed, otherwise find previously
+ elsif located_entry.any_following?
+ aug.insert(prefix + "/*[1]", located_entry.key, true)
+ aug.match(prefix + "/*[1]").first
+ else
+ "#{prefix}/#{located_entry.key}"
+ end
+ end
+
+ # Insert key after preceding.
+ # @see insert_entry
+ # @param preceding [LocatedEntry] entry after which the new one goes
+ # @param located_entry [LocatedEntry] entry to insert
+ # @return [String] where value should be written.
+ def insert_after(preceding, located_entry)
+ aug.insert(preceding.path, located_entry.key, false)
+ path_after(preceding)
+ end
+
+ # Finds path immediately after preceding entry
+ # @param preceding [LocatedEntry]
+ def path_after(preceding)
+ paths = aug.match(preceding.prefix + "/*")
+ preceding_index = paths.index(preceding.path)
+ # it can happen, that insertion change previous entry from
+ # e.g. #comment to #comment[1]. Can happen only if it switch from
+ # single entry to collection
+ preceding_index ||= paths.index(preceding.path + "[1]")
+ paths[preceding_index + 1]
+ end
+ end
+
+ attr_reader :aug
+
+ # Does modification according to the operation defined in {AugeasElement}
+ # @param located_entry [LocatedEntry] entry to process
+ def process_operation(located_entry)
+ case located_entry.entry[:operation]
+ when :add, nil then @lazy_operations.add(located_entry)
+ when :remove then @lazy_operations.remove(located_entry)
+ when :modify then modify_entry(located_entry)
+ when :keep then recurse_write(located_entry)
+ else raise "invalid :operation in #{located_entry.inspect}"
+ end
+ end
+
+ # Writes value of entry to path and if it has a sub-tree
+ # then it calls {#write} on it
+ # @param located_entry [LocatedEntry] entry to modify
+ def modify_entry(located_entry)
+ value = located_entry.entry_value
+ aug.set(located_entry.path, value)
+ report_error { aug.set(located_entry.path, value) }
+ recurse_write(located_entry)
+ end
+
+ # calls write on entry if entry have sub-tree
+ # @param located_entry [LocatedEntry] entry to recursive write
+ def recurse_write(located_entry)
+ write(located_entry.path, located_entry.entry_tree, top_level: false)
+ end
+
+ # Calls block and if it failed, raise exception with details from augeas
+ # why it failed
+ # @yield call to aug that is secured
+ # @raise [RuntimeError]
+ def report_error
+ return if yield
+
+ error = aug.error
+ # zero is no error, so problem in lense
+ if aug.error[:code].nonzero?
+ raise "Augeas error #{error[:message]}. Details: #{error[:details]}."
+ end
+
+ msg = aug.get("/augeas/text/store/error/message")
+ location = aug.get("/augeas/text/store/error/lens")
+ raise "Augeas serializing error: #{msg} at #{location}"
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/augeas_parser.rb new/lib/cfa/augeas_parser.rb
--- old/lib/cfa/augeas_parser.rb 2016-11-30 16:54:05.000000000 +0100
+++ new/lib/cfa/augeas_parser.rb 2017-03-21 16:50:58.000000000 +0100
@@ -1,7 +1,9 @@
+require "set"
require "augeas"
require "forwardable"
require "cfa/placer"
+# CFA: Configuration Files API
module CFA
# A building block for {AugeasTree}.
#
@@ -16,6 +18,17 @@
# A `:value` is either a String, or an {AugeasTree},
# or an {AugeasTreeValue} (which combines both).
#
+ # An `:operation` is an internal variable holding modification of Augeas
+ # structure. It is used for minimizing modifications of source files. Its
+ # possible values are
+ # - `:keep` when the value is untouched
+ # - `:modify` when the `:value` changed but the `:key` is the same
+ # - `:remove` when it is going to be removed, and
+ # - `:add` when a new element is added.
+ #
+ # An `:orig_key` is an internal variable used to hold the original key
+ # including its index.
+ #
# @return [Hash{Symbol => String, AugeasTree}]
#
# @todo Unify naming: entry, element
@@ -38,19 +51,16 @@
element = placer.new_element(@tree)
element[:key] = augeas_name
element[:value] = value
+ element[:operation] = :add
# FIXME: load_collection missing here
end
def delete(value)
- key = augeas_name
- @tree.data.reject! do |entry|
- entry[:key] == key &&
- if value.is_a?(Regexp)
- value =~ entry[:value]
- else
- value == entry[:value]
- end
- end
+ to_delete, to_mark = to_remove(value)
+ .partition { |e| e[:operation] == :add }
+ @tree.all_data.delete_if { |e| to_delete.include?(e) }
+
+ to_mark.each { |e| e[:operation] = :remove }
load_collection
end
@@ -58,26 +68,45 @@
private
def load_collection
- entries = @tree.data.select { |d| d[:key] == augeas_name }
+ entries = @tree.data.select do |entry|
+ entry[:key] == augeas_name && entry[:operation] != :remove
+ end
@collection = entries.map { |e| e[:value] }.freeze
end
def augeas_name
@name + "[]"
end
+
+ def to_remove(value)
+ key = augeas_name
+
+ @tree.data.select do |entry|
+ entry[:key] == key && value_match?(entry[:value], value)
+ end
+ end
+
+ def value_match?(value, match)
+ if match.is_a?(Regexp)
+ value =~ match
+ else
+ value == match
+ end
+ end
end
# Represents a node that contains both a value and a subtree below it.
# For easier traversal it forwards `#[]` to the subtree.
class AugeasTreeValue
# @return [String] the value in the node
- attr_accessor :value
+ attr_reader :value
# @return [AugeasTree] the subtree below the node
attr_accessor :tree
def initialize(tree, value)
@tree = tree
@value = value
+ @modified = false
end
# (see AugeasTree#[])
@@ -85,12 +114,22 @@
tree[key]
end
+ def value=(value)
+ @value = value
+ @modified = true
+ end
+
def ==(other)
[:class, :value, :tree].all? do |a|
public_send(a) == other.public_send(a)
end
end
+ # @return true if the value has been modified
+ def modified?
+ @modified
+ end
+
# For objects of class Object, eql? is synonymous with ==:
# http://ruby-doc.org/core-2.3.3/Object.html#method-i-eql-3F
alias_method :eql?, :==
@@ -100,29 +139,55 @@
class AugeasTree
# Low level access to Augeas structure
#
- # An ordered mapping, represented by an Array of Hashes
- # with the keys :key and :value.
+ # An ordered mapping, represented by an Array of AugeasElement, but without
+ # any removed elements.
#
# @see AugeasElement
#
- # @return [Array<Hash{Symbol => String, AugeasTree}>]
- attr_reader :data
+ # @return [Array<Hash{Symbol => Object}>] a frozen array as it is
+ # just a copy of the real data
+ def data
+ @data.select { |e| e[:operation] != :remove }.freeze
+ end
+
+ # low level access to all AugeasElement including ones marked for removal
+ def all_data
+ @data
+ end
def initialize
@data = []
end
+ # Gets new unique id in numberic sequence. Useful for augeas models that
+ # using sequences like /etc/hosts . It have keys like "1", "2" and when
+ # adding new one it need to find new key.
+ def unique_id
+ # check all_data instead of data, as we have to not reuse deleted key
+ ids = Set.new(all_data.map { |e| e[:key] })
+ id = 1
+ loop do
+ return id.to_s unless ids.include?(id.to_s)
+ id += 1
+ end
+ end
+
# @return [AugeasCollection] collection for *key*
def collection(key)
AugeasCollection.new(self, key)
end
- # @param [String, Matcher]
+ # @param [String, Matcher] matcher
def delete(matcher)
+ return if matcher.nil?
unless matcher.is_a?(CFA::Matcher)
matcher = CFA::Matcher.new(key: matcher)
end
- @data.reject!(&matcher)
+ to_remove = @data.select(&matcher)
+
+ to_delete, to_mark = to_remove.partition { |e| e[:operation] == :add }
+ @data -= to_delete
+ to_mark.each { |e| e[:operation] = :remove }
end
# Adds the given *value* for *key* in the tree.
@@ -138,6 +203,7 @@
element = placer.new_element(self)
element[:key] = key
element[:value] = value
+ element[:operation] = :add
end
# Finds given *key* in tree.
@@ -145,7 +211,7 @@
# @return [String,AugeasTree,AugeasTreeValue,nil] the first value for *key*,
# or `nil` if not found
def [](key)
- entry = @data.find { |d| d[:key] == key }
+ entry = @data.find { |d| d[:key] == key && d[:operation] != :remove }
return entry[:value] if entry
nil
@@ -153,61 +219,30 @@
# Replace the first value for *key* with *value*.
# Append a new element if *key* did not exist.
+ # If *key* was previously removed, then put it back to its old position.
# @param key [String]
# @param value [String, AugeasTree, AugeasTreeValue]
def []=(key, value)
- entry = @data.find { |d| d[:key] == key }
- if entry
- entry[:value] = value
- else
- @data << {
- key: key,
- value: value
- }
- end
+ new_entry = entry_to_modify(key, value)
+ new_entry[:key] = key
+ new_entry[:value] = value
end
# @param matcher [Matcher]
# @return [Array<AugeasElement>] matching elements
def select(matcher)
- @data.select(&matcher)
+ data.select(&matcher)
end
- # @note for internal usage only
- # @api private
- #
- # Initializes {#data} from *prefix* in *aug*.
- # @param aug [::Augeas]
- # @param prefix [String] Augeas path prefix
- # @param keys_cache [AugeasKeysCache]
- # @return [void]
- def load_from_augeas(aug, prefix, keys_cache)
- @data = keys_cache.keys_for_prefix(prefix).map do |key|
- aug_key = prefix + "/" + key
- {
- key: load_key(prefix, aug_key),
- value: load_value(aug, aug_key, keys_cache)
- }
- end
- end
-
- # @note for internal usage only
- # @api private
- #
- # Saves {#data} to *prefix* in *aug*.
- # @param aug [::Augeas]
- # @param prefix [String] Augeas path prefix
- # @return [void]
- def save_to_augeas(aug, prefix)
- arrays = {}
-
- @data.each do |entry|
- save_entry(entry[:key], entry[:value], arrays, aug, prefix)
+ def ==(other)
+ return false if self.class != other.class
+ other_data = other.data # do not compute again
+ data.each_with_index do |entry, index|
+ return false if entry[:key] != other_data[index][:key]
+ return false if entry[:value] != other_data[index][:value]
end
- end
- def ==(other)
- [:class, :data].all? { |a| public_send(a) == other.public_send(a) }
+ true
end
# For objects of class Object, eql? is synonymous with ==:
@@ -216,54 +251,44 @@
private
- def save_entry(key, value, arrays, aug, prefix)
- aug_key = obtain_aug_key(prefix, key, arrays)
- case value
- when AugeasTree then value.save_to_augeas(aug, aug_key)
- when AugeasTreeValue
- report_error(aug) unless aug.set(aug_key, value.value)
- value.tree.save_to_augeas(aug, aug_key)
+ def replace_entry(old_entry)
+ index = @data.index(old_entry)
+ new_entry = { operation: :add }
+ # insert the replacement to the same location
+ @data.insert(index, new_entry)
+ # the entry is not yet in the tree
+ if old_entry[:operation] == :add
+ @data.delete_if { |d| d[:key] == key }
else
- report_error(aug) unless aug.set(aug_key, value)
+ old_entry[:operation] = :remove
end
- end
- def obtain_aug_key(prefix, key, arrays)
- if key.end_with?("[]")
- array_key = key[0..-3] # remove trailing []
- arrays[array_key] ||= 0
- arrays[array_key] += 1
- key = array_key + "[#{arrays[array_key]}]"
- end
-
- "#{prefix}/#{key}"
+ new_entry
end
- def report_error(aug)
- error = aug.error
- raise "Augeas error #{error[:message]}." \
- "Details: #{error[:details]}."
+ def mark_new_entry(new_entry, old_entry)
+ # if an entry already exists then just modify it,
+ # but only if we previously did not add it
+ new_entry[:operation] = if old_entry && old_entry[:operation] != :add
+ :modify
+ else
+ :add
+ end
end
- def load_key(prefix, aug_key)
- # clean from key prefix and for collection remove number inside []
- # +1 for size due to ending '/' not part of prefix
- key = aug_key[(prefix.size + 1)..-1]
- key.end_with?("]") ? key.sub(/\[\d+\]$/, "[]") : key
- end
-
- def load_value(aug, aug_key, keys_cache)
- subkeys = keys_cache.keys_for_prefix(aug_key)
-
- nested = !subkeys.empty?
- value = aug.get(aug_key)
- if nested
- subtree = AugeasTree.new
- subtree.load_from_augeas(aug, aug_key, keys_cache)
- value ? AugeasTreeValue.new(subtree, value) : subtree
- else
- value
+ def entry_to_modify(key, value)
+ entry = @data.find { |d| d[:key] == key }
+ # we are switching from tree to value or treevalue to value only
+ # like change from key=value to key=value#comment
+ if entry && entry[:value].class != value.class
+ entry = replace_entry(entry)
end
+ new_entry = entry || {}
+ mark_new_entry(new_entry, entry)
+
+ @data << new_entry unless entry
+
+ new_entry
end
end
@@ -285,6 +310,7 @@
# @param raw_string [String] a string to be parsed
# @return [AugeasTree] the parsed data
def parse(raw_string)
+ require "cfa/augeas_parser/reader"
@old_content = raw_string
# open augeas without any autoloading and it should not touch disk and
@@ -294,24 +320,21 @@
aug.set("/input", raw_string)
report_error(aug) unless aug.text_store(@lens, "/input", "/store")
- keys_cache = AugeasKeysCache.new(aug)
-
- tree = AugeasTree.new
- tree.load_from_augeas(aug, "/store", keys_cache)
-
- return tree
+ return AugeasReader.read(aug, "/store")
end
end
# @param data [AugeasTree] the data to be serialized
# @return [String] a string to be written
def serialize(data)
+ require "cfa/augeas_parser/writer"
# open augeas without any autoloading and it should not touch disk and
# load lenses as needed only
root = load_path = nil
Augeas.open(root, load_path, Augeas::NO_MODL_AUTOLOAD) do |aug|
aug.set("/input", @old_content || "")
- data.save_to_augeas(aug, "/store")
+ aug.text_store(@lens, "/input", "/store") if @old_content
+ AugeasWriter.new(aug).write("/store", data)
res = aug.text_retrieve(@lens, "/input", "/store", "/output")
report_error(aug) unless res
@@ -341,44 +364,4 @@
raise "Augeas parsing/serializing error: #{msg} at #{location}"
end
end
-
- # Cache that holds all avaiable keys in augeas tree. It is used to
- # prevent too many aug.match calls which are expensive.
- class AugeasKeysCache
- STORE_PREFIX = "/store".freeze
-
- # initialize cache from passed augeas object
- def initialize(aug)
- fill_cache(aug)
- end
-
- # returns list of keys available on given prefix
- def keys_for_prefix(prefix)
- @cache[prefix] || []
- end
-
- private
-
- def fill_cache(aug)
- @cache = {}
- search_path = "#{STORE_PREFIX}/*"
- loop do
- matches = aug.match(search_path)
- break if matches.empty?
- assign_matches(matches, @cache)
-
- search_path += "/*"
- end
- end
-
- def assign_matches(matches, cache)
- matches.each do |match|
- split_index = match.rindex("/")
- prefix = match[0..(split_index - 1)]
- key = match[(split_index + 1)..-1]
- cache[prefix] ||= []
- cache[prefix] << key
- end
- end
- end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/base_model.rb new/lib/cfa/base_model.rb
--- old/lib/cfa/base_model.rb 2016-11-30 16:54:05.000000000 +0100
+++ new/lib/cfa/base_model.rb 2017-03-21 16:50:58.000000000 +0100
@@ -53,14 +53,15 @@
# smart to at first modify existing value, then replace commented out code
# and if even that doesn't work, then append it at the end
# @note prefer to use specialized methods of children
- def generic_set(key, value)
- modify(key, value) || uncomment(key, value) || add_new(key, value)
+ def generic_set(key, value, tree = data)
+ modify(key, value, tree) || uncomment(key, value, tree) ||
+ add_new(key, value, tree)
end
# powerfull method that gets unformatted any value in config.
# @note prefer to use specialized methods of children
- def generic_get(key)
- data[key]
+ def generic_get(key, tree = data)
+ tree[key]
end
# rubocop:disable Style/TrivialAccessors
@@ -120,18 +121,18 @@
# Modify an **existing** entry and return `true`,
# or do nothing and return `false`.
# @return [Boolean]
- def modify(key, value)
+ def modify(key, value, tree)
# if already set, just change value
- return false unless data[key]
+ return false unless tree[key]
- data[key] = value
+ tree[key] = value
true
end
# Replace a commented out entry and return `true`,
# or do nothing and return `false`.
# @return [Boolean]
- def uncomment(key, value)
+ def uncomment(key, value, tree)
# Try to find if it is commented out, so we can replace line
matcher = Matcher.new(
collection: "#comment",
@@ -139,15 +140,15 @@
# FIXME: this will match also "# If you set FOO=bar then..."
value_matcher: /(\s|^)#{key}\s*=/
)
- return false unless data.data.any?(&matcher)
+ return false unless tree.data.any?(&matcher)
# FIXME: this assumes that *data* is an AugeasTree
- data.add(key, value, ReplacePlacer.new(matcher))
+ tree.add(key, value, ReplacePlacer.new(matcher))
true
end
- def add_new(key, value)
- data.add(key, value)
+ def add_new(key, value, tree)
+ tree.add(key, value)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/placer.rb new/lib/cfa/placer.rb
--- old/lib/cfa/placer.rb 2016-11-30 16:54:05.000000000 +0100
+++ new/lib/cfa/placer.rb 2017-03-21 16:50:58.000000000 +0100
@@ -11,14 +11,20 @@
raise NotImplementedError,
"Subclasses of #{Module.nesting.first} must override #{__method__}"
end
+
+ protected
+
+ def create_element
+ { operation: :add }
+ end
end
# Places the new element at the end of the tree.
class AppendPlacer < Placer
# (see Placer#new_element)
def new_element(tree)
- res = {}
- tree.data << res
+ res = create_element
+ tree.all_data << res
res
end
@@ -37,14 +43,15 @@
# (see Placer#new_element)
def new_element(tree)
- index = tree.data.index(&@matcher)
+ index = tree.all_data.index(&@matcher)
- res = {}
+ res = create_element
if index
- tree.data.insert(index, res)
+ tree.all_data.insert(index, res)
else
- tree.data << res
+ tree.all_data << res
end
+
res
end
end
@@ -61,14 +68,15 @@
# (see Placer#new_element)
def new_element(tree)
- index = tree.data.index(&@matcher)
+ index = tree.all_data.index(&@matcher)
- res = {}
+ res = create_element
if index
- tree.data.insert(index + 1, res)
+ tree.all_data.insert(index + 1, res)
else
- tree.data << res
+ tree.all_data << res
end
+
res
end
end
@@ -86,13 +94,16 @@
# (see Placer#new_element)
def new_element(tree)
- index = tree.data.index(&@matcher)
- res = {}
+ index = tree.all_data.index(&@matcher)
+ res = create_element
if index
- tree.data[index] = res
+ # remove old one and add new one, as it can have different key
+ # which cause problem to simple modify
+ tree.all_data[index][:operation] = :remove
+ tree.all_data.insert(index + 1, res)
else
- tree.data << res
+ tree.all_data << res
end
res
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2016-11-30 16:54:05.000000000 +0100
+++ new/metadata 2017-03-21 16:51:15.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: cfa
version: !ruby/object:Gem::Version
- version: 0.4.2
+ version: 0.6.0
platform: ruby
authors:
- Josef Reidinger
autorequire:
bindir: bin
cert_chain: []
-date: 2016-11-30 00:00:00.000000000 Z
+date: 2017-03-21 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: ruby-augeas
@@ -34,6 +34,9 @@
extra_rdoc_files: []
files:
- lib/cfa/augeas_parser.rb
+- lib/cfa/augeas_parser/keys_cache.rb
+- lib/cfa/augeas_parser/reader.rb
+- lib/cfa/augeas_parser/writer.rb
- lib/cfa/base_model.rb
- lib/cfa/matcher.rb
- lib/cfa/memory_file.rb
@@ -58,10 +61,9 @@
version: 1.3.6
requirements: []
rubyforge_project:
-rubygems_version: 2.2.2
+rubygems_version: 2.4.5.2
signing_key:
specification_version: 4
summary: CFA (Config Files API) provides an easy way to create models on top of configuration
files
test_files: []
-has_rdoc:
1
0
Hello community,
here is the log from the commit of package rubygem-cfa_grub2 for openSUSE:Factory checked in at 2017-03-29 13:22:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cfa_grub2 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-cfa_grub2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-cfa_grub2"
Wed Mar 29 13:22:11 2017 rev:6 rq:481352 version:0.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cfa_grub2/rubygem-cfa_grub2.changes 2016-12-09 09:35:48.952960447 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-cfa_grub2.new/rubygem-cfa_grub2.changes 2017-03-29 13:22:12.980436728 +0200
@@ -1,0 +2,6 @@
+Mon Mar 20 13:52:28 UTC 2017 - jreidinger(a)suse.com
+
+- adapt to new cfa version (bsc#1023204)
+- 0.6.0
+
+-------------------------------------------------------------------
Old:
----
cfa_grub2-0.5.3.gem
New:
----
cfa_grub2-0.6.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-cfa_grub2.spec ++++++
--- /var/tmp/diff_new_pack.iTm3aX/_old 2017-03-29 13:22:13.600349058 +0200
+++ /var/tmp/diff_new_pack.iTm3aX/_new 2017-03-29 13:22:13.600349058 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-cfa_grub2
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: rubygem-cfa_grub2
-Version: 0.5.3
+Version: 0.6.0
Release: 0
%define mod_name cfa_grub2
%define mod_full_name %{mod_name}-%{version}
++++++ cfa_grub2-0.5.3.gem -> cfa_grub2-0.6.0.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/cfa/grub2/default.rb new/lib/cfa/grub2/default.rb
--- old/lib/cfa/grub2/default.rb 2016-12-07 09:36:07.000000000 +0100
+++ new/lib/cfa/grub2/default.rb 2017-03-20 15:31:04.000000000 +0100
@@ -185,6 +185,7 @@
def add_parameter(key, value, placer = AppendPlacer.new)
element = placer.new_element(@tree)
+ element[:operation] = :add
element[:key] = key
element[:value] = value
end
@@ -192,31 +193,29 @@
# Removes parameter from kernel command line.
# @param matcher [Matcher] to find entry to remove
def remove_parameter(matcher)
- @tree.data.reject!(&matcher)
+ @tree.data.select(&matcher).each { |e| e[:operation] = :remove }
end
# Represents parsed kernel parameters tree. Parses in initialization
# and backserilized by `to_string`.
# TODO: replace it via augeas parser when someone write lense
class ParamTree
- attr_reader :data
-
def initialize(line)
- line ||= ""
- pairs = line.split(/\s/)
- .reject(&:empty?)
- .map { |e| e.split("=", 2) }
+ pairs = (line || "").split(/\s/)
+ .reject(&:empty?)
+ .map { |e| e.split("=", 2) }
@data = pairs.map do |k, v|
{
- key: k,
- value: v || true, # kernel param without value have true
+ key: k,
+ value: v || true, # kernel param without value have true
+ operation: :keep
}
end
end
def to_string
- snippets = @data.map do |e|
+ snippets = data.map do |e|
if e[:value] == true
e[:key]
else
@@ -226,6 +225,14 @@
snippets.join(" ")
end
+
+ def data
+ @data.select { |e| e[:operation] != :remove }.freeze
+ end
+
+ def all_data
+ @data
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2016-12-07 09:36:33.000000000 +0100
+++ new/metadata 2017-03-20 15:31:04.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: cfa_grub2
version: !ruby/object:Gem::Version
- version: 0.5.3
+ version: 0.6.0
platform: ruby
authors:
- Josef Reidinger
autorequire:
bindir: bin
cert_chain: []
-date: 2016-12-07 00:00:00.000000000 Z
+date: 2017-03-20 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: cfa
@@ -16,14 +16,14 @@
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.3'
+ version: '0.5'
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '0.3'
+ version: '0.5'
description: Models allowing easy read and modification of GRUB2 configuration files.
It is a plugin for cfa framework.
email:
@@ -56,8 +56,9 @@
version: 1.3.6
requirements: []
rubyforge_project:
-rubygems_version: 2.4.5.1
+rubygems_version: 2.2.2
signing_key:
specification_version: 4
summary: Models for GRUB2 configuration files.
test_files: []
+has_rdoc:
1
0