Hello community, here is the log from the commit of package autoyast2 for openSUSE:Factory checked in at 2014-10-15 16:26:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old) and /work/SRC/openSUSE:Factory/.autoyast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "autoyast2" Changes: -------- --- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes 2014-10-11 19:25:04.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.autoyast2.new/autoyast2.changes 2014-10-15 16:26:36.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Oct 13 16:32:53 UTC 2014 - lslezak@suse.cz + +- Fixed "No base product found" error when evaluating + rules/rules.xml file (bnc#900750) +- 3.1.66 + +------------------------------------------------------------------- Old: ---- autoyast2-3.1.65.tar.bz2 New: ---- autoyast2-3.1.66.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autoyast2.spec ++++++ --- /var/tmp/diff_new_pack.t5nKLo/_old 2014-10-15 16:26:37.000000000 +0200 +++ /var/tmp/diff_new_pack.t5nKLo/_new 2014-10-15 16:26:37.000000000 +0200 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.1.65 +Version: 3.1.66 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -30,6 +30,12 @@ BuildRequires: yast2-installation-control # xmllint BuildRequires: libxml2-tools +BuildRequires: yast2 +BuildRequires: yast2-services-manager +BuildRequires: yast2-storage +BuildRequires: yast2-transfer +BuildRequires: yast2-xml +BuildRequires: rubygem(rspec) # %%{_unitdir} macro definition is in a separate package since 13.1 %if 0%{?suse_version} >= 1310 ++++++ autoyast2-3.1.65.tar.bz2 -> autoyast2-3.1.66.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.65/package/autoyast2.changes new/autoyast2-3.1.66/package/autoyast2.changes --- old/autoyast2-3.1.65/package/autoyast2.changes 2014-10-09 12:14:10.000000000 +0200 +++ new/autoyast2-3.1.66/package/autoyast2.changes 2014-10-13 21:39:09.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Oct 13 16:32:53 UTC 2014 - lslezak@suse.cz + +- Fixed "No base product found" error when evaluating + rules/rules.xml file (bnc#900750) +- 3.1.66 + +------------------------------------------------------------------- Thu Oct 9 11:02:41 CEST 2014 - schubi@suse.de - Preventing double definition of ALWAYS_CLONABLE_MODULES. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.65/package/autoyast2.spec new/autoyast2-3.1.66/package/autoyast2.spec --- old/autoyast2-3.1.65/package/autoyast2.spec 2014-10-09 12:14:10.000000000 +0200 +++ new/autoyast2-3.1.66/package/autoyast2.spec 2014-10-13 21:39:09.000000000 +0200 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.1.65 +Version: 3.1.66 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -30,6 +30,12 @@ BuildRequires: yast2-installation-control # xmllint BuildRequires: libxml2-tools +BuildRequires: rubygem(rspec) +BuildRequires: yast2 +BuildRequires: yast2-storage +BuildRequires: yast2-xml +BuildRequires: yast2-transfer +BuildRequires: yast2-services-manager # %%{_unitdir} macro definition is in a separate package since 13.1 %if 0%{?suse_version} >= 1310 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.65/src/modules/AutoInstallRules.rb new/autoyast2-3.1.66/src/modules/AutoInstallRules.rb --- old/autoyast2-3.1.65/src/modules/AutoInstallRules.rb 2014-10-09 12:14:10.000000000 +0200 +++ new/autoyast2-3.1.66/src/modules/AutoInstallRules.rb 2014-10-13 21:39:09.000000000 +0200 @@ -10,6 +10,8 @@ module Yast class AutoInstallRulesClass < Module + include Yast::Logger + def main Yast.import "UI" textdomain "autoinst" @@ -317,17 +319,20 @@ Builtins.y2milestone("Other linux parts: %1", @LinuxPartitions) - @installed_product = Product.name - @installed_product_version = Product.version + distro_str = SCR.Read(path(".content.DISTRO")) + log.info "DISTRO: #{distro_str}" + + distro = distro_map(distro_str) + cpe = distro ? cpeid_map(distro["cpeid"]) : {} + + @installed_product = distro["name"] || "" + @installed_product_version = cpe["version"] || "" Ops.set(@ATTR, "installed_product", @installed_product) Ops.set(@ATTR, "installed_product_version", @installed_product_version) - Builtins.y2milestone( - "Installing %1 %2", - @installed_product, - @installed_product_version - ) - Builtins.y2milestone("ATTR=%1", @ATTR) + log.info "Installing #{@installed_product.inspect}, " \ + "version: #{@installed_product_version.inspect}" + log.info "ATTR=#{@ATTR}" nil end @@ -1159,6 +1164,56 @@ publish :function => :CreateDefault, :type => "void ()" publish :function => :CreateFile, :type => "void (string)" publish :function => :AutoInstallRules, :type => "void ()" + + private + + # TODO FIXME: share these functions (move to yast2?) + + # Split CPE ID and distro label (separated by comma) + # @param distro [String] "DISTRO" value from content file + # @return [Hash<String,String>,nil] parsed value, map: + # {"name" => <string>, "cpeid" => <string> } + # or nil if the input value is invalid + def distro_map(distro) + if !distro + log.warn "Received nil distro value" + return nil + end + + # split at the first comma, resulting in 2 parts at max. + cpeid, name = distro.split(",", 2) + + if !name + log.warn "Cannot parse DISTRO value: #{distro}" + return nil + end + + {"cpeid" => cpeid, "name" => name} + end + + # parse CPE ID in URI syntax + # @see http://csrc.nist.gov/publications/nistir/ir7695/NISTIR-7695-CPE-Naming.pdf + # @param cpeid [String] e.g. "cpe:/o:suse:sles:12" + # @return [Hash<String,String>] parsed values, the keys are "part", "vendor", "product", + # "version", "update", "edition", "lang", nil is returned for missing values + def cpeid_map(cpeid) + return nil unless cpeid && cpeid.start_with?("cpe:/") + + # remove the "cpe:/" prefix + raw_cpe = cpeid.sub(/^cpe:\//, "") + + parts = raw_cpe.split(":") + + { + "part" => parts[0], + "vendor" => parts[1], + "product" => parts[2], + "version" => parts[3], + "update" => parts[4], + "edition" => parts[5], + "lang" => parts[6] + } + end end AutoInstallRules = AutoInstallRulesClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.65/test/AutoInstallRules_test.rb new/autoyast2-3.1.66/test/AutoInstallRules_test.rb --- old/autoyast2-3.1.65/test/AutoInstallRules_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/autoyast2-3.1.66/test/AutoInstallRules_test.rb 2014-10-13 21:39:09.000000000 +0200 @@ -0,0 +1,100 @@ +#!/usr/bin/env rspec + +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +require "yast" + +Yast.import "AutoInstallRules" + +describe "Yast::AutoInstallRules" do + subject { Yast::AutoInstallRules } + + describe "#cpeid_map" do + it "parses SLES12 CPE ID" do + expect(subject.send(:cpeid_map, "cpe:/o:suse:sles:12")).to eq( + "part" => "o", + "vendor" => "suse", + "product" => "sles", + "version" => "12", + "update" => nil, + "edition" => nil, + "lang" => nil + ) + end + + it "parses Adv. mgmt module CPE ID" do + machinery_cpeid = "cpe:/o:suse:sle-module-adv-systems-management:12" + expect(subject.send(:cpeid_map, machinery_cpeid)).to eq( + "part" => "o", + "vendor" => "suse", + "product" => "sle-module-adv-systems-management", + "version" => "12", + "update" => nil, + "edition" => nil, + "lang" => nil + ) + end + + it "return nil when CPE ID is does not start with 'cpe:/'" do + expect(subject.send(:cpeid_map, "invalid")).to be_nil + end + end + + describe "#distro_map" do + it "returns CPEID and product name" do + param = "cpe:/o:suse:sles:12,SUSE Linux Enterprise Server 12" + expected = { + "cpeid" => "cpe:/o:suse:sles:12", + "name" => "SUSE Linux Enterprise Server 12" + } + + expect(subject.send(:distro_map, param)).to eq(expected) + end + + it "returns product name with comma" do + param = "cpe:/o:suse:sles:12,SLES12, Mini edition" + expected = { + "cpeid" => "cpe:/o:suse:sles:12", + "name" => "SLES12, Mini edition" + } + + expect(subject.send(:distro_map, param)).to eq(expected) + end + + it "returns nil if input is nil" do + expect(subject.send(:distro_map, nil)).to be_nil + end + + it "returns nil if the input does not contain comma" do + expect(subject.send(:distro_map, "foo")).to be_nil + end + end + + describe "#ProbeRules" do + it "reads installed product properties from content file" do + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".probe.bios")).and_return([]) + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".probe.memory")).and_return([]) + expect(Yast::Kernel).to receive(:GetPackages).and_return([]) + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), "/bin/hostname") + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".etc.install_inf.Domain")) + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".etc.install_inf.Hostname")) + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".etc.install_inf.Network")) + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".etc.install_inf.HasPCMCIA")) + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".etc.install_inf.XServer")) + + expect(Yast::StorageControllers).to receive(:Initialize) + expect(Yast::Storage).to receive(:GetTargetMap).and_return({}) + expect(Yast::Storage).to receive(:GetForeignPrimary) + expect(Yast::Storage).to receive(:GetOtherLinuxPartitions) + + expect(Yast::SCR).to receive(:Read).with(Yast::Path.new(".content.DISTRO")). + and_return("cpe:/o:suse:sles:12,SUSE Linux Enterprise Server 12") + + subject.ProbeRules + + expect(Yast::AutoInstallRules.installed_product).to eq("SUSE Linux Enterprise Server 12") + expect(Yast::AutoInstallRules.installed_product_version).to eq("12") + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.65/test/Makefile.am new/autoyast2-3.1.66/test/Makefile.am --- old/autoyast2-3.1.65/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/autoyast2-3.1.66/test/Makefile.am 2014-10-13 21:39:09.000000000 +0200 @@ -0,0 +1,11 @@ +# +# Makefile.am for autoinstallation/test +# + +TESTS = AutoInstallRules_test.rb + +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = rspec +VERBOSE = 1 +EXTRA_DIST = $(TESTS) + -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org