| |
@@ -18,16 +18,16 @@
|
| |
r'^((source[0-9]*|patch[0-9]*)\s*:\s*(?P<val>.*))\s*$',
|
| |
re.IGNORECASE)
|
| |
|
| |
- def __init__(self, spec, sourcedir):
|
| |
+ def __init__(self, spec, rpmdefines):
|
| |
self.spec = spec
|
| |
- self.sourcedir = sourcedir
|
| |
+ self.rpmdefines = rpmdefines
|
| |
self.sources = []
|
| |
|
| |
self.parse()
|
| |
|
| |
def parse(self):
|
| |
"""Call rpmspec and find source tags from the result."""
|
| |
- stdout = run(self.spec, self.sourcedir)
|
| |
+ stdout = run(self.spec, self.rpmdefines)
|
| |
for line in stdout.splitlines():
|
| |
m = self.sourcefile_expression.match(line)
|
| |
if not m:
|
| |
@@ -38,8 +38,10 @@
|
| |
self.sources.append(val)
|
| |
|
| |
|
| |
- def run(spec, sourcedir):
|
| |
- cmdline = ['rpmspec', '--define', "_sourcedir %s" % sourcedir, '-P', spec]
|
| |
+ def run(spec, rpmdefines):
|
| |
+ cmdline = ['rpmspec']
|
| |
+ cmdline.extend(rpmdefines)
|
| |
+ cmdline.extend(['-P', spec])
|
| |
try:
|
| |
process = subprocess.Popen(cmdline,
|
| |
stdout=subprocess.PIPE,
|
| |
Conditional Source: tags are problematic and, in fact, forbidden in at
least Fedora. However, there are packages that conditionalize packages
based on macros such as %{rhel} or %{fedora}. 'x-pkg sources' did not
handle such packages correctly, because when the specfile was parsed
to check for unused sources, values for those macros were not set. This
was different from other commands which set such macros based on the
value of --release parameter or Git branch name.
Improve support for conditional Source: tags by using the standard set
of rpmdefines when the specfile is parsed in 'fedpkg sources'.
Fixes #671
Signed-off-by: Otto Liljalaakso otto.liljalaakso@iki.fi