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.


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.


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.


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 of data to request.
Default return value if key does not exist.

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


Returns the component of the package.


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


Returns the name of the .dsc file.


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().


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.


Returns the source package name


Returns the path the changes file would be


Returns the priority of the package.


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 for a package, using check_hack’s type to validate the package.

Valid check_hash types:

  • sha1
  • sha256
  • md5
  • md5sum

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.