From 69c2acaebc3b21306a4a69ec577c41df9c7aca82 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Feb 12 2019 21:09:19 +0000 Subject: use librepo instead of yum where possible librepo is not available from RHEL6 by default, so don't expect it as a hardrequire for now --- diff --git a/builder/kojid b/builder/kojid index 3bdac89..ddd1c00 100755 --- a/builder/kojid +++ b/builder/kojid @@ -724,7 +724,7 @@ class BuildRoot(object): opts['tempdir'] = self.options.workdir # prefer librepo - if not yum_available: + if librepo is not None: repo_url = os.path.join(repodir, self.br_arch) # repo_url can start with '/', don't use os.path.join if self.options.topurl: @@ -742,7 +742,7 @@ class BuildRoot(object): h.perform(r) pkgorigins = r.getinfo(librepo.LRR_YUM_REPOMD)['origin']['location_href'] koji.util.rmtree(tmpdir) - else: + elif yum_available: #XXX - cheap hack to get relative paths repomdpath = os.path.join(repodir, self.br_arch, 'repodata', 'repomd.xml') with koji.openRemoteFile(repomdpath, **opts) as fo: @@ -752,6 +752,9 @@ class BuildRoot(object): raise koji.BuildError("Unable to parse repomd.xml file for %s" % os.path.join(repodir, self.br_arch)) data = repodata.getData('origin') pkgorigins = data.location[1] + else: + # shouldn't occur + raise koji.GenericError("install librepo or yum") relpath = os.path.join(repodir, self.br_arch, pkgorigins) with koji.openRemoteFile(relpath, **opts) as fo: