YaST2 Developers Documentation: Package Source Management

Package Source Management

modules/SourceManager.ycp
SourceManager settings, input and output functions

This module has an unstable interface.

Representation of the configuration of source-manager. Input and output routines.

Imports

  • Arch
  • HTML
  • InstURL
  • Label
  • Message
  • Mode
  • Popup
  • Progress
  • Report
  • SLP
  • Stage
  • String
  • Summary
  • URL

Structures

Global Variables

Global Functions

Local Functions

global Modified () -> boolean

Prototypes

global modified -> boolean

Data was modified?

global proposal_valid -> boolean

global AbortFunction () -> boolean

Abort function return boolean return true if abort

global Abort () -> boolean

Abort function

Return value:
return true if abort
global Modified () -> boolean

Data was modified?

Return value:
true if modified
global Read () -> boolean

Read all source-manager settings

Return value:
true on success
global CommitSources () -> boolean

Commit changed sources

global Write () -> boolean

Write all source-manager settings

Return value:
true on success
global Import (map settings) -> boolean

Get all source-manager settings from the first parameter (For use by autoinstallation.)

Parameters:
settings The YCP structure to be imported.
Return value:
True on success
global Export () -> map

Dump the source-manager settings to a single map (For use by autoinstallation.)

Return value:
Dumped settings (later acceptable by Import ())
global GetSrcIdByIndex (integer idx) -> integer

Get Source ID by index

Parameters:
idx
global SetUrlByIndex (integer idx) -> void

Set current used source URL by index

Parameters:
idx
global getSourceId (string url) -> integer

Get Source ID when only URL is known

Parameters:
url
global SourceData (integer source) -> map

Gather Source Metadata

Parameters:
source
global createSource (string url) -> symbol

Create a Source from an URL

Parameters:
url
global deleteSourceBySrcId (integer SrcId) -> void

Delete Source by Source ID

Parameters:
SrcId
global deleteSourceByIndex (integer idx) -> void

Delete Source by Source Index

Parameters:
idx
global deleteSourceByUrl (string url) -> void

Delete Source by Source URL

Parameters:
url
local createItem (integer index, map source) -> string

Create Summary Item

Parameters:
index
source
local createOverviewItem (integer index, map source) -> term

Create Source Item for Overview

Parameters:
index
source
local HandleMultipleSources (string url) -> boolean

Handle Multiple source URLs (order/instorder)

Parameters:
url
global Summary () -> list

Create a textual summary and a list of unconfigured cards

Return value:
summary of the current configuration
global Overview () -> list

Create an overview table with all configured cards

Return value:
table items
global RunCommandWithTimeout (string run_command, string log_command, integer script_time_out) -> map

Runs a bash command with timeout.

Structure Returns map $[

     "exit" : int_return_code,
     "stdout"  : [ "script", "stdout", "lines" ],
     "stderr"  : [ "script", "stderr", "lines" ],
 ]
Parameters:
run_command what to run
log_command what to log (passwords masked)
script_time_out in sec.
Return value:
with out, err and ret_code
global RunDumbTimeout (string command, string log_command, integer seconds) -> map

Run - with a timeout - on dumb terminal to disable colors etc - using 'exit $?' because of buggy behavior '.background vs. ZMD'

Parameters:
command a command
log_command a command to log
seconds timeout
Return value:
with out, err and ret_code
local RunLongLog (string command, string log_command) -> map

Run with a long timeout

Parameters:
command a command
log_command a command to log
Return value:
with out, err and ret_code
local RunLong (string command) -> map

Run with a long timeout

Parameters:
command a command
Return value:
with out, err and ret_code
Info:

path to ZMD CLI

local CheckZMDStatus () -> boolean

Detect whether ZMD is running

local ResetKnownServiceCache () -> void

Force calling rug on next IsUrlKnownToZMD

local UpdateKnownServiceCache (boolean adding, string url) -> void

Update the cache after a successful rug service-{add,delete} call

Parameters:
adding add url or delete it
url what
local IsUrlKnownToZMD (string url) -> boolean

Whether the URL is known to rug service-list. The known services are cached, the caller should use ResetKnownServiceCache if appropriate (each time when coming from outside this module at least)

Parameters:
url
Return value:
or nil if determining the status failed
local RugGetPref (string pref) -> string

Get a ZMD preference

Parameters:
pref see "rug get-prefs"
local RugSetPref (string pref, string value) -> void

Set a ZMD preference

Parameters:
pref
value
local AddOrDeleteZYPPServiceIntoZMD (integer src_id, boolean adding) -> boolean

Adds a ZYPP service into ZMD

Parameters:
src_id installation source id
adding
Return value:
success
local ZMDStart () -> map

Start ZMD if it was not running Report::Error on failure

Return value:
an opaque handle
local ZMDWorking (map zmd_handle) -> boolean

Parameters:
zmd_handle what ZMDStart returned
Return value:
can we work with ZMD now
local ZMDRestore (map zmd_handle) -> void

Restore the status before ZMDStart Report::Error on failure

Parameters:
zmd_handle what ZMDStart returned
global Lock () -> void

Start a section where other processes (such as ZMD helpers) should not access the source database. #170113 The calls may be nested.

global Unlock () -> void

Other processes may access the source database again

global SyncYaSTInstSourceWithZMD () -> boolean

Checks whether ZMD is running, starts it when isn't. Checks whether a ZYPP source is listed in the ZMD services, adds one if it is missing. Everything is done via the .background agent with timeout (number in seconds).

Return value:
whether the syncing succeeds
local ParseUrlQuery (string query) -> map<string, string>

Parse a URL query (already unescaped) to a map. If no equal sign, the value will be nil.

Parameters:
query foo=bar&baz=qux
Return value:
$["foo": "bar", "baz": "qux"]
local get_alias_to_id () -> map<string,integer>

Return value:
For existing sources, get a mapping from the alias to the id
local SourceByAlias (string url, map<string,integer> alias_to_id) -> integer

Extract an alias parameter from the URL and check whether we have such a source already.

Parameters:
url a source with an alias parameter (actually optional)
alias_to_id a premade mapping, @see get_alias_to_id
Return value:
the source id or -1
global AddUpdateSources (list<string> urls) -> list<string>

Used by registration. This is really hairy because we simultaneously add them to zypp and zenworks, but not if they are not signed. (thus being better than inst_source)

Parameters:
urls update sources to add
Return value:
a list of added URLs