summaryrefslogtreecommitdiff
path: root/src/pacman/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/add.c')
-rw-r--r--src/pacman/add.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 04182df9..7c4cd909 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -50,7 +50,7 @@ int pacman_add(list_t *targets)
*/
for(i = targets; i; i = i->next) {
if(strstr(i->data, "://")) {
- char *str = fetch_pkgurl(i->data);
+ char *str = alpm_fetch_pkgurl(i->data);
if(str == NULL) {
return(1);
} else {
@@ -63,11 +63,11 @@ int pacman_add(list_t *targets)
/* Step 1: create a new transaction
*/
if(alpm_trans_init((config->upgrade == 0) ? PM_TRANS_TYPE_ADD : PM_TRANS_TYPE_UPGRADE,
- config->flags, cb_trans_evt, cb_trans_conv) == -1) {
+ config->flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
MSG(NL, _(" if you're sure a package manager is not already running,\n"
- " you can remove %s\n"), PM_LOCK);
+ " you can remove %s%s\n"), config->root, PM_LOCK);
}
return(1);
}
@@ -86,6 +86,7 @@ int pacman_add(list_t *targets)
/* Step 2: "compute" the transaction based on targets and flags
*/
if(alpm_trans_prepare(&data) == -1) {
+ long long *pkgsize, *freespace;
PM_LIST *i;
ERR(NL, _("failed to prepare transaction (%s)\n"), alpm_strerror(pm_errno));
@@ -95,7 +96,7 @@ int pacman_add(list_t *targets)
PM_DEPMISS *miss = alpm_list_getdata(i);
MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
+ switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -115,16 +116,18 @@ int pacman_add(list_t *targets)
case PM_ERR_FILE_CONFLICTS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
PM_CONFLICT *conflict = alpm_list_getdata(i);
- switch((int)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
+ switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
case PM_CONFLICT_TYPE_TARGET:
- MSG(NL, _("%s exists in \"%s\" (target) and \"%s\" (target)"),
+ MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
break;
case PM_CONFLICT_TYPE_FILE:
- MSG(NL, _("%s: %s exists in filesystem"),
+ MSG(NL, _("%s: %s%s exists in filesystem"),
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
+ config->root,
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
break;
}
@@ -132,10 +135,19 @@ int pacman_add(list_t *targets)
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
+ case PM_ERR_DISK_FULL:
+ i = alpm_list_first(data);
+ pkgsize = alpm_list_getdata(i);
+ i = alpm_list_next(i);
+ freespace = alpm_list_getdata(i);
+ MSG(NL, _(":: %.1f MB required, have %.1f MB"),
+ (double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0));
+ alpm_list_free(data);
+ break;
default:
break;
}
- retval = 1;
+ retval=1;
goto cleanup;
}
@@ -143,16 +155,14 @@ int pacman_add(list_t *targets)
*/
if(alpm_trans_commit(NULL) == -1) {
ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
- retval = 1;
+ retval=1;
goto cleanup;
}
- /* Step 4: release transaction resources
- */
cleanup:
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
- retval = 1;
+ retval=1;
}
return(retval);