Skip to content

Commit

Permalink
Merge branch 'SLE-12-SP2-CASP' into add-minimalistic-libzypp-config-m…
Browse files Browse the repository at this point in the history
…aster

* SLE-12-SP2-CASP:
  Add log message when zypp.conf is adapted
  Adjust tests to zypp.conf augeas handling
  minimalistic_configuration -> minimalistic_libzypp_config
  Fix ProductFeatures.GetBooleanFeature reference
  Add zypp_conf.rb file to package
  Add a flag to control libzypp minimalistic config
  Add a writing example for CFA::ZyppConf class
  Update Travis dependencies
  Add augeas-lenses dependency
  Drop ZyppConf module
  Add a pretty minimal test for ZyppConf class
  Use CFA to handle /etc/zypp/zypp.conf
  packaging
  using sed to write zypp.conf in the installed system instead of copying
  packaging
  copy zypp.conf from inst_sys to target_system
  • Loading branch information
imobachgs committed Jan 16, 2017
2 parents 315c9fd + af66e60 commit 8781484
Show file tree
Hide file tree
Showing 8 changed files with 1,352 additions and 1 deletion.
8 changes: 8 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Dec 21 15:06:31 CET 2016 - schubi@suse.de

- Patch /etc/zypp/zypp.conf in the installed system when
software/minimalistic_libzypp_config is enabled in the control
file (FATE#321764)
- 3.2.11

-------------------------------------------------------------------
Thu Dec 1 08:03:05 UTC 2016 - lslezak@suse.cz

Expand Down
10 changes: 9 additions & 1 deletion package/yast2-packager.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 3.2.10
Version: 3.2.11
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand All @@ -41,6 +41,9 @@ BuildRequires: yast2_theme
# Pkg::SourceSetPriority()
BuildRequires: yast2-pkg-bindings >= 3.2.1

# Augeas lenses
BuildRequires: augeas-lenses

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

Expand All @@ -65,6 +68,9 @@ Requires: /usr/bin/md5sum
# .process agent
Requires: yast2-core >= 2.16.35

# Augeas lenses
Requires: augeas-lenses

# setenv() builtin
Conflicts: yast2-core < 2.15.10

Expand Down Expand Up @@ -119,9 +125,11 @@ rake install DESTDIR="%{buildroot}"
%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
32 changes: 32 additions & 0 deletions src/lib/packager/cfa/zypp_conf.rb
@@ -0,0 +1,32 @@
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!
data["main"]["solver.onlyRequires"] = "true"
data["main"]["rpm.install.excludedocs"] = "yes"
data["main"]["multiversion"] = nil
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 8781484

Please sign in to comment.