Skip to content

Commit

Permalink
[reposync] Unify syncing remote and local packages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-blaha committed Jul 12, 2019
1 parent 09f7c5c commit b51c313
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions plugins/reposync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b51c313

Please sign in to comment.