summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-07-21 23:03:25 -0500
committerDan McGee <dan@archlinux.org>2009-09-06 15:50:42 -0500
commit594621cbeb2f27ce8d36e652c4fdd9a9d4385ec3 (patch)
tree78041ce99beafb27918a52b6398db92e3386cfd6 /lib/libalpm
parent92f0775e76c75ebe9e30355cc99bb40cf365abcb (diff)
downloadpacman-594621cbeb2f27ce8d36e652c4fdd9a9d4385ec3.tar.xz
Add Architecture and --arch option
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> 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.c16
-rw-r--r--lib/libalpm/handle.h1
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 9a935c28..b81b3f83 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -151,6 +151,9 @@ void alpm_option_add_ignoregrp(const char *grp);
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps);
int alpm_option_remove_ignoregrp(const char *grp);
+const char *alpm_option_get_arch();
+void alpm_option_set_arch(const char *arch);
+
void alpm_option_set_usedelta(unsigned short usedelta);
pmdb_t *alpm_option_get_localdb();
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 819b9742..012d4121 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -79,6 +79,7 @@ void _alpm_handle_free(pmhandle_t *handle)
FREELIST(handle->cachedirs);
FREE(handle->logfile);
FREE(handle->lockfile);
+ FREE(handle->arch);
FREELIST(handle->dbs_sync);
FREELIST(handle->noupgrade);
FREELIST(handle->noextract);
@@ -213,6 +214,15 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
return handle->ignoregrp;
}
+const char SYMEXPORT *alpm_option_get_arch()
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return NULL;
+ }
+ return handle->arch;
+}
+
pmdb_t SYMEXPORT *alpm_option_get_localdb()
{
if (handle == NULL) {
@@ -520,6 +530,12 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
return(0);
}
+void SYMEXPORT alpm_option_set_arch(const char *arch)
+{
+ if(handle->arch) FREE(handle->arch);
+ if(arch) handle->arch = strdup(arch);
+}
+
void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta)
{
handle->usedelta = usedelta;
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 541eb23a..a1eb1cde 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -58,6 +58,7 @@ typedef struct _pmhandle_t {
/* options */
unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
+ char *arch; /* Architecture of packages we should allow */
unsigned short usedelta; /* Download deltas if possible */
} pmhandle_t;