1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Add signature directory as option on libalpm handle

This will serve as the home directory we pass to GPGME when making calls so
we can have a libalpm-utilized keyring.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-12-07 13:12:33 -06:00
parent 39ce9b3afc
commit 4ae902ec5f
3 changed files with 32 additions and 0 deletions

View File

@ -127,6 +127,9 @@ int alpm_option_set_logfile(const char *logfile);
const char *alpm_option_get_lockfile(void);
/* no set_lockfile, path is determined from dbpath */
const char *alpm_option_get_signaturedir(void);
int alpm_option_set_signaturedir(const char *signaturedir);
int alpm_option_get_usesyslog(void);
void alpm_option_set_usesyslog(int usesyslog);

View File

@ -84,6 +84,7 @@ void _alpm_handle_free(pmhandle_t *handle)
FREE(handle->logfile);
FREE(handle->lockfile);
FREE(handle->arch);
FREE(handle->signaturedir);
FREELIST(handle->dbs_sync);
FREELIST(handle->noupgrade);
FREELIST(handle->noextract);
@ -174,6 +175,15 @@ const char SYMEXPORT *alpm_option_get_lockfile()
return handle->lockfile;
}
const char SYMEXPORT *alpm_option_get_signaturedir()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
return NULL;
}
return handle->signaturedir;
}
int SYMEXPORT alpm_option_get_usesyslog()
{
if (handle == NULL) {
@ -460,6 +470,24 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
return 0;
}
int SYMEXPORT alpm_option_set_signaturedir(const char *signaturedir)
{
ALPM_LOG_FUNC;
if(!signaturedir) {
pm_errno = PM_ERR_WRONG_ARGS;
return -1;
}
if(handle->signaturedir) {
FREE(handle->signaturedir);
}
handle->signaturedir = strdup(signaturedir);
_alpm_log(PM_LOG_DEBUG, "option 'signaturedir' = %s\n", handle->signaturedir);
return 0;
}
void SYMEXPORT alpm_option_set_usesyslog(int usesyslog)
{
handle->usesyslog = usesyslog;

View File

@ -58,6 +58,7 @@ typedef struct _pmhandle_t {
char *dbpath; /* Base path to pacman's DBs */
char *logfile; /* Name of the log file */
char *lockfile; /* Name of the lock file */
char *signaturedir; /* Directory where GnuPG files are stored */
alpm_list_t *cachedirs; /* Paths to pacman cache directories */
/* package lists */