summaryrefslogtreecommitdiff
path: root/src/pacman/upgrade.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 16:06:16 -0500
committerDan McGee <dan@archlinux.org>2011-06-13 19:38:38 -0500
commite2aa952689da8763d534d1c19310eb97009f4f76 (patch)
tree7d022d67801bc01c24fef985feb9a617c48d316a /src/pacman/upgrade.c
parent8b62d9bc0ade64897990b8fc6a1b6a54b629cb5b (diff)
Move pm_errno onto the handle
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/upgrade.c')
-rw-r--r--src/pacman/upgrade.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 8db88265..c0466456 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -57,7 +57,7 @@ int pacman_upgrade(alpm_list_t *targets)
char *str = alpm_fetch_pkgurl(config->handle, i->data);
if(str == NULL) {
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n",
- (char *)i->data, alpm_strerrorlast());
+ (char *)i->data, alpm_strerror(alpm_errno(config->handle)));
return 1;
} else {
free(i->data);
@@ -78,13 +78,13 @@ int pacman_upgrade(alpm_list_t *targets)
if(alpm_pkg_load(config->handle, targ, 1, check_sig, &pkg) != 0) {
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n",
- targ, alpm_strerrorlast());
+ targ, alpm_strerror(alpm_errno(config->handle)));
trans_release();
return 1;
}
if(alpm_add_pkg(config->handle, pkg) == -1) {
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n",
- targ, alpm_strerrorlast());
+ targ, alpm_strerror(alpm_errno(config->handle)));
alpm_pkg_free(pkg);
trans_release();
return 1;
@@ -94,9 +94,10 @@ int pacman_upgrade(alpm_list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags */
/* TODO: No, compute nothing. This is stupid. */
if(alpm_trans_prepare(config->handle, &data) == -1) {
+ enum _pmerrno_t err = alpm_errno(config->handle);
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
- alpm_strerrorlast());
- switch(pm_errno) {
+ alpm_strerror(err));
+ switch(err) {
case PM_ERR_PKG_INVALID_ARCH:
for(i = data; i; i = alpm_list_next(i)) {
char *pkg = alpm_list_getdata(i);
@@ -140,15 +141,15 @@ int pacman_upgrade(alpm_list_t *targets)
}
/* Step 3: perform the installation */
+ alpm_list_t *packages = alpm_trans_get_add(config->handle);
if(config->print) {
- print_packages(alpm_trans_get_add(config->handle));
+ print_packages(packages);
trans_release();
return 0;
}
/* print targets and ask user confirmation */
- alpm_list_t *packages = alpm_trans_get_add(config->handle);
if(packages == NULL) { /* we are done */
printf(_(" there is nothing to do\n"));
trans_release();
@@ -164,9 +165,10 @@ int pacman_upgrade(alpm_list_t *targets)
}
if(alpm_trans_commit(config->handle, &data) == -1) {
+ enum _pmerrno_t err = alpm_errno(config->handle);
pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
- alpm_strerrorlast());
- switch(pm_errno) {
+ alpm_strerror(err));
+ switch(err) {
alpm_list_t *i;
case PM_ERR_FILE_CONFLICTS:
for(i = data; i; i = alpm_list_next(i)) {