debian_inspector.package module

class debian_inspector.package.CodeArchive(name, version, original_filename=None)

Bases: object

A Debian .orig or .debian package archive. These are not architecture-specific. For instance in ./pool/main/a/apr-util there are files such as:

  • apr-util_1.5.4.orig.tar.bz2 that contains the original upstream code

  • apr-util_1.6.1-4.debian.tar.xz that contains the Debian patches and control files

classmethod from_filename(filename)

Parse the filename of a Debian original package archive and return an OrigArchive instance. Raise ValueError if the filename is not valid.

to_dict()
to_tuple()

Return a tuple of name, Vresion, architecture suitable for sorting. This tuple does not contain the original_filename values.

class debian_inspector.package.DebArchive(name, version, architecture, original_filename=None)

Bases: object

A .deb binary package archive.

classmethod from_filename(filename)

Parse the filename of a Debian binary package archive and return a DebArchive instance. Raise ValueError if the filename is not valid.

to_dict()
to_tuple()

Return a tuple of name, Version, architecture suitable for sorting. This tuple does not contain the original_filename value.

debian_inspector.package.find_latest_version(packages)

Return the DebArchive package archive with the highest version number given a packages list of package filename strings or DebArchive instances. All package items must have the same package name

Raise ValueError if a package filename is invalid or if the packages do not have all the same package name.

debian_inspector.package.find_latest_versions(packages)

Return a mapping {name: DebArchive} where DebArchive is the package archive with the highest version number for a given package name given a packages list of package filename strings or DebArchive instances.

debian_inspector.package.get_nva(filename)

Return a tuple of (name string, Version object, archictecture string or None) parsed from the filename of .deb, .udeb, .orig or .debian archive..

debian_inspector.package.match_relationships(package_archive, relationship_sets)

Validate that package_archive DebArchive satisfies all the relationships of a relationship_sets. Return True if valid and False otherwise.