From 594621cbeb2f27ce8d36e652c4fdd9a9d4385ec3 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 21 Jul 2009 23:03:25 -0500 Subject: Add Architecture and --arch option Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 3 +++ lib/libalpm/handle.c | 16 ++++++++++++++++ lib/libalpm/handle.h | 1 + 3 files changed, 20 insertions(+) (limited to 'lib/libalpm') 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; -- cgit v1.2.3-70-g09d2