daklib.upload¶
module to handle uploads not yet installed to the archive
This module provides classes to handle uploads not yet installed to the
archive. Central is the Changes
class which represents a changes file.
It provides methods to access the included binary and source packages.
Functions
|
Parse Files and Checksums-* fields |
Classes
|
Representation of a binary package |
|
Representation of a .changes file |
|
file with checksums |
|
Representation of a source package |
Exceptions
|
|
|
|
|
|
- class daklib.upload.Binary(directory: str, hashed_file: HashedFile)[source]¶
Representation of a binary package
- control: TagSection¶
dict to access fields in DEBIAN/control
- hashed_file: HashedFile¶
file object for the .deb
- class daklib.upload.Changes(directory: str, filename: str, keyrings, require_signature: bool = True)[source]¶
Representation of a .changes file
- _key() tuple[str, daklib.aptversion.AptVersion, bool, str] [source]¶
tuple used to compare two changes files
We sort by source name and version first. If these are identical, we sort changes that include source before those without source (so that sourceful uploads get processed first), and finally fall back to the filename (this should really never happen).
- property binaries: list[daklib.upload.Binary]¶
included binary packages
- property buildinfo_files: list[daklib.upload.HashedFile]¶
included buildinfo files
- property byhand_files: list[daklib.upload.HashedFile]¶
included byhand files
- changes: TagSection¶
dict to access fields of the .changes file
- property files: dict[str, daklib.upload.HashedFile]¶
dict mapping filenames to
HashedFile
objects
- property signature_timestamp: datetime.datetime¶
- class daklib.upload.HashedFile(filename: str, size: int, md5sum: str, sha1sum: str, sha256sum: str, section: Optional[str] = None, priority: Optional[str] = None, input_filename: Optional[str] = None)[source]¶
file with checksums
- check(directory: str) None [source]¶
Validate hashes
Check if size and hashes match the expected value.
- Parameters:
directory – directory the file is located in
- Raises:
InvalidHashException – if there is a hash mismatch
- classmethod from_file(directory: str, filename: str, section: Optional[str] = None, priority: Optional[str] = None) HashedFile [source]¶
create with values for an existing file
Create a
HashedFile
object that refers to an already existing file.- Parameters:
directory – directory the file is located in
filename – filename
section – optional section as given in .changes files
priority – optional priority as given in .changes files
- Returns:
HashedFile
object for the given file
- exception daklib.upload.InvalidHashException(filename: str, hash_name: str, expected, actual)[source]¶
- class daklib.upload.Source(directory: str, hashed_files: list[daklib.upload.HashedFile], keyrings, require_signature=True)[source]¶
Representation of a source package
- property files: dict[str, daklib.upload.HashedFile]¶
dict mapping filenames to
HashedFile
objects for additional source filesThis list does not include the .dsc itself.
- hashed_files: list[daklib.upload.HashedFile]¶
list of source files (including the .dsc itself)
- package_list: PackageList¶
Information about packages built by the source.
- daklib.upload.parse_file_list(control: Mapping[str, str], has_priority_and_section: bool, safe_file_regexp: Pattern = re.compile('^[a-zA-Z0-9][a-zA-Z0-9_.~+-]*$'), fields=('Files', 'Checksums-Sha1', 'Checksums-Sha256')) dict[str, daklib.upload.HashedFile] [source]¶
Parse Files and Checksums-* fields
- Parameters:
control – control file to take fields from
has_priority_and_section – Files field include section and priority (as in .changes)
- Returns:
dict mapping filenames to
HashedFile
objects- Raises:
InvalidChangesException – missing fields or other grave errors