2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* conf.h
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2015-01-21 01:31:20 -05:00
|
|
|
* Copyright (c) 2006-2015 Pacman Development Team <pacman-dev@archlinux.org>
|
2009-07-01 03:08:33 -04:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2005-03-14 20:51:43 -05:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-12-10 23:55:22 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-14 20:51:43 -05:00
|
|
|
*/
|
|
|
|
#ifndef _PM_CONF_H
|
|
|
|
#define _PM_CONF_H
|
|
|
|
|
2007-01-19 04:28:44 -05:00
|
|
|
#include <alpm.h>
|
|
|
|
|
2013-03-01 14:52:16 -05:00
|
|
|
typedef struct __colstr_t {
|
|
|
|
const char *colon;
|
|
|
|
const char *title;
|
|
|
|
const char *repo;
|
|
|
|
const char *version;
|
|
|
|
const char *groups;
|
|
|
|
const char *meta;
|
|
|
|
const char *warn;
|
|
|
|
const char *err;
|
|
|
|
const char *nocolor;
|
|
|
|
} colstr_t;
|
|
|
|
|
2014-04-26 11:24:13 -04:00
|
|
|
typedef struct __config_repo_t {
|
2014-04-26 12:19:03 -04:00
|
|
|
char *name;
|
2014-04-26 11:24:13 -04:00
|
|
|
alpm_list_t *servers;
|
|
|
|
alpm_db_usage_t usage;
|
|
|
|
alpm_siglevel_t siglevel;
|
2014-04-26 11:53:47 -04:00
|
|
|
alpm_siglevel_t siglevel_mask;
|
2014-04-26 11:24:13 -04:00
|
|
|
} config_repo_t;
|
|
|
|
|
2005-10-29 03:00:56 -04:00
|
|
|
typedef struct __config_t {
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short op;
|
2007-11-07 02:05:33 -05:00
|
|
|
unsigned short quiet;
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short verbose;
|
|
|
|
unsigned short version;
|
|
|
|
unsigned short help;
|
|
|
|
unsigned short noconfirm;
|
2006-01-28 00:07:50 -05:00
|
|
|
unsigned short noprogressbar;
|
2007-06-07 15:42:26 -04:00
|
|
|
unsigned short logmask;
|
2009-07-19 05:15:11 -04:00
|
|
|
unsigned short print;
|
2011-06-03 17:13:04 -04:00
|
|
|
unsigned short checkspace;
|
|
|
|
unsigned short usesyslog;
|
2013-03-01 14:27:40 -05:00
|
|
|
unsigned short color;
|
2012-01-11 16:39:52 -05:00
|
|
|
double deltaratio;
|
2011-06-03 17:13:04 -04:00
|
|
|
char *arch;
|
2009-07-19 05:15:11 -04:00
|
|
|
char *print_format;
|
2007-12-02 13:20:55 -05:00
|
|
|
/* unfortunately, we have to keep track of paths both here and in the library
|
|
|
|
* because they can come from both the command line or config file, and we
|
|
|
|
* need to ensure we get the order of preference right. */
|
|
|
|
char *configfile;
|
|
|
|
char *rootdir;
|
|
|
|
char *dbpath;
|
|
|
|
char *logfile;
|
2008-12-14 13:59:39 -05:00
|
|
|
char *gpgdir;
|
2011-06-03 17:13:04 -04:00
|
|
|
alpm_list_t *cachedirs;
|
2007-06-07 15:42:26 -04:00
|
|
|
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short op_q_isfile;
|
|
|
|
unsigned short op_q_info;
|
|
|
|
unsigned short op_q_list;
|
2008-01-10 09:59:43 -05:00
|
|
|
unsigned short op_q_unrequired;
|
2007-07-14 18:44:06 -04:00
|
|
|
unsigned short op_q_deps;
|
|
|
|
unsigned short op_q_explicit;
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short op_q_owns;
|
|
|
|
unsigned short op_q_search;
|
2006-10-15 15:34:52 -04:00
|
|
|
unsigned short op_q_changelog;
|
2007-02-04 03:26:52 -05:00
|
|
|
unsigned short op_q_upgrade;
|
2009-03-30 12:48:15 -04:00
|
|
|
unsigned short op_q_check;
|
2012-12-13 10:06:41 -05:00
|
|
|
unsigned short op_q_locality;
|
2007-08-21 21:28:05 -04:00
|
|
|
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short op_s_clean;
|
|
|
|
unsigned short op_s_downloadonly;
|
|
|
|
unsigned short op_s_info;
|
|
|
|
unsigned short op_s_sync;
|
|
|
|
unsigned short op_s_search;
|
|
|
|
unsigned short op_s_upgrade;
|
2007-08-21 21:28:05 -04:00
|
|
|
|
2015-06-18 05:27:51 -04:00
|
|
|
unsigned short op_f_regex;
|
|
|
|
|
2005-10-28 08:20:40 -04:00
|
|
|
unsigned short group;
|
Re-add the non-user friendly --ask option
This re-implements the --ask option which was removed in commit
1ff8e7f364a9f640ada7526384646d510ac29967.
This option does not have to be exposed to the user (help,doc,etc), but is
very very useful for pactest if we want to have more coverage there.
This was rewritten in a smarter way, without code duplication. And with a
different behavior : this option is now only used to inverse default
behavior to questions.
We still use bit operations based on the following struct :
/* Transaction Conversations (ie, questions) */
typedef enum _pmtransconv_t {
PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
PM_TRANS_CONV_REPLACE_PKG = 0x02,
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
PM_TRANS_CONV_CORRUPTED_PKG = 0x08,
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
PM_TRANS_CONV_REMOVE_PKGS = 0x20,
} pmtransconv_t;
for each conv matched, the default answer is inversed.
--ask 0 : all default answers are preserved
--ask 4 : only conflict question is inversed
--ask 63 : all questions are inversed (63 == 1+2+4+8+16+32)
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-31 14:17:05 -04:00
|
|
|
unsigned short noask;
|
|
|
|
unsigned int ask;
|
2011-06-28 00:42:24 -04:00
|
|
|
alpm_transflag_t flags;
|
2011-06-27 17:29:49 -04:00
|
|
|
alpm_siglevel_t siglevel;
|
2011-12-22 05:19:18 -05:00
|
|
|
alpm_siglevel_t localfilesiglevel;
|
|
|
|
alpm_siglevel_t remotefilesiglevel;
|
2007-08-21 21:28:05 -04:00
|
|
|
|
2014-04-26 11:53:47 -04:00
|
|
|
alpm_siglevel_t siglevel_mask;
|
|
|
|
alpm_siglevel_t localfilesiglevel_mask;
|
|
|
|
alpm_siglevel_t remotefilesiglevel_mask;
|
|
|
|
|
2007-06-04 12:12:13 -04:00
|
|
|
/* conf file options */
|
2011-02-20 09:00:26 -05:00
|
|
|
/* I Love Candy! */
|
|
|
|
unsigned short chomp;
|
|
|
|
/* format target pkg lists as table */
|
|
|
|
unsigned short verbosepkglists;
|
2008-02-16 10:01:13 -05:00
|
|
|
/* When downloading, display the amount downloaded, rate, ETA, and percent
|
|
|
|
* downloaded of the total download list */
|
|
|
|
unsigned short totaldownload;
|
2011-02-20 09:00:26 -05:00
|
|
|
/* select -Sc behavior */
|
|
|
|
unsigned short cleanmethod;
|
2008-08-24 17:24:53 -04:00
|
|
|
alpm_list_t *holdpkg;
|
2011-06-03 17:13:04 -04:00
|
|
|
alpm_list_t *ignorepkg;
|
|
|
|
alpm_list_t *ignoregrp;
|
2014-07-04 17:12:01 -04:00
|
|
|
alpm_list_t *assumeinstalled;
|
2011-06-03 17:13:04 -04:00
|
|
|
alpm_list_t *noupgrade;
|
|
|
|
alpm_list_t *noextract;
|
2009-04-04 04:17:30 -04:00
|
|
|
char *xfercommand;
|
2011-06-03 17:13:04 -04:00
|
|
|
|
|
|
|
/* our connection to libalpm */
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_handle_t *handle;
|
2011-07-29 16:35:59 -04:00
|
|
|
|
|
|
|
alpm_list_t *explicit_adds;
|
|
|
|
alpm_list_t *explicit_removes;
|
2013-03-01 14:52:16 -05:00
|
|
|
|
|
|
|
/* Color strings for output */
|
|
|
|
colstr_t colstr;
|
2014-04-26 12:19:03 -04:00
|
|
|
|
|
|
|
alpm_list_t *repos;
|
2005-10-29 03:00:56 -04:00
|
|
|
} config_t;
|
2005-10-28 08:20:40 -04:00
|
|
|
|
2007-06-07 22:20:40 -04:00
|
|
|
/* Operations */
|
|
|
|
enum {
|
|
|
|
PM_OP_MAIN = 1,
|
|
|
|
PM_OP_REMOVE,
|
|
|
|
PM_OP_UPGRADE,
|
|
|
|
PM_OP_QUERY,
|
|
|
|
PM_OP_SYNC,
|
2009-05-20 15:46:23 -04:00
|
|
|
PM_OP_DEPTEST,
|
2015-06-17 09:56:21 -04:00
|
|
|
PM_OP_DATABASE,
|
|
|
|
PM_OP_FILES
|
2007-06-07 22:20:40 -04:00
|
|
|
};
|
|
|
|
|
2009-10-12 23:14:56 -04:00
|
|
|
/* Long Operations */
|
|
|
|
enum {
|
2013-10-12 13:32:06 -04:00
|
|
|
OP_LONG_FLAG_MIN = 1000,
|
|
|
|
OP_NOCONFIRM,
|
2014-10-06 16:45:10 -04:00
|
|
|
OP_CONFIRM,
|
2009-10-12 23:14:56 -04:00
|
|
|
OP_CONFIG,
|
|
|
|
OP_IGNORE,
|
|
|
|
OP_DEBUG,
|
|
|
|
OP_NOPROGRESSBAR,
|
|
|
|
OP_NOSCRIPTLET,
|
|
|
|
OP_ASK,
|
|
|
|
OP_CACHEDIR,
|
|
|
|
OP_ASDEPS,
|
|
|
|
OP_LOGFILE,
|
|
|
|
OP_IGNOREGROUP,
|
|
|
|
OP_NEEDED,
|
|
|
|
OP_ASEXPLICIT,
|
2009-07-19 05:15:11 -04:00
|
|
|
OP_ARCH,
|
2008-12-14 13:59:39 -05:00
|
|
|
OP_PRINTFORMAT,
|
2011-08-11 02:00:47 -04:00
|
|
|
OP_GPGDIR,
|
2011-10-11 13:35:33 -04:00
|
|
|
OP_DBONLY,
|
2013-03-01 14:27:40 -05:00
|
|
|
OP_FORCE,
|
2013-10-12 13:32:05 -04:00
|
|
|
OP_COLOR,
|
|
|
|
OP_DBPATH,
|
|
|
|
OP_CASCADE,
|
|
|
|
OP_CHANGELOG,
|
|
|
|
OP_CLEAN,
|
|
|
|
OP_NODEPS,
|
|
|
|
OP_DEPS,
|
|
|
|
OP_EXPLICIT,
|
|
|
|
OP_GROUPS,
|
|
|
|
OP_HELP,
|
|
|
|
OP_INFO,
|
|
|
|
OP_CHECK,
|
|
|
|
OP_LIST,
|
|
|
|
OP_FOREIGN,
|
|
|
|
OP_NATIVE,
|
|
|
|
OP_NOSAVE,
|
|
|
|
OP_OWNS,
|
|
|
|
OP_FILE,
|
|
|
|
OP_PRINT,
|
|
|
|
OP_QUIET,
|
|
|
|
OP_ROOT,
|
|
|
|
OP_RECURSIVE,
|
|
|
|
OP_SEARCH,
|
2015-06-18 05:27:51 -04:00
|
|
|
OP_REGEX,
|
2013-10-12 13:32:05 -04:00
|
|
|
OP_UNREQUIRED,
|
|
|
|
OP_UPGRADES,
|
|
|
|
OP_SYSUPGRADE,
|
|
|
|
OP_UNNEEDED,
|
|
|
|
OP_VERBOSE,
|
|
|
|
OP_DOWNLOADONLY,
|
2014-07-04 17:12:01 -04:00
|
|
|
OP_REFRESH,
|
|
|
|
OP_ASSUMEINSTALLED
|
2009-10-12 23:14:56 -04:00
|
|
|
};
|
|
|
|
|
2008-02-16 10:01:13 -05:00
|
|
|
/* clean method */
|
|
|
|
enum {
|
2011-01-29 13:10:05 -05:00
|
|
|
PM_CLEAN_KEEPINST = 1,
|
|
|
|
PM_CLEAN_KEEPCUR = (1 << 1)
|
2008-02-16 10:01:13 -05:00
|
|
|
};
|
|
|
|
|
2012-12-13 10:06:41 -05:00
|
|
|
/** package locality */
|
|
|
|
enum {
|
|
|
|
PKG_LOCALITY_UNSET = 0,
|
2013-10-12 13:32:08 -04:00
|
|
|
PKG_LOCALITY_NATIVE = (1 << 0),
|
2012-12-13 10:06:41 -05:00
|
|
|
PKG_LOCALITY_FOREIGN = (1 << 1)
|
|
|
|
};
|
|
|
|
|
2013-03-01 14:27:40 -05:00
|
|
|
enum {
|
|
|
|
PM_COLOR_UNSET = 0,
|
|
|
|
PM_COLOR_OFF,
|
|
|
|
PM_COLOR_ON
|
|
|
|
};
|
2012-12-13 10:06:41 -05:00
|
|
|
|
2007-11-04 13:05:22 -05:00
|
|
|
/* global config variable */
|
|
|
|
extern config_t *config;
|
|
|
|
|
2013-03-01 14:52:16 -05:00
|
|
|
void enable_colors(int colors);
|
2005-11-07 08:14:19 -05:00
|
|
|
config_t *config_new(void);
|
2007-09-10 20:13:38 -04:00
|
|
|
int config_free(config_t *oldconfig);
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2014-04-26 11:24:13 -04:00
|
|
|
void config_repo_free(config_repo_t *repo);
|
|
|
|
|
2011-05-05 12:12:49 -04:00
|
|
|
int config_set_arch(const char *arch);
|
|
|
|
int parseconfig(const char *file);
|
2005-03-14 20:51:43 -05:00
|
|
|
#endif /* _PM_CONF_H */
|
|
|
|
|
2014-01-22 18:06:11 -05:00
|
|
|
/* vim: set noet: */
|