apk_solver.h 1.48 KB
Newer Older
1 2 3
/* apk_solver.h - Alpine Package Keeper (APK)
 *
 * Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
4
 * Copyright (C) 2008-2011 Timo Teräs <timo.teras@iki.fi>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation. See http://www.gnu.org/ for details.
 */

#ifndef APK_SOLVER_H
#define APK_SOLVER_H

struct apk_change {
	struct apk_package *oldpkg;
	struct apk_package *newpkg;
};
APK_ARRAY(apk_change_array, struct apk_change);

struct apk_changeset {
	struct apk_change_array *changes;
};

Timo Teräs's avatar
Timo Teräs committed
25 26 27 28
#define APK_SOLVERF_UPGRADE		0x0001
#define APK_SOLVERF_AVAILABLE		0x0002
#define APK_SOLVERF_REINSTALL		0x0004

29 30
void apk_solver_set_name_flags(struct apk_name *name,
			       unsigned short solver_flags);
Timo Teräs's avatar
Timo Teräs committed
31 32 33 34 35
int apk_solver_solve(struct apk_database *db,
		     unsigned short solver_flags,
		     struct apk_dependency_array *world,
		     struct apk_package_array **solution,
		     struct apk_changeset *changeset);
36 37 38 39 40 41 42
int apk_solver_commit_changeset(struct apk_database *db,
				struct apk_changeset *changeset,
				struct apk_dependency_array *world);
void apk_solver_print_errors(struct apk_database *db,
			     struct apk_package_array *solution,
			     struct apk_dependency_array *world,
			     int unsatisfiable);
Timo Teräs's avatar
Timo Teräs committed
43 44 45
int apk_solver_commit(struct apk_database *db,
		      unsigned short solver_flags,
		      struct apk_dependency_array *world);
46 47 48

#endif