xbps-bin: added -A and -M options for explicitly setting install reason to auto or manual.

This commit is contained in:
Juan RP 2011-02-26 11:14:05 +01:00
parent 8191a1511c
commit 221291929e
3 changed files with 39 additions and 3 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.8.0 (???): xbps-0.8.0 (???):
* xbps-bin(8): added -A and -M options, for setting package install reason
to automatic or manual. Obviously both cannot be used togeter.
* xbps-{bin,repo}(8): -c (cachedir) argument now is an absolute path and * xbps-{bin,repo}(8): -c (cachedir) argument now is an absolute path and
not relative to the root directory. not relative to the root directory.

View File

@ -190,14 +190,18 @@ main(int argc, char **argv)
const char *rootdir, *cachedir; const char *rootdir, *cachedir;
int i , c, flags, rv; int i , c, flags, rv;
bool yes, purge, with_debug, force_rm_with_deps, recursive_rm; bool yes, purge, with_debug, force_rm_with_deps, recursive_rm;
bool show_download_pkglist_url = false; bool install_auto, install_manual, show_download_pkglist_url;
rootdir = cachedir = NULL; rootdir = cachedir = NULL;
flags = rv = 0; flags = rv = 0;
yes = purge = force_rm_with_deps = recursive_rm = with_debug = false; yes = purge = force_rm_with_deps = recursive_rm = with_debug = false;
install_auto = install_manual = show_download_pkglist_url = false;
while ((c = getopt(argc, argv, "Vc:dDFfpRr:vy")) != -1) { while ((c = getopt(argc, argv, "Ac:dDFfMpRr:Vvy")) != -1) {
switch (c) { switch (c) {
case 'A':
install_auto = true;
break;
case 'c': case 'c':
cachedir = optarg; cachedir = optarg;
break; break;
@ -213,6 +217,9 @@ main(int argc, char **argv)
case 'f': case 'f':
flags |= XBPS_FLAG_FORCE; flags |= XBPS_FLAG_FORCE;
break; break;
case 'M':
install_manual = true;
break;
case 'p': case 'p':
purge = true; purge = true;
break; break;
@ -244,6 +251,13 @@ main(int argc, char **argv)
if (argc < 1) if (argc < 1)
usage(); usage();
/* Specifying -A and -M is illegal */
if (install_manual && install_auto) {
xbps_error_printf("xbps-bin: -A and -M options cannot be "
"used together!\n");
exit(EXIT_FAILURE);
}
/* /*
* Register a signal handler to clean up resources used by libxbps. * Register a signal handler to clean up resources used by libxbps.
*/ */
@ -268,6 +282,8 @@ main(int argc, char **argv)
xh.rootdir = rootdir; xh.rootdir = rootdir;
xh.cachedir = cachedir; xh.cachedir = cachedir;
xh.flags = flags; xh.flags = flags;
xh.install_reason_manual = install_manual;
xh.install_reason_auto = install_auto;
xbps_init(&xh); xbps_init(&xh);
if ((dict = xbps_regpkgdb_dictionary_get()) == NULL) { if ((dict = xbps_regpkgdb_dictionary_get()) == NULL) {

View File

@ -2,7 +2,7 @@
.\" Title: xbps-bin .\" Title: xbps-bin
.\" Author: [see the "AUTHORS" section] .\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 02/05/2011 .\" Date: 02/26/2011
.\" Manual: \ \& .\" Manual: \ \&
.\" Source: \ \& .\" Source: \ \&
.\" Language: English .\" Language: English
@ -28,6 +28,15 @@ xbps-bin \- XBPS command for binary packages
The xbps\-bin(8) command is used to handle binary packages created for the XBPS binary package system\&. You can use it to install, remove, update, list or show information about any binary package\&. Binary packages can be installed from \fIlocal (directories)\fR or \fIremote repositories (http, https or ftp)\fR, see xbps\-repo(8) for information about repositories\&. The xbps\-bin(8) command is used to handle binary packages created for the XBPS binary package system\&. You can use it to install, remove, update, list or show information about any binary package\&. Binary packages can be installed from \fIlocal (directories)\fR or \fIremote repositories (http, https or ftp)\fR, see xbps\-repo(8) for information about repositories\&.
.SH "OPTIONS" .SH "OPTIONS"
.PP .PP
\fB\-A\fR
.RS 4
Sets the \fBautomatic\-install\fR boolean object for a package, therefore explicitly
setting that package was installed as it were a dependency, even if it is not.
Use of this option takes effect in the \fIautoupdate\fR, \fIinstall\fR and
\fIupdate\fR targets and target packages and its required dependencies will be
matched.
.RE
.PP
\fB\-c\fR \fIcachedir\fR \fB\-c\fR \fIcachedir\fR
.RS 4 .RS 4
Sets the cache directory to store downloaded binary packages from remote repositories\&. By default it\(cqs set to Sets the cache directory to store downloaded binary packages from remote repositories\&. By default it\(cqs set to
@ -74,6 +83,14 @@ and
targets\&. targets\&.
.RE .RE
.PP .PP
\fB-M\fR
.RS 4
Sets the \fBautomatic\-install\fR boolean object for package to false, therefore
explicitly setting that package was installed manually by the user. Use of this
option takes effect in the \fIautoupdate\fR, \fIinstall\fR and \fIupdate\fR targets
and target packages and its required dependencies will be matched.
.RE
.PP
\fB\-p\fR \fB\-p\fR
.RS 4 .RS 4
Used currently in the Used currently in the