summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-12-07 20:12:33 +0100
committerDan McGee <dan@archlinux.org>2011-03-23 09:16:29 +0100
commit4ae902ec5fb286a7826214f73f718a41cdf82ddb (patch)
tree93dde96133c67e8b849aef8999d798bf1295c5e1 /lib/libalpm
parent39ce9b3afc6a544c2a5137bb58012d32723096e3 (diff)
downloadpacman-4ae902ec5fb286a7826214f73f718a41cdf82ddb.tar.gz
pacman-4ae902ec5fb286a7826214f73f718a41cdf82ddb.tar.xz
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h3
-rw-r--r--lib/libalpm/handle.c28
-rw-r--r--lib/libalpm/handle.h1
3 files changed, 32 insertions, 0 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index fb438404..faba1330 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -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);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 442e99df..42c0cd1f 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -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;
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index de2dfa1a..cf192bce 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -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 */