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-??-??): 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 #25: https://github.com/voidlinux/xbps/issues/25
* Fixed issue #24: https://github.com/voidlinux/xbps/issues/24 * 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 .Os Void Linux
.Dt xbps-install 8 .Dt xbps-install 8
.Sh NAME .Sh NAME
@ -70,8 +70,7 @@ Show the help usage.
.It Fl n, Fl -dry-run .It Fl n, Fl -dry-run
Dry-run mode. Show what actions would be done but don't do anything. Dry-run mode. Show what actions would be done but don't do anything.
.It Fl R, Fl -repository=uri .It Fl R, Fl -repository=uri
Repository to be added to the list. Multiple repositories can be specified. This repository Repository to be added to the top of the list. This option can be specified multiple times.
list overrides the list in a configuration file.
.It Fl r, Fl -rootdir Ar dir .It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory. Specifies a full path for the target root directory.
.It Fl S, Fl -sync .It Fl S, Fl -sync

View File

@ -1,4 +1,4 @@
.Dd October 12, 2013 .Dd December 4, 2013
.Os Void Linux .Os Void Linux
.Dt xbps-query 8 .Dt xbps-query 8
.Sh NAME .Sh NAME
@ -62,9 +62,8 @@ Show the help usage.
Enable repository mode. This mode explicitly looks in repositories, rather Enable repository mode. This mode explicitly looks in repositories, rather
than looking in the target root directory. The than looking in the target root directory. The
.Ar url .Ar url
argument is optional and can be used to add the repository to the list, argument is optional and can be used to add the repository to the top of the list.
overriding the repository list of a configuration file. Multiple repositories This option can be specified multiple times.
can be specified.
.It Fl r, Fl -rootdir Ar dir .It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory. Specifies a full path for the target root directory.
.It Fl v, Fl -verbose .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 Lists repositories and the number of packages contained on them. If a repository is not
available the number of packages will be available the number of packages will be
.Sy -1 . .Sy -1 .
The
.Fl v
option can be used to show more detailed information of remote repositories.
.It Fl m, Fl -list-manual-pkgs .It Fl m, Fl -list-manual-pkgs
Lists registered packages in the package database (pkgdb) that were installed Lists registered packages in the package database (pkgdb) that were installed
manually by the user (i.e not as dependency of any package). 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 * Append repository list specified in configuration file.
* configuration file.
*/ */
if (xbps_array_count(xhp->repositories) == 0) { for (unsigned int i = 0; i < cfg_size(xhp->cfg, "repositories"); i++) {
for (unsigned int i = 0; i < cfg_size(xhp->cfg, "repositories"); i++) { if (xhp->repositories == NULL)
if (xhp->repositories == NULL) xhp->repositories = xbps_array_create();
xhp->repositories = xbps_array_create();
repodir = cfg_getnstr(xhp->cfg, "repositories", i); repodir = cfg_getnstr(xhp->cfg, "repositories", i);
xbps_array_add_cstring_nocopy(xhp->repositories, repodir); xbps_array_add_cstring_nocopy(xhp->repositories, repodir);
}
} }
if (xhp->cachedir == NULL) { if (xhp->cachedir == NULL) {