Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Nuke basic regex support, as it's obsolete according to re_format(7) Remove the '-X' option from most commands: '-x' still means 'match using regexes' but the syntax is now the modern style with '?' and '+' operators and without excessive backslashing of special characters.
Matthew Seaman committed 13 years ago
commit 43bf0fbdf21090ca5718bc6f7d67a6de32c85d0e
parent 69e2ed3
26 files changed +100 -191
modified libpkg/pkg.h
@@ -106,14 +106,11 @@ typedef enum {
	 */
	MATCH_GLOB,
	/**
-
	 * The argument is a basic regular expression.
+
	 * The argument is a regular expression ('modern' style
+
	 * according to re_format(7).
	 */
	MATCH_REGEX,
	/**
-
	 * The argument is an extended regular expression.
-
	 */
-
	MATCH_EREGEX,
-
	/**
	 * The argument is a WHERE clause to use as condition
	 */
	MATCH_CONDITION
modified libpkg/pkgdb.c
@@ -58,9 +58,7 @@
#define PKGEQ	(1U << 3)

static struct pkgdb_it *pkgdb_it_new(struct pkgdb *, sqlite3_stmt *, int);
-
static void pkgdb_regex(sqlite3_context *, int, sqlite3_value **, int);
-
static void pkgdb_regex_basic(sqlite3_context *, int, sqlite3_value **);
-
static void pkgdb_regex_extended(sqlite3_context *, int, sqlite3_value **);
+
static void pkgdb_regex(sqlite3_context *, int, sqlite3_value **);
static void pkgdb_regex_delete(void *);
static void pkgdb_pkglt(sqlite3_context *, int, sqlite3_value **);
static void pkgdb_pkggt(sqlite3_context *, int, sqlite3_value **);
@@ -235,7 +233,7 @@ populate_pkg(sqlite3_stmt *stmt, struct pkg *pkg) {
}

static void
-
pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv, int reg_type)
+
pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	const unsigned char	*regex = NULL;
	const unsigned char	*str;
@@ -252,7 +250,7 @@ pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv, int reg_type)
	re = (regex_t *)sqlite3_get_auxdata(ctx, 0);
	if (re == NULL) {
		re = malloc(sizeof(regex_t));
-
		if (regcomp(re, regex, reg_type | REG_NOSUB) != 0) {
+
		if (regcomp(re, regex, REG_EXTENDED | REG_NOSUB) != 0) {
			sqlite3_result_error(ctx, "Invalid regex\n", -1);
			free(re);
			return;
@@ -266,18 +264,6 @@ pkgdb_regex(sqlite3_context *ctx, int argc, sqlite3_value **argv, int reg_type)
}

static void
-
pkgdb_regex_basic(sqlite3_context *ctx, int argc, sqlite3_value **argv)
-
{
-
	pkgdb_regex(ctx, argc, argv, REG_BASIC);
-
}
-

-
static void
-
pkgdb_regex_extended(sqlite3_context *ctx, int argc, sqlite3_value **argv)
-
{
-
	pkgdb_regex(ctx, argc, argv, REG_EXTENDED);
-
}
-

-
static void
pkgdb_regex_delete(void *p)
{
	regex_t	*re = (regex_t *)p;
@@ -1098,13 +1084,6 @@ pkgdb_get_pattern_query(const char *pattern, match_t match)
		else
			comp = " WHERE origin REGEXP ?1";
		break;
-
	case MATCH_EREGEX:
-
		if (checkorigin == NULL)
-
			comp = " WHERE EREGEXP(?1, name) "
-
				"OR EREGEXP(?1, name || \"-\" || version)";
-
		else
-
			comp = " WHERE EREGEXP(?1, origin)";
-
		break;
	case MATCH_CONDITION:
		comp = pattern;
		break;
@@ -1131,9 +1110,6 @@ pkgdb_get_match_how(match_t match)
	case MATCH_REGEX:
		how = "%s REGEXP ?1";
		break;
-
	case MATCH_EREGEX:
-
		how = "EREGEXP(?1, %s)";
-
		break;
	case MATCH_CONDITION:
		/* Should not be called by pkgdb_get_match_how(). */
		assert(0);
@@ -2609,7 +2585,7 @@ pkgdb_query_newpkgversion(struct pkgdb *db, const char *repo)
	    "COALESCE(l.flatsize, p.flatsize) as flatsize, "
	    "p.cksum, p.path, 0 FROM '%s'.packages as p "
	    "  LEFT JOIN packages as l ON p.origin = l.origin "
-
	    "  WHERE p.origin REGEXP '^ports-mgmt/pkg\\(-devel\\)\\{0,1\\}$';";
+
	    "  WHERE p.origin REGEXP '^ports-mgmt/pkg(-devel)?$';";

	assert(db != NULL);
	assert(db->type == PKGDB_REMOTE);
@@ -2850,7 +2826,7 @@ pkgdb_query_installs(struct pkgdb *db, match_t match, int nbpkgs, char **pkgs,
	sql_exec(db->sqlite, sbuf_get(sql));

	sql_exec(db->sqlite, "UPDATE pkgjobs SET weight=100000 "
-
		 "WHERE origin REGEXP '^ports-mgmt/pkg\\(-devel\\)\\{0,1\\}$'");
+
		 "WHERE origin REGEXP '^ports-mgmt/pkg(-devel)?$'");

	sbuf_reset(sql);
	sbuf_printf(sql, finalsql, reponame);
@@ -3038,7 +3014,7 @@ pkgdb_query_upgrades(struct pkgdb *db, const char *repo, bool all)
	sql_exec(db->sqlite, sbuf_get(sql));

	sql_exec(db->sqlite, "UPDATE pkgjobs SET weight = 100000 "
-
		 "WHERE origin REGEXP '^ports-mgmt/pkg\\(-devel\\)\\{0,1\\}$'");
+
		 "WHERE origin REGEXP '^ports-mgmt/pkg(-devel)?$'");

	sbuf_reset(sql);
	sbuf_printf(sql, finalsql, reponame);
@@ -3900,9 +3876,7 @@ sqlcmd_init(sqlite3 *db, __unused const char **err,
	sqlite3_create_function(db, "myarch", 1, SQLITE_ANY, NULL,
				pkgdb_myarch, NULL, NULL);
	sqlite3_create_function(db, "regexp", 2, SQLITE_ANY, NULL,
-
				pkgdb_regex_basic, NULL, NULL);
-
	sqlite3_create_function(db, "eregexp", 2, SQLITE_ANY, NULL,
-
				pkgdb_regex_extended, NULL, NULL);
+
				pkgdb_regex, NULL, NULL);
	sqlite3_create_function(db, "pkglt", 2, SQLITE_ANY, NULL,
				pkgdb_pkglt, NULL, NULL);
	sqlite3_create_function(db, "pkggt", 2, SQLITE_ANY, NULL,
modified pkg/check.c
@@ -229,7 +229,7 @@ check_summary(struct pkgdb *db, struct deps_head *dh)
void
usage_check(void)
{
-
	fprintf(stderr, "usage: pkg check [-Bdsr] [-vy] [-a | -gxX <pattern>]\n\n");
+
	fprintf(stderr, "usage: pkg check [-Bdsr] [-vy] [-a | -gx <pattern>]\n\n");
	fprintf(stderr, "For more information see 'pkg help check'.\n");
}

@@ -255,7 +255,7 @@ exec_check(int argc, char **argv)

	struct deps_head dh = STAILQ_HEAD_INITIALIZER(dh);

-
	while ((ch = getopt(argc, argv, "yagdBxXsrv")) != -1) {
+
	while ((ch = getopt(argc, argv, "yagdBxsrv")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -263,9 +263,6 @@ exec_check(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'g':
			match = MATCH_GLOB;
			break;
modified pkg/create.c
@@ -50,7 +50,7 @@ usage_create(void)
{
	fprintf(stderr, "usage: pkg create [-n] [-f format] [-o outdir] "
		"[-p plist] [-r rootdir] -m manifestdir\n");
-
	fprintf(stderr, "       pkg create [-gnXx] [-f format] [-o outdir] "
+
	fprintf(stderr, "       pkg create [-gnx] [-f format] [-o outdir] "
		"[-r rootdir] pkg-name ...\n");
	fprintf(stderr, "       pkg create [-n] [-f format] [-o outdir] "
		"[-r rootdir] -a\n\n");
@@ -177,7 +177,7 @@ exec_create(int argc, char **argv)
	pkg_formats fmt;
	int ch;

-
	while ((ch = getopt(argc, argv, "agxXf:r:m:o:np:")) != -1) {
+
	while ((ch = getopt(argc, argv, "agxf:r:m:o:np:")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -188,9 +188,6 @@ exec_create(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'f':
			format = optarg;
			break;
modified pkg/delete.c
@@ -40,7 +40,7 @@
void
usage_delete(void)
{
-
	fprintf(stderr, "usage: pkg delete [-fgnqRXxy] <pkg-name> ...\n");
+
	fprintf(stderr, "usage: pkg delete [-fgnqRxy] <pkg-name> ...\n");
	fprintf(stderr, "       pkg delete [-nqy] -a\n\n");
	fprintf(stderr, "For more information see 'pkg help delete'.\n");
}
@@ -66,7 +66,7 @@ exec_delete(int argc, char **argv)

	pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);

-
	while ((ch = getopt(argc, argv, "afgnqRXxy")) != -1) {
+
	while ((ch = getopt(argc, argv, "afgnqRxy")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -86,9 +86,6 @@ exec_delete(int argc, char **argv)
		case 'R':
			recursive = 1;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'x':
			match = MATCH_REGEX;
			break;
modified pkg/fetch.c
@@ -42,7 +42,7 @@
void
usage_fetch(void)
{
-
	fprintf(stderr, "usage: pkg fetch [-r reponame] [-yqgxXadL] <pkg-name> <...>\n\n");
+
	fprintf(stderr, "usage: pkg fetch [-r reponame] [-yqgxadL] <pkg-name> <...>\n\n");
	fprintf(stderr, "For more information see 'pkg help fetch'.\n");
}

@@ -61,7 +61,7 @@ exec_fetch(int argc, char **argv)
	bool auto_update = true;
	match_t match = MATCH_EXACT;

-
	while ((ch = getopt(argc, argv, "ygxXr:qaLd")) != -1) {
+
	while ((ch = getopt(argc, argv, "ygxr:qaLd")) != -1) {
		switch (ch) {
		case 'y':
			yes = true;
@@ -75,9 +75,6 @@ exec_fetch(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'r':
			reponame = optarg;
			break;
modified pkg/info.c
@@ -50,7 +50,7 @@ usage_info(void)
{
	fprintf(stderr, "usage: pkg info <pkg-name>\n");
	fprintf(stderr, "       pkg info -a\n");
-
	fprintf(stderr, "       pkg info [-BDdefgIklOqRrsXx] <pkg-name>\n");
+
	fprintf(stderr, "       pkg info [-BDdefgIklOqRrsx] <pkg-name>\n");
	fprintf(stderr, "       pkg info [-BDdfIlqRrs] -F <pkg-file>\n\n");
	fprintf(stderr, "For more information see 'pkg help info'.\n");
}
@@ -83,7 +83,7 @@ exec_info(int argc, char **argv)
	bool origin_search = false;

	/* TODO: exclusive opts ? */
-
	while ((ch = getopt(argc, argv, "aDegxXEIdrklBsqopOfF:R")) != -1) {
+
	while ((ch = getopt(argc, argv, "aDegxEIdrklBsqopOfF:R")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -101,9 +101,6 @@ exec_info(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'D':
			opt |= INFO_MESSAGE;
			break;
modified pkg/install.c
@@ -45,7 +45,7 @@ void
usage_install(void)
{
	fprintf(stderr,
-
	    "usage: pkg install [-AfgLnqRXxy] [-r reponame] <pkg-name> ...\n\n");
+
	    "usage: pkg install [-AfgLnqRxy] [-r reponame] <pkg-name> ...\n\n");
	fprintf(stderr, "For more information see 'pkg help install'.\n");
}

@@ -71,7 +71,7 @@ exec_install(int argc, char **argv)

	pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);

-
	while ((ch = getopt(argc, argv, "AfgLnqRr:Xxy")) != -1) {
+
	while ((ch = getopt(argc, argv, "AfgLnqRr:xy")) != -1) {
		switch (ch) {
		case 'A':
			automatic = true;
@@ -97,9 +97,6 @@ exec_install(int argc, char **argv)
		case 'r':
			reponame = optarg;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'x':
			match = MATCH_REGEX;
			break;
modified pkg/lock.c
@@ -48,9 +48,9 @@ static bool yes = false; /* Assume yes answer to questions */
void
usage_lock(void)
{
-
	fprintf(stderr, "usage: pkg lock [-gqXxy] <pkg-name>\n");
+
	fprintf(stderr, "usage: pkg lock [-gqxy] <pkg-name>\n");
	fprintf(stderr, "       pkg lock [-qy] -a\n");
-
	fprintf(stderr, "       pkg unlock [-gqXxy] <pkg-name>\n");
+
	fprintf(stderr, "       pkg unlock [-gqxy] <pkg-name>\n");
	fprintf(stderr, "       pkg unlock [-qy] -a\n");
	fprintf(stderr, "For more information see 'pkg help lock'.\n");
}
@@ -137,7 +137,7 @@ exec_lock_unlock(int argc, char **argv, enum action action)

	pkg_config_bool(PKG_CONFIG_ASSUME_ALWAYS_YES, &yes);

-
	while ((ch = getopt(argc, argv, "agqXxy")) != -1) {
+
	while ((ch = getopt(argc, argv, "agqxy")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -148,9 +148,6 @@ exec_lock_unlock(int argc, char **argv, enum action action)
		case 'q':
			quiet = true;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'x':
			match = MATCH_REGEX;
			break;
modified pkg/pkg-check.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd July 9, 2012
+
.Dd October 15, 2012
.Dt PKG-CHECK 8
.Os
.Sh NAME
@@ -25,7 +25,7 @@
.Nm
.Op Fl Bdsr
.Op Fl vy
-
.Op Fl a | gxX Ar <pattern>
+
.Op Fl a | gx Ar <pattern>
.Sh DESCRIPTION
.Nm
.Fl B
@@ -63,10 +63,8 @@ as a shell glob pattern.
Treat
.Ar <pattern>
as a regular expression.
-
.It Fl X
-
Treat
-
.Ar <pattern>
-
as an extended regular expression.
+
This uses the "modern" or "extended" syntax described in
+
.Xr re_format 7
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
modified pkg/pkg-create.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd July 10, 2012
+
.Dd October 15, 2012
.Dt PKG-CREATE 8
.Os
.\" ---------------------------------------------------------------------------
@@ -32,7 +32,7 @@
.Op Fl r Ar rootdir
.Fl m Ar manifestdir
.Nm
-
.Op Fl gnxX
+
.Op Fl gnx
.Op Fl f Ar format
.Op Fl o Ar outdir
.Op Fl r Ar rootdir
@@ -85,7 +85,7 @@ Interpret
as a shell glob pattern and create package only for installed binaries whose
name match this pattern.
This option is incompatible with the
-
.Fl a , x , X
+
.Fl a , x
or
.Fl m Ar manifestdir
options.
@@ -94,20 +94,10 @@ Like
.Fl g ,
but interpret
.Ar pkg-name
-
as a regular expression.
+
as a regular expression using the "modern" or "extended" syntax described in
+
.Xr re_format 7 .
This option is incompatible with the
-
.Fl a, g , X
-
or
-
.Fl m Ar manifestdir
-
options.
-
.It Fl X
-
Like
-
.Fl g ,
-
but interpret
-
.Ar pkg-name
-
as an extended regular expression.
-
This option is incompatible with the
-
.Fl a, g , x
+
.Fl a, g
or
.Fl m Ar manifestdir
options.
@@ -145,9 +135,9 @@ are required; the
file can contain all the required information needed to build a
package.
This option is incompatible with the
-
.Fl a, g , x
+
.Fl a, g
or
-
.Fl X
+
.Fl x
options.
.It Fl n
Do not overwrite already existing packages
modified pkg/pkg-delete.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd march 26, 2012
+
.Dd October 15, 2012
.Dt PKG-DELETE 8
.Os
.Sh NAME
@@ -23,7 +23,7 @@
.Nd deletes packages from the database and the system
.Sh SYNOPSIS
.Nm
-
.Op Fl fgnqRXxy
+
.Op Fl fgnqRxy
.Ar <pkg-name> ...
.Nm
.Op Fl nqy
@@ -71,10 +71,10 @@ is also used, when
will show the list of packages to be deleted.
.It Fl R
Delete all packages that require the listed packages as well.
-
.It Fl X
-
Treat the package names as extended regular expressions.
.It Fl x
-
Treat the package names as regular expressions.
+
Treat the package names as regular expressions according to the
+
"modern" or "extended" syntax of
+
.Xr re_format 7 .
.It Fl y
Assume yes when asked for confirmation before package deletion.
.El
modified pkg/pkg-fetch.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd May 24, 2012
+
.Dd October 15, 2012
.Dt PKG-FETCH 8
.Os
.Sh NAME
@@ -24,7 +24,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl r Ar reponame
-
.Op Fl yqgxXadL
+
.Op Fl yqgxadL
.Ar <pkg-name>
.Op ...
.Sh DESCRIPTION
@@ -62,11 +62,9 @@ as a shell glob pattern.
.It Fl x
Treat
.Ar <pkg-name>
-
as a regular expression.
-
.It Fl X
-
Treat
-
.Ar <pkg-name>
-
as an extended regular expression.
+
as a regular expression according to the "modern" or "extended" syntax
+
of
+
.Xr re_format 7 .
.It Fl L
Skip updating the repository catalogues with
.Xr pkg-update 8 .
modified pkg/pkg-info.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd May 12, 2012
+
.Dd October 15, 2012
.Dt PKG-INFO 8
.Os
.Sh NAME
@@ -27,7 +27,7 @@
.Nm
.Fl a
.Nm
-
.Op Fl BDdefgIklOqRrsXx
+
.Op Fl BDdefgIklOqRrsx
.Ar <pkg-name>
.Nm
.Op Fl BDdfIlqRrs
@@ -61,11 +61,9 @@ as a shell glob pattern.
.It Fl x
Treat
.Ar <pkg-name>
-
as a regular expression.
-
.It Fl X
-
Treat
-
.Ar <pkg-name>
-
as an extended regular expression.
+
as a regular expression according to the "modern" or "extended" syntax
+
of
+
.Xr re_format 7 .
.It Fl d
Display the list of packages required by
.Ar <pkg-name> .
modified pkg/pkg-install.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd July 26, 2012
+
.Dd October 15, 2012
.Dt PKG-INSTALL 8
.Os
.Sh NAME
@@ -23,7 +23,7 @@
.Nd installs packages from remote package repositories
.Sh SYNOPSIS
.Nm
-
.Op Fl AfgLnqRXxy
+
.Op Fl AfgLnqRxy
.Op Fl r Ar reponame
.Ar <pkg-origin> ...
.Sh DESCRIPTION
@@ -32,8 +32,7 @@ is used for installation of packages from a remote package
repository.
Multiple package names can be specified on the command line, either
explicitly or by matching against package names in the repository
-
catalogues using shell globbing; standard- or extended regular
-
expressions.
+
catalogues using shell globbing or regular expressions.
.Pp
.Nm
creates a work-list of all the package installations to do.
@@ -139,10 +138,10 @@ In multi-repo mode, override the
.Fa pkg.conf
ordering and only attempt to download packages from the named
repository.
-
.It Fl X
-
Treat the package names as extended regular expressions.
.It Fl x
-
Treat the package names as regular expressions.
+
Treat the package names as regular expressions according to the
+
"modern" or "extended" syntax of
+
.Xr re_format 7 .
.It Fl y
Assume yes when asked for confirmation before package installation.
.El
modified pkg/pkg-lock.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd May 12, 2012
+
.Dd October 15, 2012
.Dt PKG-LOCK 8
.Os
.Sh NAME
@@ -27,13 +27,13 @@
.Op Fl qy
.Fl a
.Nm
-
.Op Fl gqXxy
+
.Op Fl gqxy
.Ar <pkg-name>
.Nm "pkg unlock"
.Op Fl qy
.Fl a
.Nm "pkg unlock"
-
.Op Fl gqXxy
+
.Op Fl gqxy
.Ar <pkg-name>
.Sh DESCRIPTION
.Nm
@@ -78,14 +78,12 @@ Treat
as a shell glob pattern.
.It Fl q
Operate quietly: do not output anything other than confirmatory questions.
-
.It Fl X
-
Treat
-
.Ar <pkg-name>
-
as an extended regular expression.
.It Fl x
Treat
.Ar <pkg-name>
-
as a regular expression.
+
as a regular expression according to the "modern" or "extended" syntax 
+
of
+
.Xr re_format 7 .
.It Fl y
Assume "yes" as the answer to all questions.
.El
modified pkg/pkg-query.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd July 18, 2012
+
.Dd October 15, 2012
.Dt PKG-QUERY 8
.Os
.Sh NAME
@@ -32,7 +32,7 @@
.Nm
.Fl e Ao evaluation-condition Ac Ao query-format Ac
.Nm
-
.Op Fl gxX
+
.Op Fl gx
.Ao query-format Ac Ao pattern Ac Ao ... Ac
.Sh DESCRIPTION
.Nm
@@ -57,11 +57,9 @@ as a glob pattern.
.It Fl x
Treat
.Ao pattern Ac
-
as a regular expression.
-
.It Fl X
-
Treat
-
.Ao pattern Ac
-
as an extended regular expression.
+
as a regular expression according to the "modern" or "extended" syntax
+
of
+
.Xr re_format 7 .
.El
.Sh QUERY FORMAT
There are two type of keyword for the query format: the multiline and the normal
modified pkg/pkg-rquery.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd April 25, 2012
+
.Dd October 15, 2012
.Dt PKG-RQUERY 8
.Os
.Sh NAME
@@ -33,7 +33,7 @@
.Op Fl r Ar reponame
.Ao query-format Ac
.Nm
-
.Op Fl gxX
+
.Op Fl gx
.Op Fl r Ar reponame
.Ao query-format Ac Ao pattern Ac Ao ... Ac
.Sh DESCRIPTION
@@ -62,11 +62,9 @@ as a glob pattern.
.It Fl x
Treat
.Ao pattern Ac
-
as a regular expression.
-
.It Fl X
-
Treat
-
.Ao pattern Ac
-
as an extended regular expression.
+
as a regular expression according to the "modern" or "extended" syntax
+
of
+
.Xr re_format 7 .
.El
.Sh QUERY FORMAT
There are two type of keyword for the query format: the multiline and the normal
modified pkg/pkg-search.8
@@ -23,14 +23,14 @@
.Nd search package repository catalogues
.Sh SYNOPSIS
.Nm
-
.Op Fl egxX
+
.Op Fl egx
.Op Fl r Ar repo
.Op Fl S Ar search
.Op Fl L Ar label
.Op Fl M Ar mod
.Ar pattern
.Nm
-
.Op Fl cDdefgopqXx
+
.Op Fl cDdefgopqx
.Op Fl r Ar repo
.Ar pattern
.Sh DESCRIPTION
@@ -144,16 +144,12 @@ sections for more details.
Display the installed size of matched packages.
Equivalent to
.Fl "M size" .
-
.It Fl X
-
Treat
-
.Ar pattern
-
as an extended regular expression.
-
Matches any substring of the search field unless explicit beginning
-
or ending anchor terms are used.
.It Fl x
Treat
.Ar pattern
-
as a regular expression.
+
as a regular expression according to the "modern" or "extended" 
+
syntax of
+
.Xr re_format 7 .
This is the default.
Matches any substring of the search field unless explicit beginning
or ending anchor terms are used.
modified pkg/pkg-set.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd September 14, 2012
+
.Dd October 15, 2012
.Dt PKG-SET 8
.Os
.Sh NAME
@@ -27,7 +27,7 @@
.Op Fl A Op Ar 01
.Op Fl o Ar <oldorigin>:<neworigin>
.Op Fl y
-
.Op Fl xXg
+
.Op Fl xg
.Ar <pkg-name>
.Sh DESCRIPTION
.Nm
@@ -51,16 +51,18 @@ Change the port origin of a given dependency from
to
.Ar neworigin .
This corresponds to the port directory that the package originated from.
-
Typically, this is only needed for upgrading a library or package that has MOVED or when the default version of a major port dependency changes.
+
Typically, this is only needed for upgrading a library or package that
+
has MOVED or when the default version of a major port dependency
+
changes.
Usually this will be explained in /usr/ports/UPDATING.
Also see
.Xr pkg-updating 8
and
.Sx EXAMPLES .
.It Fl x
-
Assume pkg-name is a regex
-
.It Fl X
-
Assume pkg-name is an extended regex
+
Assume pkg-name is a regular expression according to the "modern" or
+
"extended" syntax of
+
.Xr re_format 7 .
.It Fl g
Assume pkg-name is a glob
.El
modified pkg/pkg-version.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd August 14, 2012
+
.Dd October 15, 2012
.Dt PKG-VERSION 8
.Os
.Sh NAME
@@ -27,7 +27,7 @@
.Op Fl hoqv
.Op Fl l Ar limchar
.Op Fl L Ar limchar
-
.Op Fl Xxge Ar pattern
+
.Op Fl xge Ar pattern
.Op Fl r Ar reponame
.Op Fl O Ar origin
.Op Ar index
@@ -107,10 +107,10 @@ flag.
Displays the packages which status flag does not match the one
specified by
.Ar limchar
-
.It Fl X Ar pattern
-
Only display the packages that match the extended regular expression.
.It Fl x Ar pattern
Only display the packages that match the regular expression.
+
Uses the "modern" or "extended" syntax of
+
.Xr re_format 7 .
.It Fl g Ar pattern
Only display the packages that match the glob expression.
.It Fl g Ar string
modified pkg/query.c
@@ -804,7 +804,7 @@ usage_query(void)
	fprintf(stderr, "       pkg query [-a] <query-format>\n");
	fprintf(stderr, "       pkg query -F <pkg-name> <query-format>\n");
	fprintf(stderr, "       pkg query -e <evaluation> <query-format>\n");
-
	fprintf(stderr, "       pkg query [-gxX] <query-format> <pattern> <...>\n\n");
+
	fprintf(stderr, "       pkg query [-gx] <query-format> <pattern> <...>\n\n");
	fprintf(stderr, "For more information see 'pkg help query.'\n");
}

@@ -826,7 +826,7 @@ exec_query(int argc, char **argv)
	struct sbuf *sqlcond = NULL;
	const unsigned int q_flags_len = (sizeof(accepted_query_flags)/sizeof(accepted_query_flags[0]));

-
	while ((ch = getopt(argc, argv, "agxXF:e:")) != -1) {
+
	while ((ch = getopt(argc, argv, "agxF:e:")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -837,9 +837,6 @@ exec_query(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'F':
			pkgname = optarg;
			break;
modified pkg/rquery.c
@@ -69,7 +69,7 @@ usage_rquery(void)
	fprintf(stderr, "usage: pkg rquery [-r reponame] <query-format> <pkg-name>\n");
	fprintf(stderr, "       pkg rquery [-a] [-r reponame] <query-format>\n");
	fprintf(stderr, "       pkg rquery -e <evaluation> [-r reponame] <query-format>\n");
-
	fprintf(stderr, "       pkg rquery [-gxX] [-r reponame] <query-format> <pattern> <...>\n\n");
+
	fprintf(stderr, "       pkg rquery [-gx] [-r reponame] <query-format> <pattern> <...>\n\n");
	fprintf(stderr, "For more information see 'pkg help rquery.'\n");
}

@@ -93,7 +93,7 @@ exec_rquery(int argc, char **argv)
	const char *reponame = NULL;
	bool onematched = false;

-
	while ((ch = getopt(argc, argv, "agxXe:r:")) != -1) {
+
	while ((ch = getopt(argc, argv, "agxe:r:")) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -104,9 +104,6 @@ exec_rquery(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'e':
			match = MATCH_CONDITION;
			condition = optarg;
modified pkg/search.c
@@ -206,9 +206,9 @@ usage_search(void)
{
	int i, n;

-
	fprintf(stderr, "usage: pkg search [-egXx] [-r repo] [-S search] "
+
	fprintf(stderr, "usage: pkg search [-egx] [-r repo] [-S search] "
	    "[-L label] [-M mod]... <pkg-name>\n");
-
	fprintf(stderr, "       pkg search [-cDdefgopqXx] [-r repo] "
+
	fprintf(stderr, "       pkg search [-cDdefgopqx] [-r repo] "
	    "<pattern>\n\n");
	n = fprintf(stderr, "       Search and Label options:");
	for (i = 0; search_label[i].option != NULL; i++) {
@@ -243,7 +243,7 @@ exec_search(int argc, char **argv)
	struct pkg *pkg = NULL;
	bool atleastone = false;

-
	while ((ch = getopt(argc, argv, "cDdefgL:M:opqr:S:sXx")) != -1) {
+
	while ((ch = getopt(argc, argv, "cDdefgL:M:opqr:S:sx")) != -1) {
		switch (ch) {
		case 'c':	/* Same as -S comment */
			search = search_label_opt("comment");
@@ -287,9 +287,6 @@ exec_search(int argc, char **argv)
		case 's':	/* Same as -M size */
			opt |= modifier_opt("size");
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'x':
			match = MATCH_REGEX;
			break;
modified pkg/set.c
@@ -41,7 +41,7 @@
void
usage_set(void)
{
-
	fprintf(stderr, "usage: pkg set [-a] [-A [01]] [-o <oldorigin>:<neworigin>] [-y] [-xXg] <pkg-name>\n\n");
+
	fprintf(stderr, "usage: pkg set [-a] [-A [01]] [-o <oldorigin>:<neworigin>] [-y] [-gx] <pkg-name>\n\n");
	fprintf(stderr, "For more information see 'pkg help set'. \n");
}

@@ -66,7 +66,7 @@ exec_set(int argc, char **argv)
	unsigned int loads = PKG_LOAD_BASIC;
	unsigned int sets = 0;

-
	while ((ch = getopt(argc, argv, "ayA:kxXgo:")) != -1) {
+
	while ((ch = getopt(argc, argv, "ayA:kxgo:")) != -1) {
		switch (ch) {
		case 'y':
			yes_flag = true;
@@ -77,9 +77,6 @@ exec_set(int argc, char **argv)
		case 'x':
			match = MATCH_REGEX;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			break;
		case 'g':
			match = MATCH_GLOB;
			break;
modified pkg/version.c
@@ -171,7 +171,7 @@ exec_version(int argc, char **argv)

	SLIST_INIT(&indexhead);

-
	while ((ch = getopt(argc, argv, "hIPRoqvl:L:X:x:g:e:O:r:tT")) != -1) {
+
	while ((ch = getopt(argc, argv, "hIPRoqvl:L:x:g:e:O:r:tT")) != -1) {
		switch (ch) {
		case 'h':
			usage_version();
@@ -202,10 +202,6 @@ exec_version(int argc, char **argv)
			opt |= VERSION_NOSTATUS;
			limchar = *optarg;
			break;
-
		case 'X':
-
			match = MATCH_EREGEX;
-
			pattern = optarg;
-
			break;
		case 'x':
			match = MATCH_REGEX;
			pattern = optarg;