Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge branch 'master' of github.com:pkgng/pkgng
Baptiste Daroussin committed 13 years ago
commit 8755127866f75329fe453692872cd3f919224091
parent 2b3ba92
25 files changed +76 -71
modified libpkg/pkg.h
@@ -40,7 +40,7 @@
#define PKGVERSION "1.0-beta15"
/* PORTVERSION equivalent for proper pkg-static->ports-mgmt/pkg version comparison
 * in pkgdb_query_newpkgversion() */
-
#define PKG_PORTVERSION "1.0.b15"
+
#define PKG_PORTVERSION "1.0.b15_2"

struct pkg;
struct pkg_dep;
modified pkg/add.c
@@ -54,7 +54,7 @@ void
usage_add(void)
{
	fprintf(stderr, "usage: pkg add <pkg-name>\n");
-
	fprintf(stderr, "       pkg add <url>://<pkg-name>\n\n");
+
	fprintf(stderr, "       pkg add <protocol>://<path>/<pkg-name>\n\n");
	fprintf(stderr, "For more information see 'pkg help add'.\n");
}

@@ -76,7 +76,7 @@ exec_add(int argc, char **argv)
	}

	if (geteuid() != 0) {
-
		warnx("adding packages can only be done as root");
+
		warnx("Adding packages can only be done as root");
		return (EX_NOPERM);
	}

@@ -97,7 +97,7 @@ exec_add(int argc, char **argv)
			if (access(file, F_OK) != 0) {
				warn("%s",file);
				if (errno == ENOENT)
-
					warnx("Did you mean pkg install %s?", file);
+
					warnx("Did you mean 'pkg install %s'?", file);
				sbuf_cat(failedpkgs, argv[i]);
				if (i != argc - 1)
					sbuf_printf(failedpkgs, ", ");
@@ -122,7 +122,7 @@ exec_add(int argc, char **argv)
	
	if(failedpkgcount > 0) {
		sbuf_finish(failedpkgs);
-
		printf("\nFailed to install the following %d package(s): %s.\n", failedpkgcount, sbuf_data(failedpkgs));
+
		printf("\nFailed to install the following %d package(s): %s\n", failedpkgcount, sbuf_data(failedpkgs));
	}
	sbuf_delete(failedpkgs);

modified pkg/audit.c
@@ -70,7 +70,8 @@ SLIST_HEAD(audit_head, audit_entry);
void
usage_audit(void)
{
-
	fprintf(stderr, "usage: pkg audit [-F] <pattern>\n");
+
	fprintf(stderr, "usage: pkg audit [-F] <pattern>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help add'.\n");
}

static int
@@ -92,11 +93,11 @@ fetch_and_extract(const char *src, const char *dest)
		case EPKG_OK:
			break;
		case EPKG_UPTODATE:
-
			printf("audit file up-to-date\n");
+
			printf("Audit file up-to-date.\n");
			retcode = EPKG_OK;
			goto cleanup;
		default:
-
			warnx("Can't fetch audit file");
+
			warnx("Cannot fetch audit file!");
			goto cleanup;
	}

@@ -286,7 +287,7 @@ is_vulnerable(struct audit_head *h, struct pkg *pkg)
		res2 = match_version(pkgversion, &e->v2);
		if (res1 && res2) {
			res = true;
-
			printf("%s-%s is vulnerable\n", pkgname, pkgversion);
+
			printf("%s-%s is vulnerable:\n", pkgname, pkgversion);
			printf("%s\n", e->desc);
			printf("WWW: %s\n\n", e->url);
		}
@@ -369,7 +370,7 @@ exec_audit(int argc, char **argv)
		    PKG_VERSION, version);
		if (parse_db(audit_file, &h) != EPKG_OK) {
			if (errno == ENOENT)
-
				warnx("unable to open audit file, try running pkg audit -F first");
+
				warnx("unable to open audit file, try running 'pkg audit -F' first");
			else
				warn("unable to open audit file %s", audit_file);
			ret = EX_DATAERR;
@@ -391,14 +392,14 @@ exec_audit(int argc, char **argv)

	if ((it = pkgdb_query(db, NULL, MATCH_ALL)) == NULL)
	{
-
		warnx("Can not query local database");
+
		warnx("cannot query local database");
		ret = EX_IOERR;
		goto cleanup;
	}

	if (parse_db(audit_file, &h) != EPKG_OK) {
		if (errno == ENOENT)
-
			warnx("unable to open audit file, try running pkg audit -F first");
+
			warnx("unable to open audit file, try running 'pkg audit -F' first");
		else
			warn("unable to open audit file %s", audit_file);
		ret = EX_DATAERR;
modified pkg/autoremove.c
@@ -38,7 +38,7 @@
void
usage_autoremove(void)
{
-
	fprintf(stderr, "usage pkg autoremove [-yq]\n\n");
+
	fprintf(stderr, "usage: pkg autoremove [-yq]\n\n");
	fprintf(stderr, "For more information see 'pkg help autoremove'.\n");
}

@@ -112,7 +112,7 @@ exec_autoremove(int argc, char **argv)
	}

	if (pkg_jobs_is_empty(jobs)) {
-
		printf("Nothing to do\n");
+
		printf("Nothing to do.\n");
		retcode = 0;
		goto cleanup;
	}
@@ -127,14 +127,14 @@ exec_autoremove(int argc, char **argv)
		}

		if (oldsize > newsize)
-
			printf("\nThe autoremove will free %s\n", size);
+
			printf("\nThe autoremoval will free %s\n", size);
		else
-
			printf("\nThe autoremove will require %s more space\n", size);
+
			printf("\nThe autoremoval will require %s more space\n", size);

		if (!yes)
			pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);
		if (!yes)
-
			yes = query_yesno("\nProceed with autoremove of packages [y/N]: ");
+
			yes = query_yesno("\nProceed with autoremoval of packages [y/N]: ");
	}

	if (yes) {
modified pkg/backup.c
@@ -33,7 +33,8 @@
void
usage_backup(void)
{
-
	fprintf(stderr, "usage: pkg backup -[d|r] dest\n");
+
	fprintf(stderr, "usage: pkg backup -d <dest_file>\n");
+
	fprintf(stderr, "       pkg backup -r <src_file>\n\n");
	fprintf(stderr, "For more information see 'pkg help backup'.\n");
}

@@ -59,14 +60,14 @@ exec_backup(int argc, char **argv)
		if (pkgdb_dump(db, dest) == EPKG_FATAL)
			return (EPKG_FATAL);

-
		printf("done\n");
+
		printf(" done\n");
	}

	if (argv[1][1] == 'r') {
		printf("Restoring database...");
		if (pkgdb_load(db, dest) == EPKG_FATAL)
			return (EPKG_FATAL);
-
		printf("done\n");
+
		printf(" done\n");
	}

	pkgdb_close(db);
modified pkg/check.c
@@ -159,7 +159,7 @@ fix_deps(struct pkgdb *db, struct deps_head *dh, int nbpkgs, bool yes)
	}

	if (pkg_jobs_is_empty(jobs)) {
-
		printf("\n>>> Not able to find packages for installation.\n\n");
+
		printf("\n>>> Unable to find packages for installation.\n\n");
		return (EPKG_FATAL);
	}

@@ -221,8 +221,8 @@ check_summary(struct pkgdb *db, struct deps_head *dh)
void
usage_check(void)
{
-
	fprintf(stderr, "usage: pkg check [-dsr] [-vy] [-a | -gxX <pattern>]\n");
-
	fprintf(stderr, "\nFor more information see 'pkg help check'.\n");
+
	fprintf(stderr, "usage: pkg check [-dsr] [-vy] [-a | -gxX <pattern>]\n\n");
+
	fprintf(stderr, "For more information see 'pkg help check'.\n");
}

int
@@ -275,7 +275,8 @@ exec_check(int argc, char **argv)
				recompute = true;
				flags |= PKG_LOAD_FILES;
				if (geteuid() != 0)
-
					errx(EX_USAGE, "Needs to be root to recompute the checksums and size");
+
					errx(EX_USAGE, "recomputing the checksums"
+
					    " and size can only be done as root");
				break;
			case 'v':
				verbose = 1;
@@ -330,7 +331,7 @@ exec_check(int argc, char **argv)
			}
			if (recompute) {
				if (verbose)
-
					printf("Recomputing size and sums: %s\n", pkgname);
+
					printf("Recomputing size and checksums: %s\n", pkgname);
				pkg_recompute(db, pkg);
			}
		}
modified pkg/clean.c
@@ -38,7 +38,8 @@
void
usage_clean(void)
{
-
	fprintf(stderr, "usage: pkg clean\n");
+
	fprintf(stderr, "usage: pkg clean\n\n");
+
	fprintf(stderr, "For more information see 'pkg help clean'.\n");
}

int
@@ -61,7 +62,7 @@ exec_clean(int argc, char **argv)
	(void)argv;

	if (pkg_config_string(PKG_CONFIG_CACHEDIR, &cachedir) != EPKG_OK) {
-
		warnx("Cant get cachedir config entry");
+
		warnx("Cannot get cachedir config entry");
		return 1;
	}

@@ -108,9 +109,9 @@ exec_clean(int argc, char **argv)
			continue;
		} else if (ret == EPKG_END) {
			to_delete = true;
-
			printf("%s does not exist anymore, deleting\n", repopath);
+
			printf("%s does not exist anymore, deleting it\n", repopath);
		} else if (strcmp(repopath, pkgrepopath)) {
-
			printf("%s is out-of-date, deleting\n", repopath);
+
			printf("%s is out-of-date, deleting it\n", repopath);
			to_delete = true;
		}

modified pkg/delete.c
@@ -125,10 +125,10 @@ exec_delete(int argc, char **argv)
	if (pkg_jobs_is_empty(jobs)) {
		if (argc == 0) {
			if (!quiet)
-
				printf("Nothing to do\n");
+
				printf("Nothing to do.\n");
			retcode = EXIT_SUCCESS;
		} else {
-
			fprintf(stderr, "Package(s) not found\n");
+
			fprintf(stderr, "Package(s) not found!\n");
			retcode = EXIT_FAILURE;
		}
		goto cleanup;
modified pkg/event.c
@@ -162,16 +162,16 @@ event_callback(void *data, struct pkg_event *ev)
		    pkg_dep_get(ev->e_missing_dep.dep, PKG_DEP_VERSION));
		break;
	case PKG_EVENT_NOREMOTEDB:
-
		fprintf(stderr, "Unable to open remote database \"%s\", try running `%s update` first\n", ev->e_remotedb.repo, getprogname());
+
		fprintf(stderr, "Unable to open remote database \"%s\". Try running '%s update' first.\n", ev->e_remotedb.repo, getprogname());
		break;
	case PKG_EVENT_NOLOCALDB:
		/* only cares if run as root */
		if (geteuid() == 0)
-
			fprintf(stderr, "Unable to create local database\n");
+
			fprintf(stderr, "Unable to create local database!\n");
		break;
	case PKG_EVENT_NEWPKGVERSION:
		printf("New version of pkg detected, it needs to be installed first.\n"
-
			"After this upgrade it is recommended that you do a full upgrade using: 'pkg upgrade'\n\n");
+
		       "After this upgrade it is recommended that you do a full upgrade using: 'pkg upgrade'\n\n");
		break;
	case PKG_EVENT_FILE_MISMATCH:
		pkg_get(ev->e_file_mismatch.pkg, PKG_NAME, &name, PKG_VERSION, &version);
modified pkg/fetch.c
@@ -105,7 +105,7 @@ exec_fetch(int argc, char **argv)

	/* TODO: Allow the user to specify an output directory via -o outdir */
	if (geteuid() != 0) {
-
		warnx("fetching packages can only be done as root");
+
		warnx("Fetching packages can only be done as root");
		return (EX_NOPERM);
	}

modified pkg/info.c
@@ -184,7 +184,7 @@ exec_info(int argc, char **argv)
			return (EXIT_SUCCESS);

		if ((opt & INFO_QUIET) == 0)
-
			printf("No package installed\n");
+
			printf("No packages installed.\n");

		return (EXIT_FAILURE);
	}
@@ -197,7 +197,7 @@ exec_info(int argc, char **argv)
		gotone = false;
		pkgname = argv[i];
		if (match != MATCH_ALL && pkgname[0] == '\0') {
-
			fprintf(stderr, "Pattern should not be empty\n");
+
			fprintf(stderr, "Pattern must not be empty.\n");
			i++;
			continue;
		}
modified pkg/install.c
@@ -104,7 +104,7 @@ exec_install(int argc, char **argv)
	}

	if (geteuid() != 0) {
-
		warnx("installing packages can only be done as root");
+
		warnx("Installing packages can only be done as root");
		return (EX_NOPERM);
	}

modified pkg/main.c
@@ -175,7 +175,7 @@ main(int argc, char **argv)
	bool b;
	struct pkg_config_kv *kv = NULL;
	
-
	// Set stdout unbuffered
+
	/* Set stdout unbuffered */
        setvbuf(stdout, NULL, _IONBF, 0);

	if (argc < 2)
@@ -217,13 +217,13 @@ main(int argc, char **argv)
	optind = 1;

	if (jail_str != NULL && chroot_path != NULL) {
-
		fprintf(stderr, "-j and -c cannot be used at the same time\n");
+
		fprintf(stderr, "-j and -c cannot be used at the same time!\n");
		usage();
	}

	if (chroot_path != NULL)
		if (chroot(chroot_path) == -1)
-
			errx(EX_SOFTWARE, "chroot failed");
+
			errx(EX_SOFTWARE, "chroot failed!");

	if (jail_str != NULL) {
		jid = jail_getid(jail_str);
@@ -239,7 +239,7 @@ main(int argc, char **argv)
			errx(EX_SOFTWARE, "chdir() failed");

	if (pkg_init(NULL) != EPKG_OK)
-
		errx(EX_SOFTWARE, "can not parse configuration file");
+
		errx(EX_SOFTWARE, "Cannot parse configuration file!");

	if (version > 1) {
		printf("version: "PKGVERSION""GITHASH"\n");
modified pkg/pkg-add.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd February 16, 2012
+
.Dd June 12, 2012
.Dt PKG-ADD 8
.Os
.Sh NAME
@@ -25,7 +25,7 @@
.Nm
.Ar <pkg-name>
.Nm
-
.Ar <url>://<pkg-name>
+
.Ar <protocol>://<path>/<pkg-name>
.Sh DESCRIPTION
.Nm
installs a package from either a local source or a remote one.
modified pkg/pkg-backup.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd February 16, 2012
+
.Dd June 12, 2012
.Dt PKG-BACKUP 8
.Os
.Sh NAME
@@ -23,11 +23,11 @@
.Nd backup and restore the local package database
.Sh SYNOPSIS
.Nm
-
.Op Fl d
-
.Ar <file>
+
.Fl d
+
.Ar <dest_file>
.Nm
-
.Op Fl r
-
.Ar <file>
+
.Fl r
+
.Ar <src_file>
.Sh DESCRIPTION
.Nm
is used for backing up and restoring of the local package database.
@@ -35,14 +35,14 @@ is used for backing up and restoring of the local package database.
The following options are supported by
.Nm :
.Bl -tag -width F1
-
.It Fl d Ar <file>
+
.It Fl d Ar <dest_file>
Dumps the local package database to a file specified on the command-line.
If
.Ar -
is specified as the argument
.Nm
will use stdout for it's output.
-
.It Fl r Ar <file>
+
.It Fl r Ar <src_file>
Uses
.Ar file
in order to restore the local package database.
modified pkg/query.c
@@ -464,7 +464,7 @@ format_sql_condition(const char *str, struct sbuf *sqlcond)
							break;
						}
					default:
-
						fprintf(stderr, "unexpected character %c\n", str[0]);
+
						fprintf(stderr, "unexpected character: %c\n", str[0]);
						return (EPKG_FATAL);
				}
			}
@@ -531,7 +531,7 @@ format_sql_condition(const char *str, struct sbuf *sqlcond)
					sbuf_putc(sqlcond, str[0]);
				} else {
					if (!isnumber(str[0])) {
-
						fprintf(stderr, "a number is expected got %c\n", str[0]);
+
						fprintf(stderr, "a number is expected, got: %c\n", str[0]);
						return (EPKG_FATAL);
					}
					state = INT;
@@ -542,7 +542,7 @@ format_sql_condition(const char *str, struct sbuf *sqlcond)
			if (isspace(str[0])) {
				state = NONE;
			} else if (!isnumber(str[0])) {
-
				fprintf(stderr, "a number is expected %c\n", str[0]);
+
				fprintf(stderr, "a number is expected, got: %c\n", str[0]);
				return (EPKG_FATAL);
			}
			sbuf_putc(sqlcond, str[0]);
modified pkg/register.c
@@ -66,7 +66,8 @@ static const char * const scripts[] = {
void
usage_register(void)
{
-
	fprintf(stderr, "usage: pkg register [-ld] [-a <arch>] [-i <input-path>] -m <metadatadir> -f <plist-file>\n\n");
+
	fprintf(stderr, "usage: pkg register [-ld] [-a <arch>] [-i <input-path>]"
+
	                " -m <metadatadir> -f <plist-file>\n\n");
	fprintf(stderr, "For more information see 'pkg help register'.\n");
}

modified pkg/repo.c
@@ -97,7 +97,7 @@ exec_repo(int argc, char **argv)
	retcode = pkg_create_repo(argv[1], progress, &pos);

	if (retcode != EPKG_OK) {
-
		printf("can not create repository\n");
+
		printf("cannot create repository\n");
		return (retcode);
	} else {
		printf("\bdone!\n");
modified pkg/search.c
@@ -117,7 +117,7 @@ exec_search(int argc, char **argv)

	pattern = argv[0];
	if (pattern[0] == '\0') {
-
		fprintf(stderr, "Pattern should not be empty\n");
+
		fprintf(stderr, "Pattern must not be empty!\n");
		return (EX_USAGE);
	}
	if (strchr(pattern, '/') != NULL)
modified pkg/set.c
@@ -41,7 +41,7 @@
void
usage_set(void)
{
-
	fprintf(stderr, "usage pkg set [-a] [-A [01]] -yxXg <pattern>\n\n");
+
	fprintf(stderr, "usage: pkg set [-a] [-A [01]] -yxXg <pattern>\n\n");
	fprintf(stderr, "For more information see 'pkg help set'. \n");
}

@@ -87,7 +87,7 @@ exec_set(int argc, char **argv)
				sets |= AUTOMATIC;
				newautomatic = strtonum(optarg, 0, 1, &errstr);
				if (errstr)
-
					errx(EX_USAGE, "Wrong value for -A expecting 0 or 1, got: %s (%s)", optarg, errstr);
+
					errx(EX_USAGE, "Wrong value for -A. Expecting 0 or 1, got: %s (%s)", optarg, errstr);
				break;
			case 'o':
				sets |= ORIGIN;
@@ -97,13 +97,13 @@ exec_set(int argc, char **argv)
				neworigin = strrchr(oldorigin, ':');
				if (neworigin == NULL) {
					free(oldorigin);
-
					errx(EX_USAGE, "Wrong format for -o expecting oldorigin:neworigin, got %s", optarg);
+
					errx(EX_USAGE, "Wrong format for -o. Expecting oldorigin:neworigin, got: %s", optarg);
				}
				*neworigin = '\0';
				neworigin++;
				if (strrchr(oldorigin, '/') == NULL || strrchr(neworigin, '/') == NULL) {
					free(oldorigin);
-
					errx(EX_USAGE, "Bad origin format, got %s", optarg);
+
					errx(EX_USAGE, "Bad origin format, got: %s", optarg);
				}
				break;
			default:
@@ -121,7 +121,7 @@ exec_set(int argc, char **argv)
	}

	if (geteuid() != 0) {
-
		warnx("modifying local database can only be done as root");
+
		warnx("Modifying local database can only be done as root");
		return (EX_NOPERM);
	}

@@ -185,8 +185,8 @@ exec_set(int argc, char **argv)
				struct pkg_dep *d = NULL;
				while (pkg_deps(pkg, &d) == EPKG_OK) {
					/*
-
					 * Do not query user has he has already
-
					 * been queried
+
					 * Do not query user when he has already
+
					 * been queried.
					 */
					if (pkgdb_set(db, pkg, PKG_SET_DEPORIGIN, oldorigin, neworigin) != EPKG_OK)
						return (EPKG_FATAL);
modified pkg/shlib.c
@@ -109,7 +109,7 @@ exec_shlib(int argc, char **argv)
        if (ret != EPKG_END) {
		retcode = EPKG_WARN;
	} else if (count == 0) {
-
		printf("%s was not found in the database\n", libname);
+
		printf("%s was not found in the database.\n", libname);
		retcode = EPKG_WARN;
	}
		
modified pkg/update.c
@@ -126,7 +126,7 @@ exec_update(int argc, char **argv)
	}

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

modified pkg/updating.c
@@ -116,7 +116,7 @@ exec_updating(int argc, char **argv)
	if (updatingfile == NULL) {
		const char *portsdir;
		if (pkg_config_string(PKG_CONFIG_PORTSDIR, &portsdir) != EPKG_OK) {
-
			warnx("Cant get portsdir config entry");
+
			warnx("Cannot get portsdir config entry!");
			return (1);
		}
		asprintf(&updatingfile, "%s/UPDATING", portsdir);
modified pkg/upgrade.c
@@ -37,7 +37,7 @@
void
usage_upgrade(void)
{
-
	fprintf(stderr, "usage pkg upgrade [-r reponame] [-yfqL]\n");
+
	fprintf(stderr, "usage: pkg upgrade [-r reponame] [-yfqL]\n\n");
	fprintf(stderr, "For more information see 'pkg help upgrade'.\n");
}

@@ -56,7 +56,7 @@ exec_upgrade(int argc, char **argv)
	bool auto_update = true;

	if (geteuid() != 0) {
-
		warnx("upgrading can only be done as root");
+
		warnx("Upgrading can only be done as root");
		return (EX_NOPERM);
	}

modified pkg/version.c
@@ -238,7 +238,7 @@ exec_version(int argc, char **argv)
	argv += optind;

	if (pkg_config_string(PKG_CONFIG_PORTSDIR, &portsdir) != EPKG_OK)
-
		err(1, "Can not get portsdir config entry");
+
		err(1, "Cannot get portsdir config entry!");

	if (opt & VERSION_STATUS) {
			if (limchar != '<' &&
@@ -273,7 +273,7 @@ exec_version(int argc, char **argv)
		snprintf(indexpath, sizeof(indexpath), "%s/INDEX-%d", portsdir, rel_major_ver);
		indexfile = fopen(indexpath, "r");
		if (!indexfile)
-
			err(EX_SOFTWARE, "Unable to open %s", indexpath);
+
			err(EX_SOFTWARE, "Unable to open %s!", indexpath);

		while ((linelen = getline(&line, &linecap, indexfile)) > 0) {
			/* line is pkgname|portdir|... */