summaryrefslogtreecommitdiff
path: root/src/pacman/upgrade.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-12-22 20:19:18 +1000
committerAllan McRae <allan@archlinux.org>2013-02-07 10:48:11 +1000
commit33b3b6d9b854687f0fc3030eba134aad1485546f (patch)
treebbd4c9542a7bc0bad8e02d4824e5b32ea550aeb9 /src/pacman/upgrade.c
parent3aece8f0eedd703349bcd7bd6bf4b221d9f5775c (diff)
downloadpacman-33b3b6d9b854687f0fc3030eba134aad1485546f.tar.xz
Add configuration option for Upgrade operation SigLevel
Add LocalFileSigLevel and RemoteFileSigLevel to control the signature checking for "pacman -U <file>" and "pacman -U <url>" operations respectively. The starting value for both these options is SigLevel, if it is specified in the [options] section, or the built-in system default. The specified values override and/or supplement this initial value. Note there is no distinction between setting "Required" and "PackageRequired" as there are no database options for Upgrade operations. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/upgrade.c')
-rw-r--r--src/pacman/upgrade.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 7f690917..222f7fa6 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -40,8 +40,7 @@
int pacman_upgrade(alpm_list_t *targets)
{
int retval = 0;
- alpm_list_t *i;
- alpm_siglevel_t level = alpm_option_get_default_siglevel(config->handle);
+ alpm_list_t *i, *remote = NULL;
if(targets == NULL) {
pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n"));
@@ -51,6 +50,8 @@ int pacman_upgrade(alpm_list_t *targets)
/* Check for URL targets and process them
*/
for(i = targets; i; i = alpm_list_next(i)) {
+ int *r = malloc(sizeof(int));
+
if(strstr(i->data, "://")) {
char *str = alpm_fetch_pkgurl(config->handle, i->data);
if(str == NULL) {
@@ -60,8 +61,13 @@ int pacman_upgrade(alpm_list_t *targets)
} else {
free(i->data);
i->data = str;
+ *r = 1;
}
+ } else {
+ *r = 0;
}
+
+ remote = alpm_list_add(remote, r);
}
if(retval) {
@@ -75,9 +81,16 @@ int pacman_upgrade(alpm_list_t *targets)
printf(_("loading packages...\n"));
/* add targets to the created transaction */
- for(i = targets; i; i = alpm_list_next(i)) {
+ for(i = targets; i; i = alpm_list_next(i), remote = alpm_list_next(remote)) {
const char *targ = i->data;
alpm_pkg_t *pkg;
+ alpm_siglevel_t level;
+
+ if(*(int *)remote->data) {
+ level = alpm_option_get_remote_file_siglevel(config->handle);
+ } else {
+ level = alpm_option_get_local_file_siglevel(config->handle);
+ }
if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
@@ -95,6 +108,8 @@ int pacman_upgrade(alpm_list_t *targets)
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
}
+ FREELIST(remote);
+
if(retval) {
trans_release();
return retval;