Yesterday, I posted the following proposal to the mailing list. I am putting it here, too, for future reference.
I have been thinking about how we can improve the pkgtools with some new and useful features. There are two that would be easy to implement and would give us some kind of "poor man's apt":
Replace PKG_PATH, which at the moment is either a single URL or a colon-separated list of local paths, by a simple config file. It could also include a few other directives, like the default pager for MESSAGE files. I am thinking of the following:
Pager=less Source=1,/usr/ports/Packages Source=255,https://www.mirbsd.org/MirOS/Packages/i386/
The "source" lines are just local paths or URLs with a priority value, where 0 is the highest one.
For http, we have the problem of getting the file names. I propose to put an index.txt file, with just one filename per line, into each "repository". The indices might be cached so that we know what files are where. For http, we could even automatically update by using an "If-Changed-Since" header, or have something akin to "apt-get update".
It would be very easy to just search the repos in order of priority and take the first match for the pkgspec given. Or we could use findbestmatchingname() to decide which package to take.
These changes can be implemented in a reasonable amount of time, I think. Maybe during the CCC?