On Thu, Apr 18, 2024 at 12:54:02PM -0400, Jason Conroy wrote: > > Efraim Flashner writes: > > > Currently if you were to pull in rust-rand-0.8 and rust-rand-0.7 then > > you'd have both rand-0.*.crate files in the registry but only one of > > them would be listed in share/cargo/registry/index/ra/nd/rand. I need to > > adjust the generation of that file to combine multiple sources if they > > exist, and sort them (I'm not sure it's necessary, but wouldn't be > > surprised if we hit undefined behaviour if they were listed multiple > > times or out of order). > > Hi Efraim, > > I'm currently investigating this limitation of your proposed patch. > > Did you have a strategy in mind for how to fix it? I see that the index > files are currently generated during a phase of cargo-build-system, rather > than as a profile hook. So, to build an index that properly reflects the > contents of a profile, it would seem that the two simplest options are: a) > keep your existing index-generation logic during the build, and merge these > per-package index files when building the profile; or b) move your patch's > index-generating code out of the build phase and into a profile hook, so > that we build each index file in a single pass (for all versions of a > package) rather than merging the files from each package output. > > On the surface option (b) seems cleaner, but maybe you had a reason for > generating the index contents during the build? I like the idea of moving the code into a profile hook much better than what I have now. What's there was more of a proof-of-concept of how it might work. On the other hand, by generating it during the build of each package we make sure to pull in all the crates which exist in the build, so we could add into a profile/manifest just the crates listed in a Cargo.toml and then each crate would pull in its own dependencies, and then the profile hook could combine them all together. The down side is we'd have to have the logic to combine the overlapping rand-0.7/rand-0.8 paths both in the build system and in the profile. Overall it doesn't seem that bad though, since we could then add packages either as a regular input or as a cargo-input. -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted