You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.4 KiB
64 lines
2.4 KiB
diff --git a/docs/yum-builddep.1 b/docs/yum-builddep.1 |
|
index fbe32bd..54dce0e 100644 |
|
--- a/docs/yum-builddep.1 |
|
+++ b/docs/yum-builddep.1 |
|
@@ -17,6 +17,12 @@ disabled) or it can be a local source RPM or a spec file. |
|
.PP |
|
Note, that only the BuildRequires information within the SRPM header information is used to determine build dependencies. This will specifically omit any dependencies that are required only for specific architectures. |
|
.PP |
|
+.SH "GENERAL OPTIONS" |
|
+.IP "\fB\--target ARCH\fP" |
|
+Set target architecture for spec parsing. |
|
+.IP "\fB\--define 'MACRO EXPR'\fP" |
|
+Define the rpm MACRO with value EXPR for spec parsing. |
|
+.PP |
|
.SH "EXAMPLES" |
|
.IP "Download and install all the RPMs needed to build the kernel RPM:" |
|
\fByumdownloader --source kernel && rpm2cpio kernel*src.rpm | cpio -i kernel.spec && \\ \fP |
|
diff --git a/yum-builddep.py b/yum-builddep.py |
|
index 5f59ab8..dfdd31b 100755 |
|
--- a/yum-builddep.py |
|
+++ b/yum-builddep.py |
|
@@ -67,6 +67,13 @@ class YumBuildDep(YumUtilBase): |
|
if hasattr(rpm, 'reloadConfig'): |
|
self.optparser.add_option("--target", |
|
help="set target architecture for spec parsing") |
|
+ self.optparser.add_option( |
|
+ "--define", |
|
+ action="append", |
|
+ default=[], |
|
+ metavar="'MACRO EXPR'", |
|
+ help="define the rpm MACRO with value EXPR for spec parsing", |
|
+ ) |
|
self.main() |
|
|
|
def main(self): |
|
@@ -229,11 +236,28 @@ class YumBuildDep(YumUtilBase): |
|
self.logger.info('Getting requirements for %s' % srpm) |
|
self.install_deps(srpm.requiresList(), opts) |
|
|
|
+ # Parse macro defines |
|
+ macros = [] |
|
+ error = False |
|
+ for define in opts.define: |
|
+ words = define.split(None, 1) |
|
+ if len(words) == 1: |
|
+ self.logger.error('Error: No EXPR given for MACRO %%%s' |
|
+ % words[0]) |
|
+ error = True |
|
+ continue |
|
+ macros.append(words) |
|
+ if error: |
|
+ sys.exit(1) |
|
+ |
|
for name in specnames: |
|
# (re)load rpm config for target if set |
|
if reloadworks and opts.target: |
|
rpm.reloadConfig(opts.target) |
|
|
|
+ for macro in macros: |
|
+ rpm.addMacro(*macro) |
|
+ |
|
try: |
|
spec = rpm.spec(name) |
|
except ValueError:
|
|
|