index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-30 10:37:08 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-30 10:37:08 -0500 |
commit | ad577b3cb46dcaf1b143c55324a6eecf9f0ad7f1 (patch) | |
tree | d79aa34734791bb069eab172b8ea3e0ee12bedc6 /lib/libalpm/conflict.c | |
parent | 0f4aaeee42135d06dd18eb585eab3bae0e5fbf34 (diff) | |
parent | fed3e09c94d204b4655656c703a178e6fa2144b3 (diff) |
-rw-r--r-- | lib/libalpm/conflict.c | 62 |
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 94d82dd9..e54c7147 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -40,12 +40,12 @@ #include "log.h" #include "deps.h" -static pmconflict_t *conflict_new(const char *package1, const char *package2, +static alpm_conflict_t *conflict_new(const char *package1, const char *package2, const char *reason) { - pmconflict_t *conflict; + alpm_conflict_t *conflict; - MALLOC(conflict, sizeof(pmconflict_t), return NULL); + MALLOC(conflict, sizeof(alpm_conflict_t), return NULL); STRDUP(conflict->package1, package1, return NULL); STRDUP(conflict->package2, package2, return NULL); @@ -54,7 +54,7 @@ static pmconflict_t *conflict_new(const char *package1, const char *package2, return conflict; } -void _alpm_conflict_free(pmconflict_t *conflict) +void _alpm_conflict_free(alpm_conflict_t *conflict) { FREE(conflict->package2); FREE(conflict->package1); @@ -62,10 +62,10 @@ void _alpm_conflict_free(pmconflict_t *conflict) FREE(conflict); } -pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict) +alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict) { - pmconflict_t *newconflict; - CALLOC(newconflict, 1, sizeof(pmconflict_t), ); + alpm_conflict_t *newconflict; + CALLOC(newconflict, 1, sizeof(alpm_conflict_t), ); STRDUP(newconflict->package1, conflict->package1, return NULL); STRDUP(newconflict->package2, conflict->package2, return NULL); @@ -74,14 +74,14 @@ pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict) return newconflict; } -static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack) +static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack) { alpm_list_t *i; const char *npkg1 = needle->package1; const char *npkg2 = needle->package2; for(i = haystack; i; i = i->next) { - pmconflict_t *conflict = i->data; + alpm_conflict_t *conflict = i->data; const char *cpkg1 = conflict->package1; const char *cpkg2 = conflict->package2; if((strcmp(cpkg1, npkg1) == 0 && strcmp(cpkg2, npkg2) == 0) @@ -100,10 +100,10 @@ static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack) * @param pkg2 package causing conflict * @param reason reason for this conflict */ -static int add_conflict(pmhandle_t *handle, alpm_list_t **baddeps, +static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps, const char *pkg1, const char *pkg2, const char *reason) { - pmconflict_t *conflict = conflict_new(pkg1, pkg2, reason); + alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason); if(!conflict) { return -1; } @@ -129,7 +129,7 @@ static int add_conflict(pmhandle_t *handle, alpm_list_t **baddeps, * @param baddeps list to store conflicts * @param order if >= 0 the conflict order is preserved, if < 0 it's reversed */ -static void check_conflict(pmhandle_t *handle, +static void check_conflict(alpm_handle_t *handle, alpm_list_t *list1, alpm_list_t *list2, alpm_list_t **baddeps, int order) { alpm_list_t *i; @@ -138,17 +138,17 @@ static void check_conflict(pmhandle_t *handle, return; } for(i = list1; i; i = i->next) { - pmpkg_t *pkg1 = i->data; + alpm_pkg_t *pkg1 = i->data; const char *pkg1name = alpm_pkg_get_name(pkg1); alpm_list_t *j; for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) { const char *conflict = j->data; alpm_list_t *k; - pmdepend_t *parsed_conflict = _alpm_splitdep(conflict); + alpm_depend_t *parsed_conflict = _alpm_splitdep(conflict); for(k = list2; k; k = k->next) { - pmpkg_t *pkg2 = k->data; + alpm_pkg_t *pkg2 = k->data; const char *pkg2name = alpm_pkg_get_name(pkg2); if(strcmp(pkg1name, pkg2name) == 0) { @@ -170,7 +170,7 @@ static void check_conflict(pmhandle_t *handle, } /* Check for inter-conflicts */ -alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages) +alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages) { alpm_list_t *baddeps = NULL; @@ -184,7 +184,7 @@ alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages) * In case of conflict the package1 field of pmdepconflict_t contains * the target package, package2 field contains the local package */ -alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages) +alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages) { alpm_list_t *baddeps = NULL; @@ -209,9 +209,9 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages) * * @param handle the context handle * @param pkglist the list of packages to check - * @return an alpm_list_t of pmconflict_t + * @return an alpm_list_t of alpm_conflict_t */ -alpm_list_t SYMEXPORT *alpm_checkconflicts(pmhandle_t *handle, +alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist) { CHECK_HANDLE(handle, return NULL); @@ -275,17 +275,17 @@ static alpm_list_t *filelist_operation(alpm_list_t *filesA, alpm_list_t *filesB, return ret; } -/* Adds pmfileconflict_t to a conflicts list. Pass the conflicts list, type +/* Adds alpm_fileconflict_t to a conflicts list. Pass the conflicts list, type * (either PM_FILECONFLICT_TARGET or PM_FILECONFLICT_FILESYSTEM), a file * string, and either two package names or one package name and NULL. This is * a wrapper for former functionality that was done inline. */ -static alpm_list_t *add_fileconflict(pmhandle_t *handle, - alpm_list_t *conflicts, pmfileconflicttype_t type, const char *filestr, +static alpm_list_t *add_fileconflict(alpm_handle_t *handle, + alpm_list_t *conflicts, alpm_fileconflicttype_t type, const char *filestr, const char *name1, const char *name2) { - pmfileconflict_t *conflict; - MALLOC(conflict, sizeof(pmfileconflict_t), goto error); + alpm_fileconflict_t *conflict; + MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error); conflict->type = type; STRDUP(conflict->target, name1, goto error); @@ -306,7 +306,7 @@ error: RET_ERR(handle, PM_ERR_MEMORY, conflicts); } -void _alpm_fileconflict_free(pmfileconflict_t *conflict) +void _alpm_fileconflict_free(alpm_fileconflict_t *conflict) { FREE(conflict->ctarget); FREE(conflict->file); @@ -315,7 +315,7 @@ void _alpm_fileconflict_free(pmfileconflict_t *conflict) } static int dir_belongsto_pkg(const char *root, const char *dirpath, - pmpkg_t *pkg) + alpm_pkg_t *pkg) { struct dirent *ent = NULL; struct stat sbuf; @@ -362,13 +362,13 @@ static int dir_belongsto_pkg(const char *root, const char *dirpath, /* Find file conflicts that may occur during the transaction with two checks: * 1: check every target against every target * 2: check every target against the filesystem */ -alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, +alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, alpm_list_t *upgrade, alpm_list_t *remove) { alpm_list_t *i, *j, *conflicts = NULL; size_t numtargs = alpm_list_count(upgrade); size_t current; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(!upgrade) { return NULL; @@ -380,7 +380,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, * different cases. */ for(current = 0, i = upgrade; i; i = i->next, current++) { alpm_list_t *k, *tmpfiles; - pmpkg_t *p1, *p2, *dbpkg; + alpm_pkg_t *p1, *p2, *dbpkg; char path[PATH_MAX]; p1 = i->data; @@ -474,7 +474,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, /* Check remove list (will we remove the conflicting local file?) */ for(k = remove; k && !resolved_conflict; k = k->next) { - pmpkg_t *rempkg = k->data; + alpm_pkg_t *rempkg = k->data; if(alpm_list_find_str(alpm_pkg_get_files(rempkg), relative_path)) { _alpm_log(handle, PM_LOG_DEBUG, "local file will be removed, not a conflict: %s\n", @@ -489,7 +489,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, if(!p2 || strcmp(p1->name, p2->name) == 0) { continue; } - pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name); + alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name); /* localp2->files will be removed (target conflicts are handled by CHECK 1) */ if(localp2 && alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) { |