libalpm
Arch Linux Package Manager Library
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
#include "conflict.h"
#include "alpm_list.h"
#include "alpm.h"
#include "handle.h"
#include "trans.h"
#include "util.h"
#include "log.h"
#include "deps.h"
#include "filelist.h"
Functions | |
static alpm_conflict_t * | conflict_new (alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason) |
Creates a new conflict. | |
void | alpm_conflict_free (alpm_conflict_t *conflict) |
Free a conflict and its members. | |
static int | conflict_isin (alpm_conflict_t *needle, alpm_list_t *haystack) |
Searches for a conflict in a list. | |
static int | add_conflict (alpm_handle_t *handle, alpm_list_t **baddeps, alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason) |
Adds the pkg1/pkg2 conflict to the baddeps list. | |
static void | check_conflict (alpm_handle_t *handle, alpm_list_t *list1, alpm_list_t *list2, alpm_list_t **baddeps, int order) |
Check if packages from list1 conflict with packages from list2. | |
alpm_list_t * | alpm_checkconflicts (alpm_handle_t *handle, alpm_list_t *pkglist) |
Check the package conflicts in a database. | |
static alpm_list_t * | add_fileconflict (alpm_handle_t *handle, alpm_list_t *conflicts, const char *filestr, alpm_pkg_t *pkg1, alpm_pkg_t *pkg2) |
Creates and adds a file conflict to a conflict list. | |
void | alpm_fileconflict_free (alpm_fileconflict_t *conflict) |
Free a fileconflict and its members. | |
static int | dir_belongsto_pkgs (alpm_handle_t *handle, const char *dirpath, alpm_list_t *pkgs) |
Recursively checks if a set of packages own all subdirectories and files in a directory. | |
static alpm_list_t * | alpm_db_find_file_owners (alpm_db_t *db, const char *path) |
|
static |
Adds the pkg1/pkg2 conflict to the baddeps list.
handle | the context handle |
baddeps | list to add conflict to |
pkg1 | first package |
pkg2 | package causing conflict |
reason | reason for this conflict |
References alpm_conflict_free(), alpm_dep_compute_string(), alpm_list_add(), ALPM_LOG_DEBUG, conflict_isin(), and conflict_new().
Referenced by check_conflict().
|
static |
Creates and adds a file conflict to a conflict list.
handle | the context handle |
conflicts | the list of conflicts to append to |
filestr | the conflicting file path |
pkg1 | package that wishes to install the file |
pkg2 | package that currently owns the file, or NULL if unowned |
References ALPM_ERR_MEMORY, ALPM_FILECONFLICT_FILESYSTEM, alpm_fileconflict_free(), ALPM_FILECONFLICT_TARGET, alpm_list_add(), ALPM_LOG_DEBUG, ALPM_PKG_FROM_LOCALDB, CALLOC, alpm_fileconflict_t::ctarget, error, alpm_fileconflict_t::file, RET_ERR, STRDUP, alpm_fileconflict_t::target, and alpm_fileconflict_t::type.
|
static |
|
static |
Check if packages from list1 conflict with packages from list2.
This looks at the conflicts fields of all packages from list1, and sees if they match packages from list2. If a conflict (pkg1, pkg2) is found, it is added to the baddeps list in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
handle | the context handle |
list1 | first list of packages |
list2 | second list of packages |
baddeps | list to store conflicts |
order | if >= 0 the conflict order is preserved, if < 0 it's reversed |
References add_conflict(), alpm_pkg_get_conflicts(), alpm_list_t::data, and alpm_list_t::next.
|
static |
Searches for a conflict in a list.
needle | conflict to search for |
haystack | list of conflicts to search |
References alpm_list_t::data, alpm_list_t::next, alpm_conflict_t::package1, and alpm_conflict_t::package2.
Referenced by add_conflict().
|
static |
Creates a new conflict.
References alpm_conflict_free(), ASSERT, CALLOC, error, alpm_conflict_t::package1, alpm_conflict_t::package2, and alpm_conflict_t::reason.
Referenced by add_conflict().
|
static |
Recursively checks if a set of packages own all subdirectories and files in a directory.
handle | the context handle |
dirpath | path of the directory to check |
pkgs | packages being checked against |
References alpm_filelist_contains(), ALPM_LOG_DEBUG, alpm_pkg_get_files(), alpm_list_t::data, dir_belongsto_pkgs(), is_dir(), and alpm_list_t::next.
Referenced by dir_belongsto_pkgs().