Skip to content

Commit 2705f61

Browse files
committed
vmupdate: print info what's happening in dnf5
1 parent a233544 commit 2705f61

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

vmupdate/agent/source/dnf/dnf5_api.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ def progress(
174174
self.fetching_notified = True
175175
self.bytes_fetched += downloaded - self.package_bytes[user_cb_data]
176176
if downloaded > self.package_bytes[user_cb_data]:
177+
if self.package_bytes[user_cb_data] == 0:
178+
print(f"Fetching {self.package_names[user_cb_data]} [{self._format_bytes(total_to_download)}]",
179+
flush=True)
177180
self.package_bytes[user_cb_data] = downloaded
178181
percent = self.bytes_fetched / self.bytes_to_fetch * 100
179182
self.notify_callback(percent)
@@ -218,6 +221,7 @@ def __init__(self, weight: int, log):
218221
Progress.__init__(self, weight, log)
219222
self.pgks = None
220223
self.pgks_done = None
224+
self.processed_packages = set()
221225

222226
def install_progress(
223227
self, item: libdnf5.base.TransactionPackage, amount: int, total: int
@@ -229,6 +233,10 @@ def install_progress(
229233
:param amount: The portion of the package already installed
230234
:param total: The disk space used by the package after installation
231235
"""
236+
package = item.get_package().get_full_nevra()
237+
if package not in self.processed_packages:
238+
print(f"Installing {package}", flush=True)
239+
self.processed_packages.add(package)
232240
pkg_progress = amount / total
233241
percent = (self.pgks_done + pkg_progress) / self.pgks * 100
234242
self.notify_callback(percent)
@@ -252,6 +260,10 @@ def uninstall_progress(
252260
:param amount: The portion of the package already uninstalled
253261
:param total: The disk space freed by the package after removal
254262
"""
263+
package = item.get_package().get_full_nevra()
264+
if package not in self.processed_packages:
265+
print(f"Uninstalling {package}", flush=True)
266+
self.processed_packages.add(package)
255267
pkg_progress = amount / total
256268
percent = (self.pgks_done + pkg_progress) / self.pgks * 100
257269
self.notify_callback(percent)
@@ -267,3 +279,16 @@ def elem_progress(self, item, amount: int, total: int):
267279
self.pgks_done = amount
268280
percent = amount / total * 100
269281
self.notify_callback(percent)
282+
283+
def script_start(self, item: libdnf5.base.TransactionPackage, nevra, type: int):
284+
r"""
285+
Execution of the rpm scriptlet has started
286+
287+
:param item: The TransactionPackage class instance for the package that owns the executed or triggered
288+
scriptlet. It can be `nullptr` if the scriptlet owner is not part of the transaction
289+
(e.g., a package installation triggered an update of the man database, owned by man-db package).
290+
:param nevra: Nevra of the package that owns the executed or triggered scriptlet.
291+
:param type: Type of the scriptlet
292+
"""
293+
print(f"Running rpm scriptlet for {nevra.get_name()}-{nevra.get_epoch()}:{nevra.get_version()}"
294+
f"-{nevra.get_release()}.{nevra.get_arch()}", flush=True)

0 commit comments

Comments
 (0)