Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from freddy77/spectool_version_workaround
Browse files Browse the repository at this point in the history
Replace @Version@ with a proper version before calling spectool
  • Loading branch information
Jon Ludlam committed Oct 23, 2013
2 parents 0dcb794 + 424ed81 commit 103e90e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,18 @@ def sources_from_spec(spec_path):
Returns a list of source URLs with RPM macros expanded.
"""
sources = []
lines = subprocess.Popen(
["spectool", "--list-files", "--sources", spec_path],
stdout=subprocess.PIPE).communicate()[0].strip().split("\n")
p1 = subprocess.Popen(
['perl', '-pe', 's/^\\s*Version\\s*:\\s*\\@VERSION\\@.*/Version: 123.planex789\\n/i', spec_path],
stdout=subprocess.PIPE)
p2 = subprocess.Popen(
["spectool", "--list-files", "--sources", '<&STDIN'],
stdout=subprocess.PIPE,stdin=p1.stdout)
p1.stdout.close()
lines = p2.communicate()[0].strip().split("\n")
p1.wait()
if p2.returncode != 0 or p1.returncode != 0:
sys.stderr.write("error parsing spec file '%s'\n" % spec_path)
sys.exit(1)
for line in lines:
match = re.match(r"^([Ss]ource\d*):\s+(\S+)$", line)
if match:
Expand Down

0 comments on commit 103e90e

Please sign in to comment.