From 7ea74cd131ecb44acc7e1db05703d1a4c6743ce7 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sun, 15 Mar 2020 21:27:41 +0100 Subject: [PATCH] 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 --- dnf-json | 2 ++ internal/rpmmd/repository.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dnf-json b/dnf-json index bc4da2faf..0dba22816 100755 --- a/dnf-json +++ b/dnf-json @@ -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()}", }) diff --git a/internal/rpmmd/repository.go b/internal/rpmmd/repository.go index 46796dafb..d8233502c 100644 --- a/internal/rpmmd/repository.go +++ b/internal/rpmmd/repository.go @@ -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"` }