summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2007-12-04 15:38:24 -0500
committerMichael E Brown <michael_e_brown@dell.com>2007-12-04 17:28:01 -0600
commit339fada0f033950b7165fbd98efdf9323f37f6be (patch)
tree785c473d5341f5d3feb7172da4352ccf24429c8c
parent2679d3cae92a1178b586fc1c07b1fbfcac88972a (diff)
downloadmock-339fada0f033950b7165fbd98efdf9323f37f6be.tar.gz
mock-339fada0f033950b7165fbd98efdf9323f37f6be.tar.xz
mock-339fada0f033950b7165fbd98efdf9323f37f6be.zip
add --with and --without options to enable/disable options in a srpm
Signed-off-by: Michael E Brown <michael_e_brown@dell.com>
-rw-r--r--docs/mock.112
-rwxr-xr-xpy/mock.py12
2 files changed, 23 insertions, 1 deletions
diff --git a/docs/mock.1 b/docs/mock.1
index 17b5081..28c2629 100644
--- a/docs/mock.1
+++ b/docs/mock.1
@@ -59,7 +59,17 @@ Specify target build arch.
\fB\-\-define=\fR"\fIMACRO EXPR\fP"
Specify macro definitions used for the build. This option may be used multiple times, just as the rpmbuild \-\-define option can be. For example:
-\fB\-\-define="with_extra_cheese 1" \-\-define="packager Monkey"\fR
+\fB\-\-define "with_extra_cheese 1" \-\-define="packager Monkey"\fR
+.TP
+\fB\-\-with=\fR\fIOPTION\fP
+Enable configure OPTION for build. This option may be used multiple times. For example:
+
+\fB\-\-with extra_cheese\fR
+.TP
+\fB\-\-without=\fR\fIOPTION\fP
+Disable configure OPTION for build. This option may be used multiple times. For example:
+
+\fB\-\-without anchovies\fR
.TP
\fB\-\-resultdir=\fR\fIRESULTDIR\fP
Change directory where resulting files (RPMs and build logs) are written. Resultdir can contain python-string substitutions for any variable in the chroot config. For example:
diff --git a/py/mock.py b/py/mock.py
index f626bca..7426e56 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -106,6 +106,12 @@ def command_parse(config_opts):
parser.add_option("--define", action="append", dest="rpmmacros",
default=[], type="string", metavar="'MACRO EXPR'",
help="define an rpm macro (may be used more than once)")
+ parser.add_option("--with", action="append", dest="rpmwith",
+ default=[], type="string", metavar="option",
+ help="enable configure option for build (may be used more than once)")
+ parser.add_option("--without", action="append", dest="rpmwithout",
+ default=[], type="string", metavar="option",
+ help="disable configure option for build (may be used more than once)")
parser.add_option("--resultdir", action="store", type="string",
default=None, help="path for resulting files to be put")
parser.add_option("--uniqueext", action="store", type="string",
@@ -224,6 +230,12 @@ def set_config_opts_per_cmdline(config_opts, options, args):
if not options.clean:
config_opts['clean'] = options.clean
+ for option in options.rpmwith:
+ options.rpmmacros.append("_with_%s 1" % option)
+
+ for option in options.rpmwithout:
+ options.rpmmacros.append("_with_%s 0" % option)
+
for macro in options.rpmmacros:
try:
k, v = macro.split(" ", 1)