Is there any rule like this for crates?
In your developer / submitter / committer scenario, crates.io (and vast majority of open source package repos) have only the first two layers.
If you think that ports committers thoroughly audit the software source before accepting a patch, I am afraid you are mistaken. They review the ports patch itself - the build instructions - but as to the source code it pulls… nope. There are plenty of ports where the maintainer / committer doesn’t even check if the software
runs after a successful build.
I thought the discussion here is about rust *in base* - and pulling precompiled binaries from random sources into base should be an absolute no-go
1. I was responding to an article that someone shared.
2. Nobody is advocating for pulling precompiled binaries from random sources. That’s not how crates work. Any third-party Rust programs in base would have their code in contrib/ same as any other software.
That second point brings up a pretty big logistical issue: you need to have all of the source in contrib; you need all of the dependency source in contrib; and you need to verify that all of the licenses are acceptable. And the way that Rust (and Python, and Go, and Ruby, and any other 21st century programming language with a package manager) works is that every program has its own dependency environment, listing the dependencies it uses and their versions. Two programs may have completely incompatible versions of a single dependency, so what do you do then? Either patch one to make it work with a newer one and hope it gets upstreamed, or run both dependencies alongside one another... it gets messy. Effectively each of these programs statically links to its own versions of dependencies.
So I think it's unlikely to see a lot of Rust software in contrib/. If Rust gets used in base, it'll be mostly by FreeBSD developers who pull up src/, (re-)write something, and commit it. Which I think that's pretty interesting in terms of providing a reliable programming environment for Rust. Any pulled in dependencies
should get thoroughly audited, and most of all we would end up agreeing on versions of dependencies that can be used across the board. So it becomes a platform for building Rust programs that, while a bit limited and not on the cutting edge, is predictable and reliable. To an extent, Ports tree has addressed some of this - look at how Python dependencies are handled. Each dependency has its own port, so the versions are consistent. This requires coordination, and sometimes there are multiple major or minor versions, but all the versions are pinned.
Another possibility though is that developers spend a bunch of time bickering about what dependencies are allowed, what versions to use (even of rustc) etc. End users get confused and frustrated why they don't have access to particular features even though it ships with Rust. I wasn't around for the time when Perl was in base, but it brought about some of the same challenges. So the closest current example we have right now, I think, is lua. FreeBSD ships with a version of lua (
/usr/libexec/flua) and I think it may even have some libraries. But it's not really intended for end users, and I'm not sure there's a way to install Lua dependencies with it. So there ends up being a ports version that is intended for end users.