Skip to content

Commit

Permalink
Merge 60f0098 into 7ccdb95
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Mar 8, 2021
2 parents 7ccdb95 + 60f0098 commit 70a3ac9
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 2 deletions.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Mar 8 14:31:30 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

- Extend the special installer configuration dialog with
repository options (jsc#PM-1895, jsc#SLE-16263)
- 4.3.16

-------------------------------------------------------------------
Fri Mar 5 10:41:42 UTC 2021 - Ancor Gonzalez Sosa <ancor@suse.com>

Expand Down
4 changes: 2 additions & 2 deletions package/yast2-packager.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 4.3.15
Version: 4.3.16
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down Expand Up @@ -116,8 +116,8 @@ This package contains the libraries and modules for software management.
%{yast_yncludedir}/packager/*
%{yast_libdir}/language_tag.rb
%{yast_libdir}/packager/*
%{yast_libdir}/packager/cfa/*
%{yast_libdir}/y2packager/*
%{yast_libdir}/installation/*
%{yast_clientdir}/*.rb
%{yast_moduledir}/*
%{yast_desktopdir}/*.desktop
Expand Down
53 changes: 53 additions & 0 deletions src/lib/installation/console/plugins/repositories_button.rb
@@ -0,0 +1,53 @@
# ------------------------------------------------------------------------------
# Copyright (c) 2021 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.
#
# ------------------------------------------------------------------------------

require "yast"

require "cwm"
require "installation/console/menu_plugin"

module Installation
module Console
module Plugins
# define a CWM widget for starting repository configuration
class RepositoriesButton < CWM::PushButton
def initialize
textdomain "packager"
end

def label
# TRANSLATORS: a button label, it starts the repository configuration
_("Configure Software Repositories...")
end

def help
# TRANSLATORS: help text
_("<p>If you need to use an additional repository for installing packages " \
"then use the <b>Configure Software Repositories</b> button.</p>")
end

def handle
Yast::WFM.call("repositories")
nil
end
end

# define a console plugin
class RepositoriesButtonPlugin < MenuPlugin
def widget
RepositoriesButton.new
end
end
end
end
end
38 changes: 38 additions & 0 deletions src/lib/installation/console/plugins/repositories_command.rb
@@ -0,0 +1,38 @@
# ------------------------------------------------------------------------------
# Copyright (c) 2021 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.
#
# ------------------------------------------------------------------------------

require "pp"
require "yast"

module Installation
module Console
# define the "repositories" command in the expert console
class Commands
def repositories
Yast.import "Pkg"

repos = Yast::Pkg.SourceGetCurrent(false).map do |repo|
Yast::Pkg.SourceGeneralData(repo)
end

pp repos
end

private

def repositories_description
"Dump the details of the currently defined software repositories"
end
end
end
end
40 changes: 40 additions & 0 deletions test/lib/installation/plugins/repositories_button_test.rb
@@ -0,0 +1,40 @@
# Copyright (c) [2021] 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 SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require_relative "../../../test_helper"
require "installation/console/plugins/repositories_button"

require "cwm/rspec"

describe Installation::Console::Plugins::RepositoriesButton do
before do
allow(Yast::WFM).to receive(:call)
end

include_examples "CWM::PushButton"
end

describe Installation::Console::Plugins::RepositoriesButtonPlugin do
context "#widget" do
it "returns a CWM widget" do
w = subject.widget
expect(w).to be_a(CWM::AbstractWidget)
end
end
end

0 comments on commit 70a3ac9

Please sign in to comment.