One could make features available by having the -dev just go ahead and pull in all potential dependencies, and let Cargo figure out what it actually wants. As I see it, the +feature subpackages only serve to minimize the build root when those dependencies aren’t actually needed. That’s an optimization, but not a necessity.
True, but in some practical cases it becomes nearly a necessity to avoid
a massive excess in dependencies.
Anyway, good work on all this! I’m watching this closely for Fedora inspiration, as we haven’t formed proper packaging policies yet. I’m not sure there enough code that could be shared with a theoretical rpmcargo sibling to debcargo, but we can still try to cross-pollinate ideas.
I think we could share a great deal, actually. We can share all of the
downloading and parsing code, and the calculation of dependencies and
packages, and just abstract out the writing of the source package. In
the code of debcargo, the code we’d need to split out starts with a
braced block inside do_package; imagine keeping everything in do_package
above that, and factoring out the code below that into a
write_debian_source or write_srpm function.
Right now, those two blocks share a huge number of local variables; we’d
need to factor that out into a “Package” structure instead, likely using
a builder pattern.