From a493be252f25b57767023930d4ed927b37816e71 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 29 Jan 2007 18:14:56 +0000 Subject: Removed bogus macros files and added [macros ..] sections to repsys.conf. These sections are referenced by the "rpm-macros" option in [submit ..] sections and contain the RPM macros to be used with the target of the package being generated. These macros are defined using --define option of rpm. --- RepSys/rpmutil.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'RepSys/rpmutil.py') diff --git a/RepSys/rpmutil.py b/RepSys/rpmutil.py index 968470c..367fd45 100644 --- a/RepSys/rpmutil.py +++ b/RepSys/rpmutil.py @@ -25,6 +25,11 @@ def get_spec(pkgdirurl, targetdir=".", submit=False): if os.path.isdir(tmpdir): shutil.rmtree(tmpdir) +def rpm_macros_defs(macros): + defs = ("--define \"%s %s\"" % macro for macro in macros) + args = " ".join(defs) + return args + def get_srpm(pkgdirurl, mode = "current", targetdirs = None, @@ -37,6 +42,7 @@ def get_srpm(pkgdirurl, scripts = [], submit = False, template = None, + macros = [], verbose = 0): svn = SVN(baseurl=pkgdirurl) tmpdir = tempfile.mktemp() @@ -68,7 +74,7 @@ def get_srpm(pkgdirurl, if svnlog: submit = not not revision specfile_svn2rpm(pkgdirurl, spec, revision, submit=submit, - template=template) + template=template, macros=macros) revisionreal = svn.revision(pkgdirurl) for script in scripts: status, output = execcmd(script, tmpdir, spec, str(revision), @@ -78,9 +84,10 @@ def get_srpm(pkgdirurl, if packager: packager = " --define 'packager %s'" % packager - execcmd("rpm -bs --nodeps %s %s %s %s %s %s %s %s %s" % + defs = rpm_macros_defs(macros) + execcmd("rpm -bs --nodeps %s %s %s %s %s %s %s %s %s %s" % (topdir, builddir, rpmdir, sourcedir, specdir, - srcrpmdir, patchdir, packager, spec)) + srcrpmdir, patchdir, packager, spec, defs)) if revision and revisionreal: srpm = glob.glob(os.path.join(srpmsdir, "*.src.rpm"))[0] -- cgit v1.2.1