improve the error messages in the requirements check job

The phrasing and formatting of the existing messages makes it hard for
users unfamiliar with the requirements management process to
understand what is wrong. This change tries to make the messages
clearer, removes an overly verbose error message, and adds a message
to handle the case where something is missing from the global list
entirely.

Change-Id: I40711bf53aac52d534a427f4bdd1a91c20106118
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-07-05 13:03:33 -04:00
parent 427c73372e
commit 773b134b78

View File

@ -105,14 +105,24 @@ def _is_requirement_in_global_reqs(req, global_reqs):
if req_exclusions.issubset(global_exclusions):
return True
else:
difference = global_exclusions - req_exclusions
print(
"Requirement for package {} "
"has an exclusion not found in the "
"global list: {} vs. {}".format(
req.package, req_exclusions, global_exclusions)
"excludes a version not excluded in the "
"global list.\n"
" Local settings : {}\n"
" Global settings: {}\n"
" Unexpected : {}".format(
req.package, req_exclusions, global_exclusions,
difference)
)
return False
print(
"Could not find a global requirements entry to match package {}. "
"If the package is already included in the global list, "
"the name or platform markers there may not match the local settings."
)
return False
@ -151,9 +161,6 @@ def _validate_one(name, reqs, blacklist, global_reqs):
counts[''] = counts.get('', 0) + 1
if not _is_requirement_in_global_reqs(
req, global_reqs[name]):
print("Requirement for package %s: %s does "
"not match openstack/requirements value : %s" % (
name, str(req), str(global_reqs[name])))
return True
# check for minimum being defined
min = [s for s in req.specifiers.split(',') if '>' in s]