Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Set the pkg type to installed in pkgdb.
jlaffaye committed 15 years ago
commit 2ba375bb94e4e0d3c8bf0f1d6068bc2d21fb3384
parent 2eef485b34ca45f969bacc402d506f3311c32db7
4 files changed +9 -15
modified libpkg/pkg.c
@@ -15,6 +15,7 @@ pkg_type(struct pkg *pkg)
{
	return (pkg->type);
}
+

const char *
pkg_origin(struct pkg *pkg)
{
@@ -52,12 +53,6 @@ pkg_deps(struct pkg *pkg)
}

int
-
pkg_numdeps(struct pkg *pkg)
-
{
-
	return (pkg->deps.len);
-
}
-

-
int
pkg_resolvdeps(struct pkg *pkg, struct pkgdb *db) {
	struct pkg *p;
	struct pkgdb_it *it;
@@ -159,7 +154,6 @@ pkg_open(const char *path, struct pkg **pkg, int query_flags)
			continue;
		}

-

		pkg_file_new(&file);
		strlcpy(file->path, archive_entry_pathname(ae), sizeof(file->path));
		array_append(&(*pkg)->files, file);
modified libpkg/pkg.h
@@ -38,7 +38,6 @@ struct pkg ** pkg_deps(struct pkg *);
struct pkg ** pkg_rdeps(struct pkg *);
struct pkg_file ** pkg_files(struct pkg *);
struct pkg_conflict ** pkg_conflicts(struct pkg *);
-
int pkg_numdeps(struct pkg *);
int pkg_resolvdeps(struct pkg *, struct pkgdb *db);

/* pkg setters */
modified libpkg/pkgdb.c
@@ -209,6 +209,7 @@ pkgdb_it_next_pkg(struct pkgdb_it *it, struct pkg **pkg_p, int flags)
			pkg_reset(*pkg_p);
		pkg = *pkg_p;

+
		pkg->type = PKG_INSTALLED;
		pkg_setorigin(pkg, sqlite3_column_text(it->stmt, 0));
		pkg_setname(pkg, sqlite3_column_text(it->stmt, 1));
		pkg_setversion(pkg, sqlite3_column_text(it->stmt, 2));
modified pkg/add.c
@@ -21,13 +21,13 @@ exec_add(int argc, char **argv)
	struct pkg *p;
	struct pkg **deps;
	int ret = 0;
-

	bool installed = false;
+
	int i;

-
	int numdeps, i;
-

-
	if (argc != 2)
+
	if (argc != 2) {
+
		usage_add();
		return (-1);
+
	}

	if (pkg_open(argv[1], &pkg, 0) != 0) {
		return (-1);
@@ -56,11 +56,10 @@ exec_add(int argc, char **argv)
		err(1, "%s is already installed\n", pkg_name(pkg));
	}

-

-
	if ((numdeps = pkg_numdeps(pkg)) > 0) {
+
	deps = pkg_deps(pkg);
+
	if (deps != NULL) {
		pkg_resolvdeps(pkg, db);

-
		deps = pkg_deps(pkg);
		for (i = 0; deps[i] != NULL; i++) {
			if (pkg_type(deps[i]) == PKG_NOTFOUND) {
				warnx("%s-%s: unresolved dependency %s-%s", pkg_name(pkg), pkg_version(pkg), pkg_name(deps[i]), pkg_version(deps[i]));
@@ -72,6 +71,7 @@ exec_add(int argc, char **argv)
	if (ret != 0)
		return (ret);

+
	pkg_free(pkg);
	pkgdb_close(db);

	return (0);