rpmget package
rpmget workflow helper via httpx and configparser.
- class rpmget.CfgParser(*args, **kwargs)[source]
Bases:
ConfigParser
Simple subclass with extended interpolation and no empty lines in values (see design item SDD002).
- exception rpmget.CfgSectionError
Bases:
Exception
Raise if the config section [rpmget] does not exist, normally at the top of the config file. This section must exist and contain the required keys and valid values:
[rpmget] top_dir = rpms layout = tree pkg_tool = rpm
Also raised for invalid URL errors.
- exception rpmget.FileTypeError
Bases:
Exception
Raise if the file extension is not in the allowed extensions list:
['.ini', '.cfg', '.conf']
- rpmget.check_url_str(str_val)[source]
Simple string check for http … .rpm
- Parameters:
str_val (str)
- Return type:
bool
- rpmget.create_macros(topdir)[source]
Render a string template.
- Parameters:
topdir (str)
- Return type:
str
- rpmget.find_rpm_urls(config)[source]
Find all the (hopefully valid) URLs.
- Parameters:
config (CfgParser)
- Return type:
List[str]
- rpmget.load_config(ufile='')[source]
Read the configuration file and load the data. If ENV path or local file is not found in current directory, the default cfg will be loaded. Note that passing
ufile
as a parameter overrides the above default.- Parameters:
ufile (str) – path string for config file
- Returns:
cfg parser and file Path-or-None
- Raises:
FileTypeError – if the input file is not in the allowed list [‘.ini’, ‘.cfg’, ‘.conf’]
- Return type:
Tuple[CfgParser, Path | None]
- rpmget.url_is_valid(rpm_url)[source]
Validate rpm URL string using urlparse and rpm extension check.
;param rpm_url: full url string ending in .rpm :returns: True if checks pass
- Parameters:
rpm_url (str)
- Return type:
bool
- rpmget.validate_config(config, schema={'layout': {'anyof_regex': ['^flat', '^tree'], 'type': 'string'}, 'pkg_tool': {'anyof_regex': ['^rpm', '^yum', '^dnf'], 'type': 'string'}, 'top_dir': {'empty': False, 'type': 'string'}}, stop_on_error=True)[source]
Validate minimum config sections and make sure [rpmget] section exists with required options (see design item SDD003).
- Parameters:
cfg_parse – loaded CfgParser instance
schema (Dict) – cerberus schema dict
config (CfgParser)
stop_on_error (bool)
- Returns:
boolean
is_valid
flag- Return type:
bool