Changes File Implementation

This module contains code to aid in processing .changes files. Most of this code has been yanked from Jonny Lamb. Thanks, Jonny.

Facade

dput.changes.parse_changes_file(filename, directory=None)

Parse a .changes file and return a dput.changes.Change instance with parsed changes file data. The optional directory argument refers to the base directory where the referred files from the changes file are expected to be located.

Abstraction

class dput.changes.Changes(filename=None, string=None)

Changes object to help process and store information regarding Debian .changes files, used in the upload process.

_parse_section(section)

Works out the component and section from the “Section” field. Sections like python or libdevel are in main. Sections with a prefix, separated with a forward-slash also show the component. It returns a list of strings in the form [component, section].

For example, non-free/python has component non-free and section python.

section Section name to parse.

get(key, default=None)

Returns the value of the rfc822 key specified, but defaults to a specific value if not found in the rfc822 file.

key

Key of data to request.

default

Default return value if key does not exist.

get_changes_file()

Return the full, absolute path to the changes file. For just the filename, please see get_filename().

get_component()

Returns the component of the package.

get_diff()

Returns the name of the .diff.gz file if there is one, otherwise None.

get_dsc()

Returns the name of the .dsc file.

get_filename()

Returns the filename from which the changes file was generated from. Please do note this is just the basename, not the entire full path, or even a relative path. For the absolute path to the changes file, please see get_changes_file().

get_files()

Returns a list of files referenced in the changes file, such as the .dsc, .deb(s), .orig.tar.gz, and .diff.gz or .debian.tar.gz. All strings in the array will be absolute paths to the files.

get_package_name()

Returns the source package name

get_pool_path()

Returns the path the changes file would be

get_priority()

Returns the priority of the package.

get_section()

Returns the section of the package.

validate(check_hash='sha1', check_signature=True)

See validate_checksums() for check_hash, and validate_signature() if check_signature is True.

validate_checksums(check_hash='sha1')

Validate checksums for a package, using check_hack’s type to validate the package.

Valid check_hash types:

  • sha1

  • sha256

  • md5

  • md5sum

validate_signature(check_signature=True)

Validate the GPG signature of a .changes file.

Throws a dput.exceptions.ChangesFileException if there’s an issue with the GPG signature. Returns the GPG key ID.