Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add types for conflicts.
Vsevolod Stakhov committed 12 years ago
commit 3689fc684340187437da7ab4a1c52e2d19f577b2
parent 4bce6de
2 files changed +12 -2
modified libpkg/pkg_conflicts.c
@@ -145,7 +145,7 @@ pkg_conflicts_request_resolve(struct pkg_jobs *j)
}

void
-
pkg_conflicts_register(struct pkg *p1, struct pkg *p2)
+
pkg_conflicts_register(struct pkg *p1, struct pkg *p2, enum pkg_conflict_type type)
{
	struct pkg_conflict *c1, *c2, *test;
	const char *o1, *o2;
@@ -156,6 +156,7 @@ pkg_conflicts_register(struct pkg *p1, struct pkg *p2)
	pkg_conflict_new(&c1);
	pkg_conflict_new(&c2);
	if (c1 != NULL && c2 != NULL) {
+
		c1->type = c2->type = type;
		HASH_FIND_STR(p1->conflicts, o2, test);
		if (test == NULL) {
			sbuf_set(&c1->origin, o2);
modified libpkg/private/pkg.h
@@ -148,8 +148,16 @@ struct pkg_dep {
	UT_hash_handle	 hh;
};

+
enum pkg_conflict_type {
+
	PKG_CONFLICT_ALL = 0,
+
	PKG_CONFLICT_REMOTE_LOCAL,
+
	PKG_CONFLICT_REMOTE_REMOTE,
+
	PKG_CONFLICT_LOCAL_LOCAL
+
};
+

struct pkg_conflict {
	struct sbuf		*origin;
+
	enum pkg_conflict_type type;
	UT_hash_handle	hh;
};

@@ -402,7 +410,8 @@ int pkgdb_is_dir_used(struct pkgdb *db, const char *dir, int64_t *res);
int pkg_conflicts_request_resolve(struct pkg_jobs *j);
int pkg_conflicts_append_pkg(struct pkg *p, struct pkg_jobs *j);
int pkg_conflicts_integrity_check(struct pkg_jobs *j);
-
void pkg_conflicts_register(struct pkg *p1, struct pkg *p2);
+
void pkg_conflicts_register(struct pkg *p1, struct pkg *p2,
+
		enum pkg_conflict_type type);

typedef void (*conflict_func_cb)(const char *, const char *, void *);
int pkgdb_integrity_append(struct pkgdb *db, struct pkg *p,