Hello community, here is the log from the commit of package yast2-journal for openSUSE:Factory checked in at 2018-06-20 15:30:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-journal (Old) and /work/SRC/openSUSE:Factory/.yast2-journal.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-journal" Wed Jun 20 15:30:13 2018 rev:8 rq:617524 version:4.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-journal/yast2-journal.changes 2018-04-16 12:47:15.648884536 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-journal.new/yast2-journal.changes 2018-06-20 15:31:25.401931664 +0200 @@ -1,0 +2,7 @@ +Mon Jun 18 14:21:20 UTC 2018 - jreidin...@suse.com + +- Allow to reuse journal viewer from other yast modules + (needed for bsc#1008493) +- 4.1.0 + +------------------------------------------------------------------- Old: ---- yast2-journal-4.0.0.tar.bz2 New: ---- yast2-journal-4.1.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-journal.spec ++++++ --- /var/tmp/diff_new_pack.PJxt7C/_old 2018-06-20 15:31:26.545890159 +0200 +++ /var/tmp/diff_new_pack.PJxt7C/_new 2018-06-20 15:31:26.549890014 +0200 @@ -17,7 +17,7 @@ Name: yast2-journal -Version: 4.0.0 +Version: 4.1.0 Release: 0 BuildArch: noarch ++++++ yast2-journal-4.0.0.tar.bz2 -> yast2-journal-4.1.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/.travis.yml new/yast2-journal-4.1.0/.travis.yml --- old/yast2-journal-4.0.0/.travis.yml 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/.travis.yml 2018-06-18 16:29:21.000000000 +0200 @@ -8,4 +8,4 @@ script: # the "yast-travis-ruby" script is included in the base yastdevel/ruby image # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby - - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-journal-image yast-travis-ruby + - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-journal-image yast-travis-ruby -y diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/example/README.md new/yast2-journal-4.1.0/example/README.md --- old/yast2-journal-4.0.0/example/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-journal-4.1.0/example/README.md 2018-06-18 16:29:21.000000000 +0200 @@ -0,0 +1,12 @@ +# Examples + +## How to Run + +This directory allows to check how some UI will look into various circumstances. + +As it use real systemd journal it have to be run as root. It is also recommended +to run with sources in current git checkout. + +Example how to run: + +`# Y2DIR=../src/ /sbin/yast2 ./log_viewer tftp` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/example/log_viewer.rb new/yast2-journal-4.1.0/example/log_viewer.rb --- old/yast2-journal-4.0.0/example/log_viewer.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-journal-4.1.0/example/log_viewer.rb 2018-06-18 16:29:21.000000000 +0200 @@ -0,0 +1,10 @@ +require "yast" + +require "systemd_journal/entries_dialog" +require "systemd_journal/query" + +params = Yast::WFM.Args +raise "missing param for log entries" if params.empty? + +query = SystemdJournal::Query.new(interval: "0", filters: { "unit" => params }) +SystemdJournal::EntriesDialog.new(query: query).run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/package/yast2-journal.changes new/yast2-journal-4.1.0/package/yast2-journal.changes --- old/yast2-journal-4.0.0/package/yast2-journal.changes 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/package/yast2-journal.changes 2018-06-18 16:29:21.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Jun 18 14:21:20 UTC 2018 - jreidin...@suse.com + +- Allow to reuse journal viewer from other yast modules + (needed for bsc#1008493) +- 4.1.0 + +------------------------------------------------------------------- Fri Apr 6 18:51:45 UTC 2018 - mfi...@suse.com - bnc#1087957 - version bump diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/package/yast2-journal.spec new/yast2-journal-4.1.0/package/yast2-journal.spec --- old/yast2-journal-4.0.0/package/yast2-journal.spec 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/package/yast2-journal.spec 2018-06-18 16:29:21.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-journal -Version: 4.0.0 +Version: 4.1.0 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/src/lib/systemd_journal/entries_dialog.rb new/yast2-journal-4.1.0/src/lib/systemd_journal/entries_dialog.rb --- old/yast2-journal-4.0.0/src/lib/systemd_journal/entries_dialog.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/src/lib/systemd_journal/entries_dialog.rb 2018-06-18 16:29:21.000000000 +0200 @@ -28,11 +28,12 @@ module SystemdJournal # Dialog to display journal entries with several filtering options class EntriesDialog < UI::Dialog - def initialize - super + # @param query [Query] optional initial query + def initialize(query: nil) + super() textdomain "journal" - @query = QueryPresenter.new + @query = QueryPresenter.new(query) execute_query end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/src/lib/systemd_journal/entry.rb new/yast2-journal-4.1.0/src/lib/systemd_journal/entry.rb --- old/yast2-journal-4.0.0/src/lib/systemd_journal/entry.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/src/lib/systemd_journal/entry.rb 2018-06-18 16:29:21.000000000 +0200 @@ -24,23 +24,32 @@ # An entry in the systemd journal class Entry attr_reader :raw, :timestamp, :uid, :gid, :pid, :process_name, :cmdline, - :syslog_id, :unit, :machine_id, :hostname, :message + :syslog_id, :unit, :machine_id, :hostname, :message, :priority # Used internally to get the entries in a parseable format JOURNALCTL_OPTS = { "no-pager" => nil, "output" => "json" }.freeze + JSON_MAPPING = { + uid: "_UID", + gid: "_GID", + pid: "_PID", + process_name: "_COMM", + cmdline: "_CMDLINE", + syslog_id: "SYSLOG_IDENTIFIER", + unit: "UNIT", + machine_id: "_MACHINE_ID", + hostname: "_HOSTNAME", + message: "MESSAGE", + priority: "PRIORITY" + }.freeze + + private_constant :JSON_MAPPING + def initialize(json) @raw = JSON.parse(json) - @uid = @raw["_UID"] - @gid = @raw["_GID"] - @pid = @raw["_PID"] - @process_name = @raw["_COMM"] - @cmdline = @raw["_CMDLINE"] - @syslog_id = @raw["SYSLOG_IDENTIFIER"] - @unit = @raw["_SYSTEMD_UNIT"] - @machine_id = @raw["_MACHINE_ID"] - @hostname = @raw["_HOSTNAME"] - @message = @raw["MESSAGE"] + JSON_MAPPING.each_pair do |variable, json_key| + instance_variable_set(:"@#{variable}", @raw[json_key]) + end @timestamp = Time.at(@raw["__REALTIME_TIMESTAMP"].to_f / 1_000_000) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/src/lib/systemd_journal/query.rb new/yast2-journal-4.1.0/src/lib/systemd_journal/query.rb --- old/yast2-journal-4.0.0/src/lib/systemd_journal/query.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/src/lib/systemd_journal/query.rb 2018-06-18 16:29:21.000000000 +0200 @@ -37,10 +37,11 @@ # Creates a new query based on the time interval and some additional filters # - # @param interval [Array,Hash,#to_s] Time interval, can take several forms: + # @param interval [Array,Hash,#to_s,nil] Time interval, can take several forms: # * Array of two elements with starting and ending time # * Hash with two possible keys :since and :until # * An scalar value to be passed to the --boot argument of journalctl + # * Nil which means no time restriction # In the first two cases, the values can be Time objects or strings of # any format accepted by journalctl for --until and --since # @param filters [Hash] The keys must match one of the VALID_FILTERS. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/src/lib/systemd_journal/query_dialog.rb new/yast2-journal-4.1.0/src/lib/systemd_journal/query_dialog.rb --- old/yast2-journal-4.0.0/src/lib/systemd_journal/query_dialog.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/src/lib/systemd_journal/query_dialog.rb 2018-06-18 16:29:21.000000000 +0200 @@ -117,7 +117,7 @@ filters[name] = value unless value.empty? end - QueryPresenter.new(interval: interval, filters: filters) + QueryPresenter.new(Query.new(interval: interval, filters: filters)) end def interval_widget diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/src/lib/systemd_journal/query_presenter.rb new/yast2-journal-4.1.0/src/lib/systemd_journal/query_presenter.rb --- old/yast2-journal-4.0.0/src/lib/systemd_journal/query_presenter.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/src/lib/systemd_journal/query_presenter.rb 2018-06-18 16:29:21.000000000 +0200 @@ -30,20 +30,21 @@ TIME_FORMAT = "%b %d %H:%M:%S".freeze - def initialize(args = {}) + def initialize(query = nil) textdomain "journal" - # Redefine default values - query_args = { - interval: { - since: QueryPresenter.default_since, - until: QueryPresenter.default_until - }, - filters: {} - } - query_args.merge!(args) + if !query + # Redefine default values + query_args = { + interval: { + since: QueryPresenter.default_since, + until: QueryPresenter.default_until + }, + filters: {} + } - query = Query.new(query_args) + query = Query.new(query_args) + end __setobj__(query) end @@ -82,12 +83,16 @@ _("Since system's boot") when "-1" _("From previous boot") - else + when Hash dates = { since: Yast::Builtins.strftime(interval[:since], TIME_FORMAT), until: Yast::Builtins.strftime(interval[:until], TIME_FORMAT) } _("Between %{since} and %{until}") % dates + when nil + _("No time restriction") + else + raise "Unexpected interval value #{interval.inspect}" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/test/entries_dialog_test.rb new/yast2-journal-4.1.0/test/entries_dialog_test.rb --- old/yast2-journal-4.0.0/test/entries_dialog_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-journal-4.1.0/test/entries_dialog_test.rb 2018-06-18 16:29:21.000000000 +0200 @@ -0,0 +1,56 @@ +#! /usr/bin/rspec +# 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 or 3 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 SUSE LLC. + +# To contact SUSE about this file by physical or electronic mail, +# you may find current contact information at www.suse.com + +require_relative "spec_helper" +require "systemd_journal/entries_dialog" +require "systemd_journal/query" + +describe SystemdJournal::EntriesDialog do + let(:query) do + query = SystemdJournal::Query.new + allow(query).to receive(:execute) + allow(query).to receive(:entries).and_return([]) + query + end + subject { described_class.new(query: query) } + + describe "#initialize" do + it "can get optional query" do + expect { described_class.new(query: query) }.to_not raise_error + end + + it "executes query" do + expect(query).to receive(:execute) + + described_class.new(query: query) + end + end + + describe "#dialog_content" do + it "returns Term" do + expect(subject.dialog_content).to be_a(Yast::Term) + end + end + + describe "#dialog_options" do + it "returns Term" do + expect(subject.dialog_options).to be_a(Yast::Term) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-journal-4.0.0/test/spec_helper.rb new/yast2-journal-4.1.0/test/spec_helper.rb --- old/yast2-journal-4.0.0/test/spec_helper.rb 2018-04-09 11:06:00.000000000 +0200 +++ new/yast2-journal-4.1.0/test/spec_helper.rb 2018-06-18 16:29:21.000000000 +0200 @@ -30,8 +30,7 @@ add_filter "/test/" end - # for coverage we need to load all ruby files - Dir["#{SRC_PATH}/lib/**/*.rb"].each { |f| require_relative f } + SimpleCov.track_files("#{SRC_PATH}/**/*.rb") # use coveralls for on-line code coverage reporting at Travis CI if ENV["TRAVIS"]