Sun Jun 21 11:42:52 2009 UTC ()
Pullup the following revisions (requested by joerg in ticket 1325):
	external/bsd/pkg_install/dist/admin/pkg_admin.1:	1.1.1.7
	external/bsd/pkg_install/dist/lib/license.c: 		1.1.1.3
	external/bsd/pkg_install/dist/lib/version.h:		1.1.1.16
Merge pkg_install-20090610 from HEAD


(bouyer)
diff -r1.1.1.6.2.2 -r1.1.1.6.2.3 src/external/bsd/pkg_install/dist/admin/pkg_admin.1
diff -r1.1.1.2.6.2 -r1.1.1.2.6.3 src/external/bsd/pkg_install/dist/lib/license.c
diff -r1.1.1.15.2.2 -r1.1.1.15.2.3 src/external/bsd/pkg_install/dist/lib/version.h

cvs diff -r1.1.1.6.2.2 -r1.1.1.6.2.3 src/external/bsd/pkg_install/dist/admin/pkg_admin.1 (expand / switch to context diff)
--- src/external/bsd/pkg_install/dist/admin/pkg_admin.1 2009/06/05 17:01:58 1.1.1.6.2.2
+++ src/external/bsd/pkg_install/dist/admin/pkg_admin.1 2009/06/21 11:42:52 1.1.1.6.2.3
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pkg_admin.1,v 1.1.1.6.2.2 2009/06/05 17:01:58 snj Exp $
+.\"	$NetBSD: pkg_admin.1,v 1.1.1.6.2.3 2009/06/21 11:42:52 bouyer Exp $
 .\"
 .\" Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -176,7 +176,7 @@
 Reports if
 .Ar file
 is a correctly signed package.
-.It Cm check-single-license Ar liccense
+.It Cm check-single-license Ar license
 Check if
 .Ar license
 is a valid license name and if it is in the set of acceptable licenses.

cvs diff -r1.1.1.2.6.2 -r1.1.1.2.6.3 src/external/bsd/pkg_install/dist/lib/license.c (expand / switch to context diff)
--- src/external/bsd/pkg_install/dist/lib/license.c 2009/06/05 17:02:00 1.1.1.2.6.2
+++ src/external/bsd/pkg_install/dist/lib/license.c 2009/06/21 11:42:52 1.1.1.2.6.3
@@ -1,4 +1,4 @@
-/*	$NetBSD: license.c,v 1.1.1.2.6.2 2009/06/05 17:02:00 snj Exp $	*/
+/*	$NetBSD: license.c,v 1.1.1.2.6.3 2009/06/21 11:42:52 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -51,7 +51,7 @@
     "gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 "
     "gnu-gpl-v3 gnu-lgpl-v3 "
     "original-bsd modified-bsd "
-    "x11 "
+    "x11 mit miros "
     "apache-1.1 apache-2.0 "
     "artistic artistic-2.0 "
     "cddl-1.0 "
@@ -156,14 +156,16 @@
 	size_t len;
 
 	len = strlen(license);
-	if (strspn(license, license_chars) != len)
+	if (strspn(license, license_chars) != len) {
+		warnx("Invalid character in license name at position %zu", len);
 		return -1;
+	}
 
 	return acceptable_license_internal(license, len);
 }
 
 static int
-acceptable_pkg_license_internal(const char **licensep, int toplevel)
+acceptable_pkg_license_internal(const char **licensep, int toplevel, const char *start)
 {
 	const char *license = *licensep;
 	int need_parenthesis, is_true = 0;
@@ -182,7 +184,7 @@
 
 	for (;;) {
 		if (*license == '(') {
-			switch (acceptable_pkg_license_internal(&license, 0)) {
+			switch (acceptable_pkg_license_internal(&license, 0, start)) {
 			case -1:
 				return -1;
 			case 0:
@@ -196,8 +198,10 @@
 			license += strspn(license, license_spaces);
 		} else {
 			len = strspn(license, license_chars);
-			if (len == 0)
+			if (len == 0) {
+				warnx("Invalid character in license name at position %zu", license - start + 1);
 				return -1;
+			}
 
 			if (acceptable_license_internal(license, len)) {
 				if (expr_type != 2)
@@ -209,40 +213,53 @@
 			license += len;
 
 			len = strspn(license, license_spaces);
-			if (len == 0 && *license && *license  != ')')
+			if (len == 0 && *license && *license  != ')') {
+				warnx("Missing space at position %zu", license - start + 1);
 				return -1;
+			}
 			license += len;
 		}
 
 		if (*license == ')') {
-			if (!need_parenthesis)
+			if (!need_parenthesis) {
+				warnx("Missing open parenthesis at position %zu", license - start + 1);
 				return -1;
+			}
 			*licensep = license + 1;
 			return is_true;
 		}
 		if (*license == '\0') {
-			if (need_parenthesis)
+			if (need_parenthesis) {
+				warnx("Unbalanced parenthesis at position %zu", license - start + 1);
 				return -1;
+			}
 			*licensep = license;
 			return is_true;
 		}
 
 		if (strncmp(license, "AND", 3) == 0) {
-			if (expr_type == 1)
+			if (expr_type == 1) {
+				warnx("Invalid operator in OR expression at position %zu", license - start + 1);
 				return -1;
+			}
 			expr_type = 2;
 			license += 3;
 		} else if (strncmp(license, "OR", 2) == 0) {
-			if (expr_type == 2)
+			if (expr_type == 2) {
+				warnx("Invalid operator in AND expression at position %zu", license - start + 1);
 				return -1;
+			}
 			expr_type = 1;
 			license += 2;
 		} else {
+			warnx("Invalid operator at position %zu", license - start + 1);
 			return -1;
 		}
 		len = strspn(license, license_spaces);
-		if (len == 0 && *license != '(')
+		if (len == 0 && *license != '(') {
+			warnx("Missing space at position %zu", license - start + 1);
 			return -1;
+		}
 		license += len;
 	}
 
@@ -254,12 +271,14 @@
 {
 	int ret;
 
-	ret = acceptable_pkg_license_internal(&license, 1);
+	ret = acceptable_pkg_license_internal(&license, 1, license);
 	if (ret == -1)
 		return -1;
 	license += strspn(license, license_spaces);
-	if (*license)
+	if (*license) {
+		warnx("Trailing garbage in license specification");
 		return -1;
+	}
 	return ret;
 }
 

cvs diff -r1.1.1.15.2.2 -r1.1.1.15.2.3 src/external/bsd/pkg_install/dist/lib/version.h (expand / switch to context diff)
--- src/external/bsd/pkg_install/dist/lib/version.h 2009/06/05 17:02:01 1.1.1.15.2.2
+++ src/external/bsd/pkg_install/dist/lib/version.h 2009/06/21 11:42:52 1.1.1.15.2.3
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.h,v 1.1.1.15.2.2 2009/06/05 17:02:01 snj Exp $	*/
+/*	$NetBSD: version.h,v 1.1.1.15.2.3 2009/06/21 11:42:52 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20090528"
+#define PKGTOOLS_VERSION "20090610"
 
 #endif /* _INST_LIB_VERSION_H_ */