mrtest package¶
Submodules¶
mrtest.add_packages module¶
High level action of adding packages from MR’s artifacts
- mrtest.add_packages.add_packages(origin: GitLabOrigin, mr_id: int, no_cache: bool) None ¶
- Parameters:
origin – gitlab origin information, see gitlab.parse_git_origin()
mr_id – merge request ID
no_cache – instead of using a cache for api calls / downloads where it makes sense, always download a fresh copy
- mrtest.add_packages.confirm_mr_id(origin: GitLabOrigin, mr_id: int, action: Literal['add', 'upgrade']) None ¶
- Parameters:
origin – gitlab origin information, see gitlab.parse_git_origin()
mr_id – merge request ID
- mrtest.add_packages.extract_apks(zip_path: str, selection: list[str]) list[str] ¶
- Parameters:
zip_path – to the downloaded artifacts zip
selection – list of apks inside the zip archive
- Returns:
list of full paths to extracted apk files
- mrtest.add_packages.run_apk_add(origin: GitLabOrigin, mr_id: int, apk_paths: list[str]) None ¶
- Parameters:
origin – gitlab origin information, see gitlab.parse_git_origin()
mr_id – merge request ID
apk_paths – list of apk file paths to be installed
mrtest.apk_installed module¶
Code interacting with apk (Alpine’s package manager)
- mrtest.apk_installed.get_installed(pkg: str) str | None ¶
- Parameters:
pkg – path to an apk file, ending in …/$pkgname-$version.apk
- mrtest.apk_installed.get_installed_all() dict[str, str | None] ¶
Returns a map of all installed packages containing their names mapped to their versions. The version is None only if the package is a virtual package.
mrtest.frontend module¶
Parse command-line arguments.
- mrtest.frontend.arguments_add(sub: _SubParsersAction) None ¶
- Parameters:
sub – argparser’s subparser
- mrtest.frontend.arguments_upgrade(sub: _SubParsersAction) None ¶
- Parameters:
sub – argparser’s subparser
- mrtest.frontend.arguments_zap(sub: _SubParsersAction) None ¶
- Parameters:
sub – argparser’s subparser
- mrtest.frontend.get_parser() ArgumentParser ¶
- mrtest.frontend.main() None ¶
mrtest.origin module¶
Origin information about gitlab instances relevant to mrtest, in the format needed for mrhlpr.gitlab.parse_git_origin().
mrtest.select_package module¶
Interactive package selection dialog
- mrtest.select_package.ask(zip_path: str) list[str] ¶
Ask the user which packages shall be installed or upgraded.
- Parameters:
zip_path – downloaded artifacts zip containing the apks
- Returns:
paths inside the zip file of the packages that the user wants to install, e.g. [“packages/edge/aarch64/postmarketos-ui-phosh-18-r0.apk”]
- mrtest.select_package.get_apks_in_zip(zip_path: str) list[str] ¶
- Parameters:
zip_path – downloaded artifacts zip containing the apks
- Returns:
list of paths inside the zip file like: [“packages/edge/aarch64/postmarketos-ui-phosh-18-r0.apk”m …]
- mrtest.select_package.show_commands() None ¶
- mrtest.select_package.show_selection(apks: list[str], ret: list[str]) None ¶
Print the list of available packages, with a checkbox for each package. :param apks: list of all apks inside the zip file :param ret: list of selected apks inside the zip file
- mrtest.select_package.show_selection_short(apks: list[str], ret: list[str]) None ¶
Print a short summary of how many packages have been selected. :param apks: list of all apks inside the zip file :param ret: list of selected apks inside the zip file
- mrtest.select_package.toggle_installed(apks: list[str], ret: list[str]) list[str] ¶
Toggle all already instaleld packages. :param apks: list of all apks inside the zip file :param ret: list of selected apks inside the zip file :returns: updated version of ret
- mrtest.select_package.toggle_package(selection: int | str, apks: list[str], ret: list[str]) list[str] ¶
Toggle the package based on the user action. :param selection: user input, single integer :param apks: list of packages available for install :param ret: list containing packages that are marked for install
- mrtest.select_package.toggle_packages(action: str, apks: list[str], ret: list[str]) list[str] ¶
Toggle multiple packages based on the user action. :param action: user input, multiple integers or range :param apks: list of packages available for install :param ret: list containing packages that are marked for install
mrtest.upgrade_packages module¶
- mrtest.upgrade_packages.upgrade_from_mr(origin: GitLabOrigin, mr_id: int, alpine_mr: bool, available: bool) None ¶
mrtest.zap_packages module¶
Remove packages previously added with ‘mrtest add’
- mrtest.zap_packages.get_installed_mrtest_virtual_packages() list[str] ¶
- mrtest.zap_packages.remove_virtual() None ¶
- mrtest.zap_packages.zap_packages() None ¶
Module contents¶
Various small functions used in other files in mrtest.
- mrtest.get_sudo() str ¶
- Returns:
either “doas” or “sudo”
- mrtest.get_virtual_group(origin: GitLabOrigin, mr_id: int) str ¶
Generate a virtual group id to be passed to apk when installing packages from a merge request. :param origin: gitlab origin information, see gitlab.parse_git_origin() :param mr_id: merge request ID
- mrtest.is_root_user() bool ¶