From 09539112eb8f1ae5bf8bb9aa12ef505fcb39deae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Fri, 8 Jul 2016 14:24:13 +0200 Subject: buildrpm: add support for passing arguments directly to rpmbuild --- MgaRepo/commands/buildrpm.py | 2 ++ MgaRepo/rpmutil.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'MgaRepo') diff --git a/MgaRepo/commands/buildrpm.py b/MgaRepo/commands/buildrpm.py index 337ae2a..9caec45 100644 --- a/MgaRepo/commands/buildrpm.py +++ b/MgaRepo/commands/buildrpm.py @@ -19,6 +19,7 @@ Options: -s Jump to specific build stage (--short-circuit) -l Use subversion log to build rpm %changelog -F Do not use full name & email for packagers in %changelog + -- Options and arguments following will be passed to rpmbuild """ @@ -35,6 +36,7 @@ def parse_options(): parser.add_option("-F", dest="fullnames", default=True, action="store_false") opts, args = parser.parse_args() + opts.rpmargs = parser.rargs return opts def main(): diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py index 9cfbef2..3916bca 100644 --- a/MgaRepo/rpmutil.py +++ b/MgaRepo/rpmutil.py @@ -387,7 +387,8 @@ def build_rpm(build_cmd="b", use_dnf = False, svnlog = False, fullnames = True, - macros = []): + macros = [], + **rpmargs): top = os.getcwd() topdir = "_topdir %s" % top builddir = "_builddir %s/%s" % (top, "BUILD") @@ -438,6 +439,7 @@ def build_rpm(build_cmd="b", args.extend(pair) for pair in macros: args.extend(("--define", "%s %s" % pair)) + args.extend(*rpmargs.values()) os.environ["LC_ALL"] = "C" # First check whether dependencies are satisfied status, output = execcmd(*args + ["--nobuild"], show=verbose, collecterr=True, noerror=True) -- cgit v1.2.1