From 221291929eb5a09a123f5d3e45678aa730e652bd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 26 Feb 2011 11:14:05 +0100 Subject: [PATCH] xbps-bin: added -A and -M options for explicitly setting install reason to auto or manual. --- NEWS | 3 +++ bin/xbps-bin/main.c | 20 ++++++++++++++++++-- bin/xbps-bin/xbps-bin.8 | 19 ++++++++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f1a7d82b..0a46567e 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ 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 not relative to the root directory. diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index aabbbad1..b933799f 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -190,14 +190,18 @@ main(int argc, char **argv) const char *rootdir, *cachedir; int i , c, flags, rv; 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; flags = rv = 0; 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) { + case 'A': + install_auto = true; + break; case 'c': cachedir = optarg; break; @@ -213,6 +217,9 @@ main(int argc, char **argv) case 'f': flags |= XBPS_FLAG_FORCE; break; + case 'M': + install_manual = true; + break; case 'p': purge = true; break; @@ -244,6 +251,13 @@ main(int argc, char **argv) if (argc < 1) 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. */ @@ -268,6 +282,8 @@ main(int argc, char **argv) xh.rootdir = rootdir; xh.cachedir = cachedir; xh.flags = flags; + xh.install_reason_manual = install_manual; + xh.install_reason_auto = install_auto; xbps_init(&xh); if ((dict = xbps_regpkgdb_dictionary_get()) == NULL) { diff --git a/bin/xbps-bin/xbps-bin.8 b/bin/xbps-bin/xbps-bin.8 index fe45253f..a1ee6afb 100644 --- a/bin/xbps-bin/xbps-bin.8 +++ b/bin/xbps-bin/xbps-bin.8 @@ -2,7 +2,7 @@ .\" Title: xbps-bin .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 02/05/2011 +.\" Date: 02/26/2011 .\" Manual: \ \& .\" Source: \ \& .\" 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\&. .SH "OPTIONS" .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 .RS 4 Sets the cache directory to store downloaded binary packages from remote repositories\&. By default it\(cqs set to @@ -74,6 +83,14 @@ and targets\&. .RE .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 .RS 4 Used currently in the