HomeSoftware Heritage

Use attributes of *PackageInfo objects instead of untyped dicts.

Description

Use attributes of *PackageInfo objects instead of untyped dicts.

This commit does the following:

  • Move artifact_identity to BasePackageInfo, which uses a class attribute (and is overriden for ArchivePackageInfo, which needs a custom behavior to override keys). Also moved/improved its test
  • Add attributes to *PackageInfo classes, that can be accessed instead of the raw metadata.
  • Add a from_metadata class method to all *PackageInfo classes, to parse the raw metadata and build the object from it.
  • Pass the PackageInfo object to resolve_revision_from and build_revision instead of untyped dicts.

Details

Provenance
vlorentzAuthored on Jul 23 2020, 2:56 PM
vlorentzPushed on Jul 24 2020, 1:34 PM
Differential Revision
D3603: Use attributes of *PackageInfo objects instead of untyped dicts.
Parents
rDLDBASE1050d94d871d: Use an attr class for p_info instead of a dict.
Branches
Unknown
Tags
Unknown
Build Status
Buildable 13939
Build 21387: test-and-buildJenkins console · Jenkins