craft_parts.packages.base module¶
Definition and helpers for the repository base class.
- class craft_parts.packages.base.BaseRepository¶
Bases:
ABCBase implementation for a platform specific repository handler.
- abstract classmethod configure(application_package_name)¶
Set up the repository.
- abstract classmethod download_packages(package_names, *, include_recommends=False)¶
Download the specified packages to the local package cache.
- abstract classmethod fetch_stage_packages(*, cache_dir, package_names, stage_packages_path, base, arch)¶
Fetch stage packages to stage_packages_path.
- Parameters:
- Return type:
- Returns:
The list of all packages to be fetched, including dependencies.
- abstract classmethod get_installed_packages()¶
Obtain a list of the installed packages and their versions.
- abstract classmethod get_package_libraries(package_name)¶
Return a list of libraries in package_name.
Given the contents of package_name, return the subset of what are considered libraries from those contents, be it static or shared.
- abstract classmethod get_packages_for_source_type(source_type)¶
Return a list of packages required to to work with source_type.
- abstract classmethod install_packages(package_names, *, refresh_package_cache=True, include_recommends=False)¶
Install packages on the host system.
This method needs to be implemented by using the appropriate mechanism to install packages on the system. If possible they should be marked as automatically installed to allow for easy removal. The method should return a list of the actually installed packages in the form “package=version”.
If one of the packages cannot be found
BuildPackageNotFoundshould be raised. If dependencies for a package cannot be resolvedPackageBrokenshould be raised. If installing a package on the host failedBuildPackagesNotInstalledshould be raised.- Parameters:
- Return type:
- Returns:
A list with the packages installed and their versions.
- abstract classmethod is_package_installed(package_name)¶
Inform if a package is installed on the host system.
- abstract classmethod refresh_packages_list()¶
Refresh the list of packages available in the repository.
If refreshing is not possible
PackageListRefreshErrorshould be raised.- Return type:
- abstract classmethod unpack_stage_packages(*, stage_packages_path, install_path, stage_packages=None, track_stage_packages=False)¶
Unpack stage packages.
- Parameters:
- Return type:
- class craft_parts.packages.base.DummyRepository¶
Bases:
BaseRepositoryA dummy repository.
- classmethod configure(application_package_name)¶
Set up the repository.
- classmethod download_packages(package_names, *, include_recommends=False)¶
Download the specified packages to the local package cache.
- classmethod fetch_stage_packages(**kwargs)¶
Fetch stage packages to stage_packages_path.
- classmethod get_installed_packages()¶
Obtain a list of the installed packages and their versions.
- classmethod get_package_libraries(package_name)¶
Return a list of libraries in package_name.
- classmethod get_packages_for_source_type(source_type)¶
Return a list of packages required to to work with source_type.
- classmethod install_packages(package_names, *, refresh_package_cache=True, include_recommends=False)¶
Install packages on the host system.
- classmethod is_package_installed(package_name)¶
Inform if a packahe is installed on the host system.
- craft_parts.packages.base.get_pkg_name_parts(pkg_name)¶
Break package name into base parts.
- craft_parts.packages.base.mark_origin_stage_package(sources_dir, stage_package)¶
Mark all files in sources_dir as coming from stage_package.
- craft_parts.packages.base.read_origin_stage_package(path)¶
Read origin stage package.