dnf-json: pass back the repo_id and the relativepath of each package

This will eventually replace the remote_location property. The latter
pins a specific location (a specific mirror), but the two former
can together be used to re-resolve to a more suitable mirror at the
time/place the package will actually be downloaded.

Rather than pinning mirrors in the osbuild manifests, we want to be
able to include the metalink and relative locations so each worker
can use mirrors closer to them.

This would be particularly important when pipelines are rebuilt in
the future, and the best mirrors may have changed.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-15 21:27:41 +01:00
parent 6309611fea
commit 7ea74cd131
2 changed files with 4 additions and 0 deletions

View file

@ -137,6 +137,8 @@ with tempfile.TemporaryDirectory() as persistdir:
"version": package.version,
"release": package.release,
"arch": package.arch,
"repo_id": package.reponame,
"path": package.relativepath,
"remote_location": package.remote_location(),
"checksum": f"{hawkey.chksum_name(package.chksum[0])}:{package.chksum[1].hex()}",
})

View file

@ -67,6 +67,8 @@ type PackageSpec struct {
Version string `json:"version,omitempty"`
Release string `json:"release,omitempty"`
Arch string `json:"arch,omitempty"`
RepoID string `json:"repo_id,omitempty"`
Path string `json:"path,omitempty"`
RemoteLocation string `json:"remote_location,omitempty"`
Checksum string `json:"checksum,omitempty"`
}