From b51c313945b64db6bbba8cd26076aef58e3902e3 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Thu, 11 Jul 2019 15:59:00 +0200 Subject: [PATCH] [reposync] Unify syncing remote and local packages Drop special handling of packages from local repositories - do the downloading using librepo as if they were remotes. The advantage is unified output of reposync regardless the location of the repository. Without this patch packages from the local repositories are just silently copied to the destination without notifying the user. --- plugins/reposync.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/plugins/reposync.py b/plugins/reposync.py index de41128a..622987e1 100644 --- a/plugins/reposync.py +++ b/plugins/reposync.py @@ -192,23 +192,14 @@ def get_pkglist(self, repo): def download_packages(self, repo, pkglist): base = self.base - - remote_pkgs, local_repository_pkgs = base._select_remote_pkgs(pkglist) - if remote_pkgs: - progress = base.output.progress - if progress is None: - progress = dnf.callback.NullDownloadProgress() - drpm = dnf.drpm.DeltaInfo(base.sack.query(flags=hawkey.IGNORE_EXCLUDES).installed(), - progress, 0) - payloads = [RPMPayloadLocation(pkg, progress, self.pkg_download_path(pkg)) - for pkg in remote_pkgs] - base._download_remote_payloads(payloads, drpm, progress, None) - if local_repository_pkgs: - for pkg in local_repository_pkgs: - pkg_path = os.path.join(pkg.repo.pkgdir, pkg.location.lstrip("/")) - target_dir = os.path.dirname(self.pkg_download_path(pkg)) - dnf.util.ensure_dir(target_dir) - shutil.copy(pkg_path, target_dir) + progress = base.output.progress + if progress is None: + progress = dnf.callback.NullDownloadProgress() + drpm = dnf.drpm.DeltaInfo(base.sack.query(flags=hawkey.IGNORE_EXCLUDES).installed(), + progress, 0) + payloads = [RPMPayloadLocation(pkg, progress, self.pkg_download_path(pkg)) + for pkg in pkglist] + base._download_remote_payloads(payloads, drpm, progress, None) def print_urls(self, pkglist): for pkg in pkglist: