reverted back to trans->packages instead of install and remove queues
This commit is contained in:
parent
48f8f521b1
commit
e59e963f1f
|
@ -93,7 +93,7 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
|
|||
* if so, replace it in the list */
|
||||
/* ORE
|
||||
we'd better do it before load_pkg. */
|
||||
for(j = trans->install_q; j; j = j->next) {
|
||||
for(j = trans->packages; j; j = j->next) {
|
||||
pmpkg_t *pkg = j->data;
|
||||
|
||||
if(strcmp(pkg->name, info->name) == 0) {
|
||||
|
@ -107,7 +107,7 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
|
|||
}
|
||||
|
||||
/* add the package to the transaction */
|
||||
trans->install_q = pm_list_add(trans->install_q, info);
|
||||
trans->packages = pm_list_add(trans->packages, info);
|
||||
|
||||
return(0);
|
||||
|
||||
|
@ -138,7 +138,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
|||
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(PM_LOG_FLOW1, "looking for conflicts or unsatisfied dependencies");
|
||||
lp = checkdeps(db, trans->type, trans->install_q);
|
||||
lp = checkdeps(db, trans->type, trans->packages);
|
||||
if(lp != NULL) {
|
||||
int errorout = 0;
|
||||
|
||||
|
@ -187,10 +187,10 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
|||
|
||||
/* re-order w.r.t. dependencies */
|
||||
_alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
|
||||
lp = sortbydeps(trans->install_q, PM_TRANS_TYPE_ADD);
|
||||
lp = sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
|
||||
/* free the old alltargs */
|
||||
FREELISTPTR(trans->install_q);
|
||||
trans->install_q = lp;
|
||||
FREELISTPTR(trans->packages);
|
||||
trans->packages = lp;
|
||||
|
||||
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
|||
TRANS_CB(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(PM_LOG_FLOW1, "looking for file conflicts");
|
||||
lp = db_find_conflicts(db, trans->install_q, handle->root);
|
||||
lp = db_find_conflicts(db, trans->packages, handle->root);
|
||||
if(lp != NULL) {
|
||||
*data = lp;
|
||||
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
|
||||
|
@ -225,11 +225,11 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
|
|||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||
|
||||
if(trans->install_q == NULL) {
|
||||
if(trans->packages == NULL) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
for(targ = trans->install_q; targ; targ = targ->next) {
|
||||
for(targ = trans->packages; targ; targ = targ->next) {
|
||||
tartype_t gztype = {
|
||||
(openfunc_t)_alpm_gzopen_frontend,
|
||||
(closefunc_t)gzclose,
|
||||
|
|
|
@ -489,8 +489,7 @@ void *alpm_trans_getinfo(unsigned char parm)
|
|||
case PM_TRANS_TYPE: data = (void *)(int)trans->type; break;
|
||||
case PM_TRANS_FLAGS: data = (void *)(int)trans->flags; break;
|
||||
case PM_TRANS_TARGETS: data = trans->targets; break;
|
||||
case PM_TRANS_INSTALLQ: data = trans->install_q; break;
|
||||
case PM_TRANS_REMOVEQ: data = trans->remove_q; break;
|
||||
case PM_TRANS_PACKAGES: data = trans->packages; break;
|
||||
default:
|
||||
data = NULL;
|
||||
break;
|
||||
|
|
|
@ -188,6 +188,8 @@ enum {
|
|||
|
||||
void *alpm_sync_getinfo(PM_SYNCPKG *sync, unsigned char parm);
|
||||
|
||||
int alpm_sync_sysupgrade(PM_LIST **data);
|
||||
|
||||
/*
|
||||
* Transactions
|
||||
*/
|
||||
|
@ -234,8 +236,7 @@ enum {
|
|||
PM_TRANS_TYPE = 1,
|
||||
PM_TRANS_FLAGS,
|
||||
PM_TRANS_TARGETS,
|
||||
PM_TRANS_INSTALLQ,
|
||||
PM_TRANS_REMOVEQ
|
||||
PM_TRANS_PACKAGES
|
||||
};
|
||||
|
||||
void *alpm_trans_getinfo(unsigned char parm);
|
||||
|
|
|
@ -60,7 +60,7 @@ int remove_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
|
|||
_alpm_log(PM_LOG_ERROR, "could not find %s in database", name);
|
||||
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
|
||||
}
|
||||
trans->remove_q = pm_list_add(trans->remove_q, info);
|
||||
trans->packages = pm_list_add(trans->packages, info);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -78,19 +78,19 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
|||
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
|
||||
if((lp = checkdeps(db, trans->type, trans->remove_q)) != NULL) {
|
||||
if((lp = checkdeps(db, trans->type, trans->packages)) != NULL) {
|
||||
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
|
||||
while(lp) {
|
||||
PMList *j;
|
||||
for(j = lp; j; j = j->next) {
|
||||
pmdepmissing_t* miss = (pmdepmissing_t*)j->data;
|
||||
info = db_scan(db, miss->depend.name, INFRQ_ALL);
|
||||
if(!pkg_isin(info, trans->remove_q)) {
|
||||
trans->remove_q = pm_list_add(trans->remove_q, info);
|
||||
if(!pkg_isin(info, trans->packages)) {
|
||||
trans->packages = pm_list_add(trans->packages, info);
|
||||
}
|
||||
}
|
||||
FREELIST(lp);
|
||||
lp = checkdeps(db, trans->type, trans->remove_q);
|
||||
lp = checkdeps(db, trans->type, trans->packages);
|
||||
}
|
||||
} else {
|
||||
*data = lp;
|
||||
|
@ -100,15 +100,15 @@ int remove_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
|
|||
|
||||
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
|
||||
_alpm_log(PM_LOG_FLOW1, "finding removable dependencies");
|
||||
trans->remove_q = removedeps(db, trans->remove_q);
|
||||
trans->packages = removedeps(db, trans->packages);
|
||||
}
|
||||
|
||||
/* re-order w.r.t. dependencies */
|
||||
_alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
|
||||
lp = sortbydeps(trans->remove_q, PM_TRANS_TYPE_REMOVE);
|
||||
lp = sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
|
||||
/* free the old alltargs */
|
||||
FREELISTPTR(trans->remove_q);
|
||||
trans->remove_q = lp;
|
||||
FREELISTPTR(trans->packages);
|
||||
trans->packages = lp;
|
||||
|
||||
TRANS_CB(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
|
|||
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||
|
||||
for(targ = trans->remove_q; targ; targ = targ->next) {
|
||||
for(targ = trans->packages; targ; targ = targ->next) {
|
||||
char pm_install[PATH_MAX];
|
||||
info = (pmpkg_t*)targ->data;
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ pmtrans_t *trans_new()
|
|||
}
|
||||
|
||||
trans->targets = NULL;
|
||||
trans->install_q = NULL;
|
||||
trans->remove_q = NULL;
|
||||
trans->packages = NULL;
|
||||
trans->type = 0;
|
||||
trans->flags = 0;
|
||||
trans->cb = NULL;
|
||||
|
@ -62,19 +61,15 @@ void trans_free(pmtrans_t *trans)
|
|||
}
|
||||
|
||||
FREELIST(trans->targets);
|
||||
/* ORE - ugly */
|
||||
if(trans->type == PM_TRANS_TYPE_SYNC) {
|
||||
PMList *i = trans->install_q;
|
||||
while(i) {
|
||||
PMList *j = i->next;
|
||||
PMList *i;
|
||||
for(i = trans->packages; i; i = i->next) {
|
||||
sync_free(i->data);
|
||||
i->data = NULL;
|
||||
pm_list_free(i);
|
||||
i = j;
|
||||
}
|
||||
FREELIST(trans->packages);
|
||||
} else {
|
||||
FREELISTPKGS(trans->install_q);
|
||||
FREELISTPKGS(trans->remove_q);
|
||||
FREELISTPKGS(trans->packages);
|
||||
}
|
||||
|
||||
free(trans);
|
||||
|
@ -142,10 +137,6 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
|
|||
/* Sanity checks */
|
||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
if(trans->install_q == NULL && trans->remove_q == NULL) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
switch(trans->type) {
|
||||
case PM_TRANS_TYPE_ADD:
|
||||
case PM_TRANS_TYPE_UPGRADE:
|
||||
|
@ -179,7 +170,7 @@ int trans_commit(pmtrans_t *trans)
|
|||
ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
/* If there's nothing to do, return without complaining */
|
||||
if(trans->install_q == NULL && trans->remove_q == NULL) {
|
||||
if(trans->packages == NULL) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ typedef struct __pmtrans_t {
|
|||
unsigned char flags;
|
||||
unsigned char state;
|
||||
PMList *targets; /* PMList of (char *) */
|
||||
PMList *install_q; /* PMList of (pmpkginfo_t *) */
|
||||
PMList *remove_q; /* PMList of (pmpkginfo_t *) */
|
||||
PMList *packages; /* PMList of (pmpkginfo_t *) */
|
||||
alpm_trans_cb cb;
|
||||
} pmtrans_t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue