From 5ef51b3e266cf43411947248886372001fdb207a Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Fri, 7 Oct 2005 23:29:49 +0000 Subject: Merging in recent fixes/additions from 2.9.7 --- lib/libalpm/add.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index af7d6b0b..327b5407 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -191,6 +191,7 @@ error: int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) { PMList *lp; + PMList *skiplist; ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); @@ -269,12 +270,17 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL); _alpm_log(PM_LOG_FLOW1, "looking for file conflicts"); - lp = db_find_conflicts(db, trans->packages, handle->root); + lp = db_find_conflicts(db, trans->packages, handle->root, &skiplist); if(lp != NULL) { *data = lp; RET_ERR(PM_ERR_FILE_CONFLICTS, -1); } + /* copy the file skiplist into the transaction */ + for(lp = skiplist; lp; lp = lp->next) { + trans->skiplist = pm_list_add(trans->skiplist, lp->data); + } + EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL); } @@ -354,6 +360,10 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) FREETRANS(tr); RET_ERR(PM_ERR_TRANS_ABORT, -1); } + /* copy the skiplist over */ + for(lp = trans->skiplist; lp; lp = lp->next) { + pm_list_add(tr->skiplist, lp->data); + } if(remove_commit(tr, db) == -1) { FREETRANS(tr); RET_ERR(PM_ERR_TRANS_ABORT, -1); @@ -361,9 +371,8 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) FREETRANS(tr); } } else { - /* no previous package version is installed, so this is actually just an - * install - */ + /* no previous package version is installed, so this is actually + * just an install. */ pmo_upgrade = 0; } } @@ -409,6 +418,17 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) snprintf(expath, PATH_MAX, "%s%s", handle->root, pathname); } + /* if a file is in NoExtract then we never extract it. + * + * eg, /home/httpd/html/index.html may be removed so index.php + * could be used. + */ + if(pm_list_is_strin(pathname, handle->noextract)) { + alpm_logaction("notice: %s is in NoExtract -- skipping extraction", pathname); + tar_skip_regfile(tar); + continue; + } + if(!stat(expath, &buf) && !S_ISDIR(buf.st_mode)) { /* file already exists */ if(pm_list_is_strin(pathname, handle->noupgrade)) { @@ -589,7 +609,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db) /* Add the package to the database */ t = time(NULL); - /* Update the requiredby field by scaning the whole database + /* Update the requiredby field by scanning the whole database * looking for packages depending on the package to add */ for(lp = db_get_pkgcache(db); lp; lp = lp->next) { pmpkg_t *tmpp = lp->data; -- cgit v1.2.3-70-g09d2