xbps-{install,query}: added -i to ignore repos defined in xbps.d.
See the NEWS file for more information.
This commit is contained in:
parent
a72a52da1d
commit
89d11e871f
4
NEWS
4
NEWS
@ -1,5 +1,9 @@
|
|||||||
xbps-0.42 (???):
|
xbps-0.42 (???):
|
||||||
|
|
||||||
|
* xbps-{install,query}: added new option (-i, --ignore-conf-repos) to ignore
|
||||||
|
repositories defined in configuration files (xbps.d). Only repos specified
|
||||||
|
by the command line will be used (--repository).
|
||||||
|
|
||||||
* Implemented issue #69 (No way to set globally a custom architecture)
|
* Implemented issue #69 (No way to set globally a custom architecture)
|
||||||
A new configuration keyword "architecture" has been added to override
|
A new configuration keyword "architecture" has been added to override
|
||||||
the native machine architecture (uname -m).
|
the native machine architecture (uname -m).
|
||||||
|
@ -51,6 +51,7 @@ usage(bool fail)
|
|||||||
" If specified twice, all files will be\n"
|
" If specified twice, all files will be\n"
|
||||||
" overwritten.\n"
|
" overwritten.\n"
|
||||||
" -h --help Print help usage\n"
|
" -h --help Print help usage\n"
|
||||||
|
" -i --ignore-conf-repos Ignore repositories defined in xbps.d\n"
|
||||||
" -n --dry-run Dry-run mode\n"
|
" -n --dry-run Dry-run mode\n"
|
||||||
" -R,--repository=<url> Add repository to the top of the list.\n"
|
" -R,--repository=<url> Add repository to the top of the list.\n"
|
||||||
" This option can be specified multiple times.\n"
|
" This option can be specified multiple times.\n"
|
||||||
@ -90,7 +91,7 @@ repo_import_key_cb(struct xbps_repo *repo, void *arg _unused, bool *done _unused
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *shortopts = "AC:c:dfhnR:r:SuVvy";
|
const char *shortopts = "AC:c:dfhinR:r:SuVvy";
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{ "automatic", no_argument, NULL, 'A' },
|
{ "automatic", no_argument, NULL, 'A' },
|
||||||
{ "config", required_argument, NULL, 'C' },
|
{ "config", required_argument, NULL, 'C' },
|
||||||
@ -98,6 +99,7 @@ main(int argc, char **argv)
|
|||||||
{ "debug", no_argument, NULL, 'd' },
|
{ "debug", no_argument, NULL, 'd' },
|
||||||
{ "force", no_argument, NULL, 'f' },
|
{ "force", no_argument, NULL, 'f' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
|
{ "ignore-conf-repos", no_argument, NULL, 'i' },
|
||||||
{ "dry-run", no_argument, NULL, 'n' },
|
{ "dry-run", no_argument, NULL, 'n' },
|
||||||
{ "repository", required_argument, NULL, 'R' },
|
{ "repository", required_argument, NULL, 'R' },
|
||||||
{ "rootdir", required_argument, NULL, 'r' },
|
{ "rootdir", required_argument, NULL, 'r' },
|
||||||
@ -144,6 +146,9 @@ main(int argc, char **argv)
|
|||||||
case 'h':
|
case 'h':
|
||||||
usage(false);
|
usage(false);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
case 'i':
|
||||||
|
flags |= XBPS_FLAG_IGNORE_CONF_REPOS;
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
drun = true;
|
drun = true;
|
||||||
break;
|
break;
|
||||||
|
@ -81,6 +81,11 @@ is specified twice all files will be unpacked, even
|
|||||||
.Em configuration files .
|
.Em configuration files .
|
||||||
.It Fl h, Fl -help
|
.It Fl h, Fl -help
|
||||||
Show the help usage.
|
Show the help usage.
|
||||||
|
.It Fl i, Fl -ignore-conf-repos
|
||||||
|
Ignore repositories defined in configuration files.
|
||||||
|
Only repositories specified in the command line via
|
||||||
|
.Ar --repository
|
||||||
|
will be used.
|
||||||
.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
|
||||||
|
@ -42,6 +42,7 @@ usage(bool fail)
|
|||||||
" -c --cachedir <dir> Path to cachedir\n"
|
" -c --cachedir <dir> Path to cachedir\n"
|
||||||
" -d --debug Debug mode shown to stderr\n"
|
" -d --debug Debug mode shown to stderr\n"
|
||||||
" -h --help Print help usage\n"
|
" -h --help Print help usage\n"
|
||||||
|
" -i --ignore-conf-repos Ignore repositories defined in xbps.d\n"
|
||||||
" -p --property PROP[,...] Show properties for PKGNAME\n"
|
" -p --property PROP[,...] Show properties for PKGNAME\n"
|
||||||
" -R --repository Enable repository mode. This mode explicitly\n"
|
" -R --repository Enable repository mode. This mode explicitly\n"
|
||||||
" looks for packages in repositories.\n"
|
" looks for packages in repositories.\n"
|
||||||
@ -73,12 +74,13 @@ usage(bool fail)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *shortopts = "C:c:df:hHLlmOo:p:Rr:s:S:VvX:x:";
|
const char *shortopts = "C:c:df:hHiLlmOo:p:Rr:s:S:VvX:x:";
|
||||||
const struct option longopts[] = {
|
const struct option longopts[] = {
|
||||||
{ "config", required_argument, NULL, 'C' },
|
{ "config", required_argument, NULL, 'C' },
|
||||||
{ "cachedir", required_argument, NULL, 'c' },
|
{ "cachedir", required_argument, NULL, 'c' },
|
||||||
{ "debug", no_argument, NULL, 'd' },
|
{ "debug", no_argument, NULL, 'd' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
|
{ "ignore-conf-repos", no_argument, NULL, 'i' },
|
||||||
{ "list-repos", no_argument, NULL, 'L' },
|
{ "list-repos", no_argument, NULL, 'L' },
|
||||||
{ "list-pkgs", no_argument, NULL, 'l' },
|
{ "list-pkgs", no_argument, NULL, 'l' },
|
||||||
{ "list-hold-pkgs", no_argument, NULL, 'H' },
|
{ "list-hold-pkgs", no_argument, NULL, 'H' },
|
||||||
@ -137,6 +139,9 @@ main(int argc, char **argv)
|
|||||||
case 'h':
|
case 'h':
|
||||||
usage(false);
|
usage(false);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
case 'i':
|
||||||
|
flags |= XBPS_FLAG_IGNORE_CONF_REPOS;
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
list_repos = opmode = true;
|
list_repos = opmode = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.Dd November 17, 2014
|
.Dd November 21, 2014
|
||||||
.Dt XBPS-QUERY 8
|
.Dt XBPS-QUERY 8
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm xbps-query
|
.Nm xbps-query
|
||||||
@ -65,6 +65,11 @@ If the first character is not '\/' then it's a relative path of
|
|||||||
Enables extra debugging shown to stderr.
|
Enables extra debugging shown to stderr.
|
||||||
.It Fl h, Fl -help
|
.It Fl h, Fl -help
|
||||||
Show the help usage.
|
Show the help usage.
|
||||||
|
.It Fl i, Fl -ignore-conf-repos
|
||||||
|
Ignore repositories defined in configuration files.
|
||||||
|
Only repositories specified in the command line via
|
||||||
|
.Ar --repository
|
||||||
|
will be used.
|
||||||
.It Fl p, Fl -property Ar PROP[,...]
|
.It Fl p, Fl -property Ar PROP[,...]
|
||||||
Only match this package property.
|
Only match this package property.
|
||||||
Multiple properties can be specified by delimiting them with commas.
|
Multiple properties can be specified by delimiting them with commas.
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
*
|
*
|
||||||
* This header documents the full API for the XBPS Library.
|
* This header documents the full API for the XBPS Library.
|
||||||
*/
|
*/
|
||||||
#define XBPS_API_VERSION "20141121"
|
#define XBPS_API_VERSION "20141121-1"
|
||||||
|
|
||||||
#ifndef XBPS_VERSION
|
#ifndef XBPS_VERSION
|
||||||
#define XBPS_VERSION "UNSET"
|
#define XBPS_VERSION "UNSET"
|
||||||
@ -176,6 +176,13 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_FLAG_BESTMATCH 0x00000100
|
#define XBPS_FLAG_BESTMATCH 0x00000100
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def XBPS_FLAG_IGNORE_CONF_REPOS
|
||||||
|
* Ignore repos defined in configuration files.
|
||||||
|
* Must be set through the xbps_handle::flags member.
|
||||||
|
*/
|
||||||
|
#define XBPS_FLAG_IGNORE_CONF_REPOS 0x00000200
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def XBPS_FETCH_CACHECONN
|
* @def XBPS_FETCH_CACHECONN
|
||||||
* Default (global) limit of cached connections used in libfetch.
|
* Default (global) limit of cached connections used in libfetch.
|
||||||
|
@ -134,6 +134,9 @@ out:
|
|||||||
static bool
|
static bool
|
||||||
store_repo(struct xbps_handle *xhp, const char *repo)
|
store_repo(struct xbps_handle *xhp, const char *repo)
|
||||||
{
|
{
|
||||||
|
if (xhp->flags & XBPS_FLAG_IGNORE_CONF_REPOS)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (xhp->repositories == NULL)
|
if (xhp->repositories == NULL)
|
||||||
xhp->repositories = xbps_array_create();
|
xhp->repositories = xbps_array_create();
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
syntax("kyuafile", 1)
|
syntax("kyuafile", 1)
|
||||||
|
|
||||||
test_suite("xbps-query")
|
test_suite("xbps-query")
|
||||||
|
atf_test_program{name="ignore_repos_test"}
|
||||||
atf_test_program{name="remote_test"}
|
atf_test_program{name="remote_test"}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
TOPDIR = ../../..
|
TOPDIR = ../../..
|
||||||
-include $(TOPDIR)/config.mk
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
TESTSHELL = remote_test
|
TESTSHELL = ignore_repos_test remote_test
|
||||||
TESTSSUBDIR = xbps/xbps-query
|
TESTSSUBDIR = xbps/xbps-query
|
||||||
EXTRA_FILES = Kyuafile
|
EXTRA_FILES = Kyuafile
|
||||||
|
|
||||||
|
54
tests/xbps/xbps-query/ignore_repos_test.sh
Normal file
54
tests/xbps/xbps-query/ignore_repos_test.sh
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#! /usr/bin/env atf-sh
|
||||||
|
# Test that xbps-query(8) -i works as expected
|
||||||
|
|
||||||
|
atf_test_case ignore_system
|
||||||
|
|
||||||
|
ignore_system_head() {
|
||||||
|
atf_set "descr" "xbps-query(8) -i: ignore repos defined in the system directory (sharedir/xbps.d)"
|
||||||
|
}
|
||||||
|
|
||||||
|
ignore_system_body() {
|
||||||
|
mkdir -p repo pkg_A/bin
|
||||||
|
touch pkg_A/bin/file
|
||||||
|
ln -s repo repo1
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
rm -f *.xbps
|
||||||
|
cd ..
|
||||||
|
systemdir=$(xbps-uhelper getsystemdir)
|
||||||
|
mkdir -p root/${systemdir}
|
||||||
|
echo "repository=$PWD/repo1" > root/${systemdir}/myrepo.conf
|
||||||
|
out="$(xbps-query -C empty.conf --repository=$PWD/repo -i -L|wc -l)"
|
||||||
|
atf_check_equal "$out" 1
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_test_case ignore_conf
|
||||||
|
|
||||||
|
ignore_conf_head() {
|
||||||
|
atf_set "descr" "xbps-query(8) -i: ignore repos defined in the configuration directory (xbps.d)"
|
||||||
|
}
|
||||||
|
|
||||||
|
ignore_conf_body() {
|
||||||
|
mkdir -p repo pkg_A/bin
|
||||||
|
touch pkg_A/bin/file
|
||||||
|
ln -s repo repo1
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
rm -f *.xbps
|
||||||
|
cd ..
|
||||||
|
mkdir -p root/xbps.d
|
||||||
|
echo "repository=$PWD/repo1" > root/xbps.d/myrepo.conf
|
||||||
|
out="$(xbps-query -r root -C xbps.d --repository=$PWD/repo -i -L|wc -l)"
|
||||||
|
atf_check_equal "$out" 1
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases() {
|
||||||
|
atf_add_test_case ignore_conf
|
||||||
|
atf_add_test_case ignore_system
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user