package-index: index also subdirectories when using rpm

Previously only the top-level index was created, which did not
work if PACKAGE_FEED_ARCHS whitelisting (or explicitly listing
architectures in dnf repo files by hand) was in use:
https://lists.yoctoproject.org/pipermail/yocto/2018-March/040327.html
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12419

[YOCTO #12419]

(From OE-Core rev: f2a568ddb22f38114fdbc1d389c7556386ebb1fa)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2018-03-19 11:38:27 +02:00
committed by Richard Purdie
parent c256b715e6
commit dad8f073e3

View File

@@ -101,13 +101,16 @@ class Indexer(object, metaclass=ABCMeta):
class RpmIndexer(Indexer):
def write_index(self):
self.do_write_index(self.deploy_dir)
def do_write_index(self, deploy_dir):
if self.d.getVar('PACKAGE_FEED_SIGN') == '1':
signer = get_signer(self.d, self.d.getVar('PACKAGE_FEED_GPG_BACKEND'))
else:
signer = None
createrepo_c = bb.utils.which(os.environ['PATH'], "createrepo_c")
result = create_index("%s --update -q %s" % (createrepo_c, self.deploy_dir))
result = create_index("%s --update -q %s" % (createrepo_c, deploy_dir))
if result:
bb.fatal(result)
@@ -115,11 +118,22 @@ class RpmIndexer(Indexer):
if signer:
sig_type = self.d.getVar('PACKAGE_FEED_GPG_SIGNATURE_TYPE')
is_ascii_sig = (sig_type.upper() != "BIN")
signer.detach_sign(os.path.join(self.deploy_dir, 'repodata', 'repomd.xml'),
signer.detach_sign(os.path.join(deploy_dir, 'repodata', 'repomd.xml'),
self.d.getVar('PACKAGE_FEED_GPG_NAME'),
self.d.getVar('PACKAGE_FEED_GPG_PASSPHRASE_FILE'),
armor=is_ascii_sig)
class RpmSubdirIndexer(RpmIndexer):
def write_index(self):
bb.note("Generating package index for %s" %(self.deploy_dir))
self.do_write_index(self.deploy_dir)
for entry in os.walk(self.deploy_dir):
if os.path.samefile(self.deploy_dir, entry[0]):
for dir in entry[1]:
if dir != 'repodata':
dir_path = oe.path.join(self.deploy_dir, dir)
bb.note("Generating package index for %s" %(dir_path))
self.do_write_index(dir_path)
class OpkgIndexer(Indexer):
def write_index(self):
@@ -1686,7 +1700,7 @@ def generate_index_files(d):
classes = d.getVar('PACKAGE_CLASSES').replace("package_", "").split()
indexer_map = {
"rpm": (RpmIndexer, d.getVar('DEPLOY_DIR_RPM')),
"rpm": (RpmSubdirIndexer, d.getVar('DEPLOY_DIR_RPM')),
"ipk": (OpkgIndexer, d.getVar('DEPLOY_DIR_IPK')),
"deb": (DpkgIndexer, d.getVar('DEPLOY_DIR_DEB'))
}