On Sat, Feb 13, 2021 at 8:51 PM Zac Medico <zmed...@gentoo.org> wrote: > > > 2. Generate a hash of the file contents - this can go in the filename > > so that the file can co-exist with other files, and be located > > assuming you have a full matching set of metadata. > > For FEATURES=binpkg-multi-instance we currently use an integer BUILD_ID > ensure that file names are unique. > > > 3. Start dropping attributes from the file based on a list of > > priorities and generate additional hashes. Create symlinked files to > > the original file using these hashes (overwriting or not existing > > symlinks based on policy). This allows the binary package to be found > > using either an exact set of attributes or a subset of higher-priority > > attributes. This is analogous to shared object symlinking. > > 4. The package manager will look for a binary package first using the > > user's full config, and then by dropping optional elements of the > > config (so maybe it does the search without CFLAGs, then without USE > > flags). Eventually it aborts based on user prefs (maybe the user only > > wants an exact match, or is willing to accept alternate CFLAGs but not > > USE flags, or maybe anything for the arch is selected> 5. As always the > > final selected binary package still gets evaluated > > like any other binary package to ensure it is usable. > > > > Such a system can identify whether a potentially usable file exists > > using only filename, cutting down on fetching. In the interests of > > avoiding useless fetches we would only carry step 3 reasonably far - > > packages would have to match based on architecture and any dynamic > > linking requirements. So we wouldn't generate hashes that didn't > > include at least those minimums, and the package manager wouldn't > > search for them. > > > > Obviously you could do more (if you have 5 combinations of use flags, > > look for the set that matches most closely). That couldn't be done > > using hashes alone in an efficient way. You could have a small > > manifest file alongside the binary package that could be fetched > > separately if the package manager wants to narrow things down and > > fetch a few of those to narrow it down further. > > All of the above is oriented toward multi-profile binhosts, so we'll > have to do a cost/benefit analysis to determine whether it's worth the > effort to introduce the complexity that multi-profile binhosts add.
The hash label on the filenames was also considered around multi-profiles. I figured that if you're going to be building variants of packages you'd want to parallelize and hashes work better for that. Plus at least in concept you could potentially identify and fetch files by hash using info already in the local repo without having to sync additional metadata from the binhost. User-contributed binaries would also work better in such a world though for obvious security issues that might just take the form of local user-generated repos (allowing users to supplement the upstream repo with local builds for a cluster, without having to mirror/reporoduce the entire upstream. I do get that multi-profiles aren't entirely an essential feature, but when you consider stuff like X11 support or stable/unstable it seems like we're probably going to have to provide at least a few variants on packages for this to be practical. You could just put each profile in a separate repo, but then anything that doesn't actually change across profiles gets built multiple times. The hash-based solution is also a form of deduping. But, hey, it is great to see anything like this being done at all. Walking before running isn't a bad thing! -- Rich