uv-resolver: rejigger 'trace_resolution'

When I first wrote this routine, it was intended to only emit a trace
for the final "unioned" resolution. But we actually moved that semantic
operation to the construction of the resolution *graph*. So there is no
unioned `Resolution` any more.

But this is still useful to see. So I changed this to just emit a trace
of *every* resolution right before constructing the graph.

It might be nice to also emit a trace of the unioned graph too. Or
perhaps we should do that instead if this proves too noisy. (Although
this is only emitted at TRACE level.)
This commit is contained in:
Andrew Gallant 2024-08-21 13:34:12 -04:00 committed by Andrew Gallant
parent d6a14464ab
commit 94a0a0f2ee

View file

@ -366,7 +366,6 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
);
}
Self::trace_resolution(&resolution);
resolutions.push(resolution);
continue 'FORK;
};
@ -563,6 +562,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
resolution.nodes.len()
);
}
Self::trace_resolution(resolution);
}
ResolutionGraph::from_state(
&resolutions,
@ -579,7 +579,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
}
/// When trace level logging is enabled, we dump the final
/// unioned resolution, including markers, to help with
/// set of resolutions, including markers, to help with
/// debugging. Namely, this tells use precisely the state
/// emitted by the resolver before going off to construct a
/// resolution graph.
@ -587,9 +587,14 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
if !tracing::enabled!(Level::TRACE) {
return;
}
if let Some(markers) = combined.markers.fork_markers() {
trace!("Resolution: {:?}", markers);
} else {
trace!("Resolution: <matches all marker environments>");
}
for edge in &combined.edges {
trace!(
"Resolution: {} -> {}",
"Resolution edge: {} -> {}",
edge.from
.as_ref()
.map(PackageName::as_str)
@ -619,7 +624,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
if let Some(marker) = edge.marker.contents() {
write!(msg, " ; {marker}").unwrap();
}
trace!("Resolution: {msg}");
trace!("Resolution edge: {msg}");
}
}