Skip to content

Commit

Permalink
Add delta rpms to module and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Moravec committed Dec 12, 2013
1 parent e4ae890 commit 3c9dec8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/include/online-update-configuration/OUCDialogs.rb
Expand Up @@ -69,6 +69,7 @@ def initialize_online_update_configuration_OUCDialogs(include_target)
@skipInteractivePatches = _("Skip Interactive Patches")
@autoAgreeWithLicenses = _("Agree with Licenses")
@includeRecommends = _("Include Recommended Packages")
@use_delta_rpm = _("Use delta rpms")
@currentUpdateRepo = _("Current Update Repository:")
@needToRegister = _(
"In order to add the default update repository\nyou have to register this product."
Expand Down Expand Up @@ -212,6 +213,14 @@ def getOUCDialog(type)
OnlineUpdateConfiguration.includeRecommends == true ? true : false
)
),
VSpacing(0.2),
Left(
CheckBox(
Id(:use_delta_rpm),
@use_delta_rpm,
OnlineUpdateConfiguration.use_delta_rpm
)
),
VSpacing(0.8),
CheckBoxFrame(
Id(:category),
Expand Down
35 changes: 35 additions & 0 deletions src/lib/online-update-configuration/zypp_config.rb
@@ -0,0 +1,35 @@
module ZyppConfiguration
CONFIG_USE_DELTA_RPM = '.etc.zypp_conf.value.main.\"download.use_deltarpm\"'

def zypp_config
@config ||= ZyppConfig.new
end

class ZyppConfig
def use_delta_rpm?
current_config = delta_rpm_config_value
# Default settings in zypp.conf for using delta rpms is true
current_config == nil || current_config == 'true'
end

def activate_delta_rpm
set_config_value(true)
end

def deactivate_delta_rpm
set_config_value(false)
end

private

def set_config_value new_value
return if new_value == use_delta_rpm?
Yast::SCR.Write(Yast::Path.new(CONFIG_USE_DELTA_RPM), new_value)
end

def delta_rpm_config_value
Yast::SCR.Read(Yast::Path.new(CONFIG_USE_DELTA_RPM))
end
end
end

8 changes: 8 additions & 0 deletions src/modules/OnlineUpdateConfiguration.rb
Expand Up @@ -28,9 +28,12 @@
#
# $Id: OnlineUpdateConfiguration.ycp 1 2008-09-10 09:45:05Z jdsn $
require "yast"
require "online-update-configuration/zypp_config"

module Yast
class OnlineUpdateConfigurationClass < Module
include ZyppConfiguration

def main
Yast.import "Pkg"

Expand All @@ -45,6 +48,7 @@ def main
@skipInteractivePatches = true
@autoAgreeWithLicenses = false
@includeRecommends = false
@use_delta_rpm = true
@updateInterval = :weekly
@currentCategories = []
@OUCmodified = false
Expand Down Expand Up @@ -546,6 +550,8 @@ def Read
path(".sysconfig.automatic_online_update.AOU_PATCH_CATEGORIES")
)
)
@use_delta_rpm = zypp_config.use_delta_rpm?

@currentCategories = Builtins.splitstring(patchCategories, " ")
@currentCategories = Builtins.filter(@currentCategories) do |s|
s != nil && s != ""
Expand Down Expand Up @@ -617,6 +623,7 @@ def Write
path(".sysconfig.automatic_online_update.AOU_INCLUDE_RECOMMENDS"),
@includeRecommends == true ? "true" : "false"
)
@use_delta_rpm ? zypp_config.activate_delta_rpm : zypp_config.deactivate_delta_rpm
catConf = ""
if Ops.greater_than(Builtins.size(@currentCategories), 0)
catConf = Builtins.mergestring(@currentCategories, " ")
Expand Down Expand Up @@ -665,6 +672,7 @@ def Export
publish :variable => :skipInteractivePatches, :type => "boolean"
publish :variable => :autoAgreeWithLicenses, :type => "boolean"
publish :variable => :includeRecommends, :type => "boolean"
publish :variable => :use_delta_rpm, :type => "boolean"
publish :variable => :updateInterval, :type => "symbol"
publish :variable => :currentCategories, :type => "list <string>"
publish :variable => :OUCmodified, :type => "boolean"
Expand Down

0 comments on commit 3c9dec8

Please sign in to comment.