2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* handle.h
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2016-01-02 22:48:43 -05:00
|
|
|
* Copyright (c) 2006-2016 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
|
|
|
*/
|
2016-09-03 23:14:49 -04:00
|
|
|
#ifndef ALPM_HANDLE_H
|
|
|
|
#define ALPM_HANDLE_H
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2007-11-16 21:18:45 -05:00
|
|
|
#include <stdio.h>
|
2007-06-03 23:57:38 -04:00
|
|
|
#include <sys/types.h>
|
2011-12-30 13:17:52 -05:00
|
|
|
#include <regex.h>
|
2007-03-05 17:13:33 -05:00
|
|
|
|
|
|
|
#include "alpm_list.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "alpm.h"
|
|
|
|
|
2011-01-15 13:59:45 -05:00
|
|
|
#ifdef HAVE_LIBCURL
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#endif
|
|
|
|
|
2014-01-10 10:25:14 -05:00
|
|
|
#define EVENT(h, e) \
|
2011-09-01 18:16:56 -04:00
|
|
|
do { \
|
|
|
|
if((h)->eventcb) { \
|
2014-01-10 10:25:14 -05:00
|
|
|
(h)->eventcb((alpm_event_t *) (e)); \
|
2011-09-01 18:16:56 -04:00
|
|
|
} \
|
|
|
|
} while(0)
|
2014-06-15 13:42:40 -04:00
|
|
|
#define QUESTION(h, q) \
|
2011-09-01 18:16:56 -04:00
|
|
|
do { \
|
2011-09-01 18:35:50 -04:00
|
|
|
if((h)->questioncb) { \
|
2014-06-15 13:42:40 -04:00
|
|
|
(h)->questioncb((alpm_question_t *) (q)); \
|
2011-09-01 18:16:56 -04:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
#define PROGRESS(h, e, p, per, n, r) \
|
|
|
|
do { \
|
|
|
|
if((h)->progresscb) { \
|
|
|
|
(h)->progresscb(e, p, per, n, r); \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2011-06-28 00:04:00 -04:00
|
|
|
struct __alpm_handle_t {
|
2007-07-09 15:22:01 -04:00
|
|
|
/* internal usage */
|
2013-11-08 00:44:40 -05:00
|
|
|
alpm_db_t *db_local; /* local db pointer */
|
2011-06-28 00:11:43 -04:00
|
|
|
alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */
|
2007-07-09 15:22:01 -04:00
|
|
|
FILE *logstream; /* log file stream pointer */
|
2011-06-28 09:27:16 -04:00
|
|
|
alpm_trans_t *trans;
|
2007-11-16 21:18:45 -05:00
|
|
|
|
2011-01-15 13:59:45 -05:00
|
|
|
#ifdef HAVE_LIBCURL
|
|
|
|
/* libcurl handle */
|
|
|
|
CURL *curl; /* reusable curl_easy handle */
|
|
|
|
#endif
|
|
|
|
|
2014-09-30 15:00:03 -04:00
|
|
|
#ifdef HAVE_LIBGPGME
|
|
|
|
alpm_list_t *known_keys; /* keys verified to be in our keychain */
|
|
|
|
#endif
|
|
|
|
|
2007-07-09 15:22:01 -04:00
|
|
|
/* callback functions */
|
2014-09-28 17:45:35 -04:00
|
|
|
alpm_cb_log logcb; /* Log callback function */
|
2013-11-08 00:44:40 -05:00
|
|
|
alpm_cb_download dlcb; /* Download callback function */
|
2008-06-02 00:10:30 -04:00
|
|
|
alpm_cb_totaldl totaldlcb; /* Total download callback function */
|
2013-11-08 00:44:40 -05:00
|
|
|
alpm_cb_fetch fetchcb; /* Download file callback function */
|
2011-09-01 18:16:56 -04:00
|
|
|
alpm_cb_event eventcb;
|
2011-09-01 18:35:50 -04:00
|
|
|
alpm_cb_question questioncb;
|
2011-09-01 18:16:56 -04:00
|
|
|
alpm_cb_progress progresscb;
|
2006-11-20 04:10:23 -05:00
|
|
|
|
2007-07-09 15:22:01 -04:00
|
|
|
/* filesystem paths */
|
|
|
|
char *root; /* Root path, default '/' */
|
|
|
|
char *dbpath; /* Base path to pacman's DBs */
|
|
|
|
char *logfile; /* Name of the log file */
|
|
|
|
char *lockfile; /* Name of the lock file */
|
2011-06-15 13:02:29 -04:00
|
|
|
char *gpgdir; /* Directory where GnuPG files are stored */
|
2007-07-09 15:22:01 -04:00
|
|
|
alpm_list_t *cachedirs; /* Paths to pacman cache directories */
|
2015-10-16 20:28:23 -04:00
|
|
|
alpm_list_t *hookdirs; /* Paths to hook directories */
|
2007-07-09 15:22:01 -04:00
|
|
|
|
|
|
|
/* package lists */
|
|
|
|
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
|
2008-05-26 02:27:06 -04:00
|
|
|
alpm_list_t *noextract; /* List of files NOT to extract */
|
2007-07-09 15:22:01 -04:00
|
|
|
alpm_list_t *ignorepkg; /* List of packages to ignore */
|
2011-06-29 01:59:48 -04:00
|
|
|
alpm_list_t *ignoregroup; /* List of groups to ignore */
|
2014-07-04 17:12:01 -04:00
|
|
|
alpm_list_t *assumeinstalled; /* List of virtual packages used to satisfy dependencies */
|
2007-07-09 15:22:01 -04:00
|
|
|
|
|
|
|
/* options */
|
2011-03-25 21:40:16 -04:00
|
|
|
char *arch; /* Architecture of packages we should allow */
|
2012-01-11 16:39:52 -05:00
|
|
|
double deltaratio; /* Download deltas if possible; a ratio value */
|
2011-12-01 17:18:23 -05:00
|
|
|
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
2011-03-25 21:40:16 -04:00
|
|
|
int checkspace; /* Check disk space before installing */
|
2015-07-14 07:45:59 -04:00
|
|
|
char *dbext; /* Sync DB extension */
|
2016-10-12 16:13:32 -04:00
|
|
|
int siglevel; /* Default signature verification level */
|
|
|
|
int localfilesiglevel; /* Signature verification level for local file
|
2011-12-22 05:19:18 -05:00
|
|
|
upgrade operations */
|
2016-10-12 16:13:32 -04:00
|
|
|
int remotefilesiglevel; /* Signature verification level for remote file
|
2011-12-22 05:19:18 -05:00
|
|
|
upgrade operations */
|
2011-06-07 17:06:16 -04:00
|
|
|
|
|
|
|
/* error code */
|
2011-10-28 22:03:24 -04:00
|
|
|
alpm_errno_t pm_errno;
|
2011-12-30 13:17:52 -05:00
|
|
|
|
2014-01-02 13:37:08 -05:00
|
|
|
/* lock file descriptor */
|
|
|
|
int lockfd;
|
|
|
|
|
2011-12-30 13:17:52 -05:00
|
|
|
/* for delta parsing efficiency */
|
|
|
|
int delta_regex_compiled;
|
|
|
|
regex_t delta_regex;
|
2011-06-03 13:06:25 -04:00
|
|
|
};
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_handle_t *_alpm_handle_new(void);
|
|
|
|
void _alpm_handle_free(alpm_handle_t *handle);
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2011-06-28 00:04:00 -04:00
|
|
|
int _alpm_handle_lock(alpm_handle_t *handle);
|
|
|
|
int _alpm_handle_unlock(alpm_handle_t *handle);
|
2011-06-24 05:02:58 -04:00
|
|
|
|
2011-10-28 22:03:24 -04:00
|
|
|
alpm_errno_t _alpm_set_directory_option(const char *value,
|
2011-06-03 16:24:01 -04:00
|
|
|
char **storage, int must_exist);
|
2011-06-03 17:42:41 -04:00
|
|
|
|
2016-09-03 23:14:49 -04:00
|
|
|
#endif /* ALPM_HANDLE_H */
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2014-01-22 18:06:11 -05:00
|
|
|
/* vim: set noet: */
|