pkgset: Hardlink downloaded packages

When pungi-gather (or old pungi) download the packages from repos into
work/$arch/, they are linked to work/global/. This was using link_type
configuration option.

However if that is set to symlink, we get a relative symlink in
work/global/ which is later copied under the compose/ directory. Since
it's a relative symlink, it gets broken by this.

The fix is to hardlink the downloaded packages instead in the first
step. Since both the source and destination are in work/ directory, we
know it's the same volume and hardlinks should work. There is a fallback
to copy just to be sure, but it shouldn't ever be used.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-01-06 10:45:52 +01:00
parent 3f111b559f
commit 02ace28fe4

View File

@ -45,8 +45,7 @@ def get_pkgset_from_repos(compose):
profiler = compose.conf["gather_profiler"] profiler = compose.conf["gather_profiler"]
link_type = compose.conf["link_type"] pool = LinkerPool.with_workers(10, "hardlink-or-copy", logger=compose._logger)
pool = LinkerPool.with_workers(10, link_type, logger=compose._logger)
path_prefix = os.path.join(compose.paths.work.topdir(arch="global"), "download") + "/" path_prefix = os.path.join(compose.paths.work.topdir(arch="global"), "download") + "/"
makedirs(path_prefix) makedirs(path_prefix)