2005-03-15 01:51:43 +00:00
|
|
|
/*
|
|
|
|
* deps.h
|
2007-11-16 20:18:45 -06:00
|
|
|
*
|
2007-12-10 22:55:22 -06:00
|
|
|
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
2006-10-15 19:31:03 +00:00
|
|
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
|
|
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
2007-11-16 20:18:45 -06:00
|
|
|
*
|
2005-03-15 01:51:43 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-12-10 22:55:22 -06:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-15 01:51:43 +00:00
|
|
|
*/
|
|
|
|
#ifndef _ALPM_DEPS_H
|
|
|
|
#define _ALPM_DEPS_H
|
|
|
|
|
|
|
|
#include "db.h"
|
|
|
|
#include "sync.h"
|
2006-11-22 09:03:41 +00:00
|
|
|
#include "package.h"
|
2006-11-20 09:10:23 +00:00
|
|
|
#include "alpm.h"
|
2005-03-15 01:51:43 +00:00
|
|
|
|
2006-11-20 09:10:23 +00:00
|
|
|
/* Dependency */
|
|
|
|
struct __pmdepend_t {
|
2007-01-24 03:02:53 +00:00
|
|
|
pmdepmod_t mod;
|
2008-01-11 00:01:58 -06:00
|
|
|
char *name;
|
|
|
|
char *version;
|
2006-11-20 09:10:23 +00:00
|
|
|
};
|
2005-03-29 20:31:03 +00:00
|
|
|
|
2006-11-20 09:10:23 +00:00
|
|
|
/* Missing dependency */
|
|
|
|
struct __pmdepmissing_t {
|
2008-01-11 00:01:58 -06:00
|
|
|
char *target;
|
2008-01-11 01:00:15 -06:00
|
|
|
pmdepend_t *depend;
|
2007-11-18 18:45:46 +01:00
|
|
|
char *causingpkg; /* this is used in case of remove dependency error only */
|
2006-11-20 09:10:23 +00:00
|
|
|
};
|
2005-03-29 20:31:03 +00:00
|
|
|
|
2008-01-11 01:00:15 -06:00
|
|
|
void _alpm_dep_free(pmdepend_t *dep);
|
|
|
|
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
2007-11-18 18:45:46 +01:00
|
|
|
pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
|
|
|
|
const char *causinpkg);
|
2008-01-11 00:01:58 -06:00
|
|
|
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
2008-03-16 22:36:31 +01:00
|
|
|
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
|
2007-11-14 12:42:15 +01:00
|
|
|
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
|
Resolvedeps rework
I divided resolvedeps into 2 functions. The new _alpm_resolvedep function
will resolve one dependency, for example the 'foo>=1.0-1' dependency. It
can be useful in sync_addtarget refactoring.
The resolvedeps parameters were changed, to be coherent with recursedeps:
* the target-list is an alpm_list* instead of alpm_list**. This is OK,
because alpm_list_add == alpm_list_add_last
* syncpkg param was removed. list contains the to-be-installed packages,
resolvedeps will add the required dependencies into this list
* trans param was removed, it was used in QUESTION() only, which can be used
on the main (handle->trans) transaction only (because the front-end cannot
access our pseudo-transactions at all!).
The patch fixes some wrong dynamic pmdepmissing_t usage.
I did a behavior change (and sync1003.py was modified accordingly), which
needs some explanation: The old resolvedeps didn't elect packages from
'remove' list. I've dropped this because I don't want that 2nd excluding
list param. In fact, in real life, we ~never need this rule. Resolvedeps is
called before checkconflicts, so only -Su's %REPLACES% packages are sitting
in 'remove' list. This means, that we have the replacement packages in our
target list. Usually "foo replaces bar" means, that bar isn't in our repos
any more, so resolvedeps *cannot* elect it; but usually it won't try it at
all, because foo is in the target list, and it is expected to satisfy
'bar>=1.0-1'-like dependencies too. Since checkdeps and checkconflicts is
done after resolvedeps, this cannot cause any harm.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-06 01:22:13 +02:00
|
|
|
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, pmpkg_t *tpkg);
|
|
|
|
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, alpm_list_t *list,
|
|
|
|
alpm_list_t *remove, alpm_list_t **data);
|
2008-07-01 22:53:13 +02:00
|
|
|
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);
|
2008-01-22 01:28:05 +01:00
|
|
|
pmdepend_t *_alpm_splitdep(const char *depstring);
|
2008-07-04 15:39:26 +02:00
|
|
|
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep);
|
Cleanup usages of alpm_list_find and alpm_list_remove.
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and
_alpm_grp_cmp
* new alpm_list_remove_str function, used 6 times in handle.c
* remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by
a more general alpm_find_pkg_satisfiers with a cleaner implementation.
before: alpm_db_whatprovides(db, targ)
after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ)
* remove satisfycmp and replace alpm_list_find + satisfycmp usage by
_alpm_find_dep_satisfiers.
before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp)
after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep)
* remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and
use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead.
This commit actually get rids of all complicated and asymmetric _cmp
functions. I first thought these functions were worth it, be caused it
allowed us to reuse list_find and list_remove. But this was at the detriment
of the clarity and also the ease of use of these functions, dangerous
because of their asymmetricity.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 18:47:42 +02:00
|
|
|
alpm_list_t *_alpm_find_dep_satisfiers(alpm_list_t *pkgs, pmdepend_t *dep);
|
2005-03-15 01:51:43 +00:00
|
|
|
|
|
|
|
#endif /* _ALPM_DEPS_H */
|
|
|
|
|
|
|
|
/* vim: set ts=2 sw=2 noet: */
|