Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge remote-tracking branch 'upstream/master'
Yuri Pankov committed 14 years ago
commit 099e0b41026a2e72c35206c5999c035cc1ab177b
parent 896198f
2 files changed +21 -14
modified FAQ.md
@@ -16,7 +16,7 @@ Table of Contents
* [How do I know if I have packages with the same origin?](#10)
* [How to start working with multi-repos in pkgng?](#11)
* [Why `pkg create` is slow?](#12)
-
* [Does pkgng work wit portaudit?](#13)
+
* [Does pkgng work with portaudit?](#13)
* [When will pkgng be the default package manager?](#14)

<a name="1"></a>
modified pkg/check.c
@@ -27,7 +27,7 @@ STAILQ_HEAD(deps_head, deps_entry);
static int check_deps(struct pkgdb *db, struct pkg *pkg, struct deps_head *dh);
static void add_missing_dep(struct pkg_dep *d, struct deps_head *dh);
static void deps_free(struct deps_head *dh);
-
static void fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs);
+
static void fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs, bool yes);
static void check_summary(struct pkgdb *db, struct deps_head *dh);

static int
@@ -69,9 +69,17 @@ static void
add_missing_dep(struct pkg_dep *d, struct deps_head *dh)
{
	struct deps_entry *e = NULL;
+
	const char *origin = NULL;

	assert(d != NULL);

+
	/* do not add duplicate entries in the queue */
+
	STAILQ_FOREACH(e, dh, next) {
+
		origin = pkg_dep_get(d, PKG_DEP_ORIGIN);
+
		if (strcmp(e->origin, origin) == 0)
+
			return;
+
	}
+

	if ((e = calloc(1, sizeof(struct deps_entry))) == NULL)
		err(1, "calloc(deps_entry)");

@@ -98,7 +106,7 @@ deps_free(struct deps_head *dh)
}

static void
-
fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs)
+
fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs, bool yes)
{
	struct pkg *pkg = NULL;
	struct pkgdb_it *it = NULL;
@@ -164,12 +172,16 @@ fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs)
                printf("\nthe installation will save %s\n", size);
        } else {
                humanize_number(size, sizeof(size), newsize - oldsize, "B", HN_AUTOSCALE, 0);
-
                printf("\nthe installation will require %s more space\n", size);
+
                printf("\nThe installation will require %s more space\n", size);
        }
        humanize_number(size, sizeof(size), dlsize, "B", HN_AUTOSCALE, 0);
        printf("%s to be downloaded\n", size);

-
	pkg_jobs_apply(jobs, 0);
+
	if (yes == false)
+
		yes = query_yesno("\n>>> Try to fix the missing dependencies [y/N]: ");
+

+
	if (yes == true)
+
		pkg_jobs_apply(jobs, 0);

	free(pkgs);
	pkg_free(pkg);
@@ -252,7 +264,7 @@ exec_check(int argc, char **argv)
	}

	if (geteuid() != 0) {
-
		warnx("fixing package database can only be done as root");
+
		warnx("fixing the package database can only be done as root");
		return (EX_NOPERM);
	}

@@ -270,17 +282,12 @@ exec_check(int argc, char **argv)
		nbpkgs += check_deps(db, pkg, &dh);

	if (nbpkgs > 0) {
-
		printf("\n>>> Missing package dependencies were detected.\n");
-

		if (yes == false) 
			pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);
-
		if (yes == false)
-
			yes = query_yesno("\nTry to fix the missing dependencies [y/N]: ");

-
		if (yes == true) {
-
			fix_deps(db, &dh, nbpkgs);
-
			check_summary(db, &dh);
-
		}
+
		printf("\n>>> Missing package dependencies were detected.\n\n");
+
		fix_deps(db, &dh, nbpkgs, yes);
+
		check_summary(db, &dh);
	}

	deps_free(&dh);