Date: Fri, 12 Sep 2014 21:14:51 -0500 From: Dan Lists <lists.dan@gmail.com> To: freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: Repository Search Order Message-ID: <CAPW8bZ3gfX_YMfLi0_7WnOMyJhT%2BvrWG17dJtkvyv334nc5pXA@mail.gmail.com> In-Reply-To: <CAPW8bZ3tnUk_FhR5oS-p7K-Cy3kY1rL8YDzdK11O860tjfcjpw@mail.gmail.com> References: <CAPW8bZ3tnUk_FhR5oS-p7K-Cy3kY1rL8YDzdK11O860tjfcjpw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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? >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPW8bZ3gfX_YMfLi0_7WnOMyJhT%2BvrWG17dJtkvyv334nc5pXA>