summaryrefslogtreecommitdiffstats
path: root/src/transaction.h
blob: 5f5e0ec9b74819888ef02a7650057514bb73295a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (C) 2003,2004,2005 Jason Woodward <woodwardj at jaos dot org>
 *
 * 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
 * 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#define MAX_LINE_LEN 80

struct suggests {
	char **pkgs;
	unsigned int count;
};

typedef struct {
	union { pkg_info_t *i; pkg_upgrade_t *u; } pkg;
	unsigned int type;
} queue_i;

typedef struct {
	queue_i **pkgs;
	unsigned int count;
} queue_t;

typedef struct {
	struct pkg_list *install_pkgs;
	struct pkg_upgrade_list *upgrade_pkgs;
	struct pkg_list *remove_pkgs;
	struct pkg_list *exclude_pkgs;
	struct suggests *suggests;
	queue_t *queue;
} transaction_t;

void init_transaction(transaction_t *);
int handle_transaction(const rc_config *,transaction_t *);
void add_install_to_transaction(transaction_t *,pkg_info_t *pkg);
void add_remove_to_transaction(transaction_t *,pkg_info_t *pkg);
void add_upgrade_to_transaction(transaction_t *,pkg_info_t *installed_pkg,pkg_info_t *upgrade_pkg);
void add_exclude_to_transaction(transaction_t *,pkg_info_t *pkg);
int search_transaction(transaction_t *,char *pkg_name);
int search_transaction_by_pkg(transaction_t *tran,pkg_info_t *pkg);
void free_transaction(transaction_t *);
transaction_t *remove_from_transaction(transaction_t *tran,pkg_info_t *pkg);
int add_deps_to_trans(const rc_config *global_config, transaction_t *tran, struct pkg_list *avail_pkgs, struct pkg_list *installed_pkgs, pkg_info_t *pkg);
/* check to see if a package is conflicted */
pkg_info_t *is_conflicted(transaction_t *tran, struct pkg_list *avail_pkgs, struct pkg_list *installed_pkgs, pkg_info_t *pkg);