craft_parts.packages.deb module

Support for deb files.

class craft_parts.packages.deb.Ubuntu

Bases: BaseRepository

Repository management for Ubuntu packages.

classmethod configure(cls, application_package_name)

Set up apt options and directories.

Parameters:

application_package_name (str)

Return type:

None

classmethod download_packages(package_names, *, include_recommends=False)

Download the specified packages to the local package cache area.

Parameters:
Return type:

None

classmethod fetch_stage_packages(*, cache_dir, package_names, stage_packages_path, base, arch, packages_filters=None)

Fetch stage packages to stage_packages_path.

Parameters:
Return type:

list[str]

classmethod get_installed_packages()

Obtain a list of the installed packages and their versions.

Prefer dpkg-query because python-apt may try to create /etc/apt/sources.list when it is missing, which fails in unprivileged environments. Fall back to parsing /var/lib/dpkg/status when dpkg-query is unavailable or fails.

Return type:

list[str]

Returns:

A list of installed packages in the form package=version.

classmethod get_package_libraries(package_name)

Return a list of libraries in package_name.

Parameters:

package_name (str)

Return type:

set[str]

classmethod get_packages_for_source_type(cls, source_type)

Return the packages required to work with source_type.

Parameters:

source_type (str)

Return type:

set[str]

classmethod install_packages(package_names, *, refresh_package_cache=True, include_recommends=False)

Install packages on the host system.

Parameters:
  • package_names (list[str])

  • refresh_package_cache (bool)

  • include_recommends (bool)

Return type:

list[str]

classmethod is_package_installed(cls, package_name)

Inform if a package is installed on the host system.

Parameters:

package_name (str)

Return type:

bool

classmethod refresh_packages_list(cls)

Refresh the list of packages available in the repository.

Return type:

None

classmethod unpack_stage_packages(*, stage_packages_path, install_path, stage_packages=None, track_stage_packages=False)

Unpack stage packages to install_path.

Parameters:
Return type:

None

craft_parts.packages.deb.get_cache_dirs(cache_dir)

Return the paths to the stage and deb cache directories.

Parameters:

cache_dir (Path)

Return type:

tuple[Path, Path]

craft_parts.packages.deb.get_packages_from_chisel_manifest(manifest_path)

Return deb packages recorded in a chisel manifest.wall file.

Parameters:

manifest_path (Path) – Path to the chisel manifest.

Return type:

list[DebPackage]

Returns:

A list of packages recorded in the manifest.

craft_parts.packages.deb.get_packages_in_base(*, base)

Get the list of packages for the given base.

Parameters:

base (str)

Return type:

list[DebPackage]

craft_parts.packages.deb.process_run(command, **kwargs)

Run a command and log its output.

Parameters:
Return type:

None