Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2021-04-21 22:47:13 +1000
committerAllan McRae <allan@archlinux.org>2021-04-22 00:15:21 +1000
commit3179db108a83104d9de6d1d607f55f8118e92160 (patch)
tree2141a5a0a565bbfc8261bbc434bcfa53830115a1 /lib/libalpm/handle.c
parentabdb4d7fa699ae3b8ff09ba79656f6853b9a1357 (diff)
Add support for multiple 'Architecture' values
This allows architecture to be multivalued. On x86-64 machines, this could be something like: Architecture = x86-64-v3 x86-64 We use the first specified Architecture value in mirrorlist $arch variable replacement, as this is backwards-compatible and sane. Original-patch-by: Dan McGee <dan@archlinux.org> Patch-updated-by: Allan McRae <allan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 7b8cb1da..46224a25 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -77,7 +77,7 @@ void _alpm_handle_free(alpm_handle_t *handle)
FREELIST(handle->hookdirs);
FREE(handle->logfile);
FREE(handle->lockfile);
- FREE(handle->arch);
+ FREELIST(handle->architectures);
FREE(handle->gpgdir);
FREELIST(handle->noupgrade);
FREELIST(handle->noextract);
@@ -276,10 +276,10 @@ alpm_list_t SYMEXPORT *alpm_option_get_assumeinstalled(alpm_handle_t *handle)
return handle->assumeinstalled;
}
-const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle)
+alpm_list_t SYMEXPORT *alpm_option_get_architectures(alpm_handle_t *handle)
{
CHECK_HANDLE(handle, return NULL);
- return handle->arch;
+ return handle->architectures;
}
int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
@@ -720,11 +720,29 @@ int SYMEXPORT alpm_option_remove_assumeinstalled(alpm_handle_t *handle, const al
return 0;
}
-int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
+int SYMEXPORT alpm_option_add_architecture(alpm_handle_t *handle, const char *arch)
{
+ handle->architectures = alpm_list_add(handle->architectures, strdup(arch));
+ return 0;
+}
+
+int SYMEXPORT alpm_option_set_architectures(alpm_handle_t *handle, alpm_list_t *arches)
+{
+ CHECK_HANDLE(handle, return -1);
+ if(handle->architectures) FREELIST(handle->architectures);
+ handle->architectures = alpm_list_strdup(arches);
+ return 0;
+}
+
+int SYMEXPORT alpm_option_remove_architecture(alpm_handle_t *handle, const char *arch)
+{
+ char *vdata = NULL;
CHECK_HANDLE(handle, return -1);
- if(handle->arch) FREE(handle->arch);
- STRDUP(handle->arch, arch, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+ handle->architectures = alpm_list_remove_str(handle->architectures, arch, &vdata);
+ if(vdata != NULL) {
+ FREE(vdata);
+ return 1;
+ }
return 0;
}