index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2008-04-26 11:30:49 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-04-26 11:15:09 -0500 |
commit | ff9744aa1f9d3da380e722fd44a07b8c8a68d101 (patch) | |
tree | b8d65bf6d02688e9a49e712e9a4ffde206502f11 /src/pacman/upgrade.c | |
parent | 1b5a851851cce4ae53e82fdec128ff6d6f73393b (diff) |
-rw-r--r-- | src/pacman/upgrade.c | 34 |
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index e5626516..589970ed 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -28,23 +28,9 @@ /* pacman */ #include "pacman.h" -#include "callback.h" #include "conf.h" #include "util.h" -/* Free the current transaction and print an error if unsuccessful */ -static int upgrade_cleanup(void) -{ - int ret = alpm_trans_release(); - if(ret != 0) { - pm_printf(PM_LOG_ERROR, _("failed to release transaction (%s)\n"), - alpm_strerrorlast()); - ret = 1; - } - - return(ret); -} - /** * @brief Upgrade a specified list of packages. * @@ -78,15 +64,7 @@ int pacman_upgrade(alpm_list_t *targets) } /* Step 1: create a new transaction */ - if(alpm_trans_init(transtype, config->flags, cb_trans_evt, - cb_trans_conv, cb_trans_progress) == -1) { - /* TODO: error messages should be in the front end, not the back */ - fprintf(stderr, _("error: %s\n"), alpm_strerrorlast()); - if(pm_errno == PM_ERR_HANDLE_LOCK) { - /* TODO this and the 2 other places should probably be on stderr */ - printf(_(" if you're sure a package manager is not already\n" - " running, you can remove %s.\n"), alpm_option_get_lockfile()); - } + if(trans_init(transtype, config->flags) == -1) { return(1); } @@ -97,7 +75,7 @@ int pacman_upgrade(alpm_list_t *targets) if(alpm_trans_addtarget(targ) == -1) { fprintf(stderr, _("error: '%s': %s\n"), targ, alpm_strerrorlast()); - upgrade_cleanup(); + trans_release(); return(1); } } @@ -151,7 +129,7 @@ int pacman_upgrade(alpm_list_t *targets) default: break; } - upgrade_cleanup(); + trans_release(); FREELIST(data); return(1); } @@ -160,11 +138,13 @@ int pacman_upgrade(alpm_list_t *targets) /* Step 3: perform the installation */ if(alpm_trans_commit(NULL) == -1) { fprintf(stderr, _("error: failed to commit transaction (%s)\n"), alpm_strerrorlast()); - upgrade_cleanup(); + trans_release(); return(1); } - retval = upgrade_cleanup(); + if(trans_release() == -1) { + retval = 1; + } return(retval); } |