Add repos set in xbps_handle::repositories to the top of the list.

That means that now xbps-install(8) and xbps-query(8) --repository
option does not override the repository list of a configuration file.
This commit is contained in:
Juan RP 2013-12-04 16:59:15 +01:00
parent d98468515a
commit 4403caa434
4 changed files with 18 additions and 16 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.28 (2014-??-??):
* The `--repository` option in xbps-install(8) and xbps-query(8) now adds
the repositories at the top of the list, rather than overriding the list
specified in a configuration file.
* Fixed issue #25: https://github.com/voidlinux/xbps/issues/25
* Fixed issue #24: https://github.com/voidlinux/xbps/issues/24

View File

@ -1,4 +1,4 @@
.Dd October 12, 2013
.Dd December 4, 2013
.Os Void Linux
.Dt xbps-install 8
.Sh NAME
@ -70,8 +70,7 @@ Show the help usage.
.It Fl n, Fl -dry-run
Dry-run mode. Show what actions would be done but don't do anything.
.It Fl R, Fl -repository=uri
Repository to be added to the list. Multiple repositories can be specified. This repository
list overrides the list in a configuration file.
Repository to be added to the top of the list. This option can be specified multiple times.
.It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory.
.It Fl S, Fl -sync

View File

@ -1,4 +1,4 @@
.Dd October 12, 2013
.Dd December 4, 2013
.Os Void Linux
.Dt xbps-query 8
.Sh NAME
@ -62,9 +62,8 @@ Show the help usage.
Enable repository mode. This mode explicitly looks in repositories, rather
than looking in the target root directory. The
.Ar url
argument is optional and can be used to add the repository to the list,
overriding the repository list of a configuration file. Multiple repositories
can be specified.
argument is optional and can be used to add the repository to the top of the list.
This option can be specified multiple times.
.It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory.
.It Fl v, Fl -verbose
@ -110,6 +109,9 @@ Such packages won't be updated automatically.
Lists repositories and the number of packages contained on them. If a repository is not
available the number of packages will be
.Sy -1 .
The
.Fl v
option can be used to show more detailed information of remote repositories.
.It Fl m, Fl -list-manual-pkgs
Lists registered packages in the package database (pkgdb) that were installed
manually by the user (i.e not as dependency of any package).

View File

@ -172,17 +172,14 @@ xbps_init(struct xbps_handle *xhp)
}
}
/*
* If repositories array is empty use the provided list from
* configuration file.
* Append repository list specified in configuration file.
*/
if (xbps_array_count(xhp->repositories) == 0) {
for (unsigned int i = 0; i < cfg_size(xhp->cfg, "repositories"); i++) {
if (xhp->repositories == NULL)
xhp->repositories = xbps_array_create();
for (unsigned int i = 0; i < cfg_size(xhp->cfg, "repositories"); i++) {
if (xhp->repositories == NULL)
xhp->repositories = xbps_array_create();
repodir = cfg_getnstr(xhp->cfg, "repositories", i);
xbps_array_add_cstring_nocopy(xhp->repositories, repodir);
}
repodir = cfg_getnstr(xhp->cfg, "repositories", i);
xbps_array_add_cstring_nocopy(xhp->repositories, repodir);
}
if (xhp->cachedir == NULL) {