| |
@@ -17,15 +17,16 @@
|
| |
|
| |
sourcefile_expression = re.compile(r'^source[0-9]*:\s*(?P<val>.*)\s*$', re.IGNORECASE)
|
| |
|
| |
- def __init__(self, spec):
|
| |
+ def __init__(self, spec, sourcedir):
|
| |
self.spec = spec
|
| |
+ self.sourcedir = sourcedir
|
| |
self.sources = []
|
| |
|
| |
self.parse()
|
| |
|
| |
def parse(self):
|
| |
"""Call rpmspec and find source tags from the result."""
|
| |
- stdout = run(self.spec)
|
| |
+ stdout = run(self.spec, self.sourcedir)
|
| |
for line in stdout.splitlines():
|
| |
m = self.sourcefile_expression.match(line)
|
| |
if not m:
|
| |
@@ -36,8 +37,8 @@
|
| |
self.sources.append(val)
|
| |
|
| |
|
| |
- def run(spec):
|
| |
- cmdline = ['rpmspec', '-P', spec]
|
| |
+ def run(spec, sourcedir):
|
| |
+ cmdline = ['rpmspec', '--define', "_sourcedir %s" % sourcedir, '-P', spec]
|
| |
try:
|
| |
process = subprocess.Popen(cmdline,
|
| |
stdout=subprocess.PIPE,
|
| |
In many cases, specfile parsing in class
SpecFile
failedwhen the specfile contained local sources
like
Source2: local.txt
.This happened because rpm sourcedir configuration
was not passed to utility
rpmspec
used for parsing,leading it to default to
~/rpmbuild/SOURCES
,which is not correct for many layouts supported by rpkg.
Fixed by passing sourcedir correctly.
Signed-off-by: Otto Urpelainen oturpe@iki.fi