Repository Search Order
Dan Lists
lists.dan at gmail.com
Sat Sep 13 02:14:52 UTC 2014
Attached is a proof of concept patch that handles the sorting. For
production, the repos array would need bounds checking, and the 1024 should
be a define.
On Fri, Sep 12, 2014 at 8:02 PM, Dan Lists <lists.dan at gmail.com> wrote:
> man pkg.conf states:
>
> Repositories are prioritized in the order they are found on the
> REPOS_DIR
> search path, with individual repository configuration files in the
> same
> directory processed in alphabetical order. Earlier files take prece-
> dence, meaning that packages will be downloaded from them
> preferentially
> where the same package is available from several repositories.
>
> This is not true, but I would like it to be.
>
> # ls /usr/local/etc/pkg/repos/
> 00_Local.conf 80_zzz.conf 90_fff.conf 99_mmm.conf FreeBSD.conf
>
> So the order should be local, zzz, fff, mmm.
>
> Repositories:
> mmm: {
> url : "http://some.dom/freebsd:8:x86:64/mmm",
> enabled : yes
> }
> fff: {
> url : "http://some.dom/freebsd:8:x86:64/fff",
> enabled : yes
> }
> local: {
> url : "file:///usr/ports/packages",
> enabled : yes
> }
> zzz: {
> url : "http://some.dom/freebsd:8:x86:64/zzz",
> enabled : yes
> }
>
> The order has no relation to alphabetical order at all. Interestingly,
> if I use find (unsorted), it matches the repository order!
>
> # find /usr/local/etc/pkg/repos
> /usr/local/etc/pkg/repos
> /usr/local/etc/pkg/repos/FreeBSD.conf
> /usr/local/etc/pkg/repos/99_mmm.conf
> /usr/local/etc/pkg/repos/90_fff.conf
> /usr/local/etc/pkg/repos/00_Local.conf
> /usr/local/etc/pkg/repos/80_zzz.conf
>
> I quick look at the source shows that load_repo_files is just reading the
> files in the order they are in the directory table:
>
> while ((ent = readdir(d))) {
> ...
> }
>
> Can we get the repo config files sorted like the docs say?
>
More information about the freebsd-questions
mailing list