From aea06b5322692608d94670d809e4244ce68ed7a5 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 4 Oct 2018 21:35:14 +0000 Subject: Define _topdir in getrelease This is required for specfiles using files from SOURCES with %load --- MgaRepo/log.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MgaRepo/log.py b/MgaRepo/log.py index ac76b1e..ab7695a 100644 --- a/MgaRepo/log.py +++ b/MgaRepo/log.py @@ -30,23 +30,22 @@ def getrelease(pkgdirurl, rev=None, macros=[], exported=None, create=False): from MgaRepo.rpmutil import rpm_macros_defs svn = SVN() pkgcurrenturl = os.path.join(pkgdirurl, "current") - specurl = os.path.join(pkgcurrenturl, "SPECS") - srpmurl = os.path.join(pkgcurrenturl, "SRPMS") if not create: if exported is None: tmpdir = tempfile.mktemp() - svn.export(specurl, tmpdir, rev=rev) + svn.export(pkgcurrenturl, tmpdir, rev=rev) + topdir = tmpdir else: - tmpdir = os.path.join(exported, "SPECS") + topdir = exported try: - found = glob.glob(os.path.join(tmpdir, "*.spec")) + found = glob.glob(os.path.join(topdir, "SPECS", "*.spec")) if not found: raise Error("no .spec file found inside %s" % specurl) specpath = found[0] options = rpm_macros_defs(macros) command = (("rpm -q --qf '%%{EPOCH}:%%{VERSION}-%%{RELEASE}\n' " - "--specfile %s %s") % - (specpath, options)) + "--specfile %s %s --define '_topdir %s'") % + (specpath, options, topdir)) pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) pipe.wait() @@ -73,18 +72,19 @@ def getrelease(pkgdirurl, rev=None, macros=[], exported=None, create=False): else: if exported is None: tmpdir = tempfile.mktemp() - svn.export(specurl, tmpdir, rev=rev) + svn.export(pkgcurrenturl, tmpdir, rev=rev) + topdir = tmpdir else: - tmpdir = os.path.join(exported, "SRPMS") + topdir = exported try: - found = glob.glob(os.path.join(srpmurl, "*.src.rpm")) + found = glob.glob(os.path.join(topdir, "SRPMS", "*.src.rpm")) if not found: raise Error("no .src.rpm file found inside %s" % srpmurl) srpmpath = found[0] options = rpm_macros_defs(macros) command = (("rpm -qp --qf '%%{EPOCH}:%%{VERSION}-%%{RELEASE}\n' " - " %s %s") % - (srpmpath, options)) + " %s %s --define '_topdir %s'") % + (srpmpath, options, topdir)) pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) pipe.wait() -- cgit v1.2.1