From 4403caa434e8d9cb024399ce708a507b4a6e3730 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 4 Dec 2013 16:59:15 +0100 Subject: [PATCH] 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. --- NEWS | 4 ++++ bin/xbps-install/xbps-install.8 | 5 ++--- bin/xbps-query/xbps-query.8 | 10 ++++++---- lib/initend.c | 15 ++++++--------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index bc3b0e73..bd200457 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/bin/xbps-install/xbps-install.8 b/bin/xbps-install/xbps-install.8 index d5e4093f..8d5f3a85 100644 --- a/bin/xbps-install/xbps-install.8 +++ b/bin/xbps-install/xbps-install.8 @@ -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 diff --git a/bin/xbps-query/xbps-query.8 b/bin/xbps-query/xbps-query.8 index 17213e23..46125206 100644 --- a/bin/xbps-query/xbps-query.8 +++ b/bin/xbps-query/xbps-query.8 @@ -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). diff --git a/lib/initend.c b/lib/initend.c index 704204cc..93958154 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -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) {