summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-20 02:14:27 +0000
committerDan McGee <dan@archlinux.org>2007-02-20 02:14:27 +0000
commit03f034ef0eacaca3611193007c24d6c2af94bdb8 (patch)
treed0b13f3e0c3cca0a07cd908e8d332697df03dff9 /lib/libalpm/add.c
parent3f802fb38ed11a73f343191c0b3178d37d5e8a4d (diff)
downloadpacman-03f034ef0eacaca3611193007c24d6c2af94bdb8.tar.xz
* Updated conflict checking one last time. You can finally have a file move
from one package to another seemlessly (knock on wood). This is implemented through the use of two skip lists in the trans struct- skip_add and skip_remove, which replace the former trans->skiplist. * Removed an unnecessary function parameter, added a necessary one. * If a package has no backup files, print '(none)' under the heading so it is more obvious. * Updated my TODO list.
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index b503323b..28e66354 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -316,25 +316,19 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
/* Check for file conflicts
*/
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
- alpm_list_t *skiplist = NULL;
-
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, _("looking for file conflicts"));
- lp = _alpm_db_find_conflicts(db, trans, handle->root, &skiplist);
+ lp = _alpm_db_find_conflicts(db, trans, handle->root);
if(lp != NULL) {
if(data) {
*data = lp;
} else {
FREELIST(lp);
}
- FREELIST(skiplist);
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
}
- /* copy the file skiplist into the transaction */
- trans->skiplist = skiplist;
-
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
}
@@ -423,7 +417,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(oldpkg) {
/* this is kinda odd. If the old package exists, at this point we make a
* NEW transaction, unrelated to handle->trans, and instantiate a "remove"
- * with the type PM_TRANS_TYPE_UPGRADE */
+ * with the type PM_TRANS_TYPE_UPGRADE. TODO: kill this weird behavior. */
pmtrans_t *tr = _alpm_trans_new();
_alpm_log(PM_LOG_DEBUG, _("removing old package first (%s-%s)"), oldpkg->name, oldpkg->version);
@@ -441,8 +435,8 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
- /* copy the skiplist over */
- tr->skiplist = alpm_list_strdup(trans->skiplist);
+ /* copy the remove skiplist over */
+ tr->skip_remove = alpm_list_strdup(trans->skip_remove);
alpm_list_t *b;
/* Add files in the NEW package's backup array to the noupgrade array
@@ -538,11 +532,19 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* if a file is in NoExtract then we never extract it */
if(alpm_list_find_str(handle->noextract, entryname)) {
+ _alpm_log(PM_LOG_DEBUG, _("%s is in NoExtract, skipping extraction"), entryname);
alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), entryname);
archive_read_data_skip(archive);
continue;
}
+ /* if a file is in the add skiplist we never extract it */
+ if(alpm_list_find_str(trans->skip_add, filename)) {
+ _alpm_log(PM_LOG_DEBUG, _("%s is in trans->skip_add, skipping extraction"), entryname);
+ archive_read_data_skip(archive);
+ continue;
+ }
+
/* check is file already exists */
if(stat(filename, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
/* it does, is it a backup=() file?