Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2014-02-21 13:48:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2014-02-06 07:00:55.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2014-02-21 13:48:11.000000000 +0100 @@ -1,0 +2,6 @@ +Mon Feb 10 13:18:52 UTC 2014 - [email protected] + +- added memory detection code (gh#yast/yast-packager#33) +- 3.1.19 + +------------------------------------------------------------------- Old: ---- yast2-3.1.18.tar.bz2 New: ---- yast2-3.1.19.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.fWstOw/_old 2014-02-21 13:48:11.000000000 +0100 +++ /var/tmp/diff_new_pack.fWstOw/_new 2014-02-21 13:48:11.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.18 +Version: 3.1.19 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -221,6 +221,7 @@ %{yast_ydatadir}/*.ycp %{yast_clientdir}/* %{yast_moduledir}/* +%{yast_libdir}/* %{yast_scrconfdir}/* %{yast_ybindir}/* %{yast_agentdir}/ag_* ++++++ yast2-3.1.18.tar.bz2 -> yast2-3.1.19.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/general/src/modules/AsciiFile.rb new/yast2-3.1.19/library/general/src/modules/AsciiFile.rb --- old/yast2-3.1.18/library/general/src/modules/AsciiFile.rb 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/library/general/src/modules/AsciiFile.rb 2014-02-21 10:52:55.000000000 +0100 @@ -31,6 +31,36 @@ require "yast" module Yast + + # Assume this /etc/fstab file + # + # # main filesystem + # UUID=001c0d61-e99f-4ab7-ba4b-bda6f54a052d / btrfs defaults 0 0 + # + # then with this set-up + # + # file = {} + # file_ref = arg_ref(file) # an artefact of YCP API + # AsciiFile.SetComment(file_ref, "^[ \t]*#") + # AsciiFile.SetDelimiter(file_ref, " \t") + # AsciiFile.SetListWidth(file_ref, [20, 20, 10, 21, 1, 1]) + # + # this main call + # + # AsciiFile.ReadFile(file_ref, "/etc/fstab") + # # note that the result is `file["l"]` + # # as the rest of `file` are the parsing parameters + # result = file["l"] + # + # will produce + # + # result.size # => 2 + # # an integer keyed hash starting at ONE! + # result.keys # => [1, 2] + # result[1]["comment"] # => true + # result[1]["line"] # => "# main filesystem" + # result[2]["fields"].size # => 6 + # result[2]["fields"][1] # => "/" class AsciiFileClass < Module def main @@ -51,8 +81,8 @@ # Sets the widths of records on one line # - # @param [map &] file content - # @param list of widths + # @param [ArgRef<Hash>] file content + # @param [Array] widths list of widths def SetListWidth(file, widths) widths = deep_copy(widths) Ops.set(file.value, "widths", widths) @@ -62,8 +92,8 @@ # Sets the delimiter between the records on one line # - # @param [map &] file content - # @param string delimiter + # @param [ArgRef<Hash>] file content + # @param [String] delim delimiter def SetDelimiter(file, delim) Ops.set(file.value, "delim", delim) @@ -112,8 +142,8 @@ # Reads the file from the disk # - # @param [map &] file content - # @param [map &] file name + # @param [ArgRef<Hash>] file content + # @param [String] pathname file name def ReadFile(file, pathname) Builtins.y2milestone("path=%1", pathname) lines = [] @@ -182,8 +212,8 @@ # Returns the list of rows where matches searched string in the defined column # # @param [Hash] file content - # @param integer column (counted from 0 to n) - # @param string searched string + # @param [Integer] field column (counted from 0 to n) + # @param [String] content searched string # @return [Array<Fixnum>] matching rows def FindLineField(file, field, content) file = deep_copy(file) @@ -200,9 +230,9 @@ # Returns map of wanted lines # - # @param [map &] file content - # @param list<integer> rows (counted from 1 to n) - # @return [Hash{Fixnum => map}] with wanted lines + # @param [ArgRef<Hash>] file content + # @param [Array<Integer>] lines rows (counted from 1 to n) + # @return [Hash<Fixnum, Hash>] hash with wanted lines def GetLines(file, lines) lines = deep_copy(lines) ret = {} @@ -220,8 +250,8 @@ # Returns map of wanted line # - # @param [map &] file content - # @param integer row number (counted from 1 to n) + # @param [ArgRef<Hash>] file content + # @param [Integer] line row number (counted from 1 to n) # @return [Hash] of wanted line def GetLine(file, line) ret = {} @@ -248,9 +278,9 @@ # Changes the record in the file defined by row and column # - # @param [map &] file content - # @param integer row number (counted from 1 to n) - # @param integer column number (counted from 0 to n) + # @param [ArgRef<Hash>] file content + # @param [Integer] line row number (counted from 1 to n) + # @param [Integer] field column number (counted from 0 to n) def ChangeLineField(file, line, field, entry) Builtins.y2debug("line %1 field %2 entry %3", line, field, entry) changed = false @@ -288,9 +318,9 @@ # Changes a complete line # - # @param [map &] file content - # @param integer row number (counted from 1 to n) - # @param list of new entries on the line + # @param [ArgRef<Hash>] file content + # @param [Integer] line row number (counted from 1 to n) + # @param [Array] entry array of new fields on the line def ReplaceLine(file, line, entry) entry = deep_copy(entry) Builtins.y2debug("line %1 entry %2", line, entry) @@ -307,8 +337,8 @@ # Appends a new line at the bottom # - # @param [map &] file content - # @param list of new entries on one line + # @param [ArgRef<Hash>] file content + # @param [Array] entry array of new fields on the line def AppendLine(file, entry) entry = deep_copy(entry) line = Ops.add(Builtins.size(Ops.get_map(file.value, "l", {})), 1) @@ -323,7 +353,7 @@ # Removes lines # - # @param [map &] file content + # @param [ArgRef<Hash>] file content # @param [Array<Fixnum>] lines to remove (counted from 1 to n) def RemoveLines(file, lines) lines = deep_copy(lines) @@ -343,8 +373,8 @@ # Writes a content into the file # - # @param [map &] file content - # @param [map &] file name + # @param [ArgRef<Hash>] file content + # @param [String] fpath file name def RewriteFile(file, fpath) Builtins.y2milestone("path %1", fpath) Builtins.y2debug("out: %1", file.value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/general/test/Makefile.am new/yast2-3.1.19/library/general/test/Makefile.am --- old/yast2-3.1.18/library/general/test/Makefile.am 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/library/general/test/Makefile.am 2014-02-21 10:52:55.000000000 +0100 @@ -1,6 +1,7 @@ TESTS = \ + asciifile_test.rb \ linuxrc_test.rb \ - hooks_test.rb + hooks_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/general/test/asciifile_test.rb new/yast2-3.1.19/library/general/test/asciifile_test.rb --- old/yast2-3.1.18/library/general/test/asciifile_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.19/library/general/test/asciifile_test.rb 2014-02-21 10:52:55.000000000 +0100 @@ -0,0 +1,90 @@ +#! /usr/bin/env rspec + +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +require "yast" +include Yast + +Yast.import "AsciiFile" + +def stub_file_reading(filename, contents) + SCR.stub(:Read) + .with(path(".target.size"), filename) + .and_return contents.length + + SCR.stub(:Read) + .with(path(".target.string"), filename) + .and_return contents +end + +describe "AsciiFile" do + context "when working with a fstab file" do + FSTAB_FILENAME = "/etc/fstab" + FSTAB_CONTENTS = <<EOS +UUID=001c0d61-e99f-4ab7-ba4b-bda6f54a052d / btrfs defaults 0 0 +# NFS +192.168.1.1:/ /mnt nfs4 rw 0 0 +# trailing comment +EOS + let(:fstab_ref) do + stub_file_reading(FSTAB_FILENAME, FSTAB_CONTENTS) + fstab = {} + fstab_ref = arg_ref(fstab) + AsciiFile.SetComment(fstab_ref, "^[ \t]*#") + AsciiFile.SetDelimiter(fstab_ref, " \t") + AsciiFile.SetListWidth(fstab_ref, [20, 20, 10, 21, 1, 1]) + fstab_ref + end + + describe "#ReadFile" do + before(:each) do + AsciiFile.ReadFile(fstab_ref, FSTAB_FILENAME) + end + + # note that the result is `fstab["l"]` + # as the rest of `fstab` are the parsing parameters + it "produces the result under the 'l' key" do + expect(fstab_ref.value).to have_key "l" + end + + describe "the result" do + subject(:result) { fstab_ref.value["l"] } + + it "is a hash indexed by line numbers, starting at ONE" do + expect(result.keys).to eq [1, 2, 3, 4] + end + + describe "comment lines" do + subject (:comment) { result[2] } + + it "have a true 'comment' key" do + expect(comment["comment"]).to be_true + end + + it "have a copy in 'line' key, including the comment start" do + expect(comment["line"]).to eq "# NFS" + end + end + + describe "regular non-comment lines" do + subject (:regular) { result[1] } + + it "have a falsy 'comment' key" do + expect(regular["comment"]).to be_false + end + + it "have a copy in 'line' key" do + expect(regular["line"]).to eq "UUID=001c0d61-e99f-4ab7-ba4b-bda6f54a052d / btrfs defaults 0 0" + end + + describe "its 'fields' key" do + it "is an array of delimiter separated fields, starting at zero as usual" do + expect(regular["fields"].size).to eq 6 + expect(regular["fields"][1]).to eq "/" + end + end + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/system/src/Makefile.am new/yast2-3.1.19/library/system/src/Makefile.am --- old/yast2-3.1.18/library/system/src/Makefile.am 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/library/system/src/Makefile.am 2014-02-21 10:52:55.000000000 +0100 @@ -27,6 +27,11 @@ desktop_DATA = \ desktop/messages.desktop -EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) $(desktop_DATA) +ylibdir = @ylibdir@/yast2 +ylib_DATA = \ + lib/yast2/hw_detection.rb -include $(top_srcdir)/Makefile.am.common \ No newline at end of file + +EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(scrconf_DATA) $(desktop_DATA) $(ylib_DATA) + +include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/system/src/lib/yast2/hw_detection.rb new/yast2-3.1.19/library/system/src/lib/yast2/hw_detection.rb --- old/yast2-3.1.18/library/system/src/lib/yast2/hw_detection.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.19/library/system/src/lib/yast2/hw_detection.rb 2014-02-21 10:52:55.000000000 +0100 @@ -0,0 +1,65 @@ +# encoding: utf-8 + +# *************************************************************************** +# +# Copyright (c) 2014 SUSE LLC +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, +# you may find current contact information at www.novell.com +# +# *************************************************************************** +# File: hw_detection.rb +# +# Authors: +# Ladislav Slezak <[email protected]> +# +# Summary: +# Module for detecting hardware +# + +require "yast" + +module Yast2 + class HwDetection + include Yast::Logger + + # this is from <hd.h> include (in hwinfo-devel) + MEMORY_CLASS = 257 # "bc_internal" value + MEMORY_SUBCLASS = 2 # "sc_int_main_mem" value + + # Return size of the system memory (in bytes) + # @return Fixnum,Bignum detected memory size + def self.memory + memory = SCR.Read(path(".probe.memory")) + log.debug("hwinfo memory: #{memory}") + + raise "Memory detection failed" unless memory + + memory_size = 0 + memory.each do |info| + # internal class, main memory + if info["class_id"] == MEMORY_CLASS && info["sub_class_id"] == MEMORY_SUBCLASS + info.fetch("resource", {}).fetch("phys_mem", []).each do |phys_mem| + memory_size += phys_mem.fetch("range", 0) + end + end + end + + log.info("Detected memory size: #{memory_size} (#{memory_size/1024/1024}MiB)") + return memory_size + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/library/system/test/hw_detection_test.rb new/yast2-3.1.19/library/system/test/hw_detection_test.rb --- old/yast2-3.1.18/library/system/test/hw_detection_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.19/library/system/test/hw_detection_test.rb 2014-02-21 10:52:55.000000000 +0100 @@ -0,0 +1,56 @@ +#! /usr/bin/rspec + +require "yast" +include Yast + +require_relative "../src/lib/yast2/hw_detection" + +describe "HwDetection" do + before do + # 16GB + @ramsize = 16*1024*1024*1024 + @memory = { + "bus" => "None", + "bus_hwcfg" => "none", + "class_id" => 257, + "model" => "Main Memory", + "old_unique_key" => "4srm.CxwsZFjVASF", + "resource" => { + "mem" => [{"active" => true, "length" => 16815341568, "start" => 0}], + "phys_mem" => [{"range" => @ramsize}] + }, + "sub_class_id" => 2, + "unique_key" => "rdCR.CxwsZFjVASF" + } + @non_memory = { + "class_id" => 42, + "sub_class_id" => 42, + "resource" => { + "mem" => [{"active" => true, "length" => 16815341568, "start" => 0}], + "phys_mem" => [{"range" => @ramsize}] + } + } + end + + describe "#memory" do + it "returns detected memory size in bytes" do + SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory]) + expect(Yast2::HwDetection.memory).to eq(@ramsize) + end + + it "sums detected memory sizes" do + SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory, @memory]) + expect(Yast2::HwDetection.memory).to eq(2*@ramsize) + end + + it "ignores non-memory devices" do + SCR.should_receive(:Read).with(path(".probe.memory")).and_return([@memory, @non_memory]) + expect(Yast2::HwDetection.memory).to eq(@ramsize) + end + + it "raises exception when detection fails" do + SCR.should_receive(:Read).with(path(".probe.memory")).and_return(nil) + expect{Yast2::HwDetection.memory}.to raise_error + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/package/yast2.changes new/yast2-3.1.19/package/yast2.changes --- old/yast2-3.1.18/package/yast2.changes 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/package/yast2.changes 2014-02-21 10:52:55.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Feb 10 13:18:52 UTC 2014 - [email protected] + +- added memory detection code (gh#yast/yast-packager#33) +- 3.1.19 + +------------------------------------------------------------------- Wed Feb 5 11:26:09 CET 2014 - [email protected] - Check for Chef outside in the yast2 shell script to catch modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/package/yast2.spec new/yast2-3.1.19/package/yast2.spec --- old/yast2-3.1.18/package/yast2.spec 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/package/yast2.spec 2014-02-21 10:52:55.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.18 +Version: 3.1.19 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -208,6 +208,7 @@ %{yast_ydatadir}/*.ycp %{yast_clientdir}/* %{yast_moduledir}/* +%{yast_libdir}/* %{yast_scrconfdir}/* %{yast_ybindir}/* %{yast_agentdir}/ag_* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.18/scripts/save_y2logs new/yast2-3.1.19/scripts/save_y2logs --- old/yast2-3.1.18/scripts/save_y2logs 2014-02-05 14:12:29.000000000 +0100 +++ new/yast2-3.1.19/scripts/save_y2logs 2014-02-21 10:52:55.000000000 +0100 @@ -71,6 +71,10 @@ LIST="$LIST /etc/X11/xorg.conf" fi +if [ -f /etc/X11/xorg.conf.install ]; then + LIST="$LIST /etc/X11/xorg.conf.install" +fi + if [ -f /var/log/Xorg.0.log ]; then LIST="$LIST /var/log/Xorg.0.log" fi -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
