libalpm
Arch Linux Package Manager Library
conf.h
Go to the documentation of this file.
00001 /*
00002  *  conf.h
00003  *
00004  *  Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
00005  *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 #ifndef _PM_CONF_H
00021 #define _PM_CONF_H
00022 
00023 #include <alpm.h>
00024 
00025 typedef struct __config_t {
00026     unsigned short op;
00027     unsigned short quiet;
00028     unsigned short verbose;
00029     unsigned short version;
00030     unsigned short help;
00031     unsigned short noconfirm;
00032     unsigned short noprogressbar;
00033     unsigned short logmask;
00034     unsigned short print;
00035     unsigned short checkspace;
00036     unsigned short usesyslog;
00037     unsigned short usedelta;
00038     char *arch;
00039     char *print_format;
00040     /* unfortunately, we have to keep track of paths both here and in the library
00041      * because they can come from both the command line or config file, and we
00042      * need to ensure we get the order of preference right. */
00043     char *configfile;
00044     char *rootdir;
00045     char *dbpath;
00046     char *logfile;
00047     char *gpgdir;
00048     alpm_list_t *cachedirs;
00049 
00050     unsigned short op_q_isfile;
00051     unsigned short op_q_info;
00052     unsigned short op_q_list;
00053     unsigned short op_q_foreign;
00054     unsigned short op_q_unrequired;
00055     unsigned short op_q_deps;
00056     unsigned short op_q_explicit;
00057     unsigned short op_q_owns;
00058     unsigned short op_q_search;
00059     unsigned short op_q_changelog;
00060     unsigned short op_q_upgrade;
00061     unsigned short op_q_check;
00062 
00063     unsigned short op_s_clean;
00064     unsigned short op_s_downloadonly;
00065     unsigned short op_s_info;
00066     unsigned short op_s_sync;
00067     unsigned short op_s_search;
00068     unsigned short op_s_upgrade;
00069 
00070     unsigned short group;
00071     unsigned short noask;
00072     unsigned int ask;
00073     alpm_transflag_t flags;
00074     alpm_siglevel_t siglevel;
00075 
00076     /* conf file options */
00077     /* I Love Candy! */
00078     unsigned short chomp;
00079     /* format target pkg lists as table */
00080     unsigned short verbosepkglists;
00081     /* When downloading, display the amount downloaded, rate, ETA, and percent
00082      * downloaded of the total download list */
00083     unsigned short totaldownload;
00084     /* select -Sc behavior */
00085     unsigned short cleanmethod;
00086     alpm_list_t *holdpkg;
00087     alpm_list_t *syncfirst;
00088     alpm_list_t *ignorepkg;
00089     alpm_list_t *ignoregrp;
00090     alpm_list_t *noupgrade;
00091     alpm_list_t *noextract;
00092     char *xfercommand;
00093 
00094     /* our connection to libalpm */
00095     alpm_handle_t *handle;
00096 
00097     alpm_list_t *explicit_adds;
00098     alpm_list_t *explicit_removes;
00099 } config_t;
00100 
00101 /* Operations */
00102 enum {
00103     PM_OP_MAIN = 1,
00104     PM_OP_REMOVE,
00105     PM_OP_UPGRADE,
00106     PM_OP_QUERY,
00107     PM_OP_SYNC,
00108     PM_OP_DEPTEST,
00109     PM_OP_DATABASE
00110 };
00111 
00112 /* Long Operations */
00113 enum {
00114     OP_NOCONFIRM = 1000,
00115     OP_CONFIG,
00116     OP_IGNORE,
00117     OP_DEBUG,
00118     OP_NOPROGRESSBAR,
00119     OP_NOSCRIPTLET,
00120     OP_ASK,
00121     OP_CACHEDIR,
00122     OP_ASDEPS,
00123     OP_LOGFILE,
00124     OP_IGNOREGROUP,
00125     OP_NEEDED,
00126     OP_ASEXPLICIT,
00127     OP_ARCH,
00128     OP_PRINTFORMAT,
00129     OP_GPGDIR,
00130     OP_RECURSIVE,
00131     OP_DBONLY,
00132     OP_FORCE
00133 };
00134 
00135 /* clean method */
00136 enum {
00137     PM_CLEAN_KEEPINST = 1,
00138     PM_CLEAN_KEEPCUR = (1 << 1)
00139 };
00140 
00141 /* global config variable */
00142 extern config_t *config;
00143 
00144 config_t *config_new(void);
00145 int config_free(config_t *oldconfig);
00146 
00147 int config_set_arch(const char *arch);
00148 int parseconfig(const char *file);
00149 #endif /* _PM_CONF_H */
00150 
00151 /* vim: set ts=2 sw=2 noet: */