Skip to content

Commit

Permalink
Merge branch 'master' into nativerubymethods
Browse files Browse the repository at this point in the history
Actually this was done with
  git merge -X ours --no-commit master
and then
  for F in library/types/src/modules/URL.rb library/types/test/url_test.rb; do
    git show HEAD:$F > $F
    git add $F
  done
to recover from the revert of these two files in master.
This was trickier than I thought :-/
  • Loading branch information
mvidner committed Jan 13, 2015
2 parents 177d509 + af5ce1c commit 46feb49
Show file tree
Hide file tree
Showing 34 changed files with 901 additions and 66 deletions.
1 change: 0 additions & 1 deletion library/desktop/groups/hardware.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Hardware
X-SuSE-YaST-SortKey=20
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/high_availability.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=High_Availability
X-SuSE-YaST-SortKey=20
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/misc.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Misc
X-SuSE-YaST-SortKey=99
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/network_devices.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Network
X-SuSE-YaST-SortKey=30
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/network_services.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Net_advanced
X-SuSE-YaST-SortKey=40
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/security.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Security
X-SuSE-YaST-SortKey=50
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/software.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Software
X-SuSE-YaST-SortKey=10
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/support.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=Support
X-SuSE-YaST-SortKey=90
Expand Down
1 change: 0 additions & 1 deletion library/desktop/groups/system.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Categories=Qt;X-SuSE-YaST;

X-KDE-ModuleType=Library
X-KDE-HasReadOnlyMode=true
X-KDE-Library=yast2

X-SuSE-YaST-Group=System
X-SuSE-YaST-SortKey=20
Expand Down
8 changes: 7 additions & 1 deletion library/general/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ ydata_DATA = \
fillup_DATA = \
fillup/sysconfig.yast2

EXTRA_DIST = $(module_DATA) $(client_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(ydata_DATA) $(fillup_DATA)
ylibdir = "${yast2dir}/lib/installation"
ylib_DATA = \
lib/installation/auto_client.rb \
lib/installation/finish_client.rb \
lib/installation/proposal_client.rb

EXTRA_DIST = $(module_DATA) $(client_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(ydata_DATA) $(fillup_DATA) $(ylib_DATA)

include $(top_srcdir)/Makefile.am.common
2 changes: 1 addition & 1 deletion library/general/src/fillup/sysconfig.yast2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# presence and adapt accordingly
WANTED_SHELL="auto"

## Type: list(auto,qt,gtk,ncurses)
## Type: list(auto,qt,ncurses)
## Default: "auto"
# Default UI backend for YaST
# selects the GUI plugin to be used to render yast widgets
Expand Down
146 changes: 146 additions & 0 deletions library/general/src/lib/installation/auto_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
require "yast"

module Installation
# An abstract class that simplifies writing `*_auto.rb` clients for AutoYaST.
#
# It provides a single entry point
# which dispatches calls to the abstract methods that all proposal clients
# need to implement.
#
# You need to implement all the methods, except {#packages}.
#
# "Autoinstall" basically means {#import}, then {#write}.
# "Clone" means {#read}, then {#export}.
#
# @example how to run a client
# require "installation/example_auto"
# ::Installation::ExampleAuto.run
#
# @see https://github.com/yast/yast-bootloader/blob/master/src/clients/bootloader_auto.rb
# Example client, bootloader_auto.rb
# @see http://users.suse.com/~ug/autoyast_doc/devel/ar01s05.html
# Code-related configuration and some old documenation.
class AutoClient < Yast::Client
include Yast::Logger

# Entry point for calling the client.
# The only part needed in client rb file.
# @return response from abstract methods
def self.run
self.new.run
end

# Dispatches to abstract method based on passed Arguments to client
def run
func, param = Yast::WFM.Args
log.info "Called #{self.class}.run with #{func} and params #{param}"

case func
when "Import"
import(param)
when "Export"
export
when "Summary"
summary
when "Reset"
reset
when "Change"
change
when "Write"
write
when "Packages"
packages
when "Read"
read
when "GetModified"
modified?
when "SetModified"
modified
else
raise ArgumentError, "Invalid action for auto client '#{func.inspect}'"
end
end

protected

# Import data from AutoYaST profile.
#
# The profile is a Hash or an Array according to the configuration item
# `X-SuSE-YaST-AutoInstDataType`
# @param profile [Hash, Array] profile data specific to this module.
# @return true on success
def import(profile)
raise NotImplementedError, "Calling abstract method 'import'"
end

# Export profile data from AutoYaST.
#
# The profile is a Hash or an Array according to the configuration item
# `X-SuSE-YaST-AutoInstDataType`
# @return [Hash, Array] profile data
def export
raise NotImplementedError, "Calling abstract method 'export'"
end

# Provide a brief summary of configuration.
# @return [String] description in RichText format
def summary
raise NotImplementedError, "Calling abstract method 'summary'"
end

# Reset configuration to default state.
# @return [void]
def reset
raise NotImplementedError, "Calling abstract method 'reset'"
end

# Run UI to modify the configuration.
# @return [Symbol] If one of `:accept`, `:next`, `:finish` is returned,
# the changes are accepted, otherwise they are discarded.
def change
raise NotImplementedError, "Calling abstract method 'change'"
end


# Write settings to the target system.
# @return [Boolean] true on success
def write
raise NotImplementedError, "Calling abstract method 'write'"
end

# Get a list of packages needed for configuration.
#
# The default implementation returns an empty list.
# @return [Array<String>] list of required packages
def packages
log.info "#{self.class}#packages not implemented, returning []."

[]
end

# Read settings from the target system.
#
# It is used to initialize configuration from the current system
# for further represent in AutoYaST profile.
# @return [void]
def read
raise NotImplementedError, "Calling abstract method 'write'"
end

# Set that the profile data has beed modified
# and should be exported from the interactive editor,
# or included in the cloned data.
# @return [void]
def modified
raise NotImplementedError, "Calling abstract method 'modified'"
end

# Query whether the profile data has beed modified
# and should be exported from the interactive editor,
# or included in the cloned data.
# @return [Boolean]
def modified?
raise NotImplementedError, "Calling abstract method 'modified?'"
end
end
end
99 changes: 99 additions & 0 deletions library/general/src/lib/installation/finish_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
require "yast"

module Installation
# Abstract class that simplify writting finish clients for installation.
# It provides single entry point and abstract methods, that all finish clients
# need to implement.
# @example how to run client
# require "installation/example_finish"
# ::Installation::ExampleFinish.run
# @see for example client in installation clone_finish.rb
#
# # Inst-Finish Scripts
# ## About
# They are called by the inst_finish.ycp installation client at the end of the
# first stage installation.
#
# Part of these clients are called with SCR connected to inst-sys, the others
# are called after SCR gets switched to the installed system (chrooted).
#
# Script inst_finish.ycp contains several stages, every has
#
# * label - visible in the writing progress
#
# * steps - list of additional inst_finish scripts that are called
# ("bingo" -> "bingo_finish.ycp")
# Important script is "switch_scr", after that call, SCR is connected to the
# just installed system.
#
# ## Finish Scripts
#
# Every single finish script is a non-interactive script (write-only). It's
# basically called twice:
#
# * At first "Info" returns in which modes "Write" should be called
#
# * Then "Write" should be called to do the job
#
class FinishClient < Yast::Client
include Yast::Logger

# Entry point for calling client.
# The only part needed in client rb file.
# @return response from abstract methods
def self.run
self.new.run
end

# Dispatches to abstract method based on passed arguments to client
def run
func = Yast::WFM.Args.first
log.info "Called #{self.class}.run with #{func}"

case func
when "Info"
info
when "Write"
write
else
raise ArgumentError, "Invalid action for proposal '#{func.inspect}'"
end
end

protected

# Write configuration.
def write
raise NotImplementedError, "Calling abstract method 'write'"
end

# Restrict in which modes it should run.
# @return [Array<Symbol>, nil]
# Valid values are `:autoinst`, `:autoupg`, `:installation`,
# `:live_installation`, and `:update`. NOTE that these values
# are NOT consistent with the names used in {Yast::ModeClass Mode}.
# By default it returns `nil`, meaning to run always.
def modes
nil
end

# @return [Integer] the number of client steps.
def steps
1
end

# @return [String] a title used to display to the user what is happening.
def title
raise NotImplementedError, "Calling abstract method 'title'"
end

# Adapt the metadata for inst_finish API
def info
{
"when " => modes,
"steps" => steps,
"title" => title
}
end
end
end
Loading

0 comments on commit 46feb49

Please sign in to comment.