From 79bc4e0c3a40c2b39e0271bbb9db02b35255f1da Mon Sep 17 00:00:00 2001 From: Ozan Unsal Date: Thu, 7 Sep 2023 14:38:34 +0200 Subject: [PATCH] gather_dnf.py: Do not raise error when the downloaded package is exists. If the packages are pulled from different repos and a package is already exists in target directory, pungi raises File exists error and breaks. This behavior can be suspended and skipped if the package is already available. Merges: https://pagure.io/pungi/pull-request/1696 Signed-off-by: Ozan Unsal (cherry picked from commit dbc0e531b204f9e326b8c0dbe3017c6e888f431c) --- pungi/gather_dnf.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index decabc09..a7dde038 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -17,6 +17,7 @@ from enum import Enum from functools import cmp_to_key from itertools import count, groupby +import errno import logging import os import re @@ -1067,9 +1068,12 @@ class Gather(GatherBase): # Link downloaded package in (or link package from file repo) try: linker.link(pkg.localPkg(), target) - except Exception: - self.logger.error("Unable to link %s from the yum cache." % pkg.name) - raise + except Exception as ex: + if ex.errno == errno.EEXIST: + self.logger.warning("Downloaded package exists in %s", target) + else: + self.logger.error("Unable to link %s from the yum cache.", pkg.name) + raise def log_count(self, msg, method, *args): """