Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/SLE-12-SP2-CASP' into caasp_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Aug 4, 2017
2 parents 19a4a50 + b19cb79 commit d66bbce
Show file tree
Hide file tree
Showing 16 changed files with 1,710 additions and 173 deletions.
2 changes: 1 addition & 1 deletion Rakefile
@@ -1,6 +1,6 @@
require "yast/rake"

Yast::Tasks.submit_to(ENV["YAST_SUBMIT"] ? ENV["YAST_SUBMIT"].to_sym : :sle12sp2)
Yast::Tasks.submit_to(ENV["YAST_SUBMIT"] ? ENV["YAST_SUBMIT"].to_sym : :casp10)

Yast::Tasks.configuration do |conf|
#lets ignore license check for now
Expand Down
42 changes: 39 additions & 3 deletions package/yast2-packager.changes
Expand Up @@ -9,7 +9,7 @@ Thu Jul 27 11:12:01 CEST 2017 - schubi@suse.de
- 3.1.123

-------------------------------------------------------------------
Tue Mar 7 09:37:15 CET 2017 - schubi@suse.de
Tue Mar 28 09:37:15 CET 2017 - schubi@suse.de

- Product selection: Do not reinstall already installed products
or products which are already included in another product.
Expand All @@ -21,6 +21,19 @@ Tue Mar 7 09:37:15 CET 2017 - schubi@suse.de
(bnc#1014861)
- 3.1.122

-------------------------------------------------------------------
Fri Mar 24 13:53:40 UTC 2017 - mvidner@suse.com

- Do not ignore solver problems after touching the partitioning
(bsc#1029306)
- 3.1.121.3

-------------------------------------------------------------------
Mon Mar 20 12:33:35 UTC 2017 - jreidinger@suse.com

- make minimal changes when modify zypp.conf (bsc#1023204)
- 3.1.121.2

-------------------------------------------------------------------
Wed Feb 1 16:03:24 UTC 2017 - jreidinger@suse.com

Expand All @@ -30,14 +43,37 @@ Wed Feb 1 16:03:24 UTC 2017 - jreidinger@suse.com
iso:/test?iso=test.iso&path=url%3A%2Finstall
- Fix editing of iso:/ without triple slash that previously caused
lost of first element of path
- 3.1.121
- 3.1.121.1

-------------------------------------------------------------------
Mon Jan 30 10:57:14 UTC 2017 - igonzalezsosa@suse.com

- Packages module is able to perform a package selection proposal
during system upgrade (bsc#1009834)
- 3.1.120
- 3.1.120.1

-------------------------------------------------------------------
Tue Jan 24 13:15:46 UTC 2017 - jsrain@suse.cz

- do not check content file on media if there is none in the
ramdisk (fate#322276)
- 3.1.119.3

-------------------------------------------------------------------
Wed Dec 21 15:06:31 CET 2016 - schubi@suse.de

- Removed: Copy /etc/zypp/zypp.conf from inst_sys to target system.
Instead: Patching /etc/zypp/zypp.conf in the installed system
directly.
(FATE#321764)
- 3.1.119.2

-------------------------------------------------------------------
Thu Dec 8 17:56:24 CET 2016 - schubi@suse.de

- Copy /etc/zypp/zypp.conf from inst_sys to target system.
(FATE#321764)
- 3.1.119.1

-------------------------------------------------------------------
Wed Nov 9 16:31:50 UTC 2016 - igonzalezsosa@suse.com
Expand Down
12 changes: 12 additions & 0 deletions package/yast2-packager.spec
Expand Up @@ -32,13 +32,17 @@ BuildRequires: yast2-testsuite
BuildRequires: yast2-xml
BuildRequires: yast2_theme
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(cfa) >= 0.5.0

# Packages::Repository and Packages::Product classes
BuildRequires: yast2 >= 3.1.187

# Pkg::SourceRawURL() and Pkg:ExpandedUrl()
BuildRequires: yast2-pkg-bindings >= 3.1.30

# Augeas lenses
BuildRequires: augeas-lenses

# Newly added RPM
Requires: yast2-country-data >= 2.16.3

Expand All @@ -63,6 +67,12 @@ Requires: /usr/bin/md5sum
# .process agent
Requires: yast2-core >= 2.16.35

# 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

Expand Down Expand Up @@ -115,9 +125,11 @@ This package contains the libraries and modules for software management.
%dir %{yast_yncludedir}/checkmedia
%dir %{yast_yncludedir}/packager
%dir %{yast_libdir}/packager
%dir %{yast_libdir}/packager/cfa
%{yast_yncludedir}/checkmedia/*
%{yast_yncludedir}/packager/*
%{yast_libdir}/packager/*
%{yast_libdir}/packager/cfa/*
%{yast_clientdir}/*.rb
%{yast_moduledir}/*
%{yast_desktopdir}/*.desktop
Expand Down
9 changes: 7 additions & 2 deletions src/Makefile.am
Expand Up @@ -72,8 +72,13 @@ desktop_DATA = \

ylibclientdir = "${yast2dir}/lib/packager/clients"
ylibclient_DATA = \
lib/packager/clients/pkg_finish.rb
lib/packager/clients/pkg_finish.rb \
lib/packager/clients/software_proposal.rb

EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(ynclude1_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(desktop_DATA) $(ylibclient_DATA) $(ylib_DATA)
ylibcfadir = "${yast2dir}/lib/packager/cfa"
ylibcfa_DATA = \
lib/packager/cfa/zypp_conf.rb

EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(ynclude1_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(desktop_DATA) $(ylibclient_DATA) $(ylib_DATA) $(ylibcfa_DATA)

include $(top_srcdir)/Makefile.am.common
159 changes: 2 additions & 157 deletions src/clients/software_proposal.rb
@@ -1,157 +1,2 @@
# encoding: utf-8

# Module: software_proposal.ycp
#
# Author: Klaus Kaempf <kkaempf@suse.de>
#
# Purpose: Proposal function dispatcher - software.
#
# See also file proposal-API.txt for details.
#
# $Id$
#
module Yast
class SoftwareProposalClient < Client
def main
Yast.import "Pkg"
textdomain "packager"

Yast.import "Packages"
Yast.import "Language"
Yast.import "Installation"

@func = Convert.to_string(WFM.Args(0))
@param = Convert.to_map(WFM.Args(1))
@ret = {}

if @func == "MakeProposal"
@force_reset = Ops.get_boolean(@param, "force_reset", false)
@language_changed = Ops.get_boolean(@param, "language_changed", false)

@reinit = false
@partition_changed = false

if Installation.dirinstall_installing_into_dir
# check the target directory in dirinstall mode
if Packages.timestamp != Installation.dirinstall_target_time
@partition_changed = true
end
# save information about target change time in module Packages
Packages.timestamp = Installation.dirinstall_target_time
else
@storage_timestamp = Convert.to_integer(
WFM.call("wrapper_storage", ["GetTargetChangeTime"])
)

# check the partitioning in installation
if Packages.timestamp != @storage_timestamp
# don't set flag partition_changed if it's the first "change"
@partition_changed = true if Packages.timestamp != 0
end
# save information about target change time in module Packages
Packages.timestamp = @storage_timestamp
end

if Pkg.GetPackageLocale != Language.language
@language_changed = true
Pkg.SetPackageLocale(Language.language)
end
if !Builtins.contains(Pkg.GetAdditionalLocales, Language.language)
# FIXME this is temporary fix
# language_changed = true;
Pkg.SetAdditionalLocales(
Builtins.add(Pkg.GetAdditionalLocales, Language.language)
)
end

# if only partitioning has been changed just return the current state,
# don't reset to default (bnc#450786, bnc#371875)
if @partition_changed && !@language_changed && !@force_reset && !Packages.PackagesProposalChanged
return Packages.Summary([ :product, :pattern, :selection, :size, :desktop ], false);
end

@reinit = true if @language_changed
Builtins.y2milestone(
"package proposal: force reset: %1, reinit: %2, language changed: %3",
@force_reset,
@reinit,
@language_changed
)
@ret = Packages.Proposal(
@force_reset, # user decision: reset to default
@reinit, # reinitialize due to language or partition change
false
) # simple version

if @language_changed && !@force_reset
# if the language has changed the software proposal is reset to the default settings
if !Builtins.haskey(@ret, "warning")
# the language_changed flag has NOT been set by the NLD frame
@ret = Builtins.add(
@ret,
"warning",
_("The software proposal is reset to the default values.")
)
end
end
if Ops.greater_than(Packages.solve_errors, 0)
# the proposal for the packages requires manual intervention
@ret = Builtins.union(
@ret,
{
# warning text
"warning" => _(
"Cannot solve dependencies automatically. Manual intervention is required."
),
"warning_level" => :blocker
}
)
end
elsif @func == "AskUser"
@has_next = Ops.get_boolean(@param, "has_next", false)

# call some function that displays a user dialog
# or a sequence of dialogs here:
#
# sequence = DummyMod::AskUser( has_next );

@chosen_id = Ops.get(@param, "chosen_id")
if @chosen_id == "mediacheck"
@result = Convert.to_symbol(WFM.CallFunction("checkmedia", WFM.Args))
@ret = { "workflow_sequence" => @result }
else
@result = :again
@client_to_call = "inst_sw_select"

while @result == :again
@result = Convert.to_symbol(
WFM.CallFunction(@client_to_call, [true, true])
)
end

# Fill return map

@ret = { "workflow_sequence" => @result }
end
elsif @func == "Description"
# disable proposal if doing image-only installation
return nil if Installation.image_only
# Fill return map.
#
# Static values do just nicely here, no need to call a function.

@ret = {
# this is a heading
"rich_text_title" => _("Software"),
# this is a menu entry
"menu_title" => _("&Software"),
"id" => "software_stuff"
}
end

deep_copy(@ret)
end
end
end

Yast::SoftwareProposalClient.new.main
require "packager/clients/software_proposal"
Yast::SoftwareProposalClient.new.run
37 changes: 37 additions & 0 deletions src/lib/packager/cfa/zypp_conf.rb
@@ -0,0 +1,37 @@
require "cfa/base_model"
require "cfa/augeas_parser"
require "cfa/matcher"

module Yast
module Packager
module CFA
# Represents a Zypper configuration file.
class ZyppConf < ::CFA::BaseModel
# Configuration parser
PARSER = ::CFA::AugeasParser.new("puppet.lns")
# Path to configuration file
PATH = "/etc/zypp/zypp.conf".freeze

def initialize(file_handler: nil)
super(PARSER, PATH, file_handler: file_handler)
end

# Set options to keep a minimalistic package selection
def set_minimalistic!
tree = data["main"]
if !tree
tree = ::CFA::AugeasTree.new
data["main"] = tree
end
generic_set("solver.onlyRequires", "true", tree)
generic_set("rpm.install.excludedocs", "yes", tree)
generic_set("multiversion", nil, tree)
end

def section(name)
data[name]
end
end
end
end
end
20 changes: 20 additions & 0 deletions src/lib/packager/clients/pkg_finish.rb
Expand Up @@ -15,6 +15,7 @@

require "installation/finish_client"
require "packages/repository"
require "packager/cfa/zypp_conf"

module Yast
class PkgFinishClient < ::Installation::FinishClient
Expand Down Expand Up @@ -43,6 +44,7 @@ def initialize
Yast.import "FileUtils"
Yast.import "Packages"
Yast.import "Directory"
Yast.import "ProductFeatures"
end

# @see Implements ::Installation::FinishClient#modes
Expand Down Expand Up @@ -80,6 +82,13 @@ def write
# (needs to be done _after_ saving repositories, see bnc#700881)
Pkg.SourceCacheCopyTo(Installation.destdir)

# Patching /etc/zypp/zypp.conf in order not to install
# recommended packages, doc-packages,...
# (needed for products like CASP)
if ProductFeatures.GetBooleanFeature("software", "minimalistic_libzypp_config")
set_minimalistic_libzypp_conf
end

# copy list of failed packages to installed system
if File.exist?(FAILED_PKGS_PATH)
::FileUtils.cp(FAILED_PKGS_PATH, File.join(Installation.destdir, FAILED_PKGS_PATH),
Expand Down Expand Up @@ -194,5 +203,16 @@ def sync_target_sources
Pkg.TargetFinish
Pkg.TargetInitialize(Installation.destdir)
end

# Set libzypp configuration to install the minimal amount of packages
#
# @see Yast::Packager::CFA::ZyppConf#set_minimalistic!
def set_minimalistic_libzypp_conf
log.info("Setting libzypp configuration as minimalistic")
config = Packager::CFA::ZyppConf.new
config.load
config.set_minimalistic!
config.save
end
end
end

0 comments on commit d66bbce

Please sign in to comment.