* bug fix FS#6100 - fix --print-uris output

This commit is contained in:
Aaron Griffin 2007-01-03 08:05:13 +00:00
parent 50030f778a
commit 043a49701f
4 changed files with 49 additions and 41 deletions

View File

@ -124,6 +124,10 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
_alpm_log(PM_LOG_FLOW2, _("loading target '%s'"), name);
/* TODO FS#5120 we need a better way to check if a package is a valid package,
* and read the metadata instead of relying on the filename for package name
* and version
*/
if(stat(name, &buf)) {
pm_errno = PM_ERR_NOT_A_FILE;
goto error;

View File

@ -717,7 +717,10 @@ int alpm_trans_commit(pmlist_t **data)
ASSERT(handle->trans->state == STATE_PREPARED, RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1));
/* Check for database R/W permission */
ASSERT(handle->access == PM_ACCESS_RW, RET_ERR(PM_ERR_BADPERMS, -1));
if(!(handle->trans->flags & PM_TRANS_FLAG_PRINTURIS)) {
/* The print-uris operation is a bit odd. So we explicitly check for it */
ASSERT(handle->access == PM_ACCESS_RW, RET_ERR(PM_ERR_BADPERMS, -1));
}
return(_alpm_trans_commit(handle->trans, data));
}

View File

@ -489,7 +489,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
FREELISTPTR(trail);
}
if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) {
/* We don't care about conflicts if we're just printing uris */
if(!(trans->flags & (PM_TRANS_FLAG_NOCONFLICTS | PM_TRANS_FLAG_PRINTURIS))) {
/* check for inter-conflicts and whatnot */
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);

View File

@ -664,47 +664,47 @@ int pacman_sync(list_t *targets)
if(!confirm) {
goto cleanup;
}
/* Step 3: actually perform the installation
*/
if(alpm_trans_commit(&data) == -1) {
ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmconflict_t *conflict = alpm_list_getdata(lp);
switch(alpm_conflict_get_type(conflict)) {
case PM_CONFLICT_TYPE_TARGET:
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
config->root,
alpm_conflict_get_file(conflict),
alpm_conflict_get_target(conflict),
alpm_conflict_get_ctarget(conflict));
break;
case PM_CONFLICT_TYPE_FILE:
MSG(NL, _("%s: %s%s exists in filesystem"),
alpm_conflict_get_target(conflict),
config->root,
alpm_conflict_get_file(conflict));
break;
}
}
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
case PM_ERR_PKG_CORRUPTED:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
MSG(NL, "%s", (char*)alpm_list_getdata(lp));
}
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
default:
break;
}
retval = 1;
goto cleanup;
}
}/* else 'print uris' requested. We're done at this point */
/* Step 3: actually perform the installation
*/
if(alpm_trans_commit(&data) == -1) {
ERR(NL, _("failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
switch(pm_errno) {
case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmconflict_t *conflict = alpm_list_getdata(lp);
switch(alpm_conflict_get_type(conflict)) {
case PM_CONFLICT_TYPE_TARGET:
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
config->root,
alpm_conflict_get_file(conflict),
alpm_conflict_get_target(conflict),
alpm_conflict_get_ctarget(conflict));
break;
case PM_CONFLICT_TYPE_FILE:
MSG(NL, _("%s: %s%s exists in filesystem"),
alpm_conflict_get_target(conflict),
config->root,
alpm_conflict_get_file(conflict));
break;
}
}
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
case PM_ERR_PKG_CORRUPTED:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
MSG(NL, "%s", (char*)alpm_list_getdata(lp));
}
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
default:
break;
}
retval = 1;
goto cleanup;
}
/* Step 4: release transaction resources
*/
cleanup: