aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MgaRepo/log.py24
1 files 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()