Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate crate check no longer reports crate names #25508

Closed
jdm opened this issue Jan 13, 2020 · 2 comments
Closed

Duplicate crate check no longer reports crate names #25508

jdm opened this issue Jan 13, 2020 · 2 comments
Assignees

Comments

@jdm
Copy link
Member

@jdm jdm commented Jan 13, 2020

Checking files for tidiness...
./Cargo.lock:1: duplicate versions for package `mach`
	The following packages depend on version 0.2.3 from 'crates.io':
	The following packages depend on version 0.3.2 from 'crates.io':
./Cargo.lock:1: duplicate versions for package `nix`
	The following packages depend on version 0.14.1 from 'crates.io':
	The following packages depend on version 0.15.0 from 'crates.io':

I suspect this is a regression from the python3 changes.

@jdm
Copy link
Member Author

@jdm jdm commented Jan 13, 2020

for (name, packages) in iteritems(packages_by_name):
has_duplicates = len(packages) > 1
duplicates_allowed = name in exceptions
if has_duplicates == duplicates_allowed:
continue
if duplicates_allowed:
message = 'duplicates for `{}` are allowed, but only single version found'.format(name)
else:
message = "duplicate versions for package `{}`".format(name)
packages.sort()
packages_dependencies = list(find_reverse_dependencies(name, content))
for version, source in packages:
short_source = source.split("#")[0].replace("git+", "")
message += "\n\t\033[93mThe following packages depend on version {} from '{}':\033[0m" \
.format(version, short_source)
for name, dependency in packages_dependencies:
if version in dependency and short_source in dependency:
message += "\n\t\t" + name
yield (1, message)

@jdm
Copy link
Member Author

@jdm jdm commented Jan 13, 2020

On the other hand, it's possible this has been broken since #24334, which would mean that

def find_reverse_dependencies(name, content):
for package in itertools.chain([content.get("root", {})], content["package"]):
for dependency in package.get("dependencies", []):
if dependency.startswith("{} ".format(name)):
yield package["name"], dependency
is broken for some reason.

@jdm jdm mentioned this issue Jan 13, 2020
2 of 2 tasks complete
@jdm jdm added the I-papercut label May 20, 2020
@jdm jdm self-assigned this May 20, 2020
bors-servo added a commit that referenced this issue May 26, 2020
Fix output of test-tidy with duplicated packages.

Fixes #25508.
bors-servo added a commit that referenced this issue May 26, 2020
Fix output of test-tidy with duplicated packages.

Fixes #25508.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.