FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 12-12-2011, 03:52 PM
Dan McGee
 
Default pacman: process all targets on upgrade operation

If an early target fails, we stopped processing the rest of the list. We
should continue all the way through and show relevant errors for each
target if possible, and error out only at the end.

We do process all targets to check for URLs first and will error out if
some could not be processed; we then do a second loop and try to load
each target specified on the command line.

This mirrors a patch by Allan to do the same for removal operations.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
src/pacman/upgrade.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 0ca6fec..650af6b 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -41,6 +41,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);

@@ -57,7 +58,7 @@ int pacman_upgrade(alpm_list_t *targets)
if(str == NULL) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s
",
(char *)i->data, alpm_strerror(alpm_errno(config->handle)));
- return 1;
+ retval = 1;
} else {
free(i->data);
i->data = str;
@@ -65,6 +66,10 @@ int pacman_upgrade(alpm_list_t *targets)
}
}

+ if(retval) {
+ return retval;
+ }
+
/* Step 1: create a new transaction */
if(trans_init(config->flags, 1) == -1) {
return 1;
@@ -79,19 +84,24 @@ int pacman_upgrade(alpm_list_t *targets)
if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s
",
targ, alpm_strerror(alpm_errno(config->handle)));
- trans_release();
- return 1;
+ retval = 1;
+ continue;
}
if(alpm_add_pkg(config->handle, pkg) == -1) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s
",
targ, alpm_strerror(alpm_errno(config->handle)));
alpm_pkg_free(pkg);
- trans_release();
- return 1;
+ retval = 1;
+ continue;
}
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
}

+ if(retval) {
+ trans_release();
+ return retval;
+ }
+
/* now that targets are resolved, we can hand it all off to the sync code */
return sync_prepare_execute();
}
--
1.7.8
 

Thread Tools




All times are GMT. The time now is 07:50 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org