mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Kill PM_TRANS_TYPE_ADD.
This was totally useless. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
73ab153c44
commit
e7a2232934
@ -68,14 +68,6 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
|
||||
pkgname = alpm_pkg_get_name(pkg);
|
||||
pkgver = alpm_pkg_get_version(pkg);
|
||||
|
||||
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
|
||||
/* only install this package if it is not already installed */
|
||||
if(_alpm_db_get_pkgfromcache(db, pkgname)) {
|
||||
pm_errno = PM_ERR_PKG_INSTALLED;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if an older version of said package is already in transaction
|
||||
* packages. if so, replace it in the list */
|
||||
for(i = trans->packages; i; i = i->next) {
|
||||
@ -130,7 +122,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||
|
||||
/* look for unsatisfied dependencies */
|
||||
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
|
||||
lp = alpm_checkdeps(db, trans->type == PM_TRANS_TYPE_UPGRADE, NULL, trans->packages);
|
||||
lp = alpm_checkdeps(db, 1, NULL, trans->packages);
|
||||
if(lp != NULL) {
|
||||
if(data) {
|
||||
*data = lp;
|
||||
@ -168,7 +160,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||
|
||||
/* re-order w.r.t. dependencies */
|
||||
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
|
||||
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
|
||||
lp = _alpm_sortbydeps(trans->packages, 0);
|
||||
/* free the old alltargs */
|
||||
alpm_list_free(trans->packages);
|
||||
trans->packages = lp;
|
||||
|
@ -256,10 +256,9 @@ int alpm_sync_sysupgrade(pmdb_t *db_local,
|
||||
|
||||
/* Types */
|
||||
typedef enum _pmtranstype_t {
|
||||
PM_TRANS_TYPE_ADD = 1,
|
||||
PM_TRANS_TYPE_UPGRADE = 1,
|
||||
PM_TRANS_TYPE_REMOVE,
|
||||
PM_TRANS_TYPE_REMOVEUPGRADE,
|
||||
PM_TRANS_TYPE_UPGRADE,
|
||||
PM_TRANS_TYPE_SYNC
|
||||
} pmtranstype_t;
|
||||
|
||||
@ -455,7 +454,6 @@ enum _pmerrno_t {
|
||||
PM_ERR_PKG_INVALID,
|
||||
PM_ERR_PKG_OPEN,
|
||||
PM_ERR_PKG_LOAD,
|
||||
PM_ERR_PKG_INSTALLED,
|
||||
PM_ERR_PKG_CANT_FRESH,
|
||||
PM_ERR_PKG_CANT_REMOVE,
|
||||
PM_ERR_PKG_INVALID_NAME,
|
||||
|
@ -109,20 +109,19 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
|
||||
|
||||
/* Re-order a list of target packages with respect to their dependencies.
|
||||
*
|
||||
* Example (PM_TRANS_TYPE_ADD):
|
||||
* Example (reverse == 0):
|
||||
* A depends on C
|
||||
* B depends on A
|
||||
* Target order is A,B,C,D
|
||||
*
|
||||
* Should be re-ordered to C,A,B,D
|
||||
*
|
||||
* mode should be either PM_TRANS_TYPE_ADD or PM_TRANS_TYPE_REMOVE. This
|
||||
* affects the dependency order sortbydeps() will use.
|
||||
* if reverse is > 0, the dependency order will be reversed.
|
||||
*
|
||||
* This function returns the new alpm_list_t* target list.
|
||||
*
|
||||
*/
|
||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
|
||||
{
|
||||
alpm_list_t *newtargs = NULL;
|
||||
alpm_list_t *vertices = NULL;
|
||||
@ -157,7 +156,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
||||
pmpkg_t *vertexpkg = vertex->data;
|
||||
pmpkg_t *childpkg = nextchild->data;
|
||||
_alpm_log(PM_LOG_WARNING, _("dependency cycle detected:\n"));
|
||||
if(mode == PM_TRANS_TYPE_REMOVE) {
|
||||
if(reverse) {
|
||||
_alpm_log(PM_LOG_WARNING, _("%s will be removed after its %s dependency\n"), vertexpkg->name, childpkg->name);
|
||||
} else {
|
||||
_alpm_log(PM_LOG_WARNING, _("%s will be installed before its %s dependency\n"), vertexpkg->name, childpkg->name);
|
||||
@ -182,8 +181,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
|
||||
|
||||
_alpm_log(PM_LOG_DEBUG, "sorting dependencies finished\n");
|
||||
|
||||
if(mode == PM_TRANS_TYPE_REMOVE) {
|
||||
/* we're removing packages, so reverse the order */
|
||||
if(reverse) {
|
||||
/* reverse the order */
|
||||
alpm_list_t *tmptargs = alpm_list_reverse(newtargs);
|
||||
/* free the old one */
|
||||
alpm_list_free(newtargs);
|
||||
|
@ -45,7 +45,7 @@ pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
||||
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
|
||||
const char *causinpkg);
|
||||
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode);
|
||||
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
||||
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
||||
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
|
||||
alpm_list_t **list, alpm_list_t *remove, pmtrans_t *trans, alpm_list_t
|
||||
|
@ -109,8 +109,6 @@ const char SYMEXPORT *alpm_strerror(int err)
|
||||
return _("cannot open package file");
|
||||
case PM_ERR_PKG_LOAD:
|
||||
return _("cannot load package data");
|
||||
case PM_ERR_PKG_INSTALLED:
|
||||
return _("package already installed");
|
||||
case PM_ERR_PKG_CANT_FRESH:
|
||||
return _("package not installed or lesser version");
|
||||
case PM_ERR_PKG_CANT_REMOVE:
|
||||
|
@ -158,7 +158,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||
|
||||
/* re-order w.r.t. dependencies */
|
||||
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
|
||||
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
|
||||
lp = _alpm_sortbydeps(trans->packages, 1);
|
||||
/* free the old alltargs */
|
||||
alpm_list_free(trans->packages);
|
||||
trans->packages = lp;
|
||||
|
@ -443,7 +443,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||
}
|
||||
|
||||
/* re-order w.r.t. dependencies */
|
||||
alpm_list_t *sortlist = _alpm_sortbydeps(list, PM_TRANS_TYPE_ADD);
|
||||
alpm_list_t *sortlist = _alpm_sortbydeps(list, 0);
|
||||
alpm_list_t *newpkgs = NULL;
|
||||
for(i = sortlist; i; i = i->next) {
|
||||
for(j = trans->packages; j; j = j->next) {
|
||||
|
@ -307,7 +307,6 @@ int _alpm_trans_addtarget(pmtrans_t *trans, char *target)
|
||||
ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
switch(trans->type) {
|
||||
case PM_TRANS_TYPE_ADD:
|
||||
case PM_TRANS_TYPE_UPGRADE:
|
||||
if(_alpm_add_loadtarget(trans, handle->db_local, target) == -1) {
|
||||
/* pm_errno is set by _alpm_add_loadtarget() */
|
||||
@ -349,7 +348,6 @@ int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data)
|
||||
}
|
||||
|
||||
switch(trans->type) {
|
||||
case PM_TRANS_TYPE_ADD:
|
||||
case PM_TRANS_TYPE_UPGRADE:
|
||||
if(_alpm_add_prepare(trans, handle->db_local, data) == -1) {
|
||||
/* pm_errno is set by _alpm_add_prepare() */
|
||||
@ -394,7 +392,6 @@ int _alpm_trans_commit(pmtrans_t *trans, alpm_list_t **data)
|
||||
trans->state = STATE_COMMITING;
|
||||
|
||||
switch(trans->type) {
|
||||
case PM_TRANS_TYPE_ADD:
|
||||
case PM_TRANS_TYPE_UPGRADE:
|
||||
if(_alpm_add_commit(trans, handle->db_local) == -1) {
|
||||
/* pm_errno is set by _alpm_add_commit() */
|
||||
|
Loading…
Reference in New Issue
Block a user