From a90ad5c43292d012109fe090e302c02e003ba0a2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Jan 2025 11:47:17 +0100 Subject: [PATCH] sources: add simple status printing like curl to librepo --- sources/org.osbuild.librepo | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sources/org.osbuild.librepo b/sources/org.osbuild.librepo index 474a203e..6888992b 100755 --- a/sources/org.osbuild.librepo +++ b/sources/org.osbuild.librepo @@ -173,6 +173,17 @@ class LibRepoSource(sources.SourceService): """ if status == librepo.TRANSFER_ERROR: self.errors.append(f"{data}: {msg}") + # Workaround the lack of structured progress reporting from + # stages/sources. See curl source for more details, once we + # have something better this block can be removed. + if status == librepo.TRANSFER_ERROR: + print(f"Error downloading {data}") + elif status == librepo.TRANSFER_SUCCESSFUL: + print(f"Downloaded {data}") + elif status == librepo.TRANSFER_ALREADYEXISTS: + print(f"Already downloaded {data}") + else: + print(f"Unknown status {status} for {data}") def make_pkg_target(self, handle, dest, path, checksum): """Return a librepo.PackageTarget populated with the package data