mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-08 12:28:00 -05:00
Simple s/conflict/fileconflict/ renaming.
The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
parent
829a7b904d
commit
65fb99133d
@ -221,7 +221,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
||||
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
|
||||
|
||||
_alpm_log(PM_LOG_DEBUG, "looking for file conflicts\n");
|
||||
lp = _alpm_db_find_conflicts(db, trans, handle->root);
|
||||
lp = _alpm_db_find_fileconflicts(db, trans, handle->root);
|
||||
if(lp != NULL) {
|
||||
if(data) {
|
||||
*data = lp;
|
||||
|
@ -52,7 +52,7 @@ typedef struct __pmtrans_t pmtrans_t;
|
||||
typedef struct __pmsyncpkg_t pmsyncpkg_t;
|
||||
typedef struct __pmdepend_t pmdepend_t;
|
||||
typedef struct __pmdepmissing_t pmdepmissing_t;
|
||||
typedef struct __pmconflict_t pmconflict_t;
|
||||
typedef struct __pmfileconflict_t pmfileconflict_t;
|
||||
typedef struct __pmgraph_t pmgraph_t;
|
||||
|
||||
/*
|
||||
@ -390,15 +390,15 @@ char *alpm_dep_get_string(const pmdepend_t *dep);
|
||||
* File conflicts
|
||||
*/
|
||||
|
||||
typedef enum _pmconflicttype_t {
|
||||
PM_CONFLICT_TYPE_TARGET = 1,
|
||||
PM_CONFLICT_TYPE_FILE
|
||||
} pmconflicttype_t;
|
||||
typedef enum _pmfileconflicttype_t {
|
||||
PM_FILECONFLICT_TARGET = 1,
|
||||
PM_FILECONFLICT_FILESYSTEM
|
||||
} pmfileconflicttype_t;
|
||||
|
||||
const char *alpm_conflict_get_target(pmconflict_t *conflict);
|
||||
pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict);
|
||||
const char *alpm_conflict_get_file(pmconflict_t *conflict);
|
||||
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
|
||||
const char *alpm_fileconflict_get_target(pmfileconflict_t *conflict);
|
||||
pmfileconflicttype_t alpm_fileconflict_get_type(pmfileconflict_t *conflict);
|
||||
const char *alpm_fileconflict_get_file(pmfileconflict_t *conflict);
|
||||
const char *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict);
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
|
@ -230,17 +230,17 @@ static alpm_list_t *chk_filedifference(alpm_list_t *filesA, alpm_list_t *filesB)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* Adds pmconflict_t to a conflicts list. Pass the conflicts list, type (either
|
||||
* PM_CONFLICT_TYPE_TARGET or PM_CONFLICT_TYPE_FILE), a file string, and either
|
||||
/* Adds pmfileconflict_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(alpm_list_t *conflicts,
|
||||
pmconflicttype_t type, const char *filestr,
|
||||
pmfileconflicttype_t type, const char *filestr,
|
||||
const char* name1, const char* name2)
|
||||
{
|
||||
pmconflict_t *conflict;
|
||||
MALLOC(conflict, sizeof(pmconflict_t), return(conflicts));
|
||||
pmfileconflict_t *conflict;
|
||||
MALLOC(conflict, sizeof(pmfileconflict_t), return(conflicts));
|
||||
|
||||
conflict->type = type;
|
||||
strncpy(conflict->target, name1, PKG_NAME_LEN);
|
||||
@ -261,7 +261,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
|
||||
/* 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_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||
{
|
||||
alpm_list_t *i, *conflicts = NULL;
|
||||
alpm_list_t *targets = trans->packages;
|
||||
@ -304,7 +304,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||
if(tmpfiles) {
|
||||
for(k = tmpfiles; k; k = k->next) {
|
||||
snprintf(path, PATH_MAX, "%s%s", root, (char *)k->data);
|
||||
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_TARGET, path,
|
||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path,
|
||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
||||
}
|
||||
FREELIST(tmpfiles);
|
||||
@ -407,7 +407,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||
}
|
||||
if(!resolved_conflict) {
|
||||
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path);
|
||||
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
|
||||
conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM,
|
||||
path, p1->name, NULL);
|
||||
}
|
||||
}
|
||||
@ -418,7 +418,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
|
||||
return(conflicts);
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict)
|
||||
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
|
||||
{
|
||||
ALPM_LOG_FUNC;
|
||||
|
||||
@ -429,7 +429,7 @@ const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict)
|
||||
return conflict->target;
|
||||
}
|
||||
|
||||
pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict)
|
||||
pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conflict)
|
||||
{
|
||||
ALPM_LOG_FUNC;
|
||||
|
||||
@ -440,7 +440,7 @@ pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict)
|
||||
return conflict->type;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict)
|
||||
const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict)
|
||||
{
|
||||
ALPM_LOG_FUNC;
|
||||
|
||||
@ -451,7 +451,7 @@ const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict)
|
||||
return conflict->file;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_conflict_get_ctarget(pmconflict_t *conflict)
|
||||
const char SYMEXPORT *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict)
|
||||
{
|
||||
ALPM_LOG_FUNC;
|
||||
|
||||
|
@ -27,15 +27,15 @@
|
||||
|
||||
#define CONFLICT_FILE_LEN 512
|
||||
|
||||
struct __pmconflict_t {
|
||||
struct __pmfileconflict_t {
|
||||
char target[PKG_NAME_LEN];
|
||||
pmconflicttype_t type;
|
||||
pmfileconflicttype_t type;
|
||||
char file[CONFLICT_FILE_LEN];
|
||||
char ctarget[PKG_NAME_LEN];
|
||||
};
|
||||
|
||||
alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
|
||||
alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
||||
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root);
|
||||
|
||||
#endif /* _ALPM_CONFLICT_H */
|
||||
|
||||
|
@ -219,7 +219,7 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, pmtrans_t *trans)
|
||||
}
|
||||
} else {
|
||||
/* check the remove skip list before removing the file.
|
||||
* see the big comment block in db_find_conflicts() for an
|
||||
* see the big comment block in db_find_fileconflicts() for an
|
||||
* explanation. */
|
||||
if(alpm_list_find_str(trans->skip_remove, file)) {
|
||||
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_remove, skipping removal\n",
|
||||
|
@ -155,18 +155,18 @@ int pacman_add(alpm_list_t *targets)
|
||||
break;
|
||||
case PM_ERR_FILE_CONFLICTS:
|
||||
for(i = data; i; i = alpm_list_next(i)) {
|
||||
pmconflict_t *conflict = alpm_list_getdata(i);
|
||||
switch(alpm_conflict_get_type(conflict)) {
|
||||
case PM_CONFLICT_TYPE_TARGET:
|
||||
pmfileconflict_t *conflict = alpm_list_getdata(i);
|
||||
switch(alpm_fileconflict_get_type(conflict)) {
|
||||
case PM_FILECONFLICT_TARGET:
|
||||
printf(_("%s exists in both '%s' and '%s'\n"),
|
||||
alpm_conflict_get_file(conflict),
|
||||
alpm_conflict_get_target(conflict),
|
||||
alpm_conflict_get_ctarget(conflict));
|
||||
alpm_fileconflict_get_file(conflict),
|
||||
alpm_fileconflict_get_target(conflict),
|
||||
alpm_fileconflict_get_ctarget(conflict));
|
||||
break;
|
||||
case PM_CONFLICT_TYPE_FILE:
|
||||
case PM_FILECONFLICT_FILESYSTEM:
|
||||
printf(_("%s: %s exists in filesystem\n"),
|
||||
alpm_conflict_get_target(conflict),
|
||||
alpm_conflict_get_file(conflict));
|
||||
alpm_fileconflict_get_target(conflict),
|
||||
alpm_fileconflict_get_file(conflict));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -674,18 +674,18 @@ int sync_trans(alpm_list_t *targets, int sync_only)
|
||||
alpm_list_t *i;
|
||||
case PM_ERR_FILE_CONFLICTS:
|
||||
for(i = data; i; i = alpm_list_next(i)) {
|
||||
pmconflict_t *conflict = alpm_list_getdata(i);
|
||||
switch(alpm_conflict_get_type(conflict)) {
|
||||
case PM_CONFLICT_TYPE_TARGET:
|
||||
pmfileconflict_t *conflict = alpm_list_getdata(i);
|
||||
switch(alpm_fileconflict_get_type(conflict)) {
|
||||
case PM_FILECONFLICT_TARGET:
|
||||
printf(_("%s exists in both '%s' and '%s'\n"),
|
||||
alpm_conflict_get_file(conflict),
|
||||
alpm_conflict_get_target(conflict),
|
||||
alpm_conflict_get_ctarget(conflict));
|
||||
alpm_fileconflict_get_file(conflict),
|
||||
alpm_fileconflict_get_target(conflict),
|
||||
alpm_fileconflict_get_ctarget(conflict));
|
||||
break;
|
||||
case PM_CONFLICT_TYPE_FILE:
|
||||
case PM_FILECONFLICT_FILESYSTEM:
|
||||
printf(_("%s: %s exists in filesystem\n"),
|
||||
alpm_conflict_get_target(conflict),
|
||||
alpm_conflict_get_file(conflict));
|
||||
alpm_fileconflict_get_target(conflict),
|
||||
alpm_fileconflict_get_file(conflict));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user