Skip to content

Commit

Permalink
Merge pull request #190 from scfc/develop
Browse files Browse the repository at this point in the history
List invalid Source URLs when failing
  • Loading branch information
jeremycline committed Jan 15, 2018
2 parents df0cea1 + d59c169 commit 03576bf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hotness/buildsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,20 @@ def _validate_spec_urls(specfile_path):
# Patch0: patch-we-expect-to-be-in-dist-git.patch
# ...
output = sp.check_output(['spectool', '-l', specfile_path])
bad_urls = []
for line in output.splitlines():
if line.startswith('Source'):
# Parse to make sure it's a url
url = line.split(':', 1)[1].strip()
parsed_url = urlparse(url)
if not parsed_url.scheme or not parsed_url.netloc:
msg = ("One or more of the specfile's Sources is not a valid URL "
"so we cannot automatically build the new version for you. "
"Please use a URL in your Source declarations if possible.")
raise exceptions.SpecUrlException(msg)
bad_urls.append(url)
if bad_urls:
msg = ("The following Sources of the specfile are not valid URLs "
"so we cannot automatically build the new version for you. "
"Please use URLs in your Source declarations if possible.\n\n"
"- " + '\n- '.join(bad_urls))
raise exceptions.SpecUrlException(msg)


def spec_sources(specfile_path, target_dir):
Expand Down

0 comments on commit 03576bf

Please sign in to comment.