summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/fedpkg.py11
-rw-r--r--src/pyfedpkg/__init__.py11
2 files changed, 22 insertions, 0 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 475b538..83dbc7a 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -880,6 +880,17 @@ def parse_cmdline(generate_manpage = False):
# Let somebody override the username found in fedora cert
parser.add_argument('-u', '--user',
help = "Override the username found in the fedora cert")
+ # Let the user define rpm macros (similar to mock)
+ parser.add_argument('-D', '--define', action = 'append', default = [],
+ dest = 'rpmmacros', metavar = "'MACRO EXPR'",
+ help = "define an rpm macro for rpmbuild")
+ # Let the user add --with/--without args for rpmbuild (similar to mock)
+ parser.add_argument('--with', action = 'append', default = [],
+ dest = 'rpmwith',
+ help = "enable configure option for rpmbuild")
+ parser.add_argument('--without', action = 'append', default = [],
+ dest = 'rpmwithout',
+ help = "disable configure option for rpmbuild")
# Let the user define which path to look at instead of pwd
parser.add_argument('--path', default = None,
help='Directory to interact with instead of current dir')
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 92bc7df..cd43498 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1198,6 +1198,10 @@ class PackageModule:
"--define 'dist .%s'" % self.dist,
"--define '%s %s'" % (self.distvar, self.distval),
"--define '%s 1'" % self.dist]
+ self.rpmbuildopts = (
+ [ ( "--define '%s'" % x) for x in args.rpmmacros] +
+ [ ( "--with '%s'" % x) for x in args.rpmwith ] +
+ [ ("--without '%s'" % x) for x in args.rpmwithout ])
try:
self.ver = self.getver()
self.rel = self.getrel()
@@ -1393,6 +1397,7 @@ class PackageModule:
# setup the rpm command
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
if arch:
cmd.extend(['--target', arch])
if short:
@@ -1565,6 +1570,7 @@ class PackageModule:
# setup the rpm command
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
if arch:
cmd.extend(['--target', arch])
if short:
@@ -1622,6 +1628,7 @@ class PackageModule:
# build up the rpm command
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
# This may need to get updated if we ever change our checksum default
if not hashtype == 'sha256':
cmd.extend(["--define '_source_filedigest_algorithm %s'" % hashtype,
@@ -1646,6 +1653,7 @@ class PackageModule:
# setup the command
cmd = ['mock']
cmd.extend(mockargs)
+ cmd.extend(self.rpmbuildopts)
cmd.extend(['-r', self.mockconfig, '--resultdir',
os.path.join(self.path, self.module, self.ver, self.rel),
'--rebuild', self.srpmname])
@@ -1792,6 +1800,7 @@ class PackageModule:
# setup the rpm command
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
if arch:
cmd.extend(['--target', arch])
cmd.extend(['--nodeps', '-bp', os.path.join(self.path, self.spec)])
@@ -1815,6 +1824,7 @@ class PackageModule:
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
# Figure out which hashtype to use, if not provided one
if not hashtype:
hashtype = self.hashtype
@@ -1853,6 +1863,7 @@ class PackageModule:
# setup the rpm command
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+ cmd.extend(self.rpmbuildopts)
cmd.extend(['-bl', os.path.join(self.path, self.spec)])
# Run the command
_run_command(cmd, shell=True)