diff options
authorZac Medico <zmedico@gentoo.org>2021-02-24 11:56:38 -0800
committerZac Medico <zmedico@gentoo.org>2021-02-26 23:43:23 -0800
commitfd04c5fb1619f86381b5d5e6ff66b20fa3967c43 (patch)
treec8f94ee19d8c4932317ca54f890d75bb923523ea /lib/portage/_emirrordist/FetchTask.py
parentemirrordist: support minimal object as options for use in unit tests (diff)
emirrordist: add --content-db option required for content-hash layout (bug 756778)
Add a --content-db option which is required for the content-hash layout because its file listings return content digests instead of distfile names. The content db serves to translate content digests to distfiles names, and distfiles names to content digests. All keys have one or more prefixes separated by colons. For a digest key, the first prefix is "digest" and the second prefix is the hash algorithm name. For a filename key, the prefix is "filename". The value associated with a digest key is a set of file names. The value associated with a distfile key is a set of content revisions. Each content revision is expressed as a dictionary of digests which is suitable for construction of a DistfileName instance. A given content digest will translate to multiple distfile names if multiple associations have been created via the content db add method. The relationship between a content digest and a distfile name is similar to the relationship between an inode and a hardlink. Bug: https://bugs.gentoo.org/756778 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/portage/_emirrordist/FetchTask.py')
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/portage/_emirrordist/FetchTask.py b/lib/portage/_emirrordist/FetchTask.py
index 997762082..5a48f91cd 100644
--- a/lib/portage/_emirrordist/FetchTask.py
+++ b/lib/portage/_emirrordist/FetchTask.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2020 Gentoo Authors
+# Copyright 2013-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import collections
@@ -47,6 +47,9 @@ class FetchTask(CompositeTask):
# Convert _pkg_str to str in order to prevent pickle problems.
self.config.distfiles_db[self.distfile] = str(self.cpv)
+ if self.config.content_db is not None:
+ self.config.content_db.add(self.distfile)
if not self._have_needed_digests():
msg = "incomplete digests: %s" % " ".join(self.digests)
self.scheduler.output(msg, background=self.background,